DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v2] ethdev: Align enable logic handling with disable functions
@ 2025-07-21 13:05 Sunyang Wu
  2025-07-21 13:09 ` Thomas Monjalon
  2025-07-22 10:15 ` Morten Brørup
  0 siblings, 2 replies; 3+ messages in thread
From: Sunyang Wu @ 2025-07-21 13:05 UTC (permalink / raw)
  To: dev; +Cc: thomas, ferruh.yigit, andrew.rybchenko, stable

This patch modifies the handling logic of the "enable" related
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.

Cc: stable@dpdk.org

Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
---
 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;
 
 	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);
 
-- 
2.19.0.rc0.windows.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ethdev: Align enable logic handling with disable functions
  2025-07-21 13:05 [PATCH v2] ethdev: Align enable logic handling with disable functions Sunyang Wu
@ 2025-07-21 13:09 ` Thomas Monjalon
  2025-07-22 10:15 ` Morten Brørup
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2025-07-21 13:09 UTC (permalink / raw)
  To: Sunyang Wu; +Cc: dev, ferruh.yigit, andrew.rybchenko, stable

21/07/2025 15:05, Sunyang Wu:
> This patch modifies the handling logic of the "enable" related
> 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.
> 
> Cc: stable@dpdk.org

No need this Cc, as it is an improvement, no need to backport.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] ethdev: Align enable logic handling with disable functions
  2025-07-21 13:05 [PATCH v2] ethdev: Align enable logic handling with disable functions Sunyang Wu
  2025-07-21 13:09 ` Thomas Monjalon
@ 2025-07-22 10:15 ` Morten Brørup
  1 sibling, 0 replies; 3+ messages in thread
From: Morten Brørup @ 2025-07-22 10:15 UTC (permalink / raw)
  To: Sunyang Wu, dev; +Cc: thomas, ferruh.yigit, andrew.rybchenko, stable

> From: Sunyang Wu [mailto:sunyang.wu@jaguarmicro.com]
> Sent: Monday, 21 July 2025 15.06
> 
> This patch modifies the handling logic of the "enable" related
> 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.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
> ---
>  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;
> 
>  	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);
> 
> --
> 2.19.0.rc0.windows.1

Acked-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-22 10:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-21 13:05 [PATCH v2] ethdev: Align enable logic handling with disable functions Sunyang Wu
2025-07-21 13:09 ` Thomas Monjalon
2025-07-22 10:15 ` Morten Brørup

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).