forked from Minki/linux
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>
This commit is contained in:
parent
d45224d604
commit
3d705f07d1
@ -3660,7 +3660,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
|
|||||||
}
|
}
|
||||||
mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan;
|
mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan;
|
||||||
|
|
||||||
mlxsw_sp_port_switchdev_init(mlxsw_sp_port);
|
|
||||||
mlxsw_sp->ports[local_port] = mlxsw_sp_port;
|
mlxsw_sp->ports[local_port] = mlxsw_sp_port;
|
||||||
err = register_netdev(dev);
|
err = register_netdev(dev);
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -3677,7 +3676,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
|
|||||||
|
|
||||||
err_register_netdev:
|
err_register_netdev:
|
||||||
mlxsw_sp->ports[local_port] = NULL;
|
mlxsw_sp->ports[local_port] = NULL;
|
||||||
mlxsw_sp_port_switchdev_fini(mlxsw_sp_port);
|
|
||||||
mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan);
|
mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan);
|
||||||
err_port_vlan_create:
|
err_port_vlan_create:
|
||||||
err_port_pvid_set:
|
err_port_pvid_set:
|
||||||
@ -3720,7 +3718,6 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port)
|
|||||||
mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp);
|
mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp);
|
||||||
unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */
|
unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */
|
||||||
mlxsw_sp->ports[local_port] = NULL;
|
mlxsw_sp->ports[local_port] = NULL;
|
||||||
mlxsw_sp_port_switchdev_fini(mlxsw_sp_port);
|
|
||||||
mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true);
|
mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true);
|
||||||
mlxsw_sp_port_nve_fini(mlxsw_sp_port);
|
mlxsw_sp_port_nve_fini(mlxsw_sp_port);
|
||||||
mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port);
|
mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port);
|
||||||
|
@ -407,8 +407,6 @@ extern const struct mlxsw_sp_sb_vals mlxsw_sp2_sb_vals;
|
|||||||
/* spectrum_switchdev.c */
|
/* spectrum_switchdev.c */
|
||||||
int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp);
|
int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp);
|
||||||
void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp);
|
void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp);
|
||||||
void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port);
|
|
||||||
void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port);
|
|
||||||
int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid,
|
int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid,
|
||||||
bool adding);
|
bool adding);
|
||||||
void
|
void
|
||||||
|
@ -1938,10 +1938,6 @@ static struct mlxsw_sp_port *mlxsw_sp_lag_rep_port(struct mlxsw_sp *mlxsw_sp,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct switchdev_ops mlxsw_sp_port_switchdev_ops = {
|
|
||||||
.switchdev_port_attr_set = mlxsw_sp_port_attr_set,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device,
|
mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device,
|
||||||
struct mlxsw_sp_bridge_port *bridge_port,
|
struct mlxsw_sp_bridge_port *bridge_port,
|
||||||
@ -3545,11 +3541,3 @@ void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp)
|
|||||||
kfree(mlxsw_sp->bridge);
|
kfree(mlxsw_sp->bridge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port)
|
|
||||||
{
|
|
||||||
mlxsw_sp_port->dev->switchdev_ops = &mlxsw_sp_port_switchdev_ops;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
@ -1324,10 +1324,6 @@ static int ocelot_port_obj_del(struct net_device *dev,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct switchdev_ops ocelot_port_switchdev_ops = {
|
|
||||||
.switchdev_port_attr_set = ocelot_port_attr_set,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int ocelot_port_bridge_join(struct ocelot_port *ocelot_port,
|
static int ocelot_port_bridge_join(struct ocelot_port *ocelot_port,
|
||||||
struct net_device *bridge)
|
struct net_device *bridge)
|
||||||
{
|
{
|
||||||
@ -1660,7 +1656,6 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port,
|
|||||||
|
|
||||||
dev->netdev_ops = &ocelot_port_netdev_ops;
|
dev->netdev_ops = &ocelot_port_netdev_ops;
|
||||||
dev->ethtool_ops = &ocelot_ethtool_ops;
|
dev->ethtool_ops = &ocelot_ethtool_ops;
|
||||||
dev->switchdev_ops = &ocelot_port_switchdev_ops;
|
|
||||||
|
|
||||||
dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS;
|
dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS;
|
||||||
dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
|
dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
|
||||||
|
@ -2142,10 +2142,6 @@ static int rocker_port_obj_del(struct net_device *dev,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct switchdev_ops rocker_port_switchdev_ops = {
|
|
||||||
.switchdev_port_attr_set = rocker_port_attr_set,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct rocker_fib_event_work {
|
struct rocker_fib_event_work {
|
||||||
struct work_struct work;
|
struct work_struct work;
|
||||||
union {
|
union {
|
||||||
@ -2599,7 +2595,6 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number)
|
|||||||
rocker_port_dev_addr_init(rocker_port);
|
rocker_port_dev_addr_init(rocker_port);
|
||||||
dev->netdev_ops = &rocker_port_netdev_ops;
|
dev->netdev_ops = &rocker_port_netdev_ops;
|
||||||
dev->ethtool_ops = &rocker_port_ethtool_ops;
|
dev->ethtool_ops = &rocker_port_ethtool_ops;
|
||||||
dev->switchdev_ops = &rocker_port_switchdev_ops;
|
|
||||||
netif_tx_napi_add(dev, &rocker_port->napi_tx, rocker_port_poll_tx,
|
netif_tx_napi_add(dev, &rocker_port->napi_tx, rocker_port_poll_tx,
|
||||||
NAPI_POLL_WEIGHT);
|
NAPI_POLL_WEIGHT);
|
||||||
netif_napi_add(dev, &rocker_port->napi_rx, rocker_port_poll_rx,
|
netif_napi_add(dev, &rocker_port->napi_rx, rocker_port_poll_rx,
|
||||||
|
@ -925,10 +925,6 @@ static int swdev_port_obj_del(struct net_device *netdev,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct switchdev_ops ethsw_port_switchdev_ops = {
|
|
||||||
.switchdev_port_attr_set = swdev_port_attr_set,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ethsw_switchdev_port_attr_set_event(struct net_device *netdev,
|
ethsw_switchdev_port_attr_set_event(struct net_device *netdev,
|
||||||
struct switchdev_notifier_port_attr_info *port_attr_info)
|
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)
|
|||||||
SET_NETDEV_DEV(port_netdev, dev);
|
SET_NETDEV_DEV(port_netdev, dev);
|
||||||
port_netdev->netdev_ops = ðsw_port_ops;
|
port_netdev->netdev_ops = ðsw_port_ops;
|
||||||
port_netdev->ethtool_ops = ðsw_port_ethtool_ops;
|
port_netdev->ethtool_ops = ðsw_port_ethtool_ops;
|
||||||
port_netdev->switchdev_ops = ðsw_port_switchdev_ops;
|
|
||||||
|
|
||||||
/* Set MTU limits */
|
/* Set MTU limits */
|
||||||
port_netdev->min_mtu = ETH_MIN_MTU;
|
port_netdev->min_mtu = ETH_MIN_MTU;
|
||||||
|
@ -1843,9 +1843,6 @@ struct net_device {
|
|||||||
#endif
|
#endif
|
||||||
const struct net_device_ops *netdev_ops;
|
const struct net_device_ops *netdev_ops;
|
||||||
const struct ethtool_ops *ethtool_ops;
|
const struct ethtool_ops *ethtool_ops;
|
||||||
#ifdef CONFIG_NET_SWITCHDEV
|
|
||||||
const struct switchdev_ops *switchdev_ops;
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_NET_L3_MASTER_DEV
|
#ifdef CONFIG_NET_L3_MASTER_DEV
|
||||||
const struct l3mdev_ops *l3mdev_ops;
|
const struct l3mdev_ops *l3mdev_ops;
|
||||||
#endif
|
#endif
|
||||||
|
@ -112,17 +112,6 @@ void *switchdev_trans_item_dequeue(struct switchdev_trans *trans);
|
|||||||
|
|
||||||
typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj);
|
typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj);
|
||||||
|
|
||||||
/**
|
|
||||||
* struct switchdev_ops - switchdev operations
|
|
||||||
*
|
|
||||||
* @switchdev_port_attr_set: Set a port attribute (see switchdev_attr).
|
|
||||||
*/
|
|
||||||
struct switchdev_ops {
|
|
||||||
int (*switchdev_port_attr_set)(struct net_device *dev,
|
|
||||||
const struct switchdev_attr *attr,
|
|
||||||
struct switchdev_trans *trans);
|
|
||||||
};
|
|
||||||
|
|
||||||
enum switchdev_notifier_type {
|
enum switchdev_notifier_type {
|
||||||
SWITCHDEV_FDB_ADD_TO_BRIDGE = 1,
|
SWITCHDEV_FDB_ADD_TO_BRIDGE = 1,
|
||||||
SWITCHDEV_FDB_DEL_TO_BRIDGE,
|
SWITCHDEV_FDB_DEL_TO_BRIDGE,
|
||||||
@ -226,9 +215,6 @@ int switchdev_handle_port_attr_set(struct net_device *dev,
|
|||||||
int (*set_cb)(struct net_device *dev,
|
int (*set_cb)(struct net_device *dev,
|
||||||
const struct switchdev_attr *attr,
|
const struct switchdev_attr *attr,
|
||||||
struct switchdev_trans *trans));
|
struct switchdev_trans *trans));
|
||||||
|
|
||||||
#define SWITCHDEV_SET_OPS(netdev, ops) ((netdev)->switchdev_ops = (ops))
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static inline void switchdev_deferred_process(void)
|
static inline void switchdev_deferred_process(void)
|
||||||
@ -325,9 +311,6 @@ switchdev_handle_port_attr_set(struct net_device *dev,
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SWITCHDEV_SET_OPS(netdev, ops) do {} while (0)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _LINUX_SWITCHDEV_H_ */
|
#endif /* _LINUX_SWITCHDEV_H_ */
|
||||||
|
@ -1118,10 +1118,6 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
|
|||||||
.ndo_vlan_rx_kill_vid = dsa_slave_vlan_rx_kill_vid,
|
.ndo_vlan_rx_kill_vid = dsa_slave_vlan_rx_kill_vid,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct switchdev_ops dsa_slave_switchdev_ops = {
|
|
||||||
.switchdev_port_attr_set = dsa_slave_port_attr_set,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct device_type dsa_type = {
|
static struct device_type dsa_type = {
|
||||||
.name = "dsa",
|
.name = "dsa",
|
||||||
};
|
};
|
||||||
@ -1382,7 +1378,6 @@ int dsa_slave_create(struct dsa_port *port)
|
|||||||
eth_hw_addr_inherit(slave_dev, master);
|
eth_hw_addr_inherit(slave_dev, master);
|
||||||
slave_dev->priv_flags |= IFF_NO_QUEUE;
|
slave_dev->priv_flags |= IFF_NO_QUEUE;
|
||||||
slave_dev->netdev_ops = &dsa_slave_netdev_ops;
|
slave_dev->netdev_ops = &dsa_slave_netdev_ops;
|
||||||
slave_dev->switchdev_ops = &dsa_slave_switchdev_ops;
|
|
||||||
slave_dev->min_mtu = 0;
|
slave_dev->min_mtu = 0;
|
||||||
slave_dev->max_mtu = ETH_MAX_MTU;
|
slave_dev->max_mtu = ETH_MAX_MTU;
|
||||||
SET_NETDEV_DEVTYPE(slave_dev, &dsa_type);
|
SET_NETDEV_DEVTYPE(slave_dev, &dsa_type);
|
||||||
|
Loading…
Reference in New Issue
Block a user