DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Long Li <longli@linuxonhyperv.com>,
	Stephen Hemminger <sthemmin@microsoft.com>
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>,
	Long Li <longli@microsoft.com>
Subject: Re: [dpdk-dev] [PATCH 1/2] net/netvsc: allow setting rx and tx copy break
Date: Fri, 23 Oct 2020 17:21:11 +0100	[thread overview]
Message-ID: <53ea0071-6a22-6efd-f209-f599e1dc1a4d@intel.com> (raw)
In-Reply-To: <1603395970-26797-1-git-send-email-longli@linuxonhyperv.com>

On 10/22/2020 8:46 PM, Long Li wrote:
> From: Stephen Hemminger <stephen@networkplumber.org>
> 
> The values for Rx and Tx copy break should be tunable rather
> than hard coded constants.
> 
> The rx_copybreak sets the threshold where the driver uses an
> external mbuf to avoid having to copy data. Setting 0 for copybreak
> will cause driver to always create an external mbuf. Setting
> a value greater than the MTU would prevent it from ever making
> an external mbuf and always copy. The default value is 256 (bytes).
> 
> Likewise the tx_copybreak sets the threshold where the driver
> aggregates multiple small packets into one request. If tx_copybreak
> is 0 then each packet goes as a VMBus request (no copying).
> If tx_copybreak is set larger than the MTU, then all packets smaller
> than the chunk size of the VMBus send buffer will be copied; larger
> packets always have to go as a single direct request. The default
> value is 512 (bytes).
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Signed-off-by: Long Li <longli@microsoft.com>

<...>

> @@ -45,6 +45,10 @@
>   			    DEV_RX_OFFLOAD_VLAN_STRIP | \
>   			    DEV_RX_OFFLOAD_RSS_HASH)
>   
> +#define NETVSC_ARG_LATENCY "latency"
> +#define NETVSC_ARG_RXBREAK "rx_copybreak"
> +#define NETVSC_ARG_TXBREAK "tx_copybreak"
> +

Can you please document new devargs in the driver documentation?

<...>

> @@ -181,12 +167,32 @@ static int hn_parse_args(const struct rte_eth_dev *dev)
>   		return -EINVAL;
>   	}
>   
> -	ret = rte_kvargs_process(kvlist, "latency", hn_set_latency, hv);
> -	if (ret)
> -		PMD_DRV_LOG(ERR, "Unable to process latency arg\n");
> +	for (i = 0; i != kvlist->count; ++i) {
> +		const struct rte_kvargs_pair *pair = &kvlist->pairs[i];
> +
> +		if (!strcmp(pair->key, NETVSC_ARG_LATENCY))
> +			latency = atoi(pair->value);
> +		else if (!strcmp(pair->key, NETVSC_ARG_RXBREAK))
> +			rx_break = atoi(pair->value);
> +		else if (!strcmp(pair->key, NETVSC_ARG_TXBREAK))
> +			tx_break = atoi(pair->value);
> +	}
> +

Instead of accessing to the kvlist internals, I think better to use 
'rte_kvargs_process()' as done previously.
If the reason to remove callback is to not create a callback for each argument,
a generic one can be used for all.

> +	if (latency >= 0) {
> +		PMD_DRV_LOG(DEBUG, "set latency %d usec", latency);
> +		hv->latency = latency * 1000;	/* usec to nsec */
> +	}
> +	if (rx_break >= 0) {
> +		PMD_DRV_LOG(DEBUG, "rx copy break set to %d", rx_break);
> +		hv->rx_copybreak = rx_break;
> +	}
> +	if (tx_break >= 0) {
> +		PMD_DRV_LOG(DEBUG, "tx copy break set to %d", tx_break);
> +		hv->tx_copybreak = tx_break;
> +	}
>   

When 'rte_kvargs_process()' used, the valued can be assigned directly to 
'hv->tx_copybreak', if the argument is not available, it won't be updated, so 
above check can be dropped.

  parent reply	other threads:[~2020-10-23 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 19:46 Long Li
2020-10-22 19:46 ` [dpdk-dev] [PATCH 2/2] net/netvsc: introduce driver parameter to control the use of external mbuf on receiving data Long Li
2020-10-23 16:23   ` Ferruh Yigit
2020-10-23 16:21 ` Ferruh Yigit [this message]
2020-10-23 19:49   ` [dpdk-dev] [PATCH 1/2] net/netvsc: allow setting rx and tx copy break Long Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53ea0071-6a22-6efd-f209-f599e1dc1a4d@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=longli@linuxonhyperv.com \
    --cc=longli@microsoft.com \
    --cc=stephen@networkplumber.org \
    --cc=sthemmin@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).