All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Andrew Rybchenko <arybchenko@solarflare.com>,
	dev@dpdk.org, Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Subject: Re: [RFC PATCH 1/2] ethdev: add function to adjust number of descriptors
Date: Mon, 24 Apr 2017 17:13:55 +0200	[thread overview]
Message-ID: <2685953.rHhyh0R7Aq@xps> (raw)
In-Reply-To: <1488459935-13273-2-git-send-email-arybchenko@solarflare.com>

Hi,

02/03/2017 14:05, Andrew Rybchenko:
> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> 
> Check that numbers of Rx and Tx descriptors satisfy descriptors limits
> from the Ethernet device information, otherwise adjust them to boundaries.
> 
> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

I think this helper is OK.
We could add it in 17.08.

Is there any comment from PMD maintainers?

[...]
> +static void
> +rte_eth_dev_adjust_nb_desc(uint16_t *nb_desc,
> +			   const struct rte_eth_desc_lim *desc_lim)
> +{
> +	if (desc_lim->nb_align != 0)
> +		*nb_desc = RTE_ALIGN_CEIL(*nb_desc, desc_lim->nb_align);
> +
> +	if (desc_lim->nb_max != 0)
> +		*nb_desc = RTE_MIN(*nb_desc, desc_lim->nb_max);
> +
> +	*nb_desc = RTE_MAX(*nb_desc, desc_lim->nb_min);
> +}
> +
> +int
> +rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
> +				 uint16_t *nb_rx_desc,
> +				 uint16_t *nb_tx_desc)
> +{
> +	struct rte_eth_dev *dev;
> +	struct rte_eth_dev_info dev_info;
> +
> +	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> +
> +	dev = &rte_eth_devices[port_id];
> +	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
> +
> +	rte_eth_dev_info_get(port_id, &dev_info);
> +
> +	if (nb_rx_desc != NULL)
> +		rte_eth_dev_adjust_nb_desc(nb_rx_desc, &dev_info.rx_desc_lim);
> +
> +	if (nb_tx_desc != NULL)
> +		rte_eth_dev_adjust_nb_desc(nb_tx_desc, &dev_info.tx_desc_lim);
> +
> +	return 0;
> +}
[...]
> +/**
> + * Check that numbers of Rx and Tx descriptors satisfy descriptors limits from
> + * the ethernet device information, otherwise adjust them to boundaries.
> + *
> + * @param port_id
> + *   The port identifier of the Ethernet device.
> + * @param nb_rx_desc
> + *   A pointer to a uint16_t where the number of receive
> + *   descriptors stored.
> + * @param nb_tx_desc
> + *   A pointer to a uint16_t where the number of transmit
> + *   descriptors stored.
> + * @return
> + *   - (0) if successful.
> + *   - (-ENOTSUP, -ENODEV or -EINVAL) on failure.
> + */
> +int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
> +				     uint16_t *nb_rx_desc,
> +				     uint16_t *nb_tx_desc);
> +

  reply	other threads:[~2017-04-24 15:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 13:05 [RFC PATCH 0/2] Helper function to ajdust Rx/Tx descriptor numbers Andrew Rybchenko
2017-03-02 13:05 ` [RFC PATCH 1/2] ethdev: add function to adjust number of descriptors Andrew Rybchenko
2017-04-24 15:13   ` Thomas Monjalon [this message]
2017-04-25  7:39     ` Andrew Rybchenko
2017-05-25 15:57   ` [PATCH " Andrew Rybchenko
2017-05-25 15:57     ` [PATCH 2/2] examples: adjust Rx and Tx descriptors to device limits Andrew Rybchenko
2017-07-08 17:05       ` Stephen Hemminger
2017-07-09  9:40         ` Andrew Rybchenko
2017-05-25 17:40     ` [PATCH 1/2] ethdev: add function to adjust number of descriptors Stephen Hemminger
2017-06-14 10:37       ` Andrew Rybchenko
2017-07-05 23:00         ` Thomas Monjalon
2017-07-08 16:45           ` Thomas Monjalon
2017-03-02 13:05 ` [RFC PATCH 2/2] examples/l3fwd: add check of Rx and Tx descriptors number Andrew Rybchenko

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=2685953.rHhyh0R7Aq@xps \
    --to=thomas@monjalon.net \
    --cc=Roman.Zhukov@oktetlabs.ru \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.