@@ -292,8 +292,6 @@ static int veth_forward_skb(struct net_device *dev, struct sk_buff *skb,
292
292
/* return true if the specified skb has chances of GRO aggregation
293
293
* Don't strive for accuracy, but try to avoid GRO overhead in the most
294
294
* common scenarios.
295
- * When XDP is enabled, all traffic is considered eligible, as the xmit
296
- * device has TSO off.
297
295
* When TSO is enabled on the xmit device, we are likely interested only
298
296
* in UDP aggregation, explicitly check for that if the skb is suspected
299
297
* - the sock_wfree destructor is used by UDP, ICMP and XDP sockets -
@@ -334,7 +332,8 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
334
332
* Don't bother with napi/GRO if the skb can't be aggregated
335
333
*/
336
334
use_napi = rcu_access_pointer (rq -> napi ) &&
337
- veth_skb_is_eligible_for_gro (dev , rcv , skb );
335
+ (rcu_access_pointer (rq -> xdp_prog ) ||
336
+ veth_skb_is_eligible_for_gro (dev , rcv , skb ));
338
337
}
339
338
340
339
skb_tx_timestamp (skb );
@@ -1508,14 +1507,15 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
1508
1507
struct veth_priv * priv = netdev_priv (dev );
1509
1508
struct bpf_prog * old_prog ;
1510
1509
struct net_device * peer ;
1511
- unsigned int max_mtu ;
1512
1510
int err ;
1513
1511
1514
1512
old_prog = priv -> _xdp_prog ;
1515
1513
priv -> _xdp_prog = prog ;
1516
1514
peer = rtnl_dereference (priv -> peer );
1517
1515
1518
1516
if (prog ) {
1517
+ unsigned int max_mtu ;
1518
+
1519
1519
if (!peer ) {
1520
1520
NL_SET_ERR_MSG_MOD (extack , "Cannot set XDP when peer is detached" );
1521
1521
err = - ENOTCONN ;
@@ -1525,9 +1525,9 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
1525
1525
max_mtu = PAGE_SIZE - VETH_XDP_HEADROOM -
1526
1526
peer -> hard_header_len -
1527
1527
SKB_DATA_ALIGN (sizeof (struct skb_shared_info ));
1528
- if (peer -> mtu > max_mtu ) {
1529
- NL_SET_ERR_MSG_MOD (extack , "Peer MTU is too large to set XDP" );
1530
- err = - ERANGE ;
1528
+ if (! prog -> aux -> xdp_has_frags && peer -> mtu > max_mtu ) {
1529
+ NL_SET_ERR_MSG_MOD (extack , "prog does not support XDP frags " );
1530
+ err = - EOPNOTSUPP ;
1531
1531
goto err ;
1532
1532
}
1533
1533
@@ -1545,21 +1545,17 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
1545
1545
}
1546
1546
}
1547
1547
1548
- if (!old_prog ) {
1549
- peer -> hw_features &= ~NETIF_F_GSO_SOFTWARE ;
1550
- peer -> max_mtu = max_mtu ;
1551
- }
1548
+ if (!old_prog )
1549
+ peer -> hw_features &= ~NETIF_F_GSO_FRAGLIST ;
1552
1550
}
1553
1551
1554
1552
if (old_prog ) {
1555
1553
if (!prog ) {
1556
1554
if (dev -> flags & IFF_UP )
1557
1555
veth_disable_xdp (dev );
1558
1556
1559
- if (peer ) {
1560
- peer -> hw_features |= NETIF_F_GSO_SOFTWARE ;
1561
- peer -> max_mtu = ETH_MAX_MTU ;
1562
- }
1557
+ if (peer )
1558
+ peer -> hw_features |= NETIF_F_GSO_FRAGLIST ;
1563
1559
}
1564
1560
bpf_prog_put (old_prog );
1565
1561
}
0 commit comments