diff mbox series

[2/2] veth: allow configuring GSO maximums

Message ID 1512522866-5544-3-git-send-email-solio.sarabia@intel.com
State Superseded, archived
Delegated to: David Miller
Headers show
Series Allow changing device gso maximums | expand

Commit Message

Solio Sarabia Dec. 6, 2017, 1:14 a.m. UTC
From: Stephen Hemminger <stephen@networkplumber.org>

Veth's can be used in environments (like Azure) where the underlying
network device is impacted by large GSO packets. This patch allows
gso maximum values to be passed in when creating the device via
netlink.

In theory, other pseudo devices could also use netlink attributes
to set GSO maximums but for now veth is what has been observed
to be an issue.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: Solio Sarabia <solio.sarabia@intel.com>
---
 drivers/net/veth.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Stephen Hemminger Dec. 6, 2017, 1:25 a.m. UTC | #1
On Tue,  5 Dec 2017 17:14:26 -0800
Solio Sarabia <solio.sarabia@intel.com> wrote:

> From: Stephen Hemminger <stephen@networkplumber.org>
> 
> Veth's can be used in environments (like Azure) where the underlying
> network device is impacted by large GSO packets. This patch allows
> gso maximum values to be passed in when creating the device via
> netlink.
> 
> In theory, other pseudo devices could also use netlink attributes
> to set GSO maximums but for now veth is what has been observed
> to be an issue.
> 
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
> Signed-off-by: Solio Sarabia <solio.sarabia@intel.com>

I am testing new version with changelink support
Solio Sarabia Dec. 6, 2017, 1:50 a.m. UTC | #2
On Tue, Dec 05, 2017 at 05:25:10PM -0800, Stephen Hemminger wrote:
> On Tue,  5 Dec 2017 17:14:26 -0800
> Solio Sarabia <solio.sarabia@intel.com> wrote:
> 
> > From: Stephen Hemminger <stephen@networkplumber.org>
> > 
> > Veth's can be used in environments (like Azure) where the underlying
> > network device is impacted by large GSO packets. This patch allows
> > gso maximum values to be passed in when creating the device via
> > netlink.
> > 
> > In theory, other pseudo devices could also use netlink attributes
> > to set GSO maximums but for now veth is what has been observed
> > to be an issue.
> > 
> > Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
> > Signed-off-by: Solio Sarabia <solio.sarabia@intel.com>
> 
> I am testing new version with changelink support

Ack, I second whatever version works best.
Will help to try newer patches.
diff mbox series

Patch

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index f5438d0..510c058 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -410,6 +410,26 @@  static int veth_newlink(struct net *src_net, struct net_device *dev,
 	if (ifmp && (dev->ifindex != 0))
 		peer->ifindex = ifmp->ifi_index;
 
+	if (tbp[IFLA_GSO_MAX_SIZE]) {
+		u32 max_size = nla_get_u32(tbp[IFLA_GSO_MAX_SIZE]);
+
+		if (max_size > GSO_MAX_SIZE)
+			return -EINVAL;
+
+		peer->gso_max_size = max_size;
+		dev->gso_max_size = max_size;
+	}
+
+	if (tbp[IFLA_GSO_MAX_SEGS]) {
+		u32 max_segs = nla_get_u32(tbp[IFLA_GSO_MAX_SEGS]);
+
+		if (max_segs > GSO_MAX_SEGS)
+			return -EINVAL;
+
+		peer->gso_max_segs = max_segs;
+		dev->gso_max_segs = max_segs;
+	}
+
 	err = register_netdevice(peer);
 	put_net(net);
 	net = NULL;