Message ID | 20250220020914.895431-9-almasrymina@google.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Device memory TCP TX | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net-next, async |
netdev/apply | fail | Patch does not apply to net-next-0 |
On 02/20, Mina Almasry wrote: > We should not enable netmem TX for drivers that don't declare support. > > Check for driver netmem TX support during devmem TX binding and fail if > the driver does not have the functionality. > > Check for driver support in validate_xmit_skb as well. > > Signed-off-by: Mina Almasry <almasrymina@google.com> Acked-by: Stanislav Fomichev <sdf@fomichev.me>
diff --git a/net/core/dev.c b/net/core/dev.c index ebc000b56828..f65a2b41a2c3 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3850,6 +3850,9 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device skb = validate_xmit_xfrm(skb, features, again); + if (!skb_frags_readable(skb) && !dev->netmem_tx) + goto out_kfree_skb; + return skb; out_kfree_skb: diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index 1faa2cf4057f..a154480a6e22 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -970,6 +970,13 @@ int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info) goto err_unlock; } + if (!netdev->netmem_tx) { + err = -EOPNOTSUPP; + NL_SET_ERR_MSG(info->extack, + "Driver does not support netmem TX"); + goto err_unlock; + } + binding = net_devmem_bind_dmabuf(netdev, DMA_TO_DEVICE, dmabuf_fd, info->extack); if (IS_ERR(binding)) {
We should not enable netmem TX for drivers that don't declare support. Check for driver netmem TX support during devmem TX binding and fail if the driver does not have the functionality. Check for driver support in validate_xmit_skb as well. Signed-off-by: Mina Almasry <almasrymina@google.com> --- v4: - New patch --- net/core/dev.c | 3 +++ net/core/netdev-genl.c | 7 +++++++ 2 files changed, 10 insertions(+)