netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: protodown support for macvlan and vxlan
@ 2019-02-22 18:06 Andy Roulin
  2019-02-22 18:06 ` [PATCH net-next 1/3] net: dev: add generic protodown handler Andy Roulin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Andy Roulin @ 2019-02-22 18:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, roopa, aroulin

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.

Andy Roulin (3):
  net: dev: add generic protodown handler
  macvlan: add ndo_change_proto_down support
  vxlan: add ndo_change_proto_down support

 drivers/net/macvlan.c     |  1 +
 drivers/net/vxlan.c       |  1 +
 include/linux/netdevice.h |  1 +
 net/core/dev.c            | 19 +++++++++++++++++++
 4 files changed, 22 insertions(+)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/3] net: dev: add generic protodown handler
  2019-02-22 18:06 [PATCH net-next 0/3] net: protodown support for macvlan and vxlan Andy Roulin
@ 2019-02-22 18:06 ` Andy Roulin
  2019-02-22 18:06 ` [PATCH net-next 2/3] macvlan: add ndo_change_proto_down support Andy Roulin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Roulin @ 2019-02-22 18:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, roopa, aroulin

Introduce dev_change_proto_down_generic, a generic ndo_change_proto_down
implementation, which sets the netdev carrier state according to proto_down.

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

Signed-off-by: Andy Roulin <aroulin@cumulusnetworks.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 include/linux/netdevice.h |  1 +
 net/core/dev.c            | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index aab4d9f6613d..9a093fde030d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3663,6 +3663,7 @@ int dev_get_port_parent_id(struct net_device *dev,
 			   struct netdev_phys_item_id *ppid, bool recurse);
 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_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 *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 				    struct netdev_queue *txq, int *ret);
diff --git a/net/core/dev.c b/net/core/dev.c
index a3d13f5e2bfc..e99a870772c1 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7954,6 +7954,25 @@ int dev_change_proto_down(struct net_device *dev, bool 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,
 		    enum bpf_netdev_command cmd)
 {
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/3] macvlan: add ndo_change_proto_down support
  2019-02-22 18:06 [PATCH net-next 0/3] net: protodown support for macvlan and vxlan Andy Roulin
  2019-02-22 18:06 ` [PATCH net-next 1/3] net: dev: add generic protodown handler Andy Roulin
@ 2019-02-22 18:06 ` Andy Roulin
  2019-02-22 18:06 ` [PATCH net-next 3/3] vxlan: " Andy Roulin
  2019-02-24 21:01 ` [PATCH net-next 0/3] net: protodown support for macvlan and vxlan David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Roulin @ 2019-02-22 18:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, roopa, aroulin

Add ndo_change_proto_down support through dev_change_proto_down_generic
for use by control protocols like VRRPD.

Signed-off-by: Andy Roulin <aroulin@cumulusnetworks.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 drivers/net/macvlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 26e53832b095..0c0f105657d3 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -1122,6 +1122,7 @@ static const struct net_device_ops macvlan_netdev_ops = {
 #endif
 	.ndo_get_iflink		= macvlan_dev_get_iflink,
 	.ndo_features_check	= passthru_features_check,
+	.ndo_change_proto_down  = dev_change_proto_down_generic,
 };
 
 void macvlan_common_setup(struct net_device *dev)
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 3/3] vxlan: add ndo_change_proto_down support
  2019-02-22 18:06 [PATCH net-next 0/3] net: protodown support for macvlan and vxlan Andy Roulin
  2019-02-22 18:06 ` [PATCH net-next 1/3] net: dev: add generic protodown handler Andy Roulin
  2019-02-22 18:06 ` [PATCH net-next 2/3] macvlan: add ndo_change_proto_down support Andy Roulin
@ 2019-02-22 18:06 ` Andy Roulin
  2019-02-24 21:01 ` [PATCH net-next 0/3] net: protodown support for macvlan and vxlan David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Roulin @ 2019-02-22 18:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, roopa, aroulin

Add ndo_change_proto_down support through dev_change_proto_down_generic
for use by control protocols like VRRPD.

Signed-off-by: Andy Roulin <aroulin@cumulusnetworks.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 drivers/net/vxlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 33edc78e818d..577201cd880c 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2923,6 +2923,7 @@ static const struct net_device_ops vxlan_netdev_ether_ops = {
 	.ndo_fdb_dump		= vxlan_fdb_dump,
 	.ndo_fdb_get		= vxlan_fdb_get,
 	.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 = {
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/3] net: protodown support for macvlan and vxlan
  2019-02-22 18:06 [PATCH net-next 0/3] net: protodown support for macvlan and vxlan Andy Roulin
                   ` (2 preceding siblings ...)
  2019-02-22 18:06 ` [PATCH net-next 3/3] vxlan: " Andy Roulin
@ 2019-02-24 21:01 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-02-24 21:01 UTC (permalink / raw)
  To: aroulin; +Cc: netdev, roopa

From: Andy Roulin <aroulin@cumulusnetworks.com>
Date: Fri, 22 Feb 2019 18:06:35 +0000

> 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.

Series applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-24 21:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-22 18:06 [PATCH net-next 0/3] net: protodown support for macvlan and vxlan Andy Roulin
2019-02-22 18:06 ` [PATCH net-next 1/3] net: dev: add generic protodown handler Andy Roulin
2019-02-22 18:06 ` [PATCH net-next 2/3] macvlan: add ndo_change_proto_down support Andy Roulin
2019-02-22 18:06 ` [PATCH net-next 3/3] vxlan: " Andy Roulin
2019-02-24 21:01 ` [PATCH net-next 0/3] net: protodown support for macvlan and vxlan David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).