net: convert users of bitmap_foo() to linkmode_foo()
authorSean Anderson <sean.anderson@seco.com>
Fri, 22 Oct 2021 22:41:04 +0000 (18:41 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sun, 24 Oct 2021 12:58:52 +0000 (13:58 +0100)
This converts instances of
bitmap_foo(args..., __ETHTOOL_LINK_MODE_MASK_NBITS)
to
linkmode_foo(args...)

I manually fixed up some lines to prevent them from being excessively
long. Otherwise, this change was generated with the following semantic
patch:

// Generated with
// echo linux/linkmode.h > includes
// git grep -Flf includes include/ | cut -f 2- -d / | cat includes - \
// | sort | uniq | tee new_includes | wc -l && mv new_includes includes
// and repeating until the number stopped going up
@i@
@@

(
 #include <linux/acpi_mdio.h>
|
 #include <linux/brcmphy.h>
|
 #include <linux/dsa/loop.h>
|
 #include <linux/dsa/sja1105.h>
|
 #include <linux/ethtool.h>
|
 #include <linux/ethtool_netlink.h>
|
 #include <linux/fec.h>
|
 #include <linux/fs_enet_pd.h>
|
 #include <linux/fsl/enetc_mdio.h>
|
 #include <linux/fwnode_mdio.h>
|
 #include <linux/linkmode.h>
|
 #include <linux/lsm_audit.h>
|
 #include <linux/mdio-bitbang.h>
|
 #include <linux/mdio.h>
|
 #include <linux/mdio-mux.h>
|
 #include <linux/mii.h>
|
 #include <linux/mii_timestamper.h>
|
 #include <linux/mlx5/accel.h>
|
 #include <linux/mlx5/cq.h>
|
 #include <linux/mlx5/device.h>
|
 #include <linux/mlx5/driver.h>
|
 #include <linux/mlx5/eswitch.h>
|
 #include <linux/mlx5/fs.h>
|
 #include <linux/mlx5/port.h>
|
 #include <linux/mlx5/qp.h>
|
 #include <linux/mlx5/rsc_dump.h>
|
 #include <linux/mlx5/transobj.h>
|
 #include <linux/mlx5/vport.h>
|
 #include <linux/of_mdio.h>
|
 #include <linux/of_net.h>
|
 #include <linux/pcs-lynx.h>
|
 #include <linux/pcs/pcs-xpcs.h>
|
 #include <linux/phy.h>
|
 #include <linux/phy_led_triggers.h>
|
 #include <linux/phylink.h>
|
 #include <linux/platform_data/bcmgenet.h>
|
 #include <linux/platform_data/xilinx-ll-temac.h>
|
 #include <linux/pxa168_eth.h>
|
 #include <linux/qed/qed_eth_if.h>
|
 #include <linux/qed/qed_fcoe_if.h>
|
 #include <linux/qed/qed_if.h>
|
 #include <linux/qed/qed_iov_if.h>
|
 #include <linux/qed/qed_iscsi_if.h>
|
 #include <linux/qed/qed_ll2_if.h>
|
 #include <linux/qed/qed_nvmetcp_if.h>
|
 #include <linux/qed/qed_rdma_if.h>
|
 #include <linux/sfp.h>
|
 #include <linux/sh_eth.h>
|
 #include <linux/smsc911x.h>
|
 #include <linux/soc/nxp/lpc32xx-misc.h>
|
 #include <linux/stmmac.h>
|
 #include <linux/sunrpc/svc_rdma.h>
|
 #include <linux/sxgbe_platform.h>
|
 #include <net/cfg80211.h>
|
 #include <net/dsa.h>
|
 #include <net/mac80211.h>
|
 #include <net/selftests.h>
|
 #include <rdma/ib_addr.h>
|
 #include <rdma/ib_cache.h>
|
 #include <rdma/ib_cm.h>
|
 #include <rdma/ib_hdrs.h>
|
 #include <rdma/ib_mad.h>
|
 #include <rdma/ib_marshall.h>
|
 #include <rdma/ib_pack.h>
|
 #include <rdma/ib_pma.h>
|
 #include <rdma/ib_sa.h>
|
 #include <rdma/ib_smi.h>
|
 #include <rdma/ib_umem.h>
|
 #include <rdma/ib_umem_odp.h>
|
 #include <rdma/ib_verbs.h>
|
 #include <rdma/iw_cm.h>
|
 #include <rdma/mr_pool.h>
|
 #include <rdma/opa_addr.h>
|
 #include <rdma/opa_port_info.h>
|
 #include <rdma/opa_smi.h>
|
 #include <rdma/opa_vnic.h>
|
 #include <rdma/rdma_cm.h>
|
 #include <rdma/rdma_cm_ib.h>
|
 #include <rdma/rdmavt_cq.h>
|
 #include <rdma/rdma_vt.h>
|
 #include <rdma/rdmavt_qp.h>
|
 #include <rdma/rw.h>
|
 #include <rdma/tid_rdma_defs.h>
|
 #include <rdma/uverbs_ioctl.h>
|
 #include <rdma/uverbs_named_ioctl.h>
|
 #include <rdma/uverbs_std_types.h>
|
 #include <rdma/uverbs_types.h>
|
 #include <soc/mscc/ocelot.h>
|
 #include <soc/mscc/ocelot_ptp.h>
|
 #include <soc/mscc/ocelot_vcap.h>
|
 #include <trace/events/ib_mad.h>
|
 #include <trace/events/rdma_core.h>
|
 #include <trace/events/rdma.h>
|
 #include <trace/events/rpcrdma.h>
|
 #include <uapi/linux/ethtool.h>
|
 #include <uapi/linux/ethtool_netlink.h>
|
 #include <uapi/linux/mdio.h>
|
 #include <uapi/linux/mii.h>
)

@depends on i@
expression list args;
@@

(
- bitmap_zero(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_zero(args)
|
- bitmap_copy(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_copy(args)
|
- bitmap_and(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_and(args)
|
- bitmap_or(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_or(args)
|
- bitmap_empty(args, ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_empty(args)
|
- bitmap_andnot(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_andnot(args)
|
- bitmap_equal(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_equal(args)
|
- bitmap_intersects(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_intersects(args)
|
- bitmap_subset(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_subset(args)
)

Add missing linux/mii.h include to mellanox. -DaveM

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
29 files changed:
drivers/net/dsa/b53/b53_common.c
drivers/net/dsa/bcm_sf2.c
drivers/net/dsa/hirschmann/hellcreek.c
drivers/net/dsa/lantiq_gswip.c
drivers/net/dsa/microchip/ksz8795.c
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/ocelot/felix_vsc9959.c
drivers/net/dsa/ocelot/seville_vsc9953.c
drivers/net/dsa/qca/ar9331.c
drivers/net/dsa/sja1105/sja1105_main.c
drivers/net/dsa/xrs700x/xrs700x.c
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
drivers/net/ethernet/atheros/ag71xx.c
drivers/net/ethernet/cadence/macb_main.c
drivers/net/ethernet/freescale/enetc/enetc_pf.c
drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
drivers/net/ethernet/marvell/mvneta.c
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
drivers/net/ethernet/marvell/pxa168_eth.c
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c
drivers/net/ethernet/mscc/ocelot_net.c
drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
drivers/net/pcs/pcs-xpcs.c
drivers/net/phy/sfp-bus.c
net/ethtool/ioctl.c

index 9c80ca17b155ca3f8e4f8f766510dbe91cd10981..b0262e69a1706295d89daf132e9aded53d83eec8 100644 (file)
@@ -1343,10 +1343,8 @@ void b53_phylink_validate(struct dsa_switch *ds, int port,
                phylink_set(mask, 100baseT_Full);
        }
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 
        phylink_helper_basex_speed(state);
 }
index a86ddc4bb897e1198780b8e50444ff9527058eb8..13aa43b5cffd90a709583f10cc90bd1e60152f39 100644 (file)
@@ -685,7 +685,7 @@ static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port,
            state->interface != PHY_INTERFACE_MODE_GMII &&
            state->interface != PHY_INTERFACE_MODE_INTERNAL &&
            state->interface != PHY_INTERFACE_MODE_MOCA) {
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                if (port != core_readl(priv, CORE_IMP0_PRT_ID))
                        dev_err(ds->dev,
                                "Unsupported interface: %d for port %d\n",
@@ -713,10 +713,8 @@ static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port,
        phylink_set(mask, 100baseT_Half);
        phylink_set(mask, 100baseT_Full);
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 }
 
 static void bcm_sf2_sw_mac_config(struct dsa_switch *ds, int port,
index 354655f9ed0036a6ddb3cf47a54265070c720414..4e0b53d94b525004b00d17fa3aba9cedf301e42d 100644 (file)
@@ -1403,10 +1403,8 @@ static void hellcreek_phylink_validate(struct dsa_switch *ds, int port,
        else
                phylink_set(mask, 1000baseT_Full);
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 }
 
 static int
index 1a96df70d1e8599a0287e748460db078411b34e4..7056d98d8177b3de1a94854e5d5bdccac7db3972 100644 (file)
@@ -1464,10 +1464,8 @@ static void gswip_phylink_set_capab(unsigned long *supported,
        phylink_set(mask, 100baseT_Half);
        phylink_set(mask, 100baseT_Full);
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 }
 
 static void gswip_xrx200_phylink_validate(struct dsa_switch *ds, int port,
@@ -1495,7 +1493,7 @@ static void gswip_xrx200_phylink_validate(struct dsa_switch *ds, int port,
                        goto unsupported;
                break;
        default:
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                dev_err(ds->dev, "Unsupported port: %i\n", port);
                return;
        }
@@ -1505,7 +1503,7 @@ static void gswip_xrx200_phylink_validate(struct dsa_switch *ds, int port,
        return;
 
 unsupported:
-       bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_zero(supported);
        dev_err(ds->dev, "Unsupported interface '%s' for port %d\n",
                phy_modes(state->interface), port);
 }
@@ -1535,7 +1533,7 @@ static void gswip_xrx300_phylink_validate(struct dsa_switch *ds, int port,
                        goto unsupported;
                break;
        default:
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                dev_err(ds->dev, "Unsupported port: %i\n", port);
                return;
        }
@@ -1545,7 +1543,7 @@ static void gswip_xrx300_phylink_validate(struct dsa_switch *ds, int port,
        return;
 
 unsupported:
-       bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_zero(supported);
        dev_err(ds->dev, "Unsupported interface '%s' for port %d\n",
                phy_modes(state->interface), port);
 }
index c5142f86a3c755577ec75729d46464a9d9ffac48..43fc3087aeb3ea5c266b8dfaa4f568662dbe4a80 100644 (file)
@@ -1542,15 +1542,13 @@ static void ksz8_validate(struct dsa_switch *ds, int port,
        phylink_set(mask, 100baseT_Half);
        phylink_set(mask, 100baseT_Full);
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 
        return;
 
 unsupported:
-       bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_zero(supported);
        dev_err(ds->dev, "Unsupported interface: %s, port: %d\n",
                phy_modes(state->interface), port);
 }
index 8dadcae93c9b53ef8ad4f3440ff9d12630c8a13e..14c678a9e41b3501678a74a04b83b2cbb8b36ddb 100644 (file)
@@ -674,9 +674,8 @@ static void mv88e6xxx_validate(struct dsa_switch *ds, int port,
        if (chip->info->ops->phylink_validate)
                chip->info->ops->phylink_validate(chip, port, mask, state);
 
-       bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 
        /* We can only operate at 2500BaseX or 1000BaseX.  If requested
         * to advertise both, only report advertising at 2500BaseX.
index 11b42fd812e4a9658edda1bf764704f12972d471..45c5ec7a83eafc66f84f1b8eff27499450d748b9 100644 (file)
@@ -943,7 +943,7 @@ static void vsc9959_phylink_validate(struct ocelot *ocelot, int port,
 
        if (state->interface != PHY_INTERFACE_MODE_NA &&
            state->interface != ocelot_port->phy_mode) {
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                return;
        }
 
@@ -965,10 +965,8 @@ static void vsc9959_phylink_validate(struct ocelot *ocelot, int port,
                phylink_set(mask, 2500baseX_Full);
        }
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 }
 
 static int vsc9959_prevalidate_phy_mode(struct ocelot *ocelot, int port,
index de1d34a1f1e47497f99f0e79528b445f6d73d990..92eae63150eae380e8fb1cda03ca2b96680ec2ab 100644 (file)
@@ -999,7 +999,7 @@ static void vsc9953_phylink_validate(struct ocelot *ocelot, int port,
 
        if (state->interface != PHY_INTERFACE_MODE_NA &&
            state->interface != ocelot_port->phy_mode) {
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                return;
        }
 
@@ -1018,10 +1018,8 @@ static void vsc9953_phylink_validate(struct ocelot *ocelot, int port,
                phylink_set(mask, 2500baseX_Full);
        }
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 }
 
 static int vsc9953_prevalidate_phy_mode(struct ocelot *ocelot, int port,
index a6bfb6abc51a7dd9e3393043cc648bc6c8f5874d..da0d7e68643a9d21c35683f2a25449b9f87a7d42 100644 (file)
@@ -522,7 +522,7 @@ static void ar9331_sw_phylink_validate(struct dsa_switch *ds, int port,
                        goto unsupported;
                break;
        default:
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                dev_err(ds->dev, "Unsupported port: %i\n", port);
                return;
        }
@@ -536,15 +536,13 @@ static void ar9331_sw_phylink_validate(struct dsa_switch *ds, int port,
        phylink_set(mask, 100baseT_Half);
        phylink_set(mask, 100baseT_Full);
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 
        return;
 
 unsupported:
-       bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_zero(supported);
        dev_err(ds->dev, "Unsupported interface: %d, port: %d\n",
                state->interface, port);
 }
index d6788a010024ecc07357d8c38b80a2887631d1f6..c343effe2e967a84ce441fb5ce58b70bc2493f72 100644 (file)
@@ -1431,7 +1431,7 @@ static void sja1105_phylink_validate(struct dsa_switch *ds, int port,
         */
        if (state->interface != PHY_INTERFACE_MODE_NA &&
            sja1105_phy_mode_mismatch(priv, port, state->interface)) {
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                return;
        }
 
@@ -1451,9 +1451,8 @@ static void sja1105_phylink_validate(struct dsa_switch *ds, int port,
                phylink_set(mask, 2500baseX_Full);
        }
 
-       bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 }
 
 static int
index 469420941054e9d4e6f9b62b75803d47164c110a..910fcb3b252b817f8d7cb20d1742484ef127e8ed 100644 (file)
@@ -456,7 +456,7 @@ static void xrs700x_phylink_validate(struct dsa_switch *ds, int port,
                phylink_set(mask, 1000baseT_Full);
                break;
        default:
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                dev_err(ds->dev, "Unsupported port: %i\n", port);
                return;
        }
@@ -467,10 +467,8 @@ static void xrs700x_phylink_validate(struct dsa_switch *ds, int port,
        phylink_set(mask, 10baseT_Full);
        phylink_set(mask, 100baseT_Full);
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 }
 
 static void xrs700x_mac_link_up(struct dsa_switch *ds, int port,
index bafc51c34e0be375bbf8622ce2a787276e35a5e1..94879cf8b42001d0e89d371e08e41dd8c8125a8c 100644 (file)
@@ -369,9 +369,8 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
                  __ETHTOOL_LINK_MODE_MASK_NBITS, cmd->link_modes.advertising,
                  __ETHTOOL_LINK_MODE_MASK_NBITS, lks->link_modes.supported);
 
-       bitmap_and(advertising,
-                  cmd->link_modes.advertising, lks->link_modes.supported,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(advertising, cmd->link_modes.advertising,
+                    lks->link_modes.supported);
 
        if ((cmd->base.autoneg == AUTONEG_ENABLE) &&
            bitmap_empty(advertising, __ETHTOOL_LINK_MODE_MASK_NBITS)) {
@@ -384,8 +383,7 @@ static int xgbe_set_link_ksettings(struct net_device *netdev,
        pdata->phy.autoneg = cmd->base.autoneg;
        pdata->phy.speed = speed;
        pdata->phy.duplex = cmd->base.duplex;
-       bitmap_copy(lks->link_modes.advertising, advertising,
-                   __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_copy(lks->link_modes.advertising, advertising);
 
        if (cmd->base.autoneg == AUTONEG_ENABLE)
                XGBE_SET_ADV(lks, Autoneg);
index ada3a9f0c8c8da8cad36e713bcedbc4a94fc33e6..88d2ab7483994a850efcea1228d9718e0f6bc2ae 100644 (file)
@@ -1082,14 +1082,12 @@ static void ag71xx_mac_validate(struct phylink_config *config,
                phylink_set(mask, 1000baseX_Full);
        }
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 
        return;
 unsupported:
-       bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_zero(supported);
 }
 
 static void ag71xx_mac_pcs_get_state(struct phylink_config *config,
index 30a65cac9e873414957ee81de601d4fdc25c3c32..309371abfe232300850e29137c6e885ebd2a403f 100644 (file)
@@ -522,21 +522,21 @@ static void macb_validate(struct phylink_config *config,
            state->interface != PHY_INTERFACE_MODE_SGMII &&
            state->interface != PHY_INTERFACE_MODE_10GBASER &&
            !phy_interface_mode_is_rgmii(state->interface)) {
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                return;
        }
 
        if (!macb_is_gem(bp) &&
            (state->interface == PHY_INTERFACE_MODE_GMII ||
             phy_interface_mode_is_rgmii(state->interface))) {
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                return;
        }
 
        if (state->interface == PHY_INTERFACE_MODE_10GBASER &&
            !(bp->caps & MACB_CAPS_HIGH_SPEED &&
              bp->caps & MACB_CAPS_PCS)) {
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                return;
        }
 
@@ -570,9 +570,8 @@ static void macb_validate(struct phylink_config *config,
                        phylink_set(mask, 1000baseT_Half);
        }
 out:
-       bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 }
 
 static void macb_usx_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
index 64f92770691fb8c3ca61d2036ab0dd5f323fa299..0e87c7043b772669a58d90fb7b42ba78244994a3 100644 (file)
@@ -942,7 +942,7 @@ static void enetc_pl_mac_validate(struct phylink_config *config,
            state->interface != PHY_INTERFACE_MODE_2500BASEX &&
            state->interface != PHY_INTERFACE_MODE_USXGMII &&
            !phy_interface_mode_is_rgmii(state->interface)) {
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                return;
        }
 
@@ -965,10 +965,8 @@ static void enetc_pl_mac_validate(struct phylink_config *config,
                phylink_set(mask, 2500baseX_Full);
        }
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 }
 
 static void enetc_pl_mac_config(struct phylink_config *config,
index b431c300ef1b9d01b27ea6bc6398b41120d4a434..a85667078b724b433eafe0000af665f1c91dafba 100644 (file)
@@ -322,12 +322,10 @@ static int hinic_get_link_ksettings(struct net_device *netdev,
                }
        }
 
-       bitmap_copy(link_ksettings->link_modes.supported,
-                   (unsigned long *)&settings.supported,
-                   __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_copy(link_ksettings->link_modes.advertising,
-                   (unsigned long *)&settings.advertising,
-                   __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_copy(link_ksettings->link_modes.supported,
+                     (unsigned long *)&settings.supported);
+       linkmode_copy(link_ksettings->link_modes.advertising,
+                     (unsigned long *)&settings.advertising);
 
        return 0;
 }
index beda8e0ef7d421aa08c4521c3ac8cabe30539621..8362822316a915bbe4e76c616c60207e6d2b74dc 100644 (file)
@@ -467,9 +467,8 @@ static int ixgbe_set_link_ksettings(struct net_device *netdev,
                 * this function does not support duplex forcing, but can
                 * limit the advertising of the adapter to the specified speed
                 */
-               if (!bitmap_subset(cmd->link_modes.advertising,
-                                  cmd->link_modes.supported,
-                                  __ETHTOOL_LINK_MODE_MASK_NBITS))
+               if (!linkmode_subset(cmd->link_modes.advertising,
+                                    cmd->link_modes.supported))
                        return -EINVAL;
 
                /* only allow one speed at a time if no autoneg */
index 98f276c617fb332dc943e68910fb0819506ad34d..b6c636592dfaac2f7086b30b9fe682a669eb54a2 100644 (file)
@@ -3834,14 +3834,14 @@ static void mvneta_validate(struct phylink_config *config,
         */
        if (phy_interface_mode_is_8023z(state->interface)) {
                if (!phylink_test(state->advertising, Autoneg)) {
-                       bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+                       linkmode_zero(supported);
                        return;
                }
        } else if (state->interface != PHY_INTERFACE_MODE_NA &&
                   state->interface != PHY_INTERFACE_MODE_QSGMII &&
                   state->interface != PHY_INTERFACE_MODE_SGMII &&
                   !phy_interface_mode_is_rgmii(state->interface)) {
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                return;
        }
 
@@ -3870,10 +3870,8 @@ static void mvneta_validate(struct phylink_config *config,
                phylink_set(mask, 100baseT_Full);
        }
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 
        /* We can only operate at 2500BaseX or 1000BaseX.  If requested
         * to advertise both, only report advertising at 2500BaseX.
index ad3be55cce6800f0f09d16cc348a3a1014e42ef8..8ddf58f379ac29561fd62da1fc664f4ffb6f9238 100644 (file)
@@ -6338,15 +6338,14 @@ static void mvpp2_phylink_validate(struct phylink_config *config,
                goto empty_set;
        }
 
-       bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 
        phylink_helper_basex_speed(state);
        return;
 
 empty_set:
-       bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_zero(supported);
 }
 
 static void mvpp2_xlg_config(struct mvpp2_port *port, unsigned int mode,
index b0f57bda7e27ab153a2fbeb3c858fdc408d1ea40..80d4ce61f442d1713cb974cb6f2fdbe3210ba2e2 100644 (file)
@@ -1175,9 +1175,8 @@ static int otx2_set_link_ksettings(struct net_device *netdev,
        otx2_get_link_ksettings(netdev, &cur_ks);
 
        /* Check requested modes against supported modes by hardware */
-       if (!bitmap_subset(cmd->link_modes.advertising,
-                          cur_ks.link_modes.supported,
-                          __ETHTOOL_LINK_MODE_MASK_NBITS))
+       if (!linkmode_subset(cmd->link_modes.advertising,
+                            cur_ks.link_modes.supported))
                return -EINVAL;
 
        mutex_lock(&mbox->lock);
index 6c02e1740609d8f1b412eeb2b5936a7a8a991394..1d607bc6b59e84ea3015f437e05053defc5fca2e 100644 (file)
@@ -977,8 +977,7 @@ static int pxa168_init_phy(struct net_device *dev)
        cmd.base.phy_address = pep->phy_addr;
        cmd.base.speed = pep->phy_speed;
        cmd.base.duplex = pep->phy_duplex;
-       bitmap_copy(cmd.link_modes.advertising, PHY_BASIC_FEATURES,
-                   __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_copy(cmd.link_modes.advertising, PHY_BASIC_FEATURES);
        cmd.base.autoneg = AUTONEG_ENABLE;
 
        if (cmd.base.speed != 0)
index 66c8ae29bc7ae82dd070269f1cf35d62ada6959a..066d79e4ecfc28d8bfc5fa7ced33f3192a339cb9 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/in.h>
 #include <net/ip.h>
 #include <linux/bitmap.h>
+#include <linux/mii.h>
 
 #include "mlx4_en.h"
 #include "en_port.h"
@@ -651,10 +652,8 @@ static unsigned long *ptys2ethtool_link_mode(struct ptys2ethtool_config *cfg,
                unsigned int i;                                         \
                cfg = &ptys2ethtool_map[reg_];                          \
                cfg->speed = speed_;                                    \
-               bitmap_zero(cfg->supported,                             \
-                           __ETHTOOL_LINK_MODE_MASK_NBITS);            \
-               bitmap_zero(cfg->advertised,                            \
-                           __ETHTOOL_LINK_MODE_MASK_NBITS);            \
+               linkmode_zero(cfg->supported);                          \
+               linkmode_zero(cfg->advertised);                         \
                for (i = 0 ; i < ARRAY_SIZE(modes) ; ++i) {             \
                        __set_bit(modes[i], cfg->supported);            \
                        __set_bit(modes[i], cfg->advertised);           \
@@ -710,10 +709,8 @@ static void ptys2ethtool_update_link_modes(unsigned long *link_modes,
        int i;
        for (i = 0; i < MLX4_LINK_MODES_SZ; i++) {
                if (eth_proto & MLX4_PROT_MASK(i))
-                       bitmap_or(link_modes, link_modes,
-                                 ptys2ethtool_link_mode(&ptys2ethtool_map[i],
-                                                        report),
-                                 __ETHTOOL_LINK_MODE_MASK_NBITS);
+                       linkmode_or(link_modes, link_modes,
+                                   ptys2ethtool_link_mode(&ptys2ethtool_map[i], report));
        }
 }
 
@@ -724,11 +721,9 @@ static u32 ethtool2ptys_link_modes(const unsigned long *link_modes,
        u32 ptys_modes = 0;
 
        for (i = 0; i < MLX4_LINK_MODES_SZ; i++) {
-               if (bitmap_intersects(
-                           ptys2ethtool_link_mode(&ptys2ethtool_map[i],
-                                                  report),
-                           link_modes,
-                           __ETHTOOL_LINK_MODE_MASK_NBITS))
+               ulong *map_mode = ptys2ethtool_link_mode(&ptys2ethtool_map[i],
+                                                        report);
+               if (linkmode_intersects(map_mode, link_modes))
                        ptys_modes |= 1 << i;
        }
        return ptys_modes;
index af70e2795125420c2faa43abe77d8f2176bded6d..fb74752de0ca25d60514000f6bfb191018ee28f7 100644 (file)
@@ -92,12 +92,11 @@ static void sparx5_phylink_validate(struct phylink_config *config,
                }
                break;
        default:
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                return;
        }
-       bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 }
 
 static void sparx5_phylink_mac_config(struct phylink_config *config,
index e3fc4548f642fdb72ff0033bdfdc333ceb802d2b..eaeba60b1bba5ef47a0bbb60a3e9a48e8c92cdb6 100644 (file)
@@ -1509,7 +1509,7 @@ static void vsc7514_phylink_validate(struct phylink_config *config,
 
        if (state->interface != PHY_INTERFACE_MODE_NA &&
            state->interface != ocelot_port->phy_mode) {
-               bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(supported);
                return;
        }
 
@@ -1528,9 +1528,8 @@ static void vsc7514_phylink_validate(struct phylink_config *config,
        phylink_set(mask, 2500baseT_Full);
        phylink_set(mask, 2500baseX_Full);
 
-       bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 }
 
 static void vsc7514_phylink_mac_config(struct phylink_config *config,
index 6b45cae39a206d1aedbf1504b740733136d60035..c54d735b9e2e830792cd6c312930b73365bb7723 100644 (file)
@@ -214,8 +214,7 @@ static int ionic_get_link_ksettings(struct net_device *netdev,
                break;
        }
 
-       bitmap_copy(ks->link_modes.advertising, ks->link_modes.supported,
-                   __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_copy(ks->link_modes.advertising, ks->link_modes.supported);
 
        ethtool_link_ksettings_add_link_mode(ks, supported, FEC_BASER);
        ethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS);
index 0b7606987c1e3ac3e32f933a7021dc33b6ad9b80..9b068b81ae09390d10b2b2df1a2891a8ceb98fc2 100644 (file)
@@ -1525,7 +1525,7 @@ static void axienet_validate(struct phylink_config *config,
                        netdev_warn(ndev, "Cannot use PHY mode %s, supported: %s\n",
                                    phy_modes(state->interface),
                                    phy_modes(lp->phy_mode));
-                       bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+                       linkmode_zero(supported);
                        return;
                }
        }
@@ -1558,10 +1558,8 @@ static void axienet_validate(struct phylink_config *config,
                break;
        }
 
-       bitmap_and(supported, supported, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
-       bitmap_and(state->advertising, state->advertising, mask,
-                  __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_and(supported, supported, mask);
+       linkmode_and(state->advertising, state->advertising, mask);
 }
 
 static void axienet_mac_pcs_get_state(struct phylink_config *config,
index 7de631f5356fc832588fe54aef0168f32c575966..cd6742e6ba8b9ca6f9758d6b8f237870d28c8c03 100644 (file)
@@ -646,7 +646,7 @@ void xpcs_validate(struct dw_xpcs *xpcs, unsigned long *supported,
        if (state->interface == PHY_INTERFACE_MODE_NA)
                return;
 
-       bitmap_zero(xpcs_supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_zero(xpcs_supported);
 
        compat = xpcs_find_compat(xpcs->id, state->interface);
 
index 7362f8c3271c97f14c5b208ce687ed1fe8d4a86c..0c6c0d1843bce34023cb8211401f159a8c148619 100644 (file)
@@ -373,7 +373,7 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
        if (bus->sfp_quirk)
                bus->sfp_quirk->modes(id, modes);
 
-       bitmap_or(support, support, modes, __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_or(support, support, modes);
 
        phylink_set(support, Autoneg);
        phylink_set(support, Pause);
index bf6e8c2f9bf73863920e9a179ccd4f02f0162a5e..44430b6ab8438fa2b0185b2068a7e8ac055d02da 100644 (file)
@@ -336,7 +336,7 @@ EXPORT_SYMBOL(ethtool_intersect_link_masks);
 void ethtool_convert_legacy_u32_to_link_mode(unsigned long *dst,
                                             u32 legacy_u32)
 {
-       bitmap_zero(dst, __ETHTOOL_LINK_MODE_MASK_NBITS);
+       linkmode_zero(dst);
        dst[0] = legacy_u32;
 }
 EXPORT_SYMBOL(ethtool_convert_legacy_u32_to_link_mode);
@@ -351,11 +351,10 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
        if (__ETHTOOL_LINK_MODE_MASK_NBITS > 32) {
                __ETHTOOL_DECLARE_LINK_MODE_MASK(ext);
 
-               bitmap_zero(ext, __ETHTOOL_LINK_MODE_MASK_NBITS);
+               linkmode_zero(ext);
                bitmap_fill(ext, 32);
                bitmap_complement(ext, ext, __ETHTOOL_LINK_MODE_MASK_NBITS);
-               if (bitmap_intersects(ext, src,
-                                     __ETHTOOL_LINK_MODE_MASK_NBITS)) {
+               if (linkmode_intersects(ext, src)) {
                        /* src mask goes beyond bit 31 */
                        retval = false;
                }