Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netdevsim: macsec: pad u64 to correct length in logs

Commit 02b34d03a24b ("netdevsim: add dummy macsec offload") pads u64
number to 8 characters using "%08llx" format specifier.

Changing format specifier to "%016llx" ensures that no matter the value
the representation of number in log is always the same length.

Before this patch, entry in log for value '1' would say:
removing SecY with SCI 00000001 at index 2
After this patch is applied, entry in log will say:
removing SecY with SCI 0000000000000001 at index 2

Signed-off-by: Ales Nezbeda <anezbeda@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Link: https://patch.msgid.link/20241017131933.136971-1-anezbeda@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Ales Nezbeda and committed by
Paolo Abeni
1a629afd 73840ca5

+28 -28
+28 -28
drivers/net/netdevsim/macsec.c
··· 46 46 return -ENOSPC; 47 47 } 48 48 49 - netdev_dbg(ctx->netdev, "%s: adding new secy with sci %08llx at index %d\n", 49 + netdev_dbg(ctx->netdev, "%s: adding new secy with sci %016llx at index %d\n", 50 50 __func__, sci_to_cpu(ctx->secy->sci), idx); 51 51 ns->macsec.nsim_secy[idx].used = true; 52 52 ns->macsec.nsim_secy[idx].nsim_rxsc_count = 0; ··· 63 63 64 64 idx = nsim_macsec_find_secy(ns, ctx->secy->sci); 65 65 if (idx < 0) { 66 - netdev_err(ctx->netdev, "%s: sci %08llx not found in secy table\n", 66 + netdev_err(ctx->netdev, "%s: sci %016llx not found in secy table\n", 67 67 __func__, sci_to_cpu(ctx->secy->sci)); 68 68 return -ENOENT; 69 69 } 70 70 71 - netdev_dbg(ctx->netdev, "%s: updating secy with sci %08llx at index %d\n", 71 + netdev_dbg(ctx->netdev, "%s: updating secy with sci %016llx at index %d\n", 72 72 __func__, sci_to_cpu(ctx->secy->sci), idx); 73 73 74 74 return 0; ··· 81 81 82 82 idx = nsim_macsec_find_secy(ns, ctx->secy->sci); 83 83 if (idx < 0) { 84 - netdev_err(ctx->netdev, "%s: sci %08llx not found in secy table\n", 84 + netdev_err(ctx->netdev, "%s: sci %016llx not found in secy table\n", 85 85 __func__, sci_to_cpu(ctx->secy->sci)); 86 86 return -ENOENT; 87 87 } 88 88 89 - netdev_dbg(ctx->netdev, "%s: removing SecY with SCI %08llx at index %d\n", 89 + netdev_dbg(ctx->netdev, "%s: removing SecY with SCI %016llx at index %d\n", 90 90 __func__, sci_to_cpu(ctx->secy->sci), idx); 91 91 92 92 ns->macsec.nsim_secy[idx].used = false; ··· 104 104 105 105 idx = nsim_macsec_find_secy(ns, ctx->secy->sci); 106 106 if (idx < 0) { 107 - netdev_err(ctx->netdev, "%s: sci %08llx not found in secy table\n", 107 + netdev_err(ctx->netdev, "%s: sci %016llx not found in secy table\n", 108 108 __func__, sci_to_cpu(ctx->secy->sci)); 109 109 return -ENOENT; 110 110 } ··· 122 122 netdev_err(ctx->netdev, "%s: nsim_rxsc_count not full but all RXSCs used\n", 123 123 __func__); 124 124 125 - netdev_dbg(ctx->netdev, "%s: adding new rxsc with sci %08llx at index %d\n", 125 + netdev_dbg(ctx->netdev, "%s: adding new rxsc with sci %016llx at index %d\n", 126 126 __func__, sci_to_cpu(ctx->rx_sc->sci), idx); 127 127 secy->nsim_rxsc[idx].used = true; 128 128 secy->nsim_rxsc[idx].sci = ctx->rx_sc->sci; ··· 139 139 140 140 idx = nsim_macsec_find_secy(ns, ctx->secy->sci); 141 141 if (idx < 0) { 142 - netdev_err(ctx->netdev, "%s: sci %08llx not found in secy table\n", 142 + netdev_err(ctx->netdev, "%s: sci %016llx not found in secy table\n", 143 143 __func__, sci_to_cpu(ctx->secy->sci)); 144 144 return -ENOENT; 145 145 } ··· 147 147 148 148 idx = nsim_macsec_find_rxsc(secy, ctx->rx_sc->sci); 149 149 if (idx < 0) { 150 - netdev_err(ctx->netdev, "%s: sci %08llx not found in RXSC table\n", 150 + netdev_err(ctx->netdev, "%s: sci %016llx not found in RXSC table\n", 151 151 __func__, sci_to_cpu(ctx->rx_sc->sci)); 152 152 return -ENOENT; 153 153 } 154 154 155 - netdev_dbg(ctx->netdev, "%s: updating RXSC with sci %08llx at index %d\n", 155 + netdev_dbg(ctx->netdev, "%s: updating RXSC with sci %016llx at index %d\n", 156 156 __func__, sci_to_cpu(ctx->rx_sc->sci), idx); 157 157 158 158 return 0; ··· 166 166 167 167 idx = nsim_macsec_find_secy(ns, ctx->secy->sci); 168 168 if (idx < 0) { 169 - netdev_err(ctx->netdev, "%s: sci %08llx not found in secy table\n", 169 + netdev_err(ctx->netdev, "%s: sci %016llx not found in secy table\n", 170 170 __func__, sci_to_cpu(ctx->secy->sci)); 171 171 return -ENOENT; 172 172 } ··· 174 174 175 175 idx = nsim_macsec_find_rxsc(secy, ctx->rx_sc->sci); 176 176 if (idx < 0) { 177 - netdev_err(ctx->netdev, "%s: sci %08llx not found in RXSC table\n", 177 + netdev_err(ctx->netdev, "%s: sci %016llx not found in RXSC table\n", 178 178 __func__, sci_to_cpu(ctx->rx_sc->sci)); 179 179 return -ENOENT; 180 180 } 181 181 182 - netdev_dbg(ctx->netdev, "%s: removing RXSC with sci %08llx at index %d\n", 182 + netdev_dbg(ctx->netdev, "%s: removing RXSC with sci %016llx at index %d\n", 183 183 __func__, sci_to_cpu(ctx->rx_sc->sci), idx); 184 184 185 185 secy->nsim_rxsc[idx].used = false; ··· 197 197 198 198 idx = nsim_macsec_find_secy(ns, ctx->secy->sci); 199 199 if (idx < 0) { 200 - netdev_err(ctx->netdev, "%s: sci %08llx not found in secy table\n", 200 + netdev_err(ctx->netdev, "%s: sci %016llx not found in secy table\n", 201 201 __func__, sci_to_cpu(ctx->secy->sci)); 202 202 return -ENOENT; 203 203 } ··· 205 205 206 206 idx = nsim_macsec_find_rxsc(secy, ctx->sa.rx_sa->sc->sci); 207 207 if (idx < 0) { 208 - netdev_err(ctx->netdev, "%s: sci %08llx not found in RXSC table\n", 208 + netdev_err(ctx->netdev, "%s: sci %016llx not found in RXSC table\n", 209 209 __func__, sci_to_cpu(ctx->sa.rx_sa->sc->sci)); 210 210 return -ENOENT; 211 211 } 212 212 213 - netdev_dbg(ctx->netdev, "%s: RXSC with sci %08llx, AN %u\n", 213 + netdev_dbg(ctx->netdev, "%s: RXSC with sci %016llx, AN %u\n", 214 214 __func__, sci_to_cpu(ctx->sa.rx_sa->sc->sci), ctx->sa.assoc_num); 215 215 216 216 return 0; ··· 224 224 225 225 idx = nsim_macsec_find_secy(ns, ctx->secy->sci); 226 226 if (idx < 0) { 227 - netdev_err(ctx->netdev, "%s: sci %08llx not found in secy table\n", 227 + netdev_err(ctx->netdev, "%s: sci %016llx not found in secy table\n", 228 228 __func__, sci_to_cpu(ctx->secy->sci)); 229 229 return -ENOENT; 230 230 } ··· 232 232 233 233 idx = nsim_macsec_find_rxsc(secy, ctx->sa.rx_sa->sc->sci); 234 234 if (idx < 0) { 235 - netdev_err(ctx->netdev, "%s: sci %08llx not found in RXSC table\n", 235 + netdev_err(ctx->netdev, "%s: sci %016llx not found in RXSC table\n", 236 236 __func__, sci_to_cpu(ctx->sa.rx_sa->sc->sci)); 237 237 return -ENOENT; 238 238 } 239 239 240 - netdev_dbg(ctx->netdev, "%s: RXSC with sci %08llx, AN %u\n", 240 + netdev_dbg(ctx->netdev, "%s: RXSC with sci %016llx, AN %u\n", 241 241 __func__, sci_to_cpu(ctx->sa.rx_sa->sc->sci), ctx->sa.assoc_num); 242 242 243 243 return 0; ··· 251 251 252 252 idx = nsim_macsec_find_secy(ns, ctx->secy->sci); 253 253 if (idx < 0) { 254 - netdev_err(ctx->netdev, "%s: sci %08llx not found in secy table\n", 254 + netdev_err(ctx->netdev, "%s: sci %016llx not found in secy table\n", 255 255 __func__, sci_to_cpu(ctx->secy->sci)); 256 256 return -ENOENT; 257 257 } ··· 259 259 260 260 idx = nsim_macsec_find_rxsc(secy, ctx->sa.rx_sa->sc->sci); 261 261 if (idx < 0) { 262 - netdev_err(ctx->netdev, "%s: sci %08llx not found in RXSC table\n", 262 + netdev_err(ctx->netdev, "%s: sci %016llx not found in RXSC table\n", 263 263 __func__, sci_to_cpu(ctx->sa.rx_sa->sc->sci)); 264 264 return -ENOENT; 265 265 } 266 266 267 - netdev_dbg(ctx->netdev, "%s: RXSC with sci %08llx, AN %u\n", 267 + netdev_dbg(ctx->netdev, "%s: RXSC with sci %016llx, AN %u\n", 268 268 __func__, sci_to_cpu(ctx->sa.rx_sa->sc->sci), ctx->sa.assoc_num); 269 269 270 270 return 0; ··· 277 277 278 278 idx = nsim_macsec_find_secy(ns, ctx->secy->sci); 279 279 if (idx < 0) { 280 - netdev_err(ctx->netdev, "%s: sci %08llx not found in secy table\n", 280 + netdev_err(ctx->netdev, "%s: sci %016llx not found in secy table\n", 281 281 __func__, sci_to_cpu(ctx->secy->sci)); 282 282 return -ENOENT; 283 283 } 284 284 285 - netdev_dbg(ctx->netdev, "%s: SECY with sci %08llx, AN %u\n", 285 + netdev_dbg(ctx->netdev, "%s: SECY with sci %016llx, AN %u\n", 286 286 __func__, sci_to_cpu(ctx->secy->sci), ctx->sa.assoc_num); 287 287 288 288 return 0; ··· 295 295 296 296 idx = nsim_macsec_find_secy(ns, ctx->secy->sci); 297 297 if (idx < 0) { 298 - netdev_err(ctx->netdev, "%s: sci %08llx not found in secy table\n", 298 + netdev_err(ctx->netdev, "%s: sci %016llx not found in secy table\n", 299 299 __func__, sci_to_cpu(ctx->secy->sci)); 300 300 return -ENOENT; 301 301 } 302 302 303 - netdev_dbg(ctx->netdev, "%s: SECY with sci %08llx, AN %u\n", 303 + netdev_dbg(ctx->netdev, "%s: SECY with sci %016llx, AN %u\n", 304 304 __func__, sci_to_cpu(ctx->secy->sci), ctx->sa.assoc_num); 305 305 306 306 return 0; ··· 313 313 314 314 idx = nsim_macsec_find_secy(ns, ctx->secy->sci); 315 315 if (idx < 0) { 316 - netdev_err(ctx->netdev, "%s: sci %08llx not found in secy table\n", 316 + netdev_err(ctx->netdev, "%s: sci %016llx not found in secy table\n", 317 317 __func__, sci_to_cpu(ctx->secy->sci)); 318 318 return -ENOENT; 319 319 } 320 320 321 - netdev_dbg(ctx->netdev, "%s: SECY with sci %08llx, AN %u\n", 321 + netdev_dbg(ctx->netdev, "%s: SECY with sci %016llx, AN %u\n", 322 322 __func__, sci_to_cpu(ctx->secy->sci), ctx->sa.assoc_num); 323 323 324 324 return 0;