Commit fad4271b authored by David S. Miller's avatar David S. Miller

Merge branch 'net-protodown-support-for-macvlan-and-vxlan'

Andy Roulin says:

====================
net: protodown support for macvlan and vxlan

This patch series adds dev_change_proto_down_generic, a generic
implementation of ndo_change_proto_down, which sets the netdev carrier
state according to the new proto_down value.

This handler adds the ability to set protodown on macvlan and vxlan
interfaces in a generic way for use by control protocols like VRRPD.

Patch (1) introduces the handler in net/code/dev.c. Patch (2) and (3) add
support for change_proto_down in macvlan and vxlan drivers, respectively,
using the new function.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 45c0e7b2 8f1af75d
...@@ -1122,6 +1122,7 @@ static const struct net_device_ops macvlan_netdev_ops = { ...@@ -1122,6 +1122,7 @@ static const struct net_device_ops macvlan_netdev_ops = {
#endif #endif
.ndo_get_iflink = macvlan_dev_get_iflink, .ndo_get_iflink = macvlan_dev_get_iflink,
.ndo_features_check = passthru_features_check, .ndo_features_check = passthru_features_check,
.ndo_change_proto_down = dev_change_proto_down_generic,
}; };
void macvlan_common_setup(struct net_device *dev) void macvlan_common_setup(struct net_device *dev)
......
...@@ -2923,6 +2923,7 @@ static const struct net_device_ops vxlan_netdev_ether_ops = { ...@@ -2923,6 +2923,7 @@ static const struct net_device_ops vxlan_netdev_ether_ops = {
.ndo_fdb_dump = vxlan_fdb_dump, .ndo_fdb_dump = vxlan_fdb_dump,
.ndo_fdb_get = vxlan_fdb_get, .ndo_fdb_get = vxlan_fdb_get,
.ndo_fill_metadata_dst = vxlan_fill_metadata_dst, .ndo_fill_metadata_dst = vxlan_fill_metadata_dst,
.ndo_change_proto_down = dev_change_proto_down_generic,
}; };
static const struct net_device_ops vxlan_netdev_raw_ops = { static const struct net_device_ops vxlan_netdev_raw_ops = {
......
...@@ -3673,6 +3673,7 @@ int dev_get_port_parent_id(struct net_device *dev, ...@@ -3673,6 +3673,7 @@ int dev_get_port_parent_id(struct net_device *dev,
struct netdev_phys_item_id *ppid, bool recurse); struct netdev_phys_item_id *ppid, bool recurse);
bool netdev_port_same_parent_id(struct net_device *a, struct net_device *b); bool netdev_port_same_parent_id(struct net_device *a, struct net_device *b);
int dev_change_proto_down(struct net_device *dev, bool proto_down); int dev_change_proto_down(struct net_device *dev, bool proto_down);
int dev_change_proto_down_generic(struct net_device *dev, bool proto_down);
struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev, bool *again); struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev, bool *again);
struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
struct netdev_queue *txq, int *ret); struct netdev_queue *txq, int *ret);
......
...@@ -7954,6 +7954,25 @@ int dev_change_proto_down(struct net_device *dev, bool proto_down) ...@@ -7954,6 +7954,25 @@ int dev_change_proto_down(struct net_device *dev, bool proto_down)
} }
EXPORT_SYMBOL(dev_change_proto_down); EXPORT_SYMBOL(dev_change_proto_down);
/**
* dev_change_proto_down_generic - generic implementation for
* ndo_change_proto_down that sets carrier according to
* proto_down.
*
* @dev: device
* @proto_down: new value
*/
int dev_change_proto_down_generic(struct net_device *dev, bool proto_down)
{
if (proto_down)
netif_carrier_off(dev);
else
netif_carrier_on(dev);
dev->proto_down = proto_down;
return 0;
}
EXPORT_SYMBOL(dev_change_proto_down_generic);
u32 __dev_xdp_query(struct net_device *dev, bpf_op_t bpf_op, u32 __dev_xdp_query(struct net_device *dev, bpf_op_t bpf_op,
enum bpf_netdev_command cmd) enum bpf_netdev_command cmd)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment