vbus: venet macvlan rt netlink changes
Subsystems (2)
cover vbus: venet macvlan rt netlink changes
(Applies to alacrityvm.git/master:a725f9950)
This series changes the venet macvlan device such that it can be created via rt netlink and no longer requires any extensive changes to the macvlan device itself. The first patch removes prior changes to the macvlan device introduced in the alacrityvm tree and also implements the changes needed for creation and management via rt netlink. The subsequent patches(2 and 3) are changes to the macvlan device for GRO support and for type specific release. These 2 patches don't appear to be upstream. If desired and approved, I'll regenerate these last 2 for net-next.
---
Patrick Mullaney (3):
macvlan: use rtnl_link_ops->dellink during unregister notications
macvlan: add GRO bit to features mask
venet-macvlan: allow rt netlink to create venet macvlan devices
drivers/net/macvlan.c | 72 ++---- include/linux/macvlan.h | 6 - kernel/vbus/devices/venet/device.c | 8 + kernel/vbus/devices/venet/macvlan.c | 360 ++++++++++++++++++++----------- kernel/vbus/devices/venet/tap.c | 3 kernel/vbus/devices/venet/venetdevice.h | 3 6 files changed, 265 insertions(+), 187 deletions(-)
PATCH 1/3 venet-macvlan: allow rt netlink to create venet macvlan devices
This reverts commit: 0698047f0e3c189b5c511959b59e9614c901dabf, which allowed in-kernel modules to create macvlans. This patch then adds support for creating a venet macvlan via rt netlink.
---
drivers/net/macvlan.c | 72 ++---- include/linux/macvlan.h | 6 - kernel/vbus/devices/venet/device.c | 8 + kernel/vbus/devices/venet/macvlan.c | 360 ++++++++++++++++++++----------- kernel/vbus/devices/venet/tap.c | 3 kernel/vbus/devices/venet/venetdevice.h | 3 6 files changed, 265 insertions(+), 187 deletions(-)
drivers/net/macvlan.c +25 -47
@@ -208,7 +208,7 @@ static const struct header_ops macvlan_hard_header_ops = { .cache_update = eth_header_cache_update, }; -int macvlan_open (struct net_device *dev) +static int macvlan_open (struct net_device *dev) {struct macvlan_dev *vlan =netdev_priv (dev);struct net_device *lowerdev = vlan->lowerdev;
@@ -235,7 +235,7 @@ out:return err; } -int macvlan_stop (struct net_device *dev) +static int macvlan_stop (struct net_device *dev) {struct macvlan_dev *vlan =netdev_priv (dev);struct net_device *lowerdev = vlan->lowerdev;
@@ -316,7 +316,7 @@ static struct lock_class_key macvlan_netdev_addr_lock_key;#define MACVLAN_FEATURES \ (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \ - NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO) + NETIF_F_TSO_ECN | NETIF_F_TSO6)#define MACVLAN_STATE_MASK \ ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
@@ -440,7 +440,7 @@ static void macvlan_port_destroy(struct net_device *dev)kfree (port); } -void macvlan_transfer_operstate (struct net_device *dev) +static void macvlan_transfer_operstate (struct net_device *dev) {struct macvlan_dev *vlan =netdev_priv (dev);const struct net_device *lowerdev = vlan->lowerdev;
@@ -458,7 +458,6 @@ void macvlan_transfer_operstate(struct net_device *dev)netif_carrier_off (dev); } } -EXPORT_SYMBOL_GPL (macvlan_transfer_operstate);int macvlan_validate (struct nlattr *tb[],struct nlattr *data[]) {
@@ -472,47 +471,11 @@ int macvlan_validate(struct nlattr *tb[], struct nlattr *data[]) }EXPORT_SYMBOL_GPL (macvlan_validate); -int macvlan_link_lowerdev (struct net_device *dev, -struct net_device *lowerdev) -{ -struct macvlan_dev *vlan =netdev_priv (dev); -struct macvlan_port *port; -int err =0 ; - -if (lowerdev->macvlan_port ==NULL ) { - err =macvlan_port_create (lowerdev); -if (err <0 ) -return err; - } - port = lowerdev->macvlan_port; - - vlan->lowerdev = lowerdev; - vlan->dev = dev; - vlan->port = port; - vlan->receive = netif_rx; - -macvlan_init (dev); - -list_add_tail (&vlan->list, &port->vlans); -return 0 ; -} -EXPORT_SYMBOL_GPL (macvlan_link_lowerdev); - -void macvlan_unlink_lowerdev (struct net_device *dev) -{ -struct macvlan_dev *vlan =netdev_priv (dev); -struct macvlan_port *port = vlan->port; - -list_del (&vlan->list); - -if (list_empty (&port->vlans)) -macvlan_port_destroy (port->dev); -} -EXPORT_SYMBOL_GPL (macvlan_unlink_lowerdev); -int macvlan_newlink (struct net_device *dev,struct nlattr *tb[],struct nlattr *data[]) { +struct macvlan_dev *vlan =netdev_priv (dev); +struct macvlan_port *port;struct net_device *lowerdev;int err;
@@ -539,14 +502,23 @@ int macvlan_newlink(struct net_device *dev,if (!tb[IFLA_ADDRESS ])random_ether_addr (dev->dev_addr); - err =macvlan_link_lowerdev (dev, lowerdev); -if (err <0 ) -return err; +if (lowerdev->macvlan_port ==NULL ) { + err =macvlan_port_create (lowerdev); +if (err <0 ) +return err; + } + port = lowerdev->macvlan_port; + + vlan->lowerdev = lowerdev; + vlan->dev = dev; + vlan->port = port; + vlan->receive = netif_rx; err =register_netdevice (dev);if (err <0 )return err; +list_add_tail (&vlan->list, &port->vlans);macvlan_transfer_operstate (dev);return 0 ; }
@@ -554,8 +526,14 @@ EXPORT_SYMBOL_GPL(macvlan_newlink);void macvlan_dellink (struct net_device *dev) { -macvlan_unlink_lowerdev (dev); +struct macvlan_dev *vlan =netdev_priv (dev); +struct macvlan_port *port = vlan->port; + +list_del (&vlan->list);unregister_netdevice (dev); + +if (list_empty (&port->vlans)) +macvlan_port_destroy (port->dev); }EXPORT_SYMBOL_GPL (macvlan_dellink);
include/linux/macvlan.h +0 -6
@@ -24,12 +24,6 @@ struct macvlan_dev { };extern int macvlan_start_xmit (struct sk_buff *skb,struct net_device *dev); -extern int macvlan_link_lowerdev (struct net_device *dev, -struct net_device *lowerdev); - -extern void macvlan_unlink_lowerdev (struct net_device *dev); - -extern void macvlan_transfer_operstate (struct net_device *dev);extern void macvlan_setup (struct net_device *dev);
kernel/vbus/devices/venet/device.c +6 -2
@@ -1999,7 +1999,7 @@ venetdev_flushrx(struct venetdev *priv)return 0 ; } -void venetdev_init (struct venetdev *device,struct net_device *dev) +void venetdev_common_init (struct venetdev *device) { device->vbus.import = &venetdev_flat_import; device->vbus.export = &venetdev_flat_export;
@@ -2018,8 +2018,12 @@ void venetdev_init(struct venetdev *device, struct net_device *dev) device->netif.rxq.completed =0 ;init_waitqueue_head (&device->netif.rxq.wq); - device->netif.dev = dev; device->netif.out = venetdev_out; +} + +void venetdev_dev_init (struct venetdev *device,struct net_device *dev) +{ + device->netif.dev = dev;ether_setup (dev);/* assign some of the fields */
kernel/vbus/devices/venet/macvlan.c +230 -130
606 lines not on this page · raw message
kernel/vbus/devices/venet/tap.c +2 -1
@@ -258,7 +258,8 @@ venettap_device_create(struct vbus_devclass *dc, _vdev->ops = &venettap_device_ops; _vdev->attrs = &venettap_attr_group; -venetdev_init (priv, dev); +venetdev_common_init (priv); +venetdev_dev_init (priv, dev); dev->netdev_ops = &venettap_netdev_ops;
kernel/vbus/devices/venet/venetdevice.h +2 -1
@@ -163,7 +163,8 @@ int venetdev_vlink_shm(struct vbus_connection *conn, struct shm_signal *signal, unsigned long flags);void venetdev_vlink_release (struct vbus_connection *conn);void venetdev_vlink_close (struct vbus_connection *conn); -void venetdev_init (struct venetdev *vdev,struct net_device *dev); +void venetdev_common_init (struct venetdev *vdev); +void venetdev_dev_init (struct venetdev *vdev,struct net_device *dev);extern struct vbus_device_attribute attr_cmac;extern struct vbus_device_attribute attr_hmac;
PATCH 2/3 macvlan: add GRO bit to features mask
In reply to Patrick MullaneyAllow macvlan devices to support GRO.
---
drivers/net/macvlan.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/macvlan.c +1 -1
@@ -316,7 +316,7 @@ static struct lock_class_key macvlan_netdev_addr_lock_key;#define MACVLAN_FEATURES \ (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \ - NETIF_F_TSO_ECN | NETIF_F_TSO6) + NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO)#define MACVLAN_STATE_MASK \ ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
PATCH 3/3 macvlan: use rtnl_link_ops->dellink during unregister notications
In reply to Patrick MullaneyDifferent macvlan device types will need to release resources in their own type specific dellink operation. This change ensures they will for unregister notifications on the lower level device.
---
drivers/net/macvlan.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/macvlan.c +1 -1
@@ -570,7 +570,7 @@ static int macvlan_device_event(struct notifier_block *unused,break ;case NETDEV_UNREGISTER :list_for_each_entry_safe (vlan, next, &port->vlans, list) -macvlan_dellink (vlan->dev); + vlan->dev->rtnl_link_ops->dellink (vlan->dev);break ; }return NOTIFY_DONE ;
Re: [PATCH 2/3] macvlan: add GRO bit to features mask
In reply to Patrick MullaneyQuoted 1 line · Patrick Mullaney
Allow macvlan devices to support GRO.
Please send this patch to Dave, this can already go upstream.
PATCH 1/1 macvlan: add GRO bit to features mask
Allow macvlan devices to support GRO.
---
drivers/net/macvlan.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/macvlan.c +1 -1
@@ -316,7 +316,7 @@ static struct lock_class_key macvlan_netdev_addr_lock_key;#define MACVLAN_FEATURES \ (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \ - NETIF_F_TSO_ECN | NETIF_F_TSO6) + NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO)#define MACVLAN_STATE_MASK \ ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
Re: [PATCH] macvlan: add GRO bit to features mask
From: Patrick Mullaney <[email protected]>
Date: Fri, 15 Jan 2010 15:00:51 -0500
Quoted 5 lines
Allow macvlan devices to support GRO.
Signed-off-by Patrick Mullaney <[email protected]>Acked-by Patrick McHardy <[email protected]>
Applied to net-next-2.6, thanks.
Gregory Haskins
AppliedQuoted 12 lines · Patrick Mullaney
(Applies to alacrityvm.git/master:a725f9950)
This series changes the venet macvlan device such that it can be created via rt netlink and no longer requires any extensive changes to the macvlan device itself. The first patch removes prior changes to the macvlan device introduced in the alacrityvm tree and also implements the changes needed for creation and management via rt netlink. The subsequent patches(2 and 3) are changes to the macvlan device for GRO support and for type specific release. These 2 patches don't appear to be upstream. If desired and approved, I'll regenerate these last 2 for net-next.
Applied to alacrityvm.git/master. Thanks Pat!
Quoted 17 lines
---
Patrick Mullaney (3):
macvlan: usertnl_link_ops->dellinkduring unregister notications
macvlan: add GRO bit to features mask
venet-macvlan: allow rt netlink to create venet macvlan devicesdrivers/net/macvlan.c | 72 ++---- include/linux/macvlan.h | 6 - kernel/vbus/devices/venet/device.c | 8 + kernel/vbus/devices/venet/macvlan.c | 360 ++++++++++++++++++++----------- kernel/vbus/devices/venet/tap.c | 3 kernel/vbus/devices/venet/venetdevice.h | 3 6 files changed, 265 insertions(+), 187 deletions(-)