Commit 6b072523 authored by David S. Miller's avatar David S. Miller

Merge branch 'bridge-gso-segs-and-size'

Eric Dumazet says:

====================
net: propagate max_gso_segs and max_gso_size

bridge code does not properly update max_gso_segs and max_gso_size.

Since this was not really obvious, first patch adds two new rtnetlink
attributes to help debugging this kind of issues (ip -d link)

Second patch fixes bridge code.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7d34fa75 ae74f100
...@@ -153,6 +153,8 @@ enum { ...@@ -153,6 +153,8 @@ enum {
IFLA_LINK_NETNSID, IFLA_LINK_NETNSID,
IFLA_PHYS_PORT_NAME, IFLA_PHYS_PORT_NAME,
IFLA_PROTO_DOWN, IFLA_PROTO_DOWN,
IFLA_GSO_MAX_SEGS,
IFLA_GSO_MAX_SIZE,
__IFLA_MAX __IFLA_MAX
}; };
......
...@@ -437,6 +437,20 @@ int br_min_mtu(const struct net_bridge *br) ...@@ -437,6 +437,20 @@ int br_min_mtu(const struct net_bridge *br)
return mtu; return mtu;
} }
static void br_set_gso_limits(struct net_bridge *br)
{
unsigned int gso_max_size = GSO_MAX_SIZE;
u16 gso_max_segs = GSO_MAX_SEGS;
const struct net_bridge_port *p;
list_for_each_entry(p, &br->port_list, list) {
gso_max_size = min(gso_max_size, p->dev->gso_max_size);
gso_max_segs = min(gso_max_segs, p->dev->gso_max_segs);
}
br->dev->gso_max_size = gso_max_size;
br->dev->gso_max_segs = gso_max_segs;
}
/* /*
* Recomputes features using slave's features * Recomputes features using slave's features
*/ */
...@@ -564,6 +578,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) ...@@ -564,6 +578,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
call_netdevice_notifiers(NETDEV_CHANGEADDR, br->dev); call_netdevice_notifiers(NETDEV_CHANGEADDR, br->dev);
dev_set_mtu(br->dev, br_min_mtu(br)); dev_set_mtu(br->dev, br_min_mtu(br));
br_set_gso_limits(br);
kobject_uevent(&p->kobj, KOBJ_ADD); kobject_uevent(&p->kobj, KOBJ_ADD);
...@@ -610,6 +625,7 @@ int br_del_if(struct net_bridge *br, struct net_device *dev) ...@@ -610,6 +625,7 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
del_nbp(p); del_nbp(p);
dev_set_mtu(br->dev, br_min_mtu(br)); dev_set_mtu(br->dev, br_min_mtu(br));
br_set_gso_limits(br);
spin_lock_bh(&br->lock); spin_lock_bh(&br->lock);
changed_addr = br_stp_recalculate_bridge_id(br); changed_addr = br_stp_recalculate_bridge_id(br);
......
...@@ -895,6 +895,8 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev, ...@@ -895,6 +895,8 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
+ nla_total_size(4) /* IFLA_PROMISCUITY */ + nla_total_size(4) /* IFLA_PROMISCUITY */
+ nla_total_size(4) /* IFLA_NUM_TX_QUEUES */ + nla_total_size(4) /* IFLA_NUM_TX_QUEUES */
+ nla_total_size(4) /* IFLA_NUM_RX_QUEUES */ + nla_total_size(4) /* IFLA_NUM_RX_QUEUES */
+ nla_total_size(4) /* IFLA_MAX_GSO_SEGS */
+ nla_total_size(4) /* IFLA_MAX_GSO_SIZE */
+ nla_total_size(1) /* IFLA_OPERSTATE */ + nla_total_size(1) /* IFLA_OPERSTATE */
+ nla_total_size(1) /* IFLA_LINKMODE */ + nla_total_size(1) /* IFLA_LINKMODE */
+ nla_total_size(4) /* IFLA_CARRIER_CHANGES */ + nla_total_size(4) /* IFLA_CARRIER_CHANGES */
...@@ -1223,6 +1225,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, ...@@ -1223,6 +1225,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
nla_put_u32(skb, IFLA_GROUP, dev->group) || nla_put_u32(skb, IFLA_GROUP, dev->group) ||
nla_put_u32(skb, IFLA_PROMISCUITY, dev->promiscuity) || nla_put_u32(skb, IFLA_PROMISCUITY, dev->promiscuity) ||
nla_put_u32(skb, IFLA_NUM_TX_QUEUES, dev->num_tx_queues) || nla_put_u32(skb, IFLA_NUM_TX_QUEUES, dev->num_tx_queues) ||
nla_put_u32(skb, IFLA_GSO_MAX_SEGS, dev->gso_max_segs) ||
nla_put_u32(skb, IFLA_GSO_MAX_SIZE, dev->gso_max_size) ||
#ifdef CONFIG_RPS #ifdef CONFIG_RPS
nla_put_u32(skb, IFLA_NUM_RX_QUEUES, dev->num_rx_queues) || nla_put_u32(skb, IFLA_NUM_RX_QUEUES, dev->num_rx_queues) ||
#endif #endif
......
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