Skip to content

Commit 85b58e3

Browse files
author
Fox Snowpatch
committed
1 parent 182544a commit 85b58e3

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

drivers/net/ethernet/ibm/ibmveth.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,25 @@ static int ibmveth_set_mac_addr(struct net_device *dev, void *p)
17561756
return 0;
17571757
}
17581758

1759+
static netdev_features_t ibmveth_features_check(struct sk_buff *skb,
1760+
struct net_device *dev,
1761+
netdev_features_t features)
1762+
{
1763+
/* Some physical adapters do not support segmentation offload with
1764+
* MSS < 224. Disable GSO for such packets to avoid adapter freeze.
1765+
*/
1766+
if (skb_is_gso(skb)) {
1767+
if (skb_shinfo(skb)->gso_size < IBMVETH_MIN_LSO_MSS) {
1768+
netdev_warn_once(dev,
1769+
"MSS %u too small for LSO, disabling GSO\n",
1770+
skb_shinfo(skb)->gso_size);
1771+
features &= ~NETIF_F_GSO_MASK;
1772+
}
1773+
}
1774+
1775+
return features;
1776+
}
1777+
17591778
static const struct net_device_ops ibmveth_netdev_ops = {
17601779
.ndo_open = ibmveth_open,
17611780
.ndo_stop = ibmveth_close,
@@ -1767,6 +1786,7 @@ static const struct net_device_ops ibmveth_netdev_ops = {
17671786
.ndo_set_features = ibmveth_set_features,
17681787
.ndo_validate_addr = eth_validate_addr,
17691788
.ndo_set_mac_address = ibmveth_set_mac_addr,
1789+
.ndo_features_check = ibmveth_features_check,
17701790
#ifdef CONFIG_NET_POLL_CONTROLLER
17711791
.ndo_poll_controller = ibmveth_poll_controller,
17721792
#endif

drivers/net/ethernet/ibm/ibmveth.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#define IBMVETH_ILLAN_IPV4_TCP_CSUM 0x0000000000000002UL
3838
#define IBMVETH_ILLAN_ACTIVE_TRUNK 0x0000000000000001UL
3939

40+
#define IBMVETH_MIN_LSO_MSS 224 /* Minimum MSS for LSO */
4041
/* hcall macros */
4142
#define h_register_logical_lan(ua, buflst, rxq, fltlst, mac) \
4243
plpar_hcall_norets(H_REGISTER_LOGICAL_LAN, ua, buflst, rxq, fltlst, mac)

0 commit comments

Comments
 (0)