5737da6e10f97c89221078f60d46312a36a441ee
[openwrt/staging/stintel.git] /
1 From 4973056cceacc70966396039fae99867dfafd796 Mon Sep 17 00:00:00 2001
2 From: Sean Anderson <sean.anderson@seco.com>
3 Date: Fri, 22 Oct 2021 18:41:04 -0400
4 Subject: [PATCH] net: convert users of bitmap_foo() to linkmode_foo()
5
6 This converts instances of
7 bitmap_foo(args..., __ETHTOOL_LINK_MODE_MASK_NBITS)
8 to
9 linkmode_foo(args...)
10
11 I manually fixed up some lines to prevent them from being excessively
12 long. Otherwise, this change was generated with the following semantic
13 patch:
14
15 // Generated with
16 // echo linux/linkmode.h > includes
17 // git grep -Flf includes include/ | cut -f 2- -d / | cat includes - \
18 // | sort | uniq | tee new_includes | wc -l && mv new_includes includes
19 // and repeating until the number stopped going up
20 @i@
21 @@
22
23 (
24 #include <linux/acpi_mdio.h>
25 |
26 #include <linux/brcmphy.h>
27 |
28 #include <linux/dsa/loop.h>
29 |
30 #include <linux/dsa/sja1105.h>
31 |
32 #include <linux/ethtool.h>
33 |
34 #include <linux/ethtool_netlink.h>
35 |
36 #include <linux/fec.h>
37 |
38 #include <linux/fs_enet_pd.h>
39 |
40 #include <linux/fsl/enetc_mdio.h>
41 |
42 #include <linux/fwnode_mdio.h>
43 |
44 #include <linux/linkmode.h>
45 |
46 #include <linux/lsm_audit.h>
47 |
48 #include <linux/mdio-bitbang.h>
49 |
50 #include <linux/mdio.h>
51 |
52 #include <linux/mdio-mux.h>
53 |
54 #include <linux/mii.h>
55 |
56 #include <linux/mii_timestamper.h>
57 |
58 #include <linux/mlx5/accel.h>
59 |
60 #include <linux/mlx5/cq.h>
61 |
62 #include <linux/mlx5/device.h>
63 |
64 #include <linux/mlx5/driver.h>
65 |
66 #include <linux/mlx5/eswitch.h>
67 |
68 #include <linux/mlx5/fs.h>
69 |
70 #include <linux/mlx5/port.h>
71 |
72 #include <linux/mlx5/qp.h>
73 |
74 #include <linux/mlx5/rsc_dump.h>
75 |
76 #include <linux/mlx5/transobj.h>
77 |
78 #include <linux/mlx5/vport.h>
79 |
80 #include <linux/of_mdio.h>
81 |
82 #include <linux/of_net.h>
83 |
84 #include <linux/pcs-lynx.h>
85 |
86 #include <linux/pcs/pcs-xpcs.h>
87 |
88 #include <linux/phy.h>
89 |
90 #include <linux/phy_led_triggers.h>
91 |
92 #include <linux/phylink.h>
93 |
94 #include <linux/platform_data/bcmgenet.h>
95 |
96 #include <linux/platform_data/xilinx-ll-temac.h>
97 |
98 #include <linux/pxa168_eth.h>
99 |
100 #include <linux/qed/qed_eth_if.h>
101 |
102 #include <linux/qed/qed_fcoe_if.h>
103 |
104 #include <linux/qed/qed_if.h>
105 |
106 #include <linux/qed/qed_iov_if.h>
107 |
108 #include <linux/qed/qed_iscsi_if.h>
109 |
110 #include <linux/qed/qed_ll2_if.h>
111 |
112 #include <linux/qed/qed_nvmetcp_if.h>
113 |
114 #include <linux/qed/qed_rdma_if.h>
115 |
116 #include <linux/sfp.h>
117 |
118 #include <linux/sh_eth.h>
119 |
120 #include <linux/smsc911x.h>
121 |
122 #include <linux/soc/nxp/lpc32xx-misc.h>
123 |
124 #include <linux/stmmac.h>
125 |
126 #include <linux/sunrpc/svc_rdma.h>
127 |
128 #include <linux/sxgbe_platform.h>
129 |
130 #include <net/cfg80211.h>
131 |
132 #include <net/dsa.h>
133 |
134 #include <net/mac80211.h>
135 |
136 #include <net/selftests.h>
137 |
138 #include <rdma/ib_addr.h>
139 |
140 #include <rdma/ib_cache.h>
141 |
142 #include <rdma/ib_cm.h>
143 |
144 #include <rdma/ib_hdrs.h>
145 |
146 #include <rdma/ib_mad.h>
147 |
148 #include <rdma/ib_marshall.h>
149 |
150 #include <rdma/ib_pack.h>
151 |
152 #include <rdma/ib_pma.h>
153 |
154 #include <rdma/ib_sa.h>
155 |
156 #include <rdma/ib_smi.h>
157 |
158 #include <rdma/ib_umem.h>
159 |
160 #include <rdma/ib_umem_odp.h>
161 |
162 #include <rdma/ib_verbs.h>
163 |
164 #include <rdma/iw_cm.h>
165 |
166 #include <rdma/mr_pool.h>
167 |
168 #include <rdma/opa_addr.h>
169 |
170 #include <rdma/opa_port_info.h>
171 |
172 #include <rdma/opa_smi.h>
173 |
174 #include <rdma/opa_vnic.h>
175 |
176 #include <rdma/rdma_cm.h>
177 |
178 #include <rdma/rdma_cm_ib.h>
179 |
180 #include <rdma/rdmavt_cq.h>
181 |
182 #include <rdma/rdma_vt.h>
183 |
184 #include <rdma/rdmavt_qp.h>
185 |
186 #include <rdma/rw.h>
187 |
188 #include <rdma/tid_rdma_defs.h>
189 |
190 #include <rdma/uverbs_ioctl.h>
191 |
192 #include <rdma/uverbs_named_ioctl.h>
193 |
194 #include <rdma/uverbs_std_types.h>
195 |
196 #include <rdma/uverbs_types.h>
197 |
198 #include <soc/mscc/ocelot.h>
199 |
200 #include <soc/mscc/ocelot_ptp.h>
201 |
202 #include <soc/mscc/ocelot_vcap.h>
203 |
204 #include <trace/events/ib_mad.h>
205 |
206 #include <trace/events/rdma_core.h>
207 |
208 #include <trace/events/rdma.h>
209 |
210 #include <trace/events/rpcrdma.h>
211 |
212 #include <uapi/linux/ethtool.h>
213 |
214 #include <uapi/linux/ethtool_netlink.h>
215 |
216 #include <uapi/linux/mdio.h>
217 |
218 #include <uapi/linux/mii.h>
219 )
220
221 @depends on i@
222 expression list args;
223 @@
224
225 (
226 - bitmap_zero(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
227 + linkmode_zero(args)
228 |
229 - bitmap_copy(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
230 + linkmode_copy(args)
231 |
232 - bitmap_and(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
233 + linkmode_and(args)
234 |
235 - bitmap_or(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
236 + linkmode_or(args)
237 |
238 - bitmap_empty(args, ETHTOOL_LINK_MODE_MASK_NBITS)
239 + linkmode_empty(args)
240 |
241 - bitmap_andnot(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
242 + linkmode_andnot(args)
243 |
244 - bitmap_equal(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
245 + linkmode_equal(args)
246 |
247 - bitmap_intersects(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
248 + linkmode_intersects(args)
249 |
250 - bitmap_subset(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
251 + linkmode_subset(args)
252 )
253
254 Add missing linux/mii.h include to mellanox. -DaveM
255
256 Signed-off-by: Sean Anderson <sean.anderson@seco.com>
257 Signed-off-by: David S. Miller <davem@davemloft.net>
258 ---
259 drivers/net/dsa/b53/b53_common.c | 6 ++----
260 drivers/net/dsa/bcm_sf2.c | 8 +++----
261 drivers/net/dsa/hirschmann/hellcreek.c | 6 ++----
262 drivers/net/dsa/lantiq_gswip.c | 14 ++++++-------
263 drivers/net/dsa/microchip/ksz8795.c | 8 +++----
264 drivers/net/dsa/mv88e6xxx/chip.c | 5 ++---
265 drivers/net/dsa/ocelot/felix_vsc9959.c | 8 +++----
266 drivers/net/dsa/ocelot/seville_vsc9953.c | 8 +++----
267 drivers/net/dsa/qca/ar9331.c | 10 ++++-----
268 drivers/net/dsa/sja1105/sja1105_main.c | 7 +++----
269 drivers/net/dsa/xrs700x/xrs700x.c | 8 +++----
270 drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 8 +++----
271 drivers/net/ethernet/atheros/ag71xx.c | 8 +++----
272 drivers/net/ethernet/cadence/macb_main.c | 11 +++++-----
273 .../net/ethernet/freescale/enetc/enetc_pf.c | 8 +++----
274 .../net/ethernet/huawei/hinic/hinic_ethtool.c | 10 ++++-----
275 .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 5 ++---
276 drivers/net/ethernet/marvell/mvneta.c | 10 ++++-----
277 .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 7 +++----
278 .../marvell/octeontx2/nic/otx2_ethtool.c | 5 ++---
279 drivers/net/ethernet/marvell/pxa168_eth.c | 3 +--
280 .../net/ethernet/mellanox/mlx4/en_ethtool.c | 21 +++++++------------
281 .../microchip/sparx5/sparx5_phylink.c | 7 +++----
282 drivers/net/ethernet/mscc/ocelot_net.c | 7 +++----
283 .../ethernet/pensando/ionic/ionic_ethtool.c | 3 +--
284 .../net/ethernet/xilinx/xilinx_axienet_main.c | 8 +++----
285 drivers/net/pcs/pcs-xpcs.c | 2 +-
286 drivers/net/phy/sfp-bus.c | 2 +-
287 net/ethtool/ioctl.c | 7 +++----
288 29 files changed, 87 insertions(+), 133 deletions(-)
289
290 --- a/drivers/net/dsa/b53/b53_common.c
291 +++ b/drivers/net/dsa/b53/b53_common.c
292 @@ -1349,10 +1349,8 @@ void b53_phylink_validate(struct dsa_swi
293 phylink_set(mask, 100baseT_Full);
294 }
295
296 - bitmap_and(supported, supported, mask,
297 - __ETHTOOL_LINK_MODE_MASK_NBITS);
298 - bitmap_and(state->advertising, state->advertising, mask,
299 - __ETHTOOL_LINK_MODE_MASK_NBITS);
300 + linkmode_and(supported, supported, mask);
301 + linkmode_and(state->advertising, state->advertising, mask);
302
303 phylink_helper_basex_speed(state);
304 }
305 --- a/drivers/net/dsa/bcm_sf2.c
306 +++ b/drivers/net/dsa/bcm_sf2.c
307 @@ -692,7 +692,7 @@ static void bcm_sf2_sw_validate(struct d
308 state->interface != PHY_INTERFACE_MODE_GMII &&
309 state->interface != PHY_INTERFACE_MODE_INTERNAL &&
310 state->interface != PHY_INTERFACE_MODE_MOCA) {
311 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
312 + linkmode_zero(supported);
313 if (port != core_readl(priv, CORE_IMP0_PRT_ID))
314 dev_err(ds->dev,
315 "Unsupported interface: %d for port %d\n",
316 @@ -720,10 +720,8 @@ static void bcm_sf2_sw_validate(struct d
317 phylink_set(mask, 100baseT_Half);
318 phylink_set(mask, 100baseT_Full);
319
320 - bitmap_and(supported, supported, mask,
321 - __ETHTOOL_LINK_MODE_MASK_NBITS);
322 - bitmap_and(state->advertising, state->advertising, mask,
323 - __ETHTOOL_LINK_MODE_MASK_NBITS);
324 + linkmode_and(supported, supported, mask);
325 + linkmode_and(state->advertising, state->advertising, mask);
326 }
327
328 static void bcm_sf2_sw_mac_config(struct dsa_switch *ds, int port,
329 --- a/drivers/net/dsa/hirschmann/hellcreek.c
330 +++ b/drivers/net/dsa/hirschmann/hellcreek.c
331 @@ -1476,10 +1476,8 @@ static void hellcreek_phylink_validate(s
332 else
333 phylink_set(mask, 1000baseT_Full);
334
335 - bitmap_and(supported, supported, mask,
336 - __ETHTOOL_LINK_MODE_MASK_NBITS);
337 - bitmap_and(state->advertising, state->advertising, mask,
338 - __ETHTOOL_LINK_MODE_MASK_NBITS);
339 + linkmode_and(supported, supported, mask);
340 + linkmode_and(state->advertising, state->advertising, mask);
341 }
342
343 static int
344 --- a/drivers/net/dsa/lantiq_gswip.c
345 +++ b/drivers/net/dsa/lantiq_gswip.c
346 @@ -1452,10 +1452,8 @@ static void gswip_phylink_set_capab(unsi
347 phylink_set(mask, 100baseT_Half);
348 phylink_set(mask, 100baseT_Full);
349
350 - bitmap_and(supported, supported, mask,
351 - __ETHTOOL_LINK_MODE_MASK_NBITS);
352 - bitmap_and(state->advertising, state->advertising, mask,
353 - __ETHTOOL_LINK_MODE_MASK_NBITS);
354 + linkmode_and(supported, supported, mask);
355 + linkmode_and(state->advertising, state->advertising, mask);
356 }
357
358 static void gswip_xrx200_phylink_validate(struct dsa_switch *ds, int port,
359 @@ -1483,7 +1481,7 @@ static void gswip_xrx200_phylink_validat
360 goto unsupported;
361 break;
362 default:
363 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
364 + linkmode_zero(supported);
365 dev_err(ds->dev, "Unsupported port: %i\n", port);
366 return;
367 }
368 @@ -1493,7 +1491,7 @@ static void gswip_xrx200_phylink_validat
369 return;
370
371 unsupported:
372 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
373 + linkmode_zero(supported);
374 dev_err(ds->dev, "Unsupported interface '%s' for port %d\n",
375 phy_modes(state->interface), port);
376 }
377 @@ -1523,7 +1521,7 @@ static void gswip_xrx300_phylink_validat
378 goto unsupported;
379 break;
380 default:
381 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
382 + linkmode_zero(supported);
383 dev_err(ds->dev, "Unsupported port: %i\n", port);
384 return;
385 }
386 @@ -1533,7 +1531,7 @@ static void gswip_xrx300_phylink_validat
387 return;
388
389 unsupported:
390 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
391 + linkmode_zero(supported);
392 dev_err(ds->dev, "Unsupported interface '%s' for port %d\n",
393 phy_modes(state->interface), port);
394 }
395 --- a/drivers/net/dsa/microchip/ksz8795.c
396 +++ b/drivers/net/dsa/microchip/ksz8795.c
397 @@ -1542,15 +1542,13 @@ static void ksz8_validate(struct dsa_swi
398 phylink_set(mask, 100baseT_Half);
399 phylink_set(mask, 100baseT_Full);
400
401 - bitmap_and(supported, supported, mask,
402 - __ETHTOOL_LINK_MODE_MASK_NBITS);
403 - bitmap_and(state->advertising, state->advertising, mask,
404 - __ETHTOOL_LINK_MODE_MASK_NBITS);
405 + linkmode_and(supported, supported, mask);
406 + linkmode_and(state->advertising, state->advertising, mask);
407
408 return;
409
410 unsupported:
411 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
412 + linkmode_zero(supported);
413 dev_err(ds->dev, "Unsupported interface: %s, port: %d\n",
414 phy_modes(state->interface), port);
415 }
416 --- a/drivers/net/dsa/mv88e6xxx/chip.c
417 +++ b/drivers/net/dsa/mv88e6xxx/chip.c
418 @@ -683,9 +683,8 @@ static void mv88e6xxx_validate(struct ds
419 if (chip->info->ops->phylink_validate)
420 chip->info->ops->phylink_validate(chip, port, mask, state);
421
422 - bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
423 - bitmap_and(state->advertising, state->advertising, mask,
424 - __ETHTOOL_LINK_MODE_MASK_NBITS);
425 + linkmode_and(supported, supported, mask);
426 + linkmode_and(state->advertising, state->advertising, mask);
427
428 /* We can only operate at 2500BaseX or 1000BaseX. If requested
429 * to advertise both, only report advertising at 2500BaseX.
430 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c
431 +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
432 @@ -944,7 +944,7 @@ static void vsc9959_phylink_validate(str
433
434 if (state->interface != PHY_INTERFACE_MODE_NA &&
435 state->interface != ocelot_port->phy_mode) {
436 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
437 + linkmode_zero(supported);
438 return;
439 }
440
441 @@ -966,10 +966,8 @@ static void vsc9959_phylink_validate(str
442 phylink_set(mask, 2500baseX_Full);
443 }
444
445 - bitmap_and(supported, supported, mask,
446 - __ETHTOOL_LINK_MODE_MASK_NBITS);
447 - bitmap_and(state->advertising, state->advertising, mask,
448 - __ETHTOOL_LINK_MODE_MASK_NBITS);
449 + linkmode_and(supported, supported, mask);
450 + linkmode_and(state->advertising, state->advertising, mask);
451 }
452
453 static int vsc9959_prevalidate_phy_mode(struct ocelot *ocelot, int port,
454 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c
455 +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
456 @@ -1000,7 +1000,7 @@ static void vsc9953_phylink_validate(str
457
458 if (state->interface != PHY_INTERFACE_MODE_NA &&
459 state->interface != ocelot_port->phy_mode) {
460 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
461 + linkmode_zero(supported);
462 return;
463 }
464
465 @@ -1019,10 +1019,8 @@ static void vsc9953_phylink_validate(str
466 phylink_set(mask, 2500baseX_Full);
467 }
468
469 - bitmap_and(supported, supported, mask,
470 - __ETHTOOL_LINK_MODE_MASK_NBITS);
471 - bitmap_and(state->advertising, state->advertising, mask,
472 - __ETHTOOL_LINK_MODE_MASK_NBITS);
473 + linkmode_and(supported, supported, mask);
474 + linkmode_and(state->advertising, state->advertising, mask);
475 }
476
477 static int vsc9953_prevalidate_phy_mode(struct ocelot *ocelot, int port,
478 --- a/drivers/net/dsa/qca/ar9331.c
479 +++ b/drivers/net/dsa/qca/ar9331.c
480 @@ -522,7 +522,7 @@ static void ar9331_sw_phylink_validate(s
481 goto unsupported;
482 break;
483 default:
484 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
485 + linkmode_zero(supported);
486 dev_err(ds->dev, "Unsupported port: %i\n", port);
487 return;
488 }
489 @@ -536,15 +536,13 @@ static void ar9331_sw_phylink_validate(s
490 phylink_set(mask, 100baseT_Half);
491 phylink_set(mask, 100baseT_Full);
492
493 - bitmap_and(supported, supported, mask,
494 - __ETHTOOL_LINK_MODE_MASK_NBITS);
495 - bitmap_and(state->advertising, state->advertising, mask,
496 - __ETHTOOL_LINK_MODE_MASK_NBITS);
497 + linkmode_and(supported, supported, mask);
498 + linkmode_and(state->advertising, state->advertising, mask);
499
500 return;
501
502 unsupported:
503 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
504 + linkmode_zero(supported);
505 dev_err(ds->dev, "Unsupported interface: %d, port: %d\n",
506 state->interface, port);
507 }
508 --- a/drivers/net/dsa/sja1105/sja1105_main.c
509 +++ b/drivers/net/dsa/sja1105/sja1105_main.c
510 @@ -1360,7 +1360,7 @@ static void sja1105_phylink_validate(str
511 */
512 if (state->interface != PHY_INTERFACE_MODE_NA &&
513 sja1105_phy_mode_mismatch(priv, port, state->interface)) {
514 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
515 + linkmode_zero(supported);
516 return;
517 }
518
519 @@ -1380,9 +1380,8 @@ static void sja1105_phylink_validate(str
520 phylink_set(mask, 2500baseX_Full);
521 }
522
523 - bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
524 - bitmap_and(state->advertising, state->advertising, mask,
525 - __ETHTOOL_LINK_MODE_MASK_NBITS);
526 + linkmode_and(supported, supported, mask);
527 + linkmode_and(state->advertising, state->advertising, mask);
528 }
529
530 static int
531 --- a/drivers/net/dsa/xrs700x/xrs700x.c
532 +++ b/drivers/net/dsa/xrs700x/xrs700x.c
533 @@ -457,7 +457,7 @@ static void xrs700x_phylink_validate(str
534 phylink_set(mask, 1000baseT_Full);
535 break;
536 default:
537 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
538 + linkmode_zero(supported);
539 dev_err(ds->dev, "Unsupported port: %i\n", port);
540 return;
541 }
542 @@ -468,10 +468,8 @@ static void xrs700x_phylink_validate(str
543 phylink_set(mask, 10baseT_Full);
544 phylink_set(mask, 100baseT_Full);
545
546 - bitmap_and(supported, supported, mask,
547 - __ETHTOOL_LINK_MODE_MASK_NBITS);
548 - bitmap_and(state->advertising, state->advertising, mask,
549 - __ETHTOOL_LINK_MODE_MASK_NBITS);
550 + linkmode_and(supported, supported, mask);
551 + linkmode_and(state->advertising, state->advertising, mask);
552 }
553
554 static void xrs700x_mac_link_up(struct dsa_switch *ds, int port,
555 --- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
556 +++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
557 @@ -374,9 +374,8 @@ static int xgbe_set_link_ksettings(struc
558 __ETHTOOL_LINK_MODE_MASK_NBITS, cmd->link_modes.advertising,
559 __ETHTOOL_LINK_MODE_MASK_NBITS, lks->link_modes.supported);
560
561 - bitmap_and(advertising,
562 - cmd->link_modes.advertising, lks->link_modes.supported,
563 - __ETHTOOL_LINK_MODE_MASK_NBITS);
564 + linkmode_and(advertising, cmd->link_modes.advertising,
565 + lks->link_modes.supported);
566
567 if ((cmd->base.autoneg == AUTONEG_ENABLE) &&
568 bitmap_empty(advertising, __ETHTOOL_LINK_MODE_MASK_NBITS)) {
569 @@ -389,8 +388,7 @@ static int xgbe_set_link_ksettings(struc
570 pdata->phy.autoneg = cmd->base.autoneg;
571 pdata->phy.speed = speed;
572 pdata->phy.duplex = cmd->base.duplex;
573 - bitmap_copy(lks->link_modes.advertising, advertising,
574 - __ETHTOOL_LINK_MODE_MASK_NBITS);
575 + linkmode_copy(lks->link_modes.advertising, advertising);
576
577 if (cmd->base.autoneg == AUTONEG_ENABLE)
578 XGBE_SET_ADV(lks, Autoneg);
579 --- a/drivers/net/ethernet/atheros/ag71xx.c
580 +++ b/drivers/net/ethernet/atheros/ag71xx.c
581 @@ -1082,14 +1082,12 @@ static void ag71xx_mac_validate(struct p
582 phylink_set(mask, 1000baseX_Full);
583 }
584
585 - bitmap_and(supported, supported, mask,
586 - __ETHTOOL_LINK_MODE_MASK_NBITS);
587 - bitmap_and(state->advertising, state->advertising, mask,
588 - __ETHTOOL_LINK_MODE_MASK_NBITS);
589 + linkmode_and(supported, supported, mask);
590 + linkmode_and(state->advertising, state->advertising, mask);
591
592 return;
593 unsupported:
594 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
595 + linkmode_zero(supported);
596 }
597
598 static void ag71xx_mac_pcs_get_state(struct phylink_config *config,
599 --- a/drivers/net/ethernet/cadence/macb_main.c
600 +++ b/drivers/net/ethernet/cadence/macb_main.c
601 @@ -523,21 +523,21 @@ static void macb_validate(struct phylink
602 state->interface != PHY_INTERFACE_MODE_SGMII &&
603 state->interface != PHY_INTERFACE_MODE_10GBASER &&
604 !phy_interface_mode_is_rgmii(state->interface)) {
605 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
606 + linkmode_zero(supported);
607 return;
608 }
609
610 if (!macb_is_gem(bp) &&
611 (state->interface == PHY_INTERFACE_MODE_GMII ||
612 phy_interface_mode_is_rgmii(state->interface))) {
613 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
614 + linkmode_zero(supported);
615 return;
616 }
617
618 if (state->interface == PHY_INTERFACE_MODE_10GBASER &&
619 !(bp->caps & MACB_CAPS_HIGH_SPEED &&
620 bp->caps & MACB_CAPS_PCS)) {
621 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
622 + linkmode_zero(supported);
623 return;
624 }
625
626 @@ -576,9 +576,8 @@ static void macb_validate(struct phylink
627 phylink_set(mask, 1000baseT_Half);
628 }
629 out:
630 - bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
631 - bitmap_and(state->advertising, state->advertising, mask,
632 - __ETHTOOL_LINK_MODE_MASK_NBITS);
633 + linkmode_and(supported, supported, mask);
634 + linkmode_and(state->advertising, state->advertising, mask);
635 }
636
637 static void macb_usx_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
638 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
639 +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
640 @@ -965,7 +965,7 @@ static void enetc_pl_mac_validate(struct
641 state->interface != PHY_INTERFACE_MODE_2500BASEX &&
642 state->interface != PHY_INTERFACE_MODE_USXGMII &&
643 !phy_interface_mode_is_rgmii(state->interface)) {
644 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
645 + linkmode_zero(supported);
646 return;
647 }
648
649 @@ -988,10 +988,8 @@ static void enetc_pl_mac_validate(struct
650 phylink_set(mask, 2500baseX_Full);
651 }
652
653 - bitmap_and(supported, supported, mask,
654 - __ETHTOOL_LINK_MODE_MASK_NBITS);
655 - bitmap_and(state->advertising, state->advertising, mask,
656 - __ETHTOOL_LINK_MODE_MASK_NBITS);
657 + linkmode_and(supported, supported, mask);
658 + linkmode_and(state->advertising, state->advertising, mask);
659 }
660
661 static void enetc_pl_mac_config(struct phylink_config *config,
662 --- a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
663 +++ b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
664 @@ -322,12 +322,10 @@ static int hinic_get_link_ksettings(stru
665 }
666 }
667
668 - bitmap_copy(link_ksettings->link_modes.supported,
669 - (unsigned long *)&settings.supported,
670 - __ETHTOOL_LINK_MODE_MASK_NBITS);
671 - bitmap_copy(link_ksettings->link_modes.advertising,
672 - (unsigned long *)&settings.advertising,
673 - __ETHTOOL_LINK_MODE_MASK_NBITS);
674 + linkmode_copy(link_ksettings->link_modes.supported,
675 + (unsigned long *)&settings.supported);
676 + linkmode_copy(link_ksettings->link_modes.advertising,
677 + (unsigned long *)&settings.advertising);
678
679 return 0;
680 }
681 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
682 +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
683 @@ -467,9 +467,8 @@ static int ixgbe_set_link_ksettings(stru
684 * this function does not support duplex forcing, but can
685 * limit the advertising of the adapter to the specified speed
686 */
687 - if (!bitmap_subset(cmd->link_modes.advertising,
688 - cmd->link_modes.supported,
689 - __ETHTOOL_LINK_MODE_MASK_NBITS))
690 + if (!linkmode_subset(cmd->link_modes.advertising,
691 + cmd->link_modes.supported))
692 return -EINVAL;
693
694 /* only allow one speed at a time if no autoneg */
695 --- a/drivers/net/ethernet/marvell/mvneta.c
696 +++ b/drivers/net/ethernet/marvell/mvneta.c
697 @@ -3835,14 +3835,14 @@ static void mvneta_validate(struct phyli
698 */
699 if (phy_interface_mode_is_8023z(state->interface)) {
700 if (!phylink_test(state->advertising, Autoneg)) {
701 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
702 + linkmode_zero(supported);
703 return;
704 }
705 } else if (state->interface != PHY_INTERFACE_MODE_NA &&
706 state->interface != PHY_INTERFACE_MODE_QSGMII &&
707 state->interface != PHY_INTERFACE_MODE_SGMII &&
708 !phy_interface_mode_is_rgmii(state->interface)) {
709 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
710 + linkmode_zero(supported);
711 return;
712 }
713
714 @@ -3871,10 +3871,8 @@ static void mvneta_validate(struct phyli
715 phylink_set(mask, 100baseT_Full);
716 }
717
718 - bitmap_and(supported, supported, mask,
719 - __ETHTOOL_LINK_MODE_MASK_NBITS);
720 - bitmap_and(state->advertising, state->advertising, mask,
721 - __ETHTOOL_LINK_MODE_MASK_NBITS);
722 + linkmode_and(supported, supported, mask);
723 + linkmode_and(state->advertising, state->advertising, mask);
724
725 /* We can only operate at 2500BaseX or 1000BaseX. If requested
726 * to advertise both, only report advertising at 2500BaseX.
727 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
728 +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
729 @@ -6377,15 +6377,14 @@ static void mvpp2_phylink_validate(struc
730 goto empty_set;
731 }
732
733 - bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
734 - bitmap_and(state->advertising, state->advertising, mask,
735 - __ETHTOOL_LINK_MODE_MASK_NBITS);
736 + linkmode_and(supported, supported, mask);
737 + linkmode_and(state->advertising, state->advertising, mask);
738
739 phylink_helper_basex_speed(state);
740 return;
741
742 empty_set:
743 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
744 + linkmode_zero(supported);
745 }
746
747 static void mvpp2_xlg_config(struct mvpp2_port *port, unsigned int mode,
748 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
749 +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
750 @@ -1172,9 +1172,8 @@ static int otx2_set_link_ksettings(struc
751 otx2_get_link_ksettings(netdev, &cur_ks);
752
753 /* Check requested modes against supported modes by hardware */
754 - if (!bitmap_subset(cmd->link_modes.advertising,
755 - cur_ks.link_modes.supported,
756 - __ETHTOOL_LINK_MODE_MASK_NBITS))
757 + if (!linkmode_subset(cmd->link_modes.advertising,
758 + cur_ks.link_modes.supported))
759 return -EINVAL;
760
761 mutex_lock(&mbox->lock);
762 --- a/drivers/net/ethernet/marvell/pxa168_eth.c
763 +++ b/drivers/net/ethernet/marvell/pxa168_eth.c
764 @@ -977,8 +977,7 @@ static int pxa168_init_phy(struct net_de
765 cmd.base.phy_address = pep->phy_addr;
766 cmd.base.speed = pep->phy_speed;
767 cmd.base.duplex = pep->phy_duplex;
768 - bitmap_copy(cmd.link_modes.advertising, PHY_BASIC_FEATURES,
769 - __ETHTOOL_LINK_MODE_MASK_NBITS);
770 + linkmode_copy(cmd.link_modes.advertising, PHY_BASIC_FEATURES);
771 cmd.base.autoneg = AUTONEG_ENABLE;
772
773 if (cmd.base.speed != 0)
774 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
775 +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
776 @@ -39,6 +39,7 @@
777 #include <linux/in.h>
778 #include <net/ip.h>
779 #include <linux/bitmap.h>
780 +#include <linux/mii.h>
781
782 #include "mlx4_en.h"
783 #include "en_port.h"
784 @@ -643,10 +644,8 @@ static unsigned long *ptys2ethtool_link_
785 unsigned int i; \
786 cfg = &ptys2ethtool_map[reg_]; \
787 cfg->speed = speed_; \
788 - bitmap_zero(cfg->supported, \
789 - __ETHTOOL_LINK_MODE_MASK_NBITS); \
790 - bitmap_zero(cfg->advertised, \
791 - __ETHTOOL_LINK_MODE_MASK_NBITS); \
792 + linkmode_zero(cfg->supported); \
793 + linkmode_zero(cfg->advertised); \
794 for (i = 0 ; i < ARRAY_SIZE(modes) ; ++i) { \
795 __set_bit(modes[i], cfg->supported); \
796 __set_bit(modes[i], cfg->advertised); \
797 @@ -702,10 +701,8 @@ static void ptys2ethtool_update_link_mod
798 int i;
799 for (i = 0; i < MLX4_LINK_MODES_SZ; i++) {
800 if (eth_proto & MLX4_PROT_MASK(i))
801 - bitmap_or(link_modes, link_modes,
802 - ptys2ethtool_link_mode(&ptys2ethtool_map[i],
803 - report),
804 - __ETHTOOL_LINK_MODE_MASK_NBITS);
805 + linkmode_or(link_modes, link_modes,
806 + ptys2ethtool_link_mode(&ptys2ethtool_map[i], report));
807 }
808 }
809
810 @@ -716,11 +713,9 @@ static u32 ethtool2ptys_link_modes(const
811 u32 ptys_modes = 0;
812
813 for (i = 0; i < MLX4_LINK_MODES_SZ; i++) {
814 - if (bitmap_intersects(
815 - ptys2ethtool_link_mode(&ptys2ethtool_map[i],
816 - report),
817 - link_modes,
818 - __ETHTOOL_LINK_MODE_MASK_NBITS))
819 + ulong *map_mode = ptys2ethtool_link_mode(&ptys2ethtool_map[i],
820 + report);
821 + if (linkmode_intersects(map_mode, link_modes))
822 ptys_modes |= 1 << i;
823 }
824 return ptys_modes;
825 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c
826 +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c
827 @@ -92,12 +92,11 @@ static void sparx5_phylink_validate(stru
828 }
829 break;
830 default:
831 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
832 + linkmode_zero(supported);
833 return;
834 }
835 - bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
836 - bitmap_and(state->advertising, state->advertising, mask,
837 - __ETHTOOL_LINK_MODE_MASK_NBITS);
838 + linkmode_and(supported, supported, mask);
839 + linkmode_and(state->advertising, state->advertising, mask);
840 }
841
842 static void sparx5_phylink_mac_config(struct phylink_config *config,
843 --- a/drivers/net/ethernet/mscc/ocelot_net.c
844 +++ b/drivers/net/ethernet/mscc/ocelot_net.c
845 @@ -1509,7 +1509,7 @@ static void vsc7514_phylink_validate(str
846
847 if (state->interface != PHY_INTERFACE_MODE_NA &&
848 state->interface != ocelot_port->phy_mode) {
849 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
850 + linkmode_zero(supported);
851 return;
852 }
853
854 @@ -1528,9 +1528,8 @@ static void vsc7514_phylink_validate(str
855 phylink_set(mask, 2500baseT_Full);
856 phylink_set(mask, 2500baseX_Full);
857
858 - bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
859 - bitmap_and(state->advertising, state->advertising, mask,
860 - __ETHTOOL_LINK_MODE_MASK_NBITS);
861 + linkmode_and(supported, supported, mask);
862 + linkmode_and(state->advertising, state->advertising, mask);
863 }
864
865 static void vsc7514_phylink_mac_config(struct phylink_config *config,
866 --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
867 +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
868 @@ -228,8 +228,7 @@ static int ionic_get_link_ksettings(stru
869 break;
870 }
871
872 - bitmap_copy(ks->link_modes.advertising, ks->link_modes.supported,
873 - __ETHTOOL_LINK_MODE_MASK_NBITS);
874 + linkmode_copy(ks->link_modes.advertising, ks->link_modes.supported);
875
876 ethtool_link_ksettings_add_link_mode(ks, supported, FEC_BASER);
877 ethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS);
878 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
879 +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
880 @@ -1565,7 +1565,7 @@ static void axienet_validate(struct phyl
881 netdev_warn(ndev, "Cannot use PHY mode %s, supported: %s\n",
882 phy_modes(state->interface),
883 phy_modes(lp->phy_mode));
884 - bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
885 + linkmode_zero(supported);
886 return;
887 }
888 }
889 @@ -1598,10 +1598,8 @@ static void axienet_validate(struct phyl
890 break;
891 }
892
893 - bitmap_and(supported, supported, mask,
894 - __ETHTOOL_LINK_MODE_MASK_NBITS);
895 - bitmap_and(state->advertising, state->advertising, mask,
896 - __ETHTOOL_LINK_MODE_MASK_NBITS);
897 + linkmode_and(supported, supported, mask);
898 + linkmode_and(state->advertising, state->advertising, mask);
899 }
900
901 static void axienet_mac_pcs_get_state(struct phylink_config *config,
902 --- a/drivers/net/pcs/pcs-xpcs.c
903 +++ b/drivers/net/pcs/pcs-xpcs.c
904 @@ -637,7 +637,7 @@ void xpcs_validate(struct dw_xpcs *xpcs,
905 if (state->interface == PHY_INTERFACE_MODE_NA)
906 return;
907
908 - bitmap_zero(xpcs_supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
909 + linkmode_zero(xpcs_supported);
910
911 compat = xpcs_find_compat(xpcs->id, state->interface);
912
913 --- a/drivers/net/phy/sfp-bus.c
914 +++ b/drivers/net/phy/sfp-bus.c
915 @@ -379,7 +379,7 @@ void sfp_parse_support(struct sfp_bus *b
916 if (bus->sfp_quirk)
917 bus->sfp_quirk->modes(id, modes);
918
919 - bitmap_or(support, support, modes, __ETHTOOL_LINK_MODE_MASK_NBITS);
920 + linkmode_or(support, support, modes);
921
922 phylink_set(support, Autoneg);
923 phylink_set(support, Pause);
924 --- a/net/ethtool/ioctl.c
925 +++ b/net/ethtool/ioctl.c
926 @@ -335,7 +335,7 @@ EXPORT_SYMBOL(ethtool_intersect_link_mas
927 void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst,
928 u32 legacy_u32)
929 {
930 - bitmap_zero(dst, __ETHTOOL_LINK_MODE_MASK_NBITS);
931 + linkmode_zero(dst);
932 dst[0] = legacy_u32;
933 }
934 EXPORT_SYMBOL(ethtool_convert_legacy_u32_to_link_mode);
935 @@ -350,11 +350,10 @@ bool ethtool_convert_link_mode_to_legacy
936 if (__ETHTOOL_LINK_MODE_MASK_NBITS > 32) {
937 __ETHTOOL_DECLARE_LINK_MODE_MASK(ext);
938
939 - bitmap_zero(ext, __ETHTOOL_LINK_MODE_MASK_NBITS);
940 + linkmode_zero(ext);
941 bitmap_fill(ext, 32);
942 bitmap_complement(ext, ext, __ETHTOOL_LINK_MODE_MASK_NBITS);
943 - if (bitmap_intersects(ext, src,
944 - __ETHTOOL_LINK_MODE_MASK_NBITS)) {
945 + if (linkmode_intersects(ext, src)) {
946 /* src mask goes beyond bit 31 */
947 retval = false;
948 }