Commit 877edb34 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

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: default avatarAndy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5a3c585f
...@@ -6896,10 +6896,29 @@ int bnxt_hwrm_set_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi) ...@@ -6896,10 +6896,29 @@ int bnxt_hwrm_set_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi)
return hwrm_req_send(bp, req_rx); return hwrm_req_send(bp, req_rx);
} }
static int
bnxt_hwrm_set_rx_coal(struct bnxt *bp, struct bnxt_napi *bnapi,
struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req)
{
u16 ring_id = bnxt_cp_ring_for_rx(bp, bnapi->rx_ring);
req->ring_id = cpu_to_le16(ring_id);
return hwrm_req_send(bp, req);
}
static int
bnxt_hwrm_set_tx_coal(struct bnxt *bp, struct bnxt_napi *bnapi,
struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req)
{
u16 ring_id = bnxt_cp_ring_for_tx(bp, bnapi->tx_ring);
req->ring_id = cpu_to_le16(ring_id);
return hwrm_req_send(bp, req);
}
int bnxt_hwrm_set_coal(struct bnxt *bp) int bnxt_hwrm_set_coal(struct bnxt *bp)
{ {
struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req_rx, *req_tx, struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *req_rx, *req_tx;
*req;
int i, rc; int i, rc;
rc = hwrm_req_init(bp, req_rx, HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS); rc = hwrm_req_init(bp, req_rx, HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS);
...@@ -6920,18 +6939,11 @@ int bnxt_hwrm_set_coal(struct bnxt *bp) ...@@ -6920,18 +6939,11 @@ int bnxt_hwrm_set_coal(struct bnxt *bp)
for (i = 0; i < bp->cp_nr_rings; i++) { for (i = 0; i < bp->cp_nr_rings; i++) {
struct bnxt_napi *bnapi = bp->bnapi[i]; struct bnxt_napi *bnapi = bp->bnapi[i];
struct bnxt_coal *hw_coal; struct bnxt_coal *hw_coal;
u16 ring_id;
req = req_rx; if (!bnapi->rx_ring)
if (!bnapi->rx_ring) { rc = bnxt_hwrm_set_tx_coal(bp, bnapi, req_tx);
ring_id = bnxt_cp_ring_for_tx(bp, bnapi->tx_ring); else
req = req_tx; rc = bnxt_hwrm_set_rx_coal(bp, bnapi, req_rx);
} else {
ring_id = bnxt_cp_ring_for_rx(bp, bnapi->rx_ring);
}
req->ring_id = cpu_to_le16(ring_id);
rc = hwrm_req_send(bp, req);
if (rc) if (rc)
break; break;
...@@ -6939,10 +6951,7 @@ int bnxt_hwrm_set_coal(struct bnxt *bp) ...@@ -6939,10 +6951,7 @@ int bnxt_hwrm_set_coal(struct bnxt *bp)
continue; continue;
if (bnapi->rx_ring && bnapi->tx_ring) { if (bnapi->rx_ring && bnapi->tx_ring) {
req = req_tx; rc = bnxt_hwrm_set_tx_coal(bp, bnapi, req_tx);
ring_id = bnxt_cp_ring_for_tx(bp, bnapi->tx_ring);
req->ring_id = cpu_to_le16(ring_id);
rc = hwrm_req_send(bp, req);
if (rc) if (rc)
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment