Commit ba77f6e2 authored by David S. Miller's avatar David S. Miller

Merge branch 'veth-xdp-gro'

Ignat Korchagin says:

====================
net: veth: ability to toggle GRO and XDP independently

It is rather confusing that GRO is automatically enabled, when an XDP program
is attached to a veth interface. Moreover, it is not possible to disable GRO
on a veth, if an XDP program is attached (which might be desirable in some use
cases).

Make GRO and XDP independent for a veth interface.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6ebfad33 ba5a6476
...@@ -1464,8 +1464,6 @@ static netdev_features_t veth_fix_features(struct net_device *dev, ...@@ -1464,8 +1464,6 @@ static netdev_features_t veth_fix_features(struct net_device *dev,
if (peer_priv->_xdp_prog) if (peer_priv->_xdp_prog)
features &= ~NETIF_F_GSO_SOFTWARE; features &= ~NETIF_F_GSO_SOFTWARE;
} }
if (priv->_xdp_prog)
features |= NETIF_F_GRO;
return features; return features;
} }
...@@ -1569,14 +1567,6 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog, ...@@ -1569,14 +1567,6 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
} }
if (!old_prog) { if (!old_prog) {
if (!veth_gro_requested(dev)) {
/* user-space did not require GRO, but adding
* XDP is supposed to get GRO working
*/
dev->features |= NETIF_F_GRO;
netdev_features_change(dev);
}
peer->hw_features &= ~NETIF_F_GSO_SOFTWARE; peer->hw_features &= ~NETIF_F_GSO_SOFTWARE;
peer->max_mtu = max_mtu; peer->max_mtu = max_mtu;
} }
...@@ -1592,14 +1582,6 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog, ...@@ -1592,14 +1582,6 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
if (dev->flags & IFF_UP) if (dev->flags & IFF_UP)
veth_disable_xdp(dev); veth_disable_xdp(dev);
/* if user-space did not require GRO, since adding XDP
* enabled it, clear it now
*/
if (!veth_gro_requested(dev)) {
dev->features &= ~NETIF_F_GRO;
netdev_features_change(dev);
}
if (peer) { if (peer) {
peer->hw_features |= NETIF_F_GSO_SOFTWARE; peer->hw_features |= NETIF_F_GSO_SOFTWARE;
peer->max_mtu = ETH_MAX_MTU; peer->max_mtu = ETH_MAX_MTU;
......
...@@ -217,6 +217,7 @@ for family in 4 6; do ...@@ -217,6 +217,7 @@ for family in 4 6; do
cleanup cleanup
create_ns create_ns
ip netns exec $NS_DST ethtool -K veth$DST generic-receive-offload on
ip netns exec $NS_DST ethtool -K veth$DST rx-gro-list on ip netns exec $NS_DST ethtool -K veth$DST rx-gro-list on
run_test "GRO frag list" $BM_NET$DST 1 0 run_test "GRO frag list" $BM_NET$DST 1 0
cleanup cleanup
...@@ -227,6 +228,7 @@ for family in 4 6; do ...@@ -227,6 +228,7 @@ for family in 4 6; do
# use NAT to circumvent GRO FWD check # use NAT to circumvent GRO FWD check
create_ns create_ns
ip -n $NS_DST addr add dev veth$DST $BM_NET$DST_NAT/$SUFFIX ip -n $NS_DST addr add dev veth$DST $BM_NET$DST_NAT/$SUFFIX
ip netns exec $NS_DST ethtool -K veth$DST generic-receive-offload on
ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
ip netns exec $NS_DST $IPT -t nat -I PREROUTING -d $BM_NET$DST_NAT \ ip netns exec $NS_DST $IPT -t nat -I PREROUTING -d $BM_NET$DST_NAT \
-j DNAT --to-destination $BM_NET$DST -j DNAT --to-destination $BM_NET$DST
...@@ -240,6 +242,7 @@ for family in 4 6; do ...@@ -240,6 +242,7 @@ for family in 4 6; do
cleanup cleanup
create_vxlan_pair create_vxlan_pair
ip netns exec $NS_DST ethtool -K veth$DST generic-receive-offload on
ip netns exec $NS_DST ethtool -K veth$DST rx-gro-list on ip netns exec $NS_DST ethtool -K veth$DST rx-gro-list on
run_test "GRO frag list over UDP tunnel" $OL_NET$DST 1 1 run_test "GRO frag list over UDP tunnel" $OL_NET$DST 1 1
cleanup cleanup
...@@ -247,6 +250,7 @@ for family in 4 6; do ...@@ -247,6 +250,7 @@ for family in 4 6; do
# use NAT to circumvent GRO FWD check # use NAT to circumvent GRO FWD check
create_vxlan_pair create_vxlan_pair
ip -n $NS_DST addr add dev $VXDEV$DST $OL_NET$DST_NAT/$SUFFIX ip -n $NS_DST addr add dev $VXDEV$DST $OL_NET$DST_NAT/$SUFFIX
ip netns exec $NS_DST ethtool -K veth$DST generic-receive-offload on
ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
ip netns exec $NS_DST $IPT -t nat -I PREROUTING -d $OL_NET$DST_NAT \ ip netns exec $NS_DST $IPT -t nat -I PREROUTING -d $OL_NET$DST_NAT \
-j DNAT --to-destination $OL_NET$DST -j DNAT --to-destination $OL_NET$DST
......
...@@ -249,9 +249,9 @@ cleanup ...@@ -249,9 +249,9 @@ cleanup
create_ns create_ns
ip -n $NS_DST link set dev veth$DST up ip -n $NS_DST link set dev veth$DST up
ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} section xdp ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} section xdp
chk_gro_flag "gro vs xdp while down - gro flag on" $DST on chk_gro_flag "gro vs xdp while down - gro flag off" $DST off
ip -n $NS_DST link set dev veth$DST down ip -n $NS_DST link set dev veth$DST down
chk_gro_flag " - after down" $DST on chk_gro_flag " - after down" $DST off
ip -n $NS_DST link set dev veth$DST xdp off ip -n $NS_DST link set dev veth$DST xdp off
chk_gro_flag " - after xdp off" $DST off chk_gro_flag " - after xdp off" $DST off
ip -n $NS_DST link set dev veth$DST up ip -n $NS_DST link set dev veth$DST up
...@@ -260,6 +260,21 @@ ip -n $NS_SRC link set dev veth$SRC xdp object ${BPF_FILE} section xdp ...@@ -260,6 +260,21 @@ ip -n $NS_SRC link set dev veth$SRC xdp object ${BPF_FILE} section xdp
chk_gro_flag " - after peer xdp" $DST off chk_gro_flag " - after peer xdp" $DST off
cleanup cleanup
create_ns
ip -n $NS_DST link set dev veth$DST up
ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} section xdp
ip netns exec $NS_DST ethtool -K veth$DST generic-receive-offload on
chk_gro_flag "gro vs xdp while down - gro flag on" $DST on
ip -n $NS_DST link set dev veth$DST down
chk_gro_flag " - after down" $DST on
ip -n $NS_DST link set dev veth$DST xdp off
chk_gro_flag " - after xdp off" $DST on
ip -n $NS_DST link set dev veth$DST up
chk_gro_flag " - after up" $DST on
ip -n $NS_SRC link set dev veth$SRC xdp object ${BPF_FILE} section xdp
chk_gro_flag " - after peer xdp" $DST on
cleanup
create_ns create_ns
chk_channels "default channels" $DST 1 1 chk_channels "default channels" $DST 1 1
...@@ -327,11 +342,14 @@ if [ $CPUS -gt 2 ]; then ...@@ -327,11 +342,14 @@ if [ $CPUS -gt 2 ]; then
fi fi
ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} section xdp 2>/dev/null ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} section xdp 2>/dev/null
chk_gro_flag "with xdp attached - gro flag" $DST on chk_gro_flag "with xdp attached - gro flag" $DST off
chk_gro_flag " - peer gro flag" $SRC off chk_gro_flag " - peer gro flag" $SRC off
chk_tso_flag " - tso flag" $SRC off chk_tso_flag " - tso flag" $SRC off
chk_tso_flag " - peer tso flag" $DST on chk_tso_flag " - peer tso flag" $DST on
ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
chk_gro " - no aggregation" 10
ip netns exec $NS_DST ethtool -K veth$DST generic-receive-offload on
chk_gro_flag " - gro flag with GRO on" $DST on
chk_gro " - aggregation" 1 chk_gro " - aggregation" 1
......
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