Skip to content

Commit a08a5c9

Browse files
TaeheeYookuba-moo
authored andcommitted
net: devmem: add ring parameter filtering
If driver doesn't support ring parameter or tcp-data-split configuration is not sufficient, the devmem should not be set up. Before setup the devmem, tcp-data-split should be ON and hds-thresh value should be 0. Tested-by: Stanislav Fomichev <[email protected]> Reviewed-by: Mina Almasry <[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 eec8359 commit a08a5c9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

net/core/devmem.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
#include <linux/dma-buf.h>
11+
#include <linux/ethtool_netlink.h>
1112
#include <linux/genalloc.h>
1213
#include <linux/mm.h>
1314
#include <linux/netdevice.h>
@@ -140,6 +141,16 @@ int net_devmem_bind_dmabuf_to_queue(struct net_device *dev, u32 rxq_idx,
140141
return -ERANGE;
141142
}
142143

144+
if (dev->ethtool->hds_config != ETHTOOL_TCP_DATA_SPLIT_ENABLED) {
145+
NL_SET_ERR_MSG(extack, "tcp-data-split is disabled");
146+
return -EINVAL;
147+
}
148+
149+
if (dev->ethtool->hds_thresh) {
150+
NL_SET_ERR_MSG(extack, "hds-thresh is not zero");
151+
return -EINVAL;
152+
}
153+
143154
rxq = __netif_get_rx_queue(dev, rxq_idx);
144155
if (rxq->mp_params.mp_priv) {
145156
NL_SET_ERR_MSG(extack, "designated queue already memory provider bound");

0 commit comments

Comments
 (0)