diff options
author | Jiri Benc <jbenc@redhat.com> | 2016-11-10 16:28:17 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-13 06:51:02 +0100 |
commit | 738314a084aae5f76ff760279034b39d52c42e8b (patch) | |
tree | 3804fb58d9d7e735e7a84db09d0717f71f7bd06e /net/openvswitch/vport.c | |
parent | bpf, mlx4: fix prog refcount in mlx4_en_try_alloc_resources error path (diff) | |
download | linux-738314a084aae5f76ff760279034b39d52c42e8b.tar.xz linux-738314a084aae5f76ff760279034b39d52c42e8b.zip |
openvswitch: use hard_header_len instead of hardcoded ETH_HLEN
On tx, use hard_header_len while deciding whether to refragment or drop the
packet. That way, all combinations are calculated correctly:
* L2 packet going to L2 interface (the L2 header len is subtracted),
* L2 packet going to L3 interface (the L2 header is included in the packet
lenght),
* L3 packet going to L3 interface.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/vport.c')
-rw-r--r-- | net/openvswitch/vport.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index 9bb85b35a1fb..3e131f6868f2 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c @@ -464,9 +464,10 @@ int ovs_vport_receive(struct vport *vport, struct sk_buff *skb, return 0; } -static unsigned int packet_length(const struct sk_buff *skb) +static unsigned int packet_length(const struct sk_buff *skb, + struct net_device *dev) { - unsigned int length = skb->len - ETH_HLEN; + unsigned int length = skb->len - dev->hard_header_len; if (!skb_vlan_tag_present(skb) && eth_type_vlan(skb->protocol)) @@ -484,10 +485,11 @@ void ovs_vport_send(struct vport *vport, struct sk_buff *skb) { int mtu = vport->dev->mtu; - if (unlikely(packet_length(skb) > mtu && !skb_is_gso(skb))) { + if (unlikely(packet_length(skb, vport->dev) > mtu && + !skb_is_gso(skb))) { net_warn_ratelimited("%s: dropped over-mtu packet: %d > %d\n", vport->dev->name, - packet_length(skb), mtu); + packet_length(skb, vport->dev), mtu); vport->dev->stats.tx_errors++; goto drop; } |