ionic: Simplify maximum determination in ionic_adminq_napi()
Subsystems (4)
PATCH 1/1 ionic: Simplify maximum determination in ionic_adminq_napi()
From: Markus Elfring <[email protected]>
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.
--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +1 -1
@@ -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
Quoted 18 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sat, 1 Mar 2025 11:01:28 +0100Reduce nested
max()calls by a singlemax3()call in this function implementation.The source code was transformed by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/pensando/ionic/ionic_lif.c +0
-0
drivers/net/ethernet/pensando/ionic/ionic_lif.c static int ionic_adminq_napi(struct napi_struct *napi, int budget) · line 1248
Quoted 8 lines
drivers/net/ethernet/pensando/ionic/ionic_lif.c +1
-1@@ -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++;
Quoted 2 lines
--
2.48.1
Quoted 30 lines · Markus Elfring
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
From: Markus Elfring <[email protected]>
Date: Sat, 1 Mar 2025 11:01:28 +0100Reduce nested
max()calls by a singlemax3()call in this function implementation.The source code was transformed by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/pensando/ionic/ionic_lif.c +1
-2@@ -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++; --
Quoted 2 lines
2.48.1
Sure, thanks - sln
Jakub Kicinski
maintainerQuoted 1 line · On Sat, 1 Mar 2025 11:12:31 +0100 Markus Elfring wrote:
Reduce nested
max()calls by a singlemax3()call in this
max3() is literally a wrapper for max(a, max(b, c)) This patch is pointless.