Commit ce896476 authored by James Hughes's avatar James Hughes Committed by David S. Miller

net: usb: lan78xx: Add .ndo_features_check

As reported by Eric Dumazet, there are still some outstanding
cases where the driver does not handle TSO correctly when skb's
are over a certain size. Most cases have been fixed, this patch
should ensure that forwarded SKB's that are greater than
MAX_SINGLE_PACKET_SIZE - TX_OVERHEAD are software segmented
and handled correctly.
Signed-off-by: default avatarJames Hughes <james.hughes@raspberrypi.org>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5b2f1f30
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/mdio.h> #include <linux/mdio.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <net/ip6_checksum.h> #include <net/ip6_checksum.h>
#include <net/vxlan.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irqdomain.h> #include <linux/irqdomain.h>
#include <linux/irq.h> #include <linux/irq.h>
...@@ -3668,6 +3669,19 @@ static void lan78xx_tx_timeout(struct net_device *net) ...@@ -3668,6 +3669,19 @@ static void lan78xx_tx_timeout(struct net_device *net)
tasklet_schedule(&dev->bh); tasklet_schedule(&dev->bh);
} }
static netdev_features_t lan78xx_features_check(struct sk_buff *skb,
struct net_device *netdev,
netdev_features_t features)
{
if (skb->len + TX_OVERHEAD > MAX_SINGLE_PACKET_SIZE)
features &= ~NETIF_F_GSO_MASK;
features = vlan_features_check(skb, features);
features = vxlan_features_check(skb, features);
return features;
}
static const struct net_device_ops lan78xx_netdev_ops = { static const struct net_device_ops lan78xx_netdev_ops = {
.ndo_open = lan78xx_open, .ndo_open = lan78xx_open,
.ndo_stop = lan78xx_stop, .ndo_stop = lan78xx_stop,
...@@ -3681,6 +3695,7 @@ static const struct net_device_ops lan78xx_netdev_ops = { ...@@ -3681,6 +3695,7 @@ static const struct net_device_ops lan78xx_netdev_ops = {
.ndo_set_features = lan78xx_set_features, .ndo_set_features = lan78xx_set_features,
.ndo_vlan_rx_add_vid = lan78xx_vlan_rx_add_vid, .ndo_vlan_rx_add_vid = lan78xx_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = lan78xx_vlan_rx_kill_vid, .ndo_vlan_rx_kill_vid = lan78xx_vlan_rx_kill_vid,
.ndo_features_check = lan78xx_features_check,
}; };
static void lan78xx_stat_monitor(struct timer_list *t) static void lan78xx_stat_monitor(struct timer_list *t)
......
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