Skip to content

Commit 877edb3

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Refactor bnxt_hwrm_set_coal()
Add 2 helper functions to set coalescing for each RX and TX rings. This will make it easier to expand the number of TX rings per MSIX in the next patches. Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5a3c585 commit 877edb3

File tree

1 file changed

+26
-17
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+26
-17
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6896,10 +6896,29 @@ int bnxt_hwrm_set_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi)
68966896
return hwrm_req_send(bp, req_rx);
68976897
}
68986898

6899+
static int
6900+
bnxt_hwrm_set_rx_coal(struct bnxt *bp, struct bnxt_napi *bnapi,
6901+
struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req)
6902+
{
6903+
u16 ring_id = bnxt_cp_ring_for_rx(bp, bnapi->rx_ring);
6904+
6905+
req->ring_id = cpu_to_le16(ring_id);
6906+
return hwrm_req_send(bp, req);
6907+
}
6908+
6909+
static int
6910+
bnxt_hwrm_set_tx_coal(struct bnxt *bp, struct bnxt_napi *bnapi,
6911+
struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req)
6912+
{
6913+
u16 ring_id = bnxt_cp_ring_for_tx(bp, bnapi->tx_ring);
6914+
6915+
req->ring_id = cpu_to_le16(ring_id);
6916+
return hwrm_req_send(bp, req);
6917+
}
6918+
68996919
int bnxt_hwrm_set_coal(struct bnxt *bp)
69006920
{
6901-
struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req_rx, *req_tx,
6902-
*req;
6921+
struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req_rx, *req_tx;
69036922
int i, rc;
69046923

69056924
rc = hwrm_req_init(bp, req_rx, HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS);
@@ -6920,29 +6939,19 @@ int bnxt_hwrm_set_coal(struct bnxt *bp)
69206939
for (i = 0; i < bp->cp_nr_rings; i++) {
69216940
struct bnxt_napi *bnapi = bp->bnapi[i];
69226941
struct bnxt_coal *hw_coal;
6923-
u16 ring_id;
69246942

6925-
req = req_rx;
6926-
if (!bnapi->rx_ring) {
6927-
ring_id = bnxt_cp_ring_for_tx(bp, bnapi->tx_ring);
6928-
req = req_tx;
6929-
} else {
6930-
ring_id = bnxt_cp_ring_for_rx(bp, bnapi->rx_ring);
6931-
}
6932-
req->ring_id = cpu_to_le16(ring_id);
6933-
6934-
rc = hwrm_req_send(bp, req);
6943+
if (!bnapi->rx_ring)
6944+
rc = bnxt_hwrm_set_tx_coal(bp, bnapi, req_tx);
6945+
else
6946+
rc = bnxt_hwrm_set_rx_coal(bp, bnapi, req_rx);
69356947
if (rc)
69366948
break;
69376949

69386950
if (!(bp->flags & BNXT_FLAG_CHIP_P5))
69396951
continue;
69406952

69416953
if (bnapi->rx_ring && bnapi->tx_ring) {
6942-
req = req_tx;
6943-
ring_id = bnxt_cp_ring_for_tx(bp, bnapi->tx_ring);
6944-
req->ring_id = cpu_to_le16(ring_id);
6945-
rc = hwrm_req_send(bp, req);
6954+
rc = bnxt_hwrm_set_tx_coal(bp, bnapi, req_tx);
69466955
if (rc)
69476956
break;
69486957
}

0 commit comments

Comments
 (0)