DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@amd.com>
To: Stephen Hemminger <stephen@networkplumber.org>, dev@dpdk.org
Cc: thomas@monjalon.net, Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: Re: [PATCH] ethdev: validate reserved fields
Date: Tue, 6 Jun 2023 16:24:36 +0100	[thread overview]
Message-ID: <2365bf8b-aafd-872b-2b13-8ba09d985747@amd.com> (raw)
In-Reply-To: <20230525203942.129413-1-stephen@networkplumber.org>

On 5/25/2023 9:39 PM, Stephen Hemminger wrote:
> The various reserved fields added to ethdev could not be
> safely used for future extensions because they were never
> checked on input. Therefore ABI would be broken if these
> fields were added in a future DPDK release.
> 
> Fixes: 436b3a6b6e62 ("ethdev: reserve space in main structs for extension")
> Cc: thomas@monjalon.net
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/ethdev/rte_ethdev.c | 41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index 4d0325568322..4f937a1914c9 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -1228,6 +1228,25 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>  	/* Backup mtu for rollback */
>  	old_mtu = dev->data->mtu;
>  
> +	/* fields must be zero to reserve them for future ABI changes */
> +	if (dev_conf->rxmode.reserved_64s[0] != 0 ||
> +	    dev_conf->rxmode.reserved_64s[1] != 0 ||
> +	    dev_conf->rxmode.reserved_ptrs[0] != NULL ||
> +	    dev_conf->rxmode.reserved_ptrs[1] != NULL) {
> +		RTE_ETHDEV_LOG(ERR, "Rxmode reserved fields not zero\n");
> +		ret = -EINVAL;
> +		goto rollback;
> +	}
> +
> +	if (dev_conf->txmode.reserved_64s[0] != 0 ||
> +	    dev_conf->txmode.reserved_64s[1] != 0 ||
> +	    dev_conf->txmode.reserved_ptrs[0] != NULL ||
> +	    dev_conf->txmode.reserved_ptrs[1] != NULL) {
> +		RTE_ETHDEV_LOG(ERR, "txmode reserved fields not zero\n");
> +		ret = -EINVAL;
> +		goto rollback;
> +	}
> +
>


No objection on validating reserved fields, but if any application
passing not zero values before (I think this was possible), it will
break with this change, so can we get this patch in this release?

Or should it need to wait ABI break release?
If we will wait v23.11, perhaps this should be applied to all structs
with reserved fields, and may be good to add a deprecation notice in
this release, what do you think?


  parent reply	other threads:[~2023-06-06 15:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 20:39 Stephen Hemminger
2023-05-26  8:15 ` Bruce Richardson
2023-09-21 15:12   ` Ferruh Yigit
2023-09-21 16:33     ` Ferruh Yigit
2023-09-22 15:23       ` Ferruh Yigit
2023-06-06 15:24 ` Ferruh Yigit [this message]
2023-06-06 15:38   ` Stephen Hemminger
2023-09-21 14:09 ` Ferruh Yigit

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=2365bf8b-aafd-872b-2b13-8ba09d985747@amd.com \
    --to=ferruh.yigit@amd.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /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).