[dpdk-dev] [PATCHv4 4/9] null: virtual dynamic rss configuration

Tetsuya Mukawa mukawa at igel.co.jp
Tue Sep 29 04:24:51 CEST 2015


On 2015/07/16 2:26, Tomasz Kulasek wrote:
> This implementation allows to set and read RSS configuration for null
> device, and is used to validate right values propagation over the slaves,
> in test units for dynamic RSS configuration for bonding.
>
> Signed-off-by: Tomasz Kulasek <tomaszx.kulasek at intel.com>
> ---
>  drivers/net/null/rte_eth_null.c |  116 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 116 insertions(+)
>
> diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
> index 39ffcde..f393422 100644
> --- a/drivers/net/null/rte_eth_null.c
> +++ b/drivers/net/null/rte_eth_null.c
> +static int
> +eth_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf)
> +{
> +	struct pmd_internals *internal = dev->data->dev_private;
> +
> +	rte_spinlock_lock(&internal->rss_lock);
> +
> +	if ((rss_conf->rss_hf & internal->flow_type_rss_offloads) != 0)
> +		dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf =
> +				rss_conf->rss_hf & internal->flow_type_rss_offloads;
> +
> +	if (rss_conf->rss_key)
> +		memcpy(internal->rss_key, rss_conf->rss_key, 40);
> +
> +	rte_spinlock_unlock(&internal->rss_lock);
> +
> +	return 0;
> +}
> +
> +static int
> +eth_rss_hash_conf_get(struct rte_eth_dev *dev,
> +		struct rte_eth_rss_conf *rss_conf)
> +{
> +	struct pmd_internals *internal = dev->data->dev_private;
> +
> +	rte_spinlock_lock(&internal->rss_lock);
> +
> +	rss_conf->rss_hf = dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf;
> +	if (rss_conf->rss_key)
> +		memcpy(rss_conf->rss_key, internal->rss_key, 40);
> +
> +	rte_spinlock_unlock(&internal->rss_lock);
> +
> +	return 0;
> +}
> +
>  static const struct eth_dev_ops ops = {
>  	.dev_start = eth_dev_start,
>  	.dev_stop = eth_dev_stop,
> @@ -436,6 +547,11 @@ eth_dev_null_create(const char *name,
>  	internals->packet_copy = packet_copy;
>  	internals->numa_node = numa_node;
>  
> +	internals->flow_type_rss_offloads =  ETH_RSS_PROTO_MASK;
> +	internals->reta_size = RTE_DIM(internals->reta_conf) * RTE_RETA_GROUP_SIZE;
> +
> +	memcpy(internals->rss_key, default_rss_key, 40);
> +
>  	eth_drv->pci_drv.name = drivername;
>  
>  	pci_dev->numa_node = numa_node;

Hi Thomasz,

I am just curious. Is it possible to use rte_memcpy instead of memcpy?
if we can, rte_memcpy may be faster.

Tetsuya


More information about the dev mailing list