Skip to content

Commit 1a629af

Browse files
SlouchyButtonPaolo Abeni
authored andcommitted
netdevsim: macsec: pad u64 to correct length in logs
Commit 02b34d0 ("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 <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Sabrina Dubroca <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 73840ca commit 1a629af

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

drivers/net/netdevsim/macsec.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static int nsim_macsec_add_secy(struct macsec_context *ctx)
4646
return -ENOSPC;
4747
}
4848

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",
5050
__func__, sci_to_cpu(ctx->secy->sci), idx);
5151
ns->macsec.nsim_secy[idx].used = true;
5252
ns->macsec.nsim_secy[idx].nsim_rxsc_count = 0;
@@ -63,12 +63,12 @@ static int nsim_macsec_upd_secy(struct macsec_context *ctx)
6363

6464
idx = nsim_macsec_find_secy(ns, ctx->secy->sci);
6565
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",
6767
__func__, sci_to_cpu(ctx->secy->sci));
6868
return -ENOENT;
6969
}
7070

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",
7272
__func__, sci_to_cpu(ctx->secy->sci), idx);
7373

7474
return 0;
@@ -81,12 +81,12 @@ static int nsim_macsec_del_secy(struct macsec_context *ctx)
8181

8282
idx = nsim_macsec_find_secy(ns, ctx->secy->sci);
8383
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",
8585
__func__, sci_to_cpu(ctx->secy->sci));
8686
return -ENOENT;
8787
}
8888

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",
9090
__func__, sci_to_cpu(ctx->secy->sci), idx);
9191

9292
ns->macsec.nsim_secy[idx].used = false;
@@ -104,7 +104,7 @@ static int nsim_macsec_add_rxsc(struct macsec_context *ctx)
104104

105105
idx = nsim_macsec_find_secy(ns, ctx->secy->sci);
106106
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",
108108
__func__, sci_to_cpu(ctx->secy->sci));
109109
return -ENOENT;
110110
}
@@ -122,7 +122,7 @@ static int nsim_macsec_add_rxsc(struct macsec_context *ctx)
122122
netdev_err(ctx->netdev, "%s: nsim_rxsc_count not full but all RXSCs used\n",
123123
__func__);
124124

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",
126126
__func__, sci_to_cpu(ctx->rx_sc->sci), idx);
127127
secy->nsim_rxsc[idx].used = true;
128128
secy->nsim_rxsc[idx].sci = ctx->rx_sc->sci;
@@ -139,20 +139,20 @@ static int nsim_macsec_upd_rxsc(struct macsec_context *ctx)
139139

140140
idx = nsim_macsec_find_secy(ns, ctx->secy->sci);
141141
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",
143143
__func__, sci_to_cpu(ctx->secy->sci));
144144
return -ENOENT;
145145
}
146146
secy = &ns->macsec.nsim_secy[idx];
147147

148148
idx = nsim_macsec_find_rxsc(secy, ctx->rx_sc->sci);
149149
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",
151151
__func__, sci_to_cpu(ctx->rx_sc->sci));
152152
return -ENOENT;
153153
}
154154

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",
156156
__func__, sci_to_cpu(ctx->rx_sc->sci), idx);
157157

158158
return 0;
@@ -166,20 +166,20 @@ static int nsim_macsec_del_rxsc(struct macsec_context *ctx)
166166

167167
idx = nsim_macsec_find_secy(ns, ctx->secy->sci);
168168
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",
170170
__func__, sci_to_cpu(ctx->secy->sci));
171171
return -ENOENT;
172172
}
173173
secy = &ns->macsec.nsim_secy[idx];
174174

175175
idx = nsim_macsec_find_rxsc(secy, ctx->rx_sc->sci);
176176
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",
178178
__func__, sci_to_cpu(ctx->rx_sc->sci));
179179
return -ENOENT;
180180
}
181181

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",
183183
__func__, sci_to_cpu(ctx->rx_sc->sci), idx);
184184

185185
secy->nsim_rxsc[idx].used = false;
@@ -197,20 +197,20 @@ static int nsim_macsec_add_rxsa(struct macsec_context *ctx)
197197

198198
idx = nsim_macsec_find_secy(ns, ctx->secy->sci);
199199
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",
201201
__func__, sci_to_cpu(ctx->secy->sci));
202202
return -ENOENT;
203203
}
204204
secy = &ns->macsec.nsim_secy[idx];
205205

206206
idx = nsim_macsec_find_rxsc(secy, ctx->sa.rx_sa->sc->sci);
207207
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",
209209
__func__, sci_to_cpu(ctx->sa.rx_sa->sc->sci));
210210
return -ENOENT;
211211
}
212212

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",
214214
__func__, sci_to_cpu(ctx->sa.rx_sa->sc->sci), ctx->sa.assoc_num);
215215

216216
return 0;
@@ -224,20 +224,20 @@ static int nsim_macsec_upd_rxsa(struct macsec_context *ctx)
224224

225225
idx = nsim_macsec_find_secy(ns, ctx->secy->sci);
226226
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",
228228
__func__, sci_to_cpu(ctx->secy->sci));
229229
return -ENOENT;
230230
}
231231
secy = &ns->macsec.nsim_secy[idx];
232232

233233
idx = nsim_macsec_find_rxsc(secy, ctx->sa.rx_sa->sc->sci);
234234
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",
236236
__func__, sci_to_cpu(ctx->sa.rx_sa->sc->sci));
237237
return -ENOENT;
238238
}
239239

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",
241241
__func__, sci_to_cpu(ctx->sa.rx_sa->sc->sci), ctx->sa.assoc_num);
242242

243243
return 0;
@@ -251,20 +251,20 @@ static int nsim_macsec_del_rxsa(struct macsec_context *ctx)
251251

252252
idx = nsim_macsec_find_secy(ns, ctx->secy->sci);
253253
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",
255255
__func__, sci_to_cpu(ctx->secy->sci));
256256
return -ENOENT;
257257
}
258258
secy = &ns->macsec.nsim_secy[idx];
259259

260260
idx = nsim_macsec_find_rxsc(secy, ctx->sa.rx_sa->sc->sci);
261261
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",
263263
__func__, sci_to_cpu(ctx->sa.rx_sa->sc->sci));
264264
return -ENOENT;
265265
}
266266

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",
268268
__func__, sci_to_cpu(ctx->sa.rx_sa->sc->sci), ctx->sa.assoc_num);
269269

270270
return 0;
@@ -277,12 +277,12 @@ static int nsim_macsec_add_txsa(struct macsec_context *ctx)
277277

278278
idx = nsim_macsec_find_secy(ns, ctx->secy->sci);
279279
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",
281281
__func__, sci_to_cpu(ctx->secy->sci));
282282
return -ENOENT;
283283
}
284284

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",
286286
__func__, sci_to_cpu(ctx->secy->sci), ctx->sa.assoc_num);
287287

288288
return 0;
@@ -295,12 +295,12 @@ static int nsim_macsec_upd_txsa(struct macsec_context *ctx)
295295

296296
idx = nsim_macsec_find_secy(ns, ctx->secy->sci);
297297
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",
299299
__func__, sci_to_cpu(ctx->secy->sci));
300300
return -ENOENT;
301301
}
302302

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",
304304
__func__, sci_to_cpu(ctx->secy->sci), ctx->sa.assoc_num);
305305

306306
return 0;
@@ -313,12 +313,12 @@ static int nsim_macsec_del_txsa(struct macsec_context *ctx)
313313

314314
idx = nsim_macsec_find_secy(ns, ctx->secy->sci);
315315
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",
317317
__func__, sci_to_cpu(ctx->secy->sci));
318318
return -ENOENT;
319319
}
320320

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",
322322
__func__, sci_to_cpu(ctx->secy->sci), ctx->sa.assoc_num);
323323

324324
return 0;

0 commit comments

Comments
 (0)