summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2019-02-27 14:44:32 -0500
committerDavid S. Miller <davem@davemloft.net>2019-02-27 15:39:56 -0500
commit3d705f07d16b1d872c556b4ebf44deabeca0e9c1 (patch)
tree6a3cb2d5ae7b60ab72a8d07374a5beebae2c8a80
parentd45224d604c5ba6ac5f9d6fddbe1d058c81dee80 (diff)
net: Remove switchdev_ops
Now that we have converted all possible callers to using a switchdev notifier for attributes we do not have a need for implementing switchdev_ops anymore, and this can be removed from all drivers the net_device structure. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c12
-rw-r--r--drivers/net/ethernet/mscc/ocelot.c5
-rw-r--r--drivers/net/ethernet/rocker/rocker_main.c5
-rw-r--r--drivers/staging/fsl-dpaa2/ethsw/ethsw.c5
-rw-r--r--include/linux/netdevice.h3
-rw-r--r--include/net/switchdev.h17
-rw-r--r--net/dsa/slave.c5
9 files changed, 0 insertions, 57 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index b00f6f74f91a..6c797e322be8 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -3660,7 +3660,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
3660 } 3660 }
3661 mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan; 3661 mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan;
3662 3662
3663 mlxsw_sp_port_switchdev_init(mlxsw_sp_port);
3664 mlxsw_sp->ports[local_port] = mlxsw_sp_port; 3663 mlxsw_sp->ports[local_port] = mlxsw_sp_port;
3665 err = register_netdev(dev); 3664 err = register_netdev(dev);
3666 if (err) { 3665 if (err) {
@@ -3677,7 +3676,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
3677 3676
3678err_register_netdev: 3677err_register_netdev:
3679 mlxsw_sp->ports[local_port] = NULL; 3678 mlxsw_sp->ports[local_port] = NULL;
3680 mlxsw_sp_port_switchdev_fini(mlxsw_sp_port);
3681 mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan); 3679 mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan);
3682err_port_vlan_create: 3680err_port_vlan_create:
3683err_port_pvid_set: 3681err_port_pvid_set:
@@ -3720,7 +3718,6 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port)
3720 mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp); 3718 mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp);
3721 unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */ 3719 unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */
3722 mlxsw_sp->ports[local_port] = NULL; 3720 mlxsw_sp->ports[local_port] = NULL;
3723 mlxsw_sp_port_switchdev_fini(mlxsw_sp_port);
3724 mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true); 3721 mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true);
3725 mlxsw_sp_port_nve_fini(mlxsw_sp_port); 3722 mlxsw_sp_port_nve_fini(mlxsw_sp_port);
3726 mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port); 3723 mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
index a61c1130d9e3..da6278b0caa4 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -407,8 +407,6 @@ extern const struct mlxsw_sp_sb_vals mlxsw_sp2_sb_vals;
407/* spectrum_switchdev.c */ 407/* spectrum_switchdev.c */
408int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp); 408int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp);
409void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp); 409void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp);
410void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port);
411void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port);
412int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, 410int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid,
413 bool adding); 411 bool adding);
414void 412void
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index c1aedfea3a31..f6ce386c3036 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -1938,10 +1938,6 @@ static struct mlxsw_sp_port *mlxsw_sp_lag_rep_port(struct mlxsw_sp *mlxsw_sp,
1938 return NULL; 1938 return NULL;
1939} 1939}
1940 1940
1941static const struct switchdev_ops mlxsw_sp_port_switchdev_ops = {
1942 .switchdev_port_attr_set = mlxsw_sp_port_attr_set,
1943};
1944
1945static int 1941static int
1946mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device, 1942mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device,
1947 struct mlxsw_sp_bridge_port *bridge_port, 1943 struct mlxsw_sp_bridge_port *bridge_port,
@@ -3545,11 +3541,3 @@ void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp)
3545 kfree(mlxsw_sp->bridge); 3541 kfree(mlxsw_sp->bridge);
3546} 3542}
3547 3543
3548void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port)
3549{
3550 mlxsw_sp_port->dev->switchdev_ops = &mlxsw_sp_port_switchdev_ops;
3551}
3552
3553void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port)
3554{
3555}
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index 83a678b11757..a1d0d6e42533 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -1324,10 +1324,6 @@ static int ocelot_port_obj_del(struct net_device *dev,
1324 return ret; 1324 return ret;
1325} 1325}
1326 1326
1327static const struct switchdev_ops ocelot_port_switchdev_ops = {
1328 .switchdev_port_attr_set = ocelot_port_attr_set,
1329};
1330
1331static int ocelot_port_bridge_join(struct ocelot_port *ocelot_port, 1327static int ocelot_port_bridge_join(struct ocelot_port *ocelot_port,
1332 struct net_device *bridge) 1328 struct net_device *bridge)
1333{ 1329{
@@ -1660,7 +1656,6 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port,
1660 1656
1661 dev->netdev_ops = &ocelot_port_netdev_ops; 1657 dev->netdev_ops = &ocelot_port_netdev_ops;
1662 dev->ethtool_ops = &ocelot_ethtool_ops; 1658 dev->ethtool_ops = &ocelot_ethtool_ops;
1663 dev->switchdev_ops = &ocelot_port_switchdev_ops;
1664 1659
1665 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS; 1660 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS;
1666 dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; 1661 dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c
index fc772cf079cc..c883aa89b7ca 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -2142,10 +2142,6 @@ static int rocker_port_obj_del(struct net_device *dev,
2142 return err; 2142 return err;
2143} 2143}
2144 2144
2145static const struct switchdev_ops rocker_port_switchdev_ops = {
2146 .switchdev_port_attr_set = rocker_port_attr_set,
2147};
2148
2149struct rocker_fib_event_work { 2145struct rocker_fib_event_work {
2150 struct work_struct work; 2146 struct work_struct work;
2151 union { 2147 union {
@@ -2599,7 +2595,6 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number)
2599 rocker_port_dev_addr_init(rocker_port); 2595 rocker_port_dev_addr_init(rocker_port);
2600 dev->netdev_ops = &rocker_port_netdev_ops; 2596 dev->netdev_ops = &rocker_port_netdev_ops;
2601 dev->ethtool_ops = &rocker_port_ethtool_ops; 2597 dev->ethtool_ops = &rocker_port_ethtool_ops;
2602 dev->switchdev_ops = &rocker_port_switchdev_ops;
2603 netif_tx_napi_add(dev, &rocker_port->napi_tx, rocker_port_poll_tx, 2598 netif_tx_napi_add(dev, &rocker_port->napi_tx, rocker_port_poll_tx,
2604 NAPI_POLL_WEIGHT); 2599 NAPI_POLL_WEIGHT);
2605 netif_napi_add(dev, &rocker_port->napi_rx, rocker_port_poll_rx, 2600 netif_napi_add(dev, &rocker_port->napi_rx, rocker_port_poll_rx,
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index b0d2d9bf2532..ad577beeb052 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -925,10 +925,6 @@ static int swdev_port_obj_del(struct net_device *netdev,
925 return err; 925 return err;
926} 926}
927 927
928static const struct switchdev_ops ethsw_port_switchdev_ops = {
929 .switchdev_port_attr_set = swdev_port_attr_set,
930};
931
932static int 928static int
933ethsw_switchdev_port_attr_set_event(struct net_device *netdev, 929ethsw_switchdev_port_attr_set_event(struct net_device *netdev,
934 struct switchdev_notifier_port_attr_info *port_attr_info) 930 struct switchdev_notifier_port_attr_info *port_attr_info)
@@ -1455,7 +1451,6 @@ static int ethsw_probe_port(struct ethsw_core *ethsw, u16 port_idx)
1455 SET_NETDEV_DEV(port_netdev, dev); 1451 SET_NETDEV_DEV(port_netdev, dev);
1456 port_netdev->netdev_ops = &ethsw_port_ops; 1452 port_netdev->netdev_ops = &ethsw_port_ops;
1457 port_netdev->ethtool_ops = &ethsw_port_ethtool_ops; 1453 port_netdev->ethtool_ops = &ethsw_port_ethtool_ops;
1458 port_netdev->switchdev_ops = &ethsw_port_switchdev_ops;
1459 1454
1460 /* Set MTU limits */ 1455 /* Set MTU limits */
1461 port_netdev->min_mtu = ETH_MIN_MTU; 1456 port_netdev->min_mtu = ETH_MIN_MTU;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 58e83bd7a861..c10b60297d28 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1843,9 +1843,6 @@ struct net_device {
1843#endif 1843#endif
1844 const struct net_device_ops *netdev_ops; 1844 const struct net_device_ops *netdev_ops;
1845 const struct ethtool_ops *ethtool_ops; 1845 const struct ethtool_ops *ethtool_ops;
1846#ifdef CONFIG_NET_SWITCHDEV
1847 const struct switchdev_ops *switchdev_ops;
1848#endif
1849#ifdef CONFIG_NET_L3_MASTER_DEV 1846#ifdef CONFIG_NET_L3_MASTER_DEV
1850 const struct l3mdev_ops *l3mdev_ops; 1847 const struct l3mdev_ops *l3mdev_ops;
1851#endif 1848#endif
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 5087c06ceb4b..e4f751e19ecf 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -112,17 +112,6 @@ void *switchdev_trans_item_dequeue(struct switchdev_trans *trans);
112 112
113typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj); 113typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj);
114 114
115/**
116 * struct switchdev_ops - switchdev operations
117 *
118 * @switchdev_port_attr_set: Set a port attribute (see switchdev_attr).
119 */
120struct switchdev_ops {
121 int (*switchdev_port_attr_set)(struct net_device *dev,
122 const struct switchdev_attr *attr,
123 struct switchdev_trans *trans);
124};
125
126enum switchdev_notifier_type { 115enum switchdev_notifier_type {
127 SWITCHDEV_FDB_ADD_TO_BRIDGE = 1, 116 SWITCHDEV_FDB_ADD_TO_BRIDGE = 1,
128 SWITCHDEV_FDB_DEL_TO_BRIDGE, 117 SWITCHDEV_FDB_DEL_TO_BRIDGE,
@@ -226,9 +215,6 @@ int switchdev_handle_port_attr_set(struct net_device *dev,
226 int (*set_cb)(struct net_device *dev, 215 int (*set_cb)(struct net_device *dev,
227 const struct switchdev_attr *attr, 216 const struct switchdev_attr *attr,
228 struct switchdev_trans *trans)); 217 struct switchdev_trans *trans));
229
230#define SWITCHDEV_SET_OPS(netdev, ops) ((netdev)->switchdev_ops = (ops))
231
232#else 218#else
233 219
234static inline void switchdev_deferred_process(void) 220static inline void switchdev_deferred_process(void)
@@ -325,9 +311,6 @@ switchdev_handle_port_attr_set(struct net_device *dev,
325{ 311{
326 return 0; 312 return 0;
327} 313}
328
329#define SWITCHDEV_SET_OPS(netdev, ops) do {} while (0)
330
331#endif 314#endif
332 315
333#endif /* _LINUX_SWITCHDEV_H_ */ 316#endif /* _LINUX_SWITCHDEV_H_ */
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index b089b43120e1..1808a2cd6872 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1118,10 +1118,6 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
1118 .ndo_vlan_rx_kill_vid = dsa_slave_vlan_rx_kill_vid, 1118 .ndo_vlan_rx_kill_vid = dsa_slave_vlan_rx_kill_vid,
1119}; 1119};
1120 1120
1121static const struct switchdev_ops dsa_slave_switchdev_ops = {
1122 .switchdev_port_attr_set = dsa_slave_port_attr_set,
1123};
1124
1125static struct device_type dsa_type = { 1121static struct device_type dsa_type = {
1126 .name = "dsa", 1122 .name = "dsa",
1127}; 1123};
@@ -1382,7 +1378,6 @@ int dsa_slave_create(struct dsa_port *port)
1382 eth_hw_addr_inherit(slave_dev, master); 1378 eth_hw_addr_inherit(slave_dev, master);
1383 slave_dev->priv_flags |= IFF_NO_QUEUE; 1379 slave_dev->priv_flags |= IFF_NO_QUEUE;
1384 slave_dev->netdev_ops = &dsa_slave_netdev_ops; 1380 slave_dev->netdev_ops = &dsa_slave_netdev_ops;
1385 slave_dev->switchdev_ops = &dsa_slave_switchdev_ops;
1386 slave_dev->min_mtu = 0; 1381 slave_dev->min_mtu = 0;
1387 slave_dev->max_mtu = ETH_MAX_MTU; 1382 slave_dev->max_mtu = ETH_MAX_MTU;
1388 SET_NETDEV_DEVTYPE(slave_dev, &dsa_type); 1383 SET_NETDEV_DEVTYPE(slave_dev, &dsa_type);