Re: [PATCH net-next v7 8/9] net: check for driver support in netmem TX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/8/25 10:40 PM, 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@xxxxxxxxxx>
> Acked-by: Stanislav Fomichev <sdf@xxxxxxxxxxx>
> 
> ---
> 
> v5: https://lore.kernel.org/netdev/20250227041209.2031104-8-almasrymina@xxxxxxxxxx/
> - Check that the dmabuf mappings belongs to the specific device the TX
>   is being sent from (Jakub)
> 
> v4:
> - New patch
> 
> ---
>  net/core/dev.c         | 33 +++++++++++++++++++++++++++++++++
>  net/core/devmem.h      |  6 ++++++
>  net/core/netdev-genl.c |  7 +++++++
>  3 files changed, 46 insertions(+)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 1cb134ff7327..5553947123a0 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3868,10 +3868,43 @@ int skb_csum_hwoffload_help(struct sk_buff *skb,
>  }
>  EXPORT_SYMBOL(skb_csum_hwoffload_help);
>  
> +static struct sk_buff *validate_xmit_unreadable_skb(struct sk_buff *skb,
> +						    struct net_device *dev)
> +{
> +	struct skb_shared_info *shinfo;
> +	struct net_iov *niov;
> +
> +	if (likely(skb_frags_readable(skb)))
> +		goto out;
> +
> +	if (likely(!dev->netmem_tx))

Minor nit: I think the above is actually unlikely. The skb is
unreadable: is supposed to be transmitted on a device supporting
netmem_tx, otherwise we are in exceptional/error path.

No need to repost just for this.

Thanks,

Paolo





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux