DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: Stephen Hemminger <stephen@networkplumber.org>, <dev@dpdk.org>
Subject: Re: [dpdk-dev] [RFC] ethdev: add min/max MTU to device info
Date: Thu, 6 Sep 2018 09:29:32 +0300	[thread overview]
Message-ID: <b817acca-439d-da4f-311d-13b5a25cb417@solarflare.com> (raw)
In-Reply-To: <20180905164157.844-1-stephen@networkplumber.org>

On 09/05/2018 07:41 PM, Stephen Hemminger wrote:
> This addresses the usability issue raised by OVS at DPDK Userspace
> summit. It adds general min/max mtu into device info. For compatiablity,
> and to save space, it fits in a hole in existing structure.

It is true for amd64, but it looks like it is false on 32-bit. So, ABI 
breakage.

> The initial version sets max mtu to normal Ethernet, it is up to
> PMD to set larger value if it supports Jumbo frames.
>
> Fixing the drivers to use this is trivial and can be done by 18.11.
> Already have some of the patches done.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>   lib/librte_ethdev/rte_ethdev.c | 7 +++++++
>   lib/librte_ethdev/rte_ethdev.h | 2 ++
>   2 files changed, 9 insertions(+)
>
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index 4c320250589a..df0c7536a7c4 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -2408,6 +2408,8 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
>   	dev_info->rx_desc_lim = lim;
>   	dev_info->tx_desc_lim = lim;
>   	dev_info->device = dev->device;
> +	dev_info->min_mtu = ETHER_MIN_MTU;
> +	dev_info->max_mtu = ETHER_MTU;
>   
>   	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
>   	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
> @@ -2471,12 +2473,17 @@ int
>   rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu)
>   {
>   	int ret;
> +	struct rte_eth_dev_info dev_info;
>   	struct rte_eth_dev *dev;
>   
>   	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->mtu_set, -ENOTSUP);
>   
> +	rte_eth_dev_info_get(port_id, &dev_info);
> +	if (mtu < dev_info.min_mtu || mtu > dev_info.max_mtu)
> +		return -EINVAL;
> +

The check breaks set MTU to value larger than ETHER_MTU for not
updated drivers. So, IMHO, it should be pushed only with appropriate
updates in all drivers which support bigger MTU.

>   	ret = (*dev->dev_ops->mtu_set)(dev, mtu);
>   	if (!ret)
>   		dev->data->mtu = mtu;
> diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
> index 7070e9ab408f..5171a9083288 100644
> --- a/lib/librte_ethdev/rte_ethdev.h
> +++ b/lib/librte_ethdev/rte_ethdev.h
> @@ -1015,6 +1015,8 @@ struct rte_eth_dev_info {
>   	const char *driver_name; /**< Device Driver name. */
>   	unsigned int if_index; /**< Index to bound host interface, or 0 if none.
>   		Use if_indextoname() to translate into an interface name. */
> +	uint16_t min_mtu;	/**< Minimum MTU allowed */
> +	uint16_t max_mtu;	/**< Maximum MTU allowed */
>   	const uint32_t *dev_flags; /**< Device flags */
>   	uint32_t min_rx_bufsize; /**< Minimum size of RX buffer. */
>   	uint32_t max_rx_pktlen; /**< Maximum configurable length of RX pkt. */

  parent reply	other threads:[~2018-09-06  6:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05 16:41 Stephen Hemminger
2018-09-06  5:51 ` Shahaf Shuler
2018-09-06  6:29 ` Andrew Rybchenko [this message]
2018-09-06 10:52   ` Stephen Hemminger
2018-11-22  9:58     ` Stokes, Ian
2018-12-19  2:37 ` Thomas Monjalon
2019-01-16 21:30   ` Stephen Hemminger
2019-02-06 13:05 ` Morten Brørup
2019-02-06 16:11   ` Stephen Hemminger
2019-02-06 21:58     ` Morten Brørup
2019-02-07 10:25       ` Ananyev, Konstantin
2019-02-07 11:10         ` Morten Brørup
2019-02-07 12:00           ` Ananyev, Konstantin
2019-02-20 16:02             ` Ian Stokes
2019-06-24 13:18               ` Nithin Kumar Dabilpuram

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=b817acca-439d-da4f-311d-13b5a25cb417@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.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 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).