DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Sunyang Wu <sunyang.wu@jaguarmicro.com>, dev@dpdk.org
Cc: thomas@monjalon.net, ferruh.yigit@amd.com
Subject: Re: [PATCH v3] ethdev: Align enable logic handling with disable functions
Date: Sat, 26 Jul 2025 11:06:39 +0300	[thread overview]
Message-ID: <efb57831-e1fc-499f-b24d-33fe1ce7b111@oktetlabs.ru> (raw)
In-Reply-To: <20250722010916.33536-1-sunyang.wu@jaguarmicro.com>

Ack from Morten on v2 is lost.

On 7/22/25 04:09, Sunyang Wu wrote:
> This patch modifies the handling logic of the "enable" related

This patch modifies -> Modify

> operations. The key intention is to align it with the processing
> approach of the "disable" functions.
> Previously, there was an inconsistency in how failure scenarios were
> dealt with between the "enable" and "disable" logic. Now, after
> adjustment, their behaviors in exceptional cases are made more uniform.
> Importantly, this change does not introduce any alteration to the actual
> runtime behavior of the functions; it only serves to enhance code
> consistency and maintainability, making the overall logic easier to
> understand and maintain in the long run.
> In this way, we ensure the codebase follows a more cohesive pattern,
> reducing potential confusion during future development and maintenance
> efforts that could stem from logical disparities.
> 
> Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>

Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

> ---
>   lib/ethdev/rte_ethdev.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index dd7c00bc94..41f96071e2 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -3018,7 +3018,8 @@ rte_eth_promiscuous_enable(uint16_t port_id)
>   		return -ENOTSUP;
>   
>   	diag = dev->dev_ops->promiscuous_enable(dev);
> -	dev->data->promiscuous = (diag == 0) ? 1 : 0;
> +	if (diag == 0)
> +		dev->data->promiscuous = 1;

Strictly speaking it changes the behaviour and result could be different
if driver callback modifies the promiscuous or all_multicast itself.
Anyway I agree that the code should be unified and driver should not
touch these flags in data.

>   
>   	diag = eth_err(port_id, diag);
>   
> @@ -3086,7 +3087,8 @@ rte_eth_allmulticast_enable(uint16_t port_id)
>   	if (dev->dev_ops->allmulticast_enable == NULL)
>   		return -ENOTSUP;
>   	diag = dev->dev_ops->allmulticast_enable(dev);
> -	dev->data->all_multicast = (diag == 0) ? 1 : 0;
> +	if (diag == 0)
> +		dev->data->all_multicast = 1;
>   
>   	diag = eth_err(port_id, diag);
>   


      reply	other threads:[~2025-07-26  8:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-22  1:09 Sunyang Wu
2025-07-26  8:06 ` Andrew Rybchenko [this message]

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=efb57831-e1fc-499f-b24d-33fe1ce7b111@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=sunyang.wu@jaguarmicro.com \
    --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).