diff mbox series

[03/11] netdev: add XDP_SETUP_ZC_RX command

Message ID 20230826011954.1801099-4-dw@davidwei.uk (mailing list archive)
State New
Headers show
Series Zero copy network RX using io_uring | expand

Commit Message

David Wei Aug. 26, 2023, 1:19 a.m. UTC
From: David Wei <davidhwei@meta.com>

This patch adds a new XDP_SETUP_ZC_RX command that will be used in a
later patch to enable or disable ZC RX for a specific RX queue.

Signed-off-by: David Wei <davidhwei@meta.com>
Co-developed-by: Jonathan Lemon <jonathan.lemon@gmail.com>
---
 include/linux/netdevice.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

David Ahern Aug. 26, 2023, 2:21 a.m. UTC | #1
On 8/25/23 6:19 PM, David Wei wrote:
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 08fbd4622ccf..a20a5c847916 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -1000,6 +1000,7 @@ enum bpf_netdev_command {
>  	BPF_OFFLOAD_MAP_ALLOC,
>  	BPF_OFFLOAD_MAP_FREE,
>  	XDP_SETUP_XSK_POOL,
> +	XDP_SETUP_ZC_RX,

Why XDP in the name? Packets go from nic to driver to stack to io_uring,
no? That is not XDP.


>  };
>  
>  struct bpf_prog_offload_ops;
> @@ -1038,6 +1039,11 @@ struct netdev_bpf {
>  			struct xsk_buff_pool *pool;
>  			u16 queue_id;
>  		} xsk;
> +		/* XDP_SETUP_ZC_RX */
> +		struct {
> +			struct io_zc_rx_ifq *ifq;
> +			u16 queue_id;
> +		} zc_rx;
>  	};
>  };
>
David Wei Aug. 26, 2023, 9:37 p.m. UTC | #2
On 25/08/2023 19:21, David Ahern wrote:
> On 8/25/23 6:19 PM, David Wei wrote:
>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>> index 08fbd4622ccf..a20a5c847916 100644
>> --- a/include/linux/netdevice.h
>> +++ b/include/linux/netdevice.h
>> @@ -1000,6 +1000,7 @@ enum bpf_netdev_command {
>>  	BPF_OFFLOAD_MAP_ALLOC,
>>  	BPF_OFFLOAD_MAP_FREE,
>>  	XDP_SETUP_XSK_POOL,
>> +	XDP_SETUP_ZC_RX,
> 
> Why XDP in the name? Packets go from nic to driver to stack to io_uring,
> no? That is not XDP.

This new bpf_netdev_command XDP_SETUP_ZC_RX mirrors XDP_SETUP_XSK_POOL above,
both in terms of naming and purpose (the arg structs are almost identical).

However, I dislike this way of toggling ZC RX support anyway and am happy to
change it to a better method e.g. properly supports namespaces.

> 
> 
>>  };
>>  
>>  struct bpf_prog_offload_ops;
>> @@ -1038,6 +1039,11 @@ struct netdev_bpf {
>>  			struct xsk_buff_pool *pool;
>>  			u16 queue_id;
>>  		} xsk;
>> +		/* XDP_SETUP_ZC_RX */
>> +		struct {
>> +			struct io_zc_rx_ifq *ifq;
>> +			u16 queue_id;
>> +		} zc_rx;
>>  	};
>>  };
>>  
>
diff mbox series

Patch

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 08fbd4622ccf..a20a5c847916 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1000,6 +1000,7 @@  enum bpf_netdev_command {
 	BPF_OFFLOAD_MAP_ALLOC,
 	BPF_OFFLOAD_MAP_FREE,
 	XDP_SETUP_XSK_POOL,
+	XDP_SETUP_ZC_RX,
 };
 
 struct bpf_prog_offload_ops;
@@ -1038,6 +1039,11 @@  struct netdev_bpf {
 			struct xsk_buff_pool *pool;
 			u16 queue_id;
 		} xsk;
+		/* XDP_SETUP_ZC_RX */
+		struct {
+			struct io_zc_rx_ifq *ifq;
+			u16 queue_id;
+		} zc_rx;
 	};
 };