[dpdk-dev,PATCHv4,3/9] null: extend number of virtual queues

Message ID 1436981189-3320-4-git-send-email-tomaszx.kulasek@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Tomasz Kulasek July 15, 2015, 5:26 p.m. UTC
  This patch adds a possibility to configure more than one queue on null
device.

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
---
 drivers/net/null/rte_eth_null.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
  

Comments

Tetsuya Mukawa Sept. 29, 2015, 2:24 a.m. UTC | #1
On 2015/07/16 2:26, Tomasz Kulasek wrote:
> This patch adds a possibility to configure more than one queue on null
> device.
>
> Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
> ---
>  drivers/net/null/rte_eth_null.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
> index a8b3191..39ffcde 100644
> --- a/drivers/net/null/rte_eth_null.c
> +++ b/drivers/net/null/rte_eth_null.c
> @@ -71,8 +71,8 @@ struct pmd_internals {
>  	unsigned nb_rx_queues;
>  	unsigned nb_tx_queues;
>  
> -	struct null_queue rx_null_queues[1];
> -	struct null_queue tx_null_queues[1];
> +	struct null_queue rx_null_queues[RTE_MAX_QUEUES_PER_PORT];
> +	struct null_queue tx_null_queues[RTE_MAX_QUEUES_PER_PORT];
>  };
>  
>  
> @@ -213,7 +213,7 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
>  	if ((dev == NULL) || (mb_pool == NULL))
>  		return -EINVAL;
>  
> -	if (rx_queue_id != 0)
> +	if (rx_queue_id >= dev->data->nb_rx_queues)
>  		return -ENODEV;
>  
>  	internals = dev->data->dev_private;
> @@ -246,7 +246,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
>  	if (dev == NULL)
>  		return -EINVAL;
>  
> -	if (tx_queue_id != 0)
> +	if (tx_queue_id >= dev->data->nb_tx_queues)
>  		return -ENODEV;
>  
>  	internals = dev->data->dev_private;
> @@ -279,8 +279,8 @@ eth_dev_info(struct rte_eth_dev *dev,
>  	dev_info->driver_name = drivername;
>  	dev_info->max_mac_addrs = 1;
>  	dev_info->max_rx_pktlen = (uint32_t)-1;
> -	dev_info->max_rx_queues = (uint16_t)internals->nb_rx_queues;
> -	dev_info->max_tx_queues = (uint16_t)internals->nb_tx_queues;
> +	dev_info->max_rx_queues = RTE_DIM(internals->rx_null_queues);
> +	dev_info->max_tx_queues = RTE_DIM(internals->tx_null_queues);
>  	dev_info->min_rx_bufsize = 0;
>  	dev_info->pci_dev = NULL;
>  }

Hi Thomasz,

To do like above, should we change below variables also?

static int
eth_dev_null_create(const char *name,
                const unsigned numa_node,
                unsigned packet_size,
                unsigned packet_copy)
{
        const unsigned nb_rx_queues = 1;
        const unsigned nb_tx_queues = 1;

        (snip)

}

Tetsuya
  
Tomasz Kulasek Sept. 29, 2015, 9:46 a.m. UTC | #2
> -----Original Message-----

> From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp]

> Sent: Tuesday, September 29, 2015 04:25

> To: Kulasek, TomaszX; dev@dpdk.org

> Subject: Re: [dpdk-dev] [PATCHv4 3/9] null: extend number of virtual

> queues

> 

> On 2015/07/16 2:26, Tomasz Kulasek wrote:

> > This patch adds a possibility to configure more than one queue on null

> > device.

> >

> > Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>

> > ---

> >  drivers/net/null/rte_eth_null.c |   12 ++++++------

> >  1 file changed, 6 insertions(+), 6 deletions(-)

> >

> > diff --git a/drivers/net/null/rte_eth_null.c

> > b/drivers/net/null/rte_eth_null.c index a8b3191..39ffcde 100644

> > --- a/drivers/net/null/rte_eth_null.c

> > +++ b/drivers/net/null/rte_eth_null.c

> > @@ -71,8 +71,8 @@ struct pmd_internals {

> >  	unsigned nb_rx_queues;

> >  	unsigned nb_tx_queues;

> >

> > -	struct null_queue rx_null_queues[1];

> > -	struct null_queue tx_null_queues[1];

> > +	struct null_queue rx_null_queues[RTE_MAX_QUEUES_PER_PORT];

> > +	struct null_queue tx_null_queues[RTE_MAX_QUEUES_PER_PORT];

> >  };

> >

> >

> > @@ -213,7 +213,7 @@ eth_rx_queue_setup(struct rte_eth_dev *dev,

> uint16_t rx_queue_id,

> >  	if ((dev == NULL) || (mb_pool == NULL))

> >  		return -EINVAL;

> >

> > -	if (rx_queue_id != 0)

> > +	if (rx_queue_id >= dev->data->nb_rx_queues)

> >  		return -ENODEV;

> >

> >  	internals = dev->data->dev_private;

> > @@ -246,7 +246,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev,

> uint16_t tx_queue_id,

> >  	if (dev == NULL)

> >  		return -EINVAL;

> >

> > -	if (tx_queue_id != 0)

> > +	if (tx_queue_id >= dev->data->nb_tx_queues)

> >  		return -ENODEV;

> >

> >  	internals = dev->data->dev_private;

> > @@ -279,8 +279,8 @@ eth_dev_info(struct rte_eth_dev *dev,

> >  	dev_info->driver_name = drivername;

> >  	dev_info->max_mac_addrs = 1;

> >  	dev_info->max_rx_pktlen = (uint32_t)-1;

> > -	dev_info->max_rx_queues = (uint16_t)internals->nb_rx_queues;

> > -	dev_info->max_tx_queues = (uint16_t)internals->nb_tx_queues;

> > +	dev_info->max_rx_queues = RTE_DIM(internals->rx_null_queues);

> > +	dev_info->max_tx_queues = RTE_DIM(internals->tx_null_queues);

> >  	dev_info->min_rx_bufsize = 0;

> >  	dev_info->pci_dev = NULL;

> >  }

> 

> Hi Thomasz,

> 

> To do like above, should we change below variables also?

> 

> static int

> eth_dev_null_create(const char *name,

>                 const unsigned numa_node,

>                 unsigned packet_size,

>                 unsigned packet_copy)

> {

>         const unsigned nb_rx_queues = 1;

>         const unsigned nb_tx_queues = 1;

> 

>         (snip)

> 

> }

> 

> Tetsuya


Hi Tetsuya,

The number of requested queues are configured later, through the rte eth_dev_configure API. Here these values mean the default number of queues after null pmd creation.

Tomasz.
  
Tetsuya Mukawa Sept. 29, 2015, 10:34 a.m. UTC | #3
On 2015/09/29 18:46, Kulasek, TomaszX wrote:
>> -----Original Message-----
>> From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp]
>> Sent: Tuesday, September 29, 2015 04:25
>> To: Kulasek, TomaszX; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [PATCHv4 3/9] null: extend number of virtual
>> queues
>>
>> On 2015/07/16 2:26, Tomasz Kulasek wrote:
>>> This patch adds a possibility to configure more than one queue on null
>>> device.
>>>
>>> Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
>>> ---
>>>  drivers/net/null/rte_eth_null.c |   12 ++++++------
>>>  1 file changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/net/null/rte_eth_null.c
>>> b/drivers/net/null/rte_eth_null.c index a8b3191..39ffcde 100644
>>> --- a/drivers/net/null/rte_eth_null.c
>>> +++ b/drivers/net/null/rte_eth_null.c
>>> @@ -71,8 +71,8 @@ struct pmd_internals {
>>>  	unsigned nb_rx_queues;
>>>  	unsigned nb_tx_queues;
>>>
>>> -	struct null_queue rx_null_queues[1];
>>> -	struct null_queue tx_null_queues[1];
>>> +	struct null_queue rx_null_queues[RTE_MAX_QUEUES_PER_PORT];
>>> +	struct null_queue tx_null_queues[RTE_MAX_QUEUES_PER_PORT];
>>>  };
>>>
>>>
>>> @@ -213,7 +213,7 @@ eth_rx_queue_setup(struct rte_eth_dev *dev,
>> uint16_t rx_queue_id,
>>>  	if ((dev == NULL) || (mb_pool == NULL))
>>>  		return -EINVAL;
>>>
>>> -	if (rx_queue_id != 0)
>>> +	if (rx_queue_id >= dev->data->nb_rx_queues)
>>>  		return -ENODEV;
>>>
>>>  	internals = dev->data->dev_private;
>>> @@ -246,7 +246,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev,
>> uint16_t tx_queue_id,
>>>  	if (dev == NULL)
>>>  		return -EINVAL;
>>>
>>> -	if (tx_queue_id != 0)
>>> +	if (tx_queue_id >= dev->data->nb_tx_queues)
>>>  		return -ENODEV;
>>>
>>>  	internals = dev->data->dev_private;
>>> @@ -279,8 +279,8 @@ eth_dev_info(struct rte_eth_dev *dev,
>>>  	dev_info->driver_name = drivername;
>>>  	dev_info->max_mac_addrs = 1;
>>>  	dev_info->max_rx_pktlen = (uint32_t)-1;
>>> -	dev_info->max_rx_queues = (uint16_t)internals->nb_rx_queues;
>>> -	dev_info->max_tx_queues = (uint16_t)internals->nb_tx_queues;
>>> +	dev_info->max_rx_queues = RTE_DIM(internals->rx_null_queues);
>>> +	dev_info->max_tx_queues = RTE_DIM(internals->tx_null_queues);
>>>  	dev_info->min_rx_bufsize = 0;
>>>  	dev_info->pci_dev = NULL;
>>>  }
>> Hi Thomasz,
>>
>> To do like above, should we change below variables also?
>>
>> static int
>> eth_dev_null_create(const char *name,
>>                 const unsigned numa_node,
>>                 unsigned packet_size,
>>                 unsigned packet_copy)
>> {
>>         const unsigned nb_rx_queues = 1;
>>         const unsigned nb_tx_queues = 1;
>>
>>         (snip)
>>
>> }
>>
>> Tetsuya
> Hi Tetsuya,
>
> The number of requested queues are configured later, through the rte eth_dev_configure API. Here these values mean the default number of queues after null pmd creation.
>
> Tomasz.
>

Hi Tomasz,

I guess we may need to change below variables when a queue is configured.
 - internals->nb_rx_queues;
 - internals->nb_tx_queues;
Without changing, 'num_stats' in eth_stats_get() might be wrong value.

Tetsuya
  
Tomasz Kulasek Sept. 29, 2015, 11:56 a.m. UTC | #4
> 

> Hi Tomasz,

> 

> I guess we may need to change below variables when a queue is

> configured.

>  - internals->nb_rx_queues;

>  - internals->nb_tx_queues;

> Without changing, 'num_stats' in eth_stats_get() might be wrong value.

> 

> Tetsuya


Hi Tetsuya,

I see it now. I was too focused on one case and I missed it. I'll modify it.
Thanks for your help, by the way.

Tomasz
  

Patch

diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index a8b3191..39ffcde 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -71,8 +71,8 @@  struct pmd_internals {
 	unsigned nb_rx_queues;
 	unsigned nb_tx_queues;
 
-	struct null_queue rx_null_queues[1];
-	struct null_queue tx_null_queues[1];
+	struct null_queue rx_null_queues[RTE_MAX_QUEUES_PER_PORT];
+	struct null_queue tx_null_queues[RTE_MAX_QUEUES_PER_PORT];
 };
 
 
@@ -213,7 +213,7 @@  eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
 	if ((dev == NULL) || (mb_pool == NULL))
 		return -EINVAL;
 
-	if (rx_queue_id != 0)
+	if (rx_queue_id >= dev->data->nb_rx_queues)
 		return -ENODEV;
 
 	internals = dev->data->dev_private;
@@ -246,7 +246,7 @@  eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 	if (dev == NULL)
 		return -EINVAL;
 
-	if (tx_queue_id != 0)
+	if (tx_queue_id >= dev->data->nb_tx_queues)
 		return -ENODEV;
 
 	internals = dev->data->dev_private;
@@ -279,8 +279,8 @@  eth_dev_info(struct rte_eth_dev *dev,
 	dev_info->driver_name = drivername;
 	dev_info->max_mac_addrs = 1;
 	dev_info->max_rx_pktlen = (uint32_t)-1;
-	dev_info->max_rx_queues = (uint16_t)internals->nb_rx_queues;
-	dev_info->max_tx_queues = (uint16_t)internals->nb_tx_queues;
+	dev_info->max_rx_queues = RTE_DIM(internals->rx_null_queues);
+	dev_info->max_tx_queues = RTE_DIM(internals->tx_null_queues);
 	dev_info->min_rx_bufsize = 0;
 	dev_info->pci_dev = NULL;
 }