[v1,2/2] net/af_xdp: name the umem memzone dynamically

Message ID 20190418152056.15018-2-xiaolong.ye@intel.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • [v1,1/2] net/af_xdp: name the buf ring dynamically
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Xiaolong Ye April 18, 2019, 3:20 p.m.
Naming the umem memzone dynamically allows to create multiple af_xdp vdevs.

Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")

Reported-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

David Marchand April 19, 2019, 9:47 a.m. | #1
On Thu, Apr 18, 2019 at 5:27 PM Xiaolong Ye <xiaolong.ye@intel.com> wrote:

> Naming the umem memzone dynamically allows to create multiple af_xdp vdevs.
>
> Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")
>
> Reported-by: Markus Theil <markus.theil@tu-ilmenau.de>
> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> ---
>  drivers/net/af_xdp/rte_eth_af_xdp.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
> b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index d8e99204e..666b4c17e 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -483,6 +483,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals
> *internals)
>                 .frame_size = ETH_AF_XDP_FRAME_SIZE,
>                 .frame_headroom = ETH_AF_XDP_DATA_HEADROOM };
>         char ring_name[RTE_RING_NAMESIZE];
> +       char mz_name[RTE_MEMZONE_NAMESIZE];
>         int ret;
>         uint64_t i;
>
> @@ -508,7 +509,9 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals
> *internals)
>                                  (void *)(i * ETH_AF_XDP_FRAME_SIZE +
>                                           ETH_AF_XDP_DATA_HEADROOM));
>
> -       mz = rte_memzone_reserve_aligned("af_xdp uemem",
> +       ret = snprintf(mz_name, sizeof(mz_name), "af_xdp_umem_%s_%d",
> +                      internals->if_name, internals->queue_idx);
>

Idem previous patch.

+       mz = rte_memzone_reserve_aligned(mz_name,
>                         ETH_AF_XDP_NUM_BUFFERS * ETH_AF_XDP_FRAME_SIZE,
>                         rte_socket_id(), RTE_MEMZONE_IOVA_CONTIG,
>                         getpagesize());
> --
> 2.17.1
>
>
How about squashing those two patches as a single one ?
The issue is that you can't create multiple devices. Having the first one
still leaves the issue.


Reviewed-by: David Marchand <david.marchand@redhat.com>
Ferruh Yigit April 19, 2019, 12:33 p.m. | #2
On 4/19/2019 10:47 AM, David Marchand wrote:
> On Thu, Apr 18, 2019 at 5:27 PM Xiaolong Ye <xiaolong.ye@intel.com> wrote:
> 
>> Naming the umem memzone dynamically allows to create multiple af_xdp vdevs.
>>
>> Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")
>>
>> Reported-by: Markus Theil <markus.theil@tu-ilmenau.de>
>> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
>> ---
>>  drivers/net/af_xdp/rte_eth_af_xdp.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
>> b/drivers/net/af_xdp/rte_eth_af_xdp.c
>> index d8e99204e..666b4c17e 100644
>> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
>> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
>> @@ -483,6 +483,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals
>> *internals)
>>                 .frame_size = ETH_AF_XDP_FRAME_SIZE,
>>                 .frame_headroom = ETH_AF_XDP_DATA_HEADROOM };
>>         char ring_name[RTE_RING_NAMESIZE];
>> +       char mz_name[RTE_MEMZONE_NAMESIZE];
>>         int ret;
>>         uint64_t i;
>>
>> @@ -508,7 +509,9 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals
>> *internals)
>>                                  (void *)(i * ETH_AF_XDP_FRAME_SIZE +
>>                                           ETH_AF_XDP_DATA_HEADROOM));
>>
>> -       mz = rte_memzone_reserve_aligned("af_xdp uemem",
>> +       ret = snprintf(mz_name, sizeof(mz_name), "af_xdp_umem_%s_%d",
>> +                      internals->if_name, internals->queue_idx);
>>
> 
> Idem previous patch.
> 
> +       mz = rte_memzone_reserve_aligned(mz_name,
>>                         ETH_AF_XDP_NUM_BUFFERS * ETH_AF_XDP_FRAME_SIZE,
>>                         rte_socket_id(), RTE_MEMZONE_IOVA_CONTIG,
>>                         getpagesize());
>> --
>> 2.17.1
>>
>>
> How about squashing those two patches as a single one ?
> The issue is that you can't create multiple devices. Having the first one
> still leaves the issue.
> 

+1 to squash. let me make a new version applying minor issues you pointed in
other patch, squashing both and keeping your review tag.

> 
> Reviewed-by: David Marchand <david.marchand@redhat.com>
>
Xiaolong Ye April 19, 2019, 3:05 p.m. | #3
On 04/19, Ferruh Yigit wrote:
>On 4/19/2019 10:47 AM, David Marchand wrote:
>> On Thu, Apr 18, 2019 at 5:27 PM Xiaolong Ye <xiaolong.ye@intel.com> wrote:
>> 
>>> Naming the umem memzone dynamically allows to create multiple af_xdp vdevs.
>>>
>>> Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")
>>>
>>> Reported-by: Markus Theil <markus.theil@tu-ilmenau.de>
>>> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
>>> ---
>>>  drivers/net/af_xdp/rte_eth_af_xdp.c | 5 ++++-
>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
>>> b/drivers/net/af_xdp/rte_eth_af_xdp.c
>>> index d8e99204e..666b4c17e 100644
>>> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
>>> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
>>> @@ -483,6 +483,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals
>>> *internals)
>>>                 .frame_size = ETH_AF_XDP_FRAME_SIZE,
>>>                 .frame_headroom = ETH_AF_XDP_DATA_HEADROOM };
>>>         char ring_name[RTE_RING_NAMESIZE];
>>> +       char mz_name[RTE_MEMZONE_NAMESIZE];
>>>         int ret;
>>>         uint64_t i;
>>>
>>> @@ -508,7 +509,9 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals
>>> *internals)
>>>                                  (void *)(i * ETH_AF_XDP_FRAME_SIZE +
>>>                                           ETH_AF_XDP_DATA_HEADROOM));
>>>
>>> -       mz = rte_memzone_reserve_aligned("af_xdp uemem",
>>> +       ret = snprintf(mz_name, sizeof(mz_name), "af_xdp_umem_%s_%d",
>>> +                      internals->if_name, internals->queue_idx);
>>>
>> 
>> Idem previous patch.
>> 
>> +       mz = rte_memzone_reserve_aligned(mz_name,
>>>                         ETH_AF_XDP_NUM_BUFFERS * ETH_AF_XDP_FRAME_SIZE,
>>>                         rte_socket_id(), RTE_MEMZONE_IOVA_CONTIG,
>>>                         getpagesize());
>>> --
>>> 2.17.1
>>>
>>>
>> How about squashing those two patches as a single one ?
>> The issue is that you can't create multiple devices. Having the first one
>> still leaves the issue.
>> 
>
>+1 to squash. let me make a new version applying minor issues you pointed in
>other patch, squashing both and keeping your review tag.

Thanks for doing the new patch.

>
>> 
>> Reviewed-by: David Marchand <david.marchand@redhat.com>
>> 
>

Patch

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index d8e99204e..666b4c17e 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -483,6 +483,7 @@  xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals)
 		.frame_size = ETH_AF_XDP_FRAME_SIZE,
 		.frame_headroom = ETH_AF_XDP_DATA_HEADROOM };
 	char ring_name[RTE_RING_NAMESIZE];
+	char mz_name[RTE_MEMZONE_NAMESIZE];
 	int ret;
 	uint64_t i;
 
@@ -508,7 +509,9 @@  xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals)
 				 (void *)(i * ETH_AF_XDP_FRAME_SIZE +
 					  ETH_AF_XDP_DATA_HEADROOM));
 
-	mz = rte_memzone_reserve_aligned("af_xdp uemem",
+	ret = snprintf(mz_name, sizeof(mz_name), "af_xdp_umem_%s_%d",
+		       internals->if_name, internals->queue_idx);
+	mz = rte_memzone_reserve_aligned(mz_name,
 			ETH_AF_XDP_NUM_BUFFERS * ETH_AF_XDP_FRAME_SIZE,
 			rte_socket_id(), RTE_MEMZONE_IOVA_CONTIG,
 			getpagesize());