netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ionic: Simplify maximum determination in ionic_adminq_napi()
@ 2025-03-01 10:12 Markus Elfring
  2025-03-03  7:15 ` Michal Swiatkowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Markus Elfring @ 2025-03-01 10:12 UTC (permalink / raw)
  To: netdev, Andrew Lunn, Brett Creeley, David S. Miller, Eric Dumazet,
	Jacob Keller, Jakub Kicinski, Paolo Abeni, Shannon Nelson
  Cc: LKML, kernel-janitors, Qasim Ijaz, Natalie Vock

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Mar 2025 11:01:28 +0100

Reduce nested max() calls by a single max3() call in this
function implementation.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index 7707a9e53c43..85c4b02bd054 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -1242,7 +1242,7 @@ static int ionic_adminq_napi(struct napi_struct *napi, int budget)
 	if (lif->hwstamp_txq)
 		tx_work = ionic_tx_cq_service(&lif->hwstamp_txq->cq, budget, !!budget);

-	work_done = max(max(n_work, a_work), max(rx_work, tx_work));
+	work_done = max3(n_work, a_work, max(rx_work, tx_work));
 	if (work_done < budget && napi_complete_done(napi, work_done)) {
 		flags |= IONIC_INTR_CRED_UNMASK;
 		intr->rearm_count++;
--
2.48.1


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

* Re: [PATCH net-next] ionic: Simplify maximum determination in ionic_adminq_napi()
  2025-03-01 10:12 [PATCH net-next] ionic: Simplify maximum determination in ionic_adminq_napi() Markus Elfring
@ 2025-03-03  7:15 ` Michal Swiatkowski
  2025-03-03 17:04 ` Nelson, Shannon
  2025-03-05  1:06 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Swiatkowski @ 2025-03-03  7:15 UTC (permalink / raw)
  To: Markus Elfring
  Cc: netdev, Andrew Lunn, Brett Creeley, David S. Miller, Eric Dumazet,
	Jacob Keller, Jakub Kicinski, Paolo Abeni, Shannon Nelson, LKML,
	kernel-janitors, Qasim Ijaz, Natalie Vock

On Sat, Mar 01, 2025 at 11:12:31AM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 1 Mar 2025 11:01:28 +0100
> 
> Reduce nested max() calls by a single max3() call in this
> function implementation.
> 
> The source code was transformed by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> index 7707a9e53c43..85c4b02bd054 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> @@ -1242,7 +1242,7 @@ static int ionic_adminq_napi(struct napi_struct *napi, int budget)
>  	if (lif->hwstamp_txq)
>  		tx_work = ionic_tx_cq_service(&lif->hwstamp_txq->cq, budget, !!budget);
> 
> -	work_done = max(max(n_work, a_work), max(rx_work, tx_work));
> +	work_done = max3(n_work, a_work, max(rx_work, tx_work));
>  	if (work_done < budget && napi_complete_done(napi, work_done)) {
>  		flags |= IONIC_INTR_CRED_UNMASK;
>  		intr->rearm_count++;

Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>

> --
> 2.48.1

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

* Re: [PATCH net-next] ionic: Simplify maximum determination in ionic_adminq_napi()
  2025-03-01 10:12 [PATCH net-next] ionic: Simplify maximum determination in ionic_adminq_napi() Markus Elfring
  2025-03-03  7:15 ` Michal Swiatkowski
@ 2025-03-03 17:04 ` Nelson, Shannon
  2025-03-05  1:06 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Nelson, Shannon @ 2025-03-03 17:04 UTC (permalink / raw)
  To: Markus Elfring, netdev, Andrew Lunn, Brett Creeley,
	David S. Miller, Eric Dumazet, Jacob Keller, Jakub Kicinski,
	Paolo Abeni
  Cc: LKML, kernel-janitors, Qasim Ijaz, Natalie Vock



On 3/1/2025 2:12 AM, Markus Elfring wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 1 Mar 2025 11:01:28 +0100
> 
> Reduce nested max() calls by a single max3() call in this
> function implementation.
> 
> The source code was transformed by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>   drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> index 7707a9e53c43..85c4b02bd054 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> @@ -1242,7 +1242,7 @@ static int ionic_adminq_napi(struct napi_struct *napi, int budget)
>          if (lif->hwstamp_txq)
>                  tx_work = ionic_tx_cq_service(&lif->hwstamp_txq->cq, budget, !!budget);
> 
> -       work_done = max(max(n_work, a_work), max(rx_work, tx_work));
> +       work_done = max3(n_work, a_work, max(rx_work, tx_work));
>          if (work_done < budget && napi_complete_done(napi, work_done)) {
>                  flags |= IONIC_INTR_CRED_UNMASK;
>                  intr->rearm_count++;
> --
> 2.48.1
> 

Sure, thanks - sln

Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>


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

* Re: [PATCH net-next] ionic: Simplify maximum determination in ionic_adminq_napi()
  2025-03-01 10:12 [PATCH net-next] ionic: Simplify maximum determination in ionic_adminq_napi() Markus Elfring
  2025-03-03  7:15 ` Michal Swiatkowski
  2025-03-03 17:04 ` Nelson, Shannon
@ 2025-03-05  1:06 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2025-03-05  1:06 UTC (permalink / raw)
  To: Markus Elfring
  Cc: netdev, Andrew Lunn, Brett Creeley, David S. Miller, Eric Dumazet,
	Jacob Keller, Paolo Abeni, Shannon Nelson, LKML, kernel-janitors,
	Qasim Ijaz, Natalie Vock

On Sat, 1 Mar 2025 11:12:31 +0100 Markus Elfring wrote:
> Reduce nested max() calls by a single max3() call in this

max3() is literally a wrapper for max(a, max(b, c))
This patch is pointless.

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

end of thread, other threads:[~2025-03-05  1:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-01 10:12 [PATCH net-next] ionic: Simplify maximum determination in ionic_adminq_napi() Markus Elfring
2025-03-03  7:15 ` Michal Swiatkowski
2025-03-03 17:04 ` Nelson, Shannon
2025-03-05  1:06 ` Jakub Kicinski

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