Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebb9a03a authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller
Browse files

switchdev: s/netdev_switch_/switchdev_/ and s/NETDEV_SWITCH_/SWITCHDEV_/



Turned out that "switchdev" sticks. So just unify all related terms to use
this prefix.

Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarScott Feldman <sfeldma@gmail.com>
Acked-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
Acked-by: default avatarAndy Gospodarek <gospo@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a3eb95f8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4039,8 +4039,8 @@ static const struct net_device_ops bond_netdev_ops = {
	.ndo_add_slave		= bond_enslave,
	.ndo_del_slave		= bond_release,
	.ndo_fix_features	= bond_fix_features,
	.ndo_bridge_setlink	= ndo_dflt_netdev_switch_port_bridge_setlink,
	.ndo_bridge_dellink	= ndo_dflt_netdev_switch_port_bridge_dellink,
	.ndo_bridge_setlink	= ndo_dflt_switchdev_port_bridge_setlink,
	.ndo_bridge_dellink	= ndo_dflt_switchdev_port_bridge_dellink,
	.ndo_features_check	= passthru_features_check,
};

+5 −5
Original line number Diff line number Diff line
@@ -3377,16 +3377,16 @@ static void rocker_port_fdb_learn_work(struct work_struct *work)
		container_of(work, struct rocker_fdb_learn_work, work);
	bool removing = (lw->flags & ROCKER_OP_FLAG_REMOVE);
	bool learned = (lw->flags & ROCKER_OP_FLAG_LEARNED);
	struct netdev_switch_notifier_fdb_info info;
	struct switchdev_notifier_fdb_info info;

	info.addr = lw->addr;
	info.vid = lw->vid;

	if (learned && removing)
		call_netdev_switch_notifiers(NETDEV_SWITCH_FDB_DEL,
		call_switchdev_notifiers(SWITCHDEV_FDB_DEL,
					 lw->dev, &info.info);
	else if (learned && !removing)
		call_netdev_switch_notifiers(NETDEV_SWITCH_FDB_ADD,
		call_switchdev_notifiers(SWITCHDEV_FDB_ADD,
					 lw->dev, &info.info);

	kfree(work);
+2 −2
Original line number Diff line number Diff line
@@ -1977,8 +1977,8 @@ static const struct net_device_ops team_netdev_ops = {
	.ndo_del_slave		= team_del_slave,
	.ndo_fix_features	= team_fix_features,
	.ndo_change_carrier     = team_change_carrier,
	.ndo_bridge_setlink     = ndo_dflt_netdev_switch_port_bridge_setlink,
	.ndo_bridge_dellink     = ndo_dflt_netdev_switch_port_bridge_dellink,
	.ndo_bridge_setlink     = ndo_dflt_switchdev_port_bridge_setlink,
	.ndo_bridge_dellink     = ndo_dflt_switchdev_port_bridge_dellink,
	.ndo_features_check	= passthru_features_check,
};

+56 −55
Original line number Diff line number Diff line
@@ -43,109 +43,110 @@ struct swdev_ops {
				      u8 tos, u8 type, u32 tb_id);
};

enum netdev_switch_notifier_type {
	NETDEV_SWITCH_FDB_ADD = 1,
	NETDEV_SWITCH_FDB_DEL,
enum switchdev_notifier_type {
	SWITCHDEV_FDB_ADD = 1,
	SWITCHDEV_FDB_DEL,
};

struct netdev_switch_notifier_info {
struct switchdev_notifier_info {
	struct net_device *dev;
};

struct netdev_switch_notifier_fdb_info {
	struct netdev_switch_notifier_info info; /* must be first */
struct switchdev_notifier_fdb_info {
	struct switchdev_notifier_info info; /* must be first */
	const unsigned char *addr;
	u16 vid;
};

static inline struct net_device *
netdev_switch_notifier_info_to_dev(const struct netdev_switch_notifier_info *info)
switchdev_notifier_info_to_dev(const struct switchdev_notifier_info *info)
{
	return info->dev;
}

#ifdef CONFIG_NET_SWITCHDEV

int netdev_switch_parent_id_get(struct net_device *dev,
int switchdev_parent_id_get(struct net_device *dev,
			    struct netdev_phys_item_id *psid);
int netdev_switch_port_stp_update(struct net_device *dev, u8 state);
int register_netdev_switch_notifier(struct notifier_block *nb);
int unregister_netdev_switch_notifier(struct notifier_block *nb);
int call_netdev_switch_notifiers(unsigned long val, struct net_device *dev,
				 struct netdev_switch_notifier_info *info);
int netdev_switch_port_bridge_setlink(struct net_device *dev,
int switchdev_port_stp_update(struct net_device *dev, u8 state);
int register_switchdev_notifier(struct notifier_block *nb);
int unregister_switchdev_notifier(struct notifier_block *nb);
int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
			     struct switchdev_notifier_info *info);
int switchdev_port_bridge_setlink(struct net_device *dev,
				  struct nlmsghdr *nlh, u16 flags);
int netdev_switch_port_bridge_dellink(struct net_device *dev,
int switchdev_port_bridge_dellink(struct net_device *dev,
				  struct nlmsghdr *nlh, u16 flags);
int ndo_dflt_netdev_switch_port_bridge_dellink(struct net_device *dev,
int ndo_dflt_switchdev_port_bridge_dellink(struct net_device *dev,
					   struct nlmsghdr *nlh, u16 flags);
int ndo_dflt_netdev_switch_port_bridge_setlink(struct net_device *dev,
int ndo_dflt_switchdev_port_bridge_setlink(struct net_device *dev,
					   struct nlmsghdr *nlh, u16 flags);
int netdev_switch_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi,
int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi,
			   u8 tos, u8 type, u32 nlflags, u32 tb_id);
int netdev_switch_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi,
int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi,
			   u8 tos, u8 type, u32 tb_id);
void netdev_switch_fib_ipv4_abort(struct fib_info *fi);
void switchdev_fib_ipv4_abort(struct fib_info *fi);

#else

static inline int netdev_switch_parent_id_get(struct net_device *dev,
static inline int switchdev_parent_id_get(struct net_device *dev,
					  struct netdev_phys_item_id *psid)
{
	return -EOPNOTSUPP;
}

static inline int netdev_switch_port_stp_update(struct net_device *dev,
static inline int switchdev_port_stp_update(struct net_device *dev,
					    u8 state)
{
	return -EOPNOTSUPP;
}

static inline int register_netdev_switch_notifier(struct notifier_block *nb)
static inline int register_switchdev_notifier(struct notifier_block *nb)
{
	return 0;
}

static inline int unregister_netdev_switch_notifier(struct notifier_block *nb)
static inline int unregister_switchdev_notifier(struct notifier_block *nb)
{
	return 0;
}

static inline int call_netdev_switch_notifiers(unsigned long val, struct net_device *dev,
					       struct netdev_switch_notifier_info *info)
static inline int call_switchdev_notifiers(unsigned long val,
					   struct net_device *dev,
					   struct switchdev_notifier_info *info)
{
	return NOTIFY_DONE;
}

static inline int netdev_switch_port_bridge_setlink(struct net_device *dev,
static inline int switchdev_port_bridge_setlink(struct net_device *dev,
						struct nlmsghdr *nlh,
						u16 flags)
{
	return -EOPNOTSUPP;
}

static inline int netdev_switch_port_bridge_dellink(struct net_device *dev,
static inline int switchdev_port_bridge_dellink(struct net_device *dev,
						struct nlmsghdr *nlh,
						u16 flags)
{
	return -EOPNOTSUPP;
}

static inline int ndo_dflt_netdev_switch_port_bridge_dellink(struct net_device *dev,
static inline int ndo_dflt_switchdev_port_bridge_dellink(struct net_device *dev,
							 struct nlmsghdr *nlh,
							 u16 flags)
{
	return 0;
}

static inline int ndo_dflt_netdev_switch_port_bridge_setlink(struct net_device *dev,
static inline int ndo_dflt_switchdev_port_bridge_setlink(struct net_device *dev,
							 struct nlmsghdr *nlh,
							 u16 flags)
{
	return 0;
}

static inline int netdev_switch_fib_ipv4_add(u32 dst, int dst_len,
static inline int switchdev_fib_ipv4_add(u32 dst, int dst_len,
					 struct fib_info *fi,
					 u8 tos, u8 type,
					 u32 nlflags, u32 tb_id)
@@ -153,14 +154,14 @@ static inline int netdev_switch_fib_ipv4_add(u32 dst, int dst_len,
	return 0;
}

static inline int netdev_switch_fib_ipv4_del(u32 dst, int dst_len,
static inline int switchdev_fib_ipv4_del(u32 dst, int dst_len,
					 struct fib_info *fi,
					 u8 tos, u8 type, u32 tb_id)
{
	return 0;
}

static inline void netdev_switch_fib_ipv4_abort(struct fib_info *fi)
static inline void switchdev_fib_ipv4_abort(struct fib_info *fi)
{
}

+11 −11
Original line number Diff line number Diff line
@@ -121,13 +121,13 @@ static struct notifier_block br_device_notifier = {
	.notifier_call = br_device_event
};

static int br_netdev_switch_event(struct notifier_block *unused,
static int br_switchdev_event(struct notifier_block *unused,
			      unsigned long event, void *ptr)
{
	struct net_device *dev = netdev_switch_notifier_info_to_dev(ptr);
	struct net_device *dev = switchdev_notifier_info_to_dev(ptr);
	struct net_bridge_port *p;
	struct net_bridge *br;
	struct netdev_switch_notifier_fdb_info *fdb_info;
	struct switchdev_notifier_fdb_info *fdb_info;
	int err = NOTIFY_DONE;

	rtnl_lock();
@@ -138,14 +138,14 @@ static int br_netdev_switch_event(struct notifier_block *unused,
	br = p->br;

	switch (event) {
	case NETDEV_SWITCH_FDB_ADD:
	case SWITCHDEV_FDB_ADD:
		fdb_info = ptr;
		err = br_fdb_external_learn_add(br, p, fdb_info->addr,
						fdb_info->vid);
		if (err)
			err = notifier_from_errno(err);
		break;
	case NETDEV_SWITCH_FDB_DEL:
	case SWITCHDEV_FDB_DEL:
		fdb_info = ptr;
		err = br_fdb_external_learn_del(br, p, fdb_info->addr,
						fdb_info->vid);
@@ -159,8 +159,8 @@ out:
	return err;
}

static struct notifier_block br_netdev_switch_notifier = {
	.notifier_call = br_netdev_switch_event,
static struct notifier_block br_switchdev_notifier = {
	.notifier_call = br_switchdev_event,
};

static void __net_exit br_net_exit(struct net *net)
@@ -214,7 +214,7 @@ static int __init br_init(void)
	if (err)
		goto err_out3;

	err = register_netdev_switch_notifier(&br_netdev_switch_notifier);
	err = register_switchdev_notifier(&br_switchdev_notifier);
	if (err)
		goto err_out4;

@@ -235,7 +235,7 @@ static int __init br_init(void)
	return 0;

err_out5:
	unregister_netdev_switch_notifier(&br_netdev_switch_notifier);
	unregister_switchdev_notifier(&br_switchdev_notifier);
err_out4:
	unregister_netdevice_notifier(&br_device_notifier);
err_out3:
@@ -253,7 +253,7 @@ static void __exit br_deinit(void)
{
	stp_proto_unregister(&br_stp_proto);
	br_netlink_fini();
	unregister_netdev_switch_notifier(&br_netdev_switch_notifier);
	unregister_switchdev_notifier(&br_switchdev_notifier);
	unregister_netdevice_notifier(&br_device_notifier);
	brioctl_set(NULL);
	unregister_pernet_subsys(&br_net_ops);
Loading