af_packet: allow configuring number of rings

Message ID 20200224231117.16354-1-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series af_packet: allow configuring number of rings |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed

Commit Message

Stephen Hemminger Feb. 24, 2020, 11:11 p.m. UTC
  The maximum number of rings in af_packet is hard coded as 16.
The user should be able to configure this as part of DPDK config.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 config/common_base                        | 1 +
 drivers/net/af_packet/rte_eth_af_packet.c | 3 +++
 2 files changed, 4 insertions(+)
  

Comments

Ferruh Yigit Feb. 27, 2020, 5:20 p.m. UTC | #1
On 2/24/2020 11:11 PM, Stephen Hemminger wrote:
> The maximum number of rings in af_packet is hard coded as 16.
> The user should be able to configure this as part of DPDK config.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  config/common_base                        | 1 +
>  drivers/net/af_packet/rte_eth_af_packet.c | 3 +++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/config/common_base b/config/common_base
> index 6ea9c63cc36b..dd154a474b57 100644
> --- a/config/common_base
> +++ b/config/common_base
> @@ -468,6 +468,7 @@ CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n
>  # Compile software PMD backed by AF_PACKET sockets (Linux only)
>  #
>  CONFIG_RTE_LIBRTE_PMD_AF_PACKET=n
> +CONFIG_RTE_PMD_AF_PACKET_MAX_RINGS=16
>  

Not sure about adding a new config option for this.

There is already "qpairs" devarg, allocating queues dynamically, instead of
using a per-defined sized arrays, should enable removing
'RTE_PMD_AF_PACKET_MAX_RINGS' completely.
  
Stephen Hemminger Feb. 27, 2020, 5:51 p.m. UTC | #2
On Thu, 27 Feb 2020 17:20:45 +0000
Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 2/24/2020 11:11 PM, Stephen Hemminger wrote:
> > The maximum number of rings in af_packet is hard coded as 16.
> > The user should be able to configure this as part of DPDK config.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  config/common_base                        | 1 +
> >  drivers/net/af_packet/rte_eth_af_packet.c | 3 +++
> >  2 files changed, 4 insertions(+)
> > 
> > diff --git a/config/common_base b/config/common_base
> > index 6ea9c63cc36b..dd154a474b57 100644
> > --- a/config/common_base
> > +++ b/config/common_base
> > @@ -468,6 +468,7 @@ CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n
> >  # Compile software PMD backed by AF_PACKET sockets (Linux only)
> >  #
> >  CONFIG_RTE_LIBRTE_PMD_AF_PACKET=n
> > +CONFIG_RTE_PMD_AF_PACKET_MAX_RINGS=16
> >    
> 
> Not sure about adding a new config option for this.
> 
> There is already "qpairs" devarg, allocating queues dynamically, instead of
> using a per-defined sized arrays, should enable removing
> 'RTE_PMD_AF_PACKET_MAX_RINGS' completely.

But the current driver does not allow qpairs > 16.
This is a config option to allow more.
  
Ferruh Yigit Feb. 27, 2020, 5:55 p.m. UTC | #3
On 2/27/2020 5:51 PM, Stephen Hemminger wrote:
> On Thu, 27 Feb 2020 17:20:45 +0000
> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> 
>> On 2/24/2020 11:11 PM, Stephen Hemminger wrote:
>>> The maximum number of rings in af_packet is hard coded as 16.
>>> The user should be able to configure this as part of DPDK config.
>>>
>>> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>>> ---
>>>  config/common_base                        | 1 +
>>>  drivers/net/af_packet/rte_eth_af_packet.c | 3 +++
>>>  2 files changed, 4 insertions(+)
>>>
>>> diff --git a/config/common_base b/config/common_base
>>> index 6ea9c63cc36b..dd154a474b57 100644
>>> --- a/config/common_base
>>> +++ b/config/common_base
>>> @@ -468,6 +468,7 @@ CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n
>>>  # Compile software PMD backed by AF_PACKET sockets (Linux only)
>>>  #
>>>  CONFIG_RTE_LIBRTE_PMD_AF_PACKET=n
>>> +CONFIG_RTE_PMD_AF_PACKET_MAX_RINGS=16
>>>    
>>
>> Not sure about adding a new config option for this.
>>
>> There is already "qpairs" devarg, allocating queues dynamically, instead of
>> using a per-defined sized arrays, should enable removing
>> 'RTE_PMD_AF_PACKET_MAX_RINGS' completely.
> 
> But the current driver does not allow qpairs > 16.
> This is a config option to allow more.
> 

This can be done without config option by removing 16 limitation.
  

Patch

diff --git a/config/common_base b/config/common_base
index 6ea9c63cc36b..dd154a474b57 100644
--- a/config/common_base
+++ b/config/common_base
@@ -468,6 +468,7 @@  CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n
 # Compile software PMD backed by AF_PACKET sockets (Linux only)
 #
 CONFIG_RTE_LIBRTE_PMD_AF_PACKET=n
+CONFIG_RTE_PMD_AF_PACKET_MAX_RINGS=16
 
 #
 # Compile software PMD backed by AF_XDP sockets (Linux only)
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index f5806bf42c46..6e90d231ca4f 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -6,6 +6,7 @@ 
  * All rights reserved.
  */
 
+#include <rte_config.h>
 #include <rte_string_fns.h>
 #include <rte_mbuf.h>
 #include <rte_ethdev_driver.h>
@@ -37,7 +38,9 @@ 
 #define DFLT_FRAME_SIZE		(1 << 11)
 #define DFLT_FRAME_COUNT	(1 << 9)
 
+#ifndef RTE_PMD_AF_PACKET_MAX_RINGS
 #define RTE_PMD_AF_PACKET_MAX_RINGS 16
+#endif
 
 struct pkt_rx_queue {
 	int sockfd;