]> www.infradead.org Git - users/hch/misc.git/commitdiff
net: disallow setup single buffer XDP when tcp-data-split is enabled.
authorTaehee Yoo <ap420073@gmail.com>
Tue, 14 Jan 2025 14:28:47 +0000 (14:28 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 15 Jan 2025 22:42:11 +0000 (14:42 -0800)
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 <kuba@kernel.org>
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Link: https://patch.msgid.link/20250114142852.3364986-6-ap420073@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/dev.c

index 5ef817d656ef6fc23fc29befadf9f74dadb92af3..47e6b0f73cfc790b55252c554e6f194eb5d1fdfc 100644 (file)
@@ -92,6 +92,7 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
+#include <linux/ethtool_netlink.h>
 #include <linux/skbuff.h>
 #include <linux/kthread.h>
 #include <linux/bpf.h>
@@ -9567,6 +9568,14 @@ int dev_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf)
        if (!dev->netdev_ops->ndo_bpf)
                return -EOPNOTSUPP;
 
+       if (dev->ethtool->hds_config == ETHTOOL_TCP_DATA_SPLIT_ENABLED &&
+           bpf->command == XDP_SETUP_PROG &&
+           bpf->prog && !bpf->prog->aux->xdp_has_frags) {
+               NL_SET_ERR_MSG(bpf->extack,
+                              "unable to propagate XDP to device using tcp-data-split");
+               return -EBUSY;
+       }
+
        if (dev_get_min_mp_channel_count(dev)) {
                NL_SET_ERR_MSG(bpf->extack, "unable to propagate XDP to device using memory provider");
                return -EBUSY;
@@ -9604,6 +9613,12 @@ static int dev_xdp_install(struct net_device *dev, enum bpf_xdp_mode mode,
        struct netdev_bpf xdp;
        int err;
 
+       if (dev->ethtool->hds_config == ETHTOOL_TCP_DATA_SPLIT_ENABLED &&
+           prog && !prog->aux->xdp_has_frags) {
+               NL_SET_ERR_MSG(extack, "unable to install XDP to device using tcp-data-split");
+               return -EBUSY;
+       }
+
        if (dev_get_min_mp_channel_count(dev)) {
                NL_SET_ERR_MSG(extack, "unable to install XDP to device using memory provider");
                return -EBUSY;