Skip to content

Commit 2d46e48

Browse files
TaeheeYookuba-moo
authored andcommitted
net: disallow setup single buffer XDP when tcp-data-split is enabled.
When a single buffer XDP is attached, NIC should guarantee only single page packets will be received. tcp-data-split feature splits packets into header and payload. single buffer XDP can't handle it properly. So attaching single buffer XDP should be disallowed when tcp-data-split is enabled. Acked-by: Jakub Kicinski <[email protected]> Signed-off-by: Taehee Yoo <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e617790 commit 2d46e48

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

net/core/dev.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
#include <linux/netdevice.h>
9393
#include <linux/etherdevice.h>
9494
#include <linux/ethtool.h>
95+
#include <linux/ethtool_netlink.h>
9596
#include <linux/skbuff.h>
9697
#include <linux/kthread.h>
9798
#include <linux/bpf.h>
@@ -9567,6 +9568,14 @@ int dev_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf)
95679568
if (!dev->netdev_ops->ndo_bpf)
95689569
return -EOPNOTSUPP;
95699570

9571+
if (dev->ethtool->hds_config == ETHTOOL_TCP_DATA_SPLIT_ENABLED &&
9572+
bpf->command == XDP_SETUP_PROG &&
9573+
bpf->prog && !bpf->prog->aux->xdp_has_frags) {
9574+
NL_SET_ERR_MSG(bpf->extack,
9575+
"unable to propagate XDP to device using tcp-data-split");
9576+
return -EBUSY;
9577+
}
9578+
95709579
if (dev_get_min_mp_channel_count(dev)) {
95719580
NL_SET_ERR_MSG(bpf->extack, "unable to propagate XDP to device using memory provider");
95729581
return -EBUSY;
@@ -9604,6 +9613,12 @@ static int dev_xdp_install(struct net_device *dev, enum bpf_xdp_mode mode,
96049613
struct netdev_bpf xdp;
96059614
int err;
96069615

9616+
if (dev->ethtool->hds_config == ETHTOOL_TCP_DATA_SPLIT_ENABLED &&
9617+
prog && !prog->aux->xdp_has_frags) {
9618+
NL_SET_ERR_MSG(extack, "unable to install XDP to device using tcp-data-split");
9619+
return -EBUSY;
9620+
}
9621+
96079622
if (dev_get_min_mp_channel_count(dev)) {
96089623
NL_SET_ERR_MSG(extack, "unable to install XDP to device using memory provider");
96099624
return -EBUSY;

0 commit comments

Comments
 (0)