@@ -292,8 +292,6 @@ static int veth_forward_skb(struct net_device *dev, struct sk_buff *skb,
292292/* return true if the specified skb has chances of GRO aggregation
293293 * Don't strive for accuracy, but try to avoid GRO overhead in the most
294294 * common scenarios.
295- * When XDP is enabled, all traffic is considered eligible, as the xmit
296- * device has TSO off.
297295 * When TSO is enabled on the xmit device, we are likely interested only
298296 * in UDP aggregation, explicitly check for that if the skb is suspected
299297 * - 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)
334332 * Don't bother with napi/GRO if the skb can't be aggregated
335333 */
336334 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 ));
338337 }
339338
340339 skb_tx_timestamp (skb );
@@ -1508,14 +1507,15 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
15081507 struct veth_priv * priv = netdev_priv (dev );
15091508 struct bpf_prog * old_prog ;
15101509 struct net_device * peer ;
1511- unsigned int max_mtu ;
15121510 int err ;
15131511
15141512 old_prog = priv -> _xdp_prog ;
15151513 priv -> _xdp_prog = prog ;
15161514 peer = rtnl_dereference (priv -> peer );
15171515
15181516 if (prog ) {
1517+ unsigned int max_mtu ;
1518+
15191519 if (!peer ) {
15201520 NL_SET_ERR_MSG_MOD (extack , "Cannot set XDP when peer is detached" );
15211521 err = - ENOTCONN ;
@@ -1525,9 +1525,9 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
15251525 max_mtu = PAGE_SIZE - VETH_XDP_HEADROOM -
15261526 peer -> hard_header_len -
15271527 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 ;
15311531 goto err ;
15321532 }
15331533
@@ -1545,21 +1545,17 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
15451545 }
15461546 }
15471547
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 ;
15521550 }
15531551
15541552 if (old_prog ) {
15551553 if (!prog ) {
15561554 if (dev -> flags & IFF_UP )
15571555 veth_disable_xdp (dev );
15581556
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 ;
15631559 }
15641560 bpf_prog_put (old_prog );
15651561 }
0 commit comments