[dpdk-dev] [PATCH 1/2] net/netvsc: allow setting rx and tx copy break
Ferruh Yigit
ferruh.yigit at intel.com
Fri Oct 23 18:21:11 CEST 2020
On 10/22/2020 8:46 PM, Long Li wrote:
> From: Stephen Hemminger <stephen at 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 at networkplumber.org>
> Signed-off-by: Long Li <longli at 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.
More information about the dev
mailing list