bnxt_en: Fix statistics context reservation logic. [Linux 5.1]

bnxt_en: Fix statistics context reservation logic. [Linux 5.1]

This Linux kernel change "bnxt_en: Fix statistics context reservation logic" is included in the Linux 5.1 release. This change is authored by Michael Chan <michael.chan [at] broadcom.com> on Thu Apr 25 22:31:54 2019 -0400. The commit for this change in Linux stable tree is 3f93cd3 (patch).

bnxt_en: Fix statistics context reservation logic.

In an earlier commit that fixes the number of stats contexts to
reserve for the RDMA driver, we added a function parameter to pass in
the number of stats contexts to all the relevant functions.  The passed
in parameter should have been used to set the enables field of the
firmware message.

Fixes: 780baad44f0f ("bnxt_en: Reserve 1 stat_ctx for RDMA driver.")
Signed-off-by: Michael Chan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>

There are 14 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index a9172b2..b6cb7b8 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -5315,17 +5315,16 @@ int __bnxt_hwrm_get_tx_rings(struct bnxt *bp, u16 fid, int *tx_rings)
    req->num_tx_rings = cpu_to_le16(tx_rings);
    if (BNXT_NEW_RM(bp)) {
        enables |= rx_rings ? FUNC_CFG_REQ_ENABLES_NUM_RX_RINGS : 0;
+       enables |= stats ? FUNC_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0;
        if (bp->flags & BNXT_FLAG_CHIP_P5) {
            enables |= cp_rings ? FUNC_CFG_REQ_ENABLES_NUM_MSIX : 0;
            enables |= tx_rings + ring_grps ?
-                  FUNC_CFG_REQ_ENABLES_NUM_CMPL_RINGS |
-                  FUNC_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0;
+                  FUNC_CFG_REQ_ENABLES_NUM_CMPL_RINGS : 0;
            enables |= rx_rings ?
                FUNC_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : 0;
        } else {
            enables |= cp_rings ?
-                  FUNC_CFG_REQ_ENABLES_NUM_CMPL_RINGS |
-                  FUNC_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0;
+                  FUNC_CFG_REQ_ENABLES_NUM_CMPL_RINGS : 0;
            enables |= ring_grps ?
                   FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS |
                   FUNC_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : 0;
@@ -5365,14 +5364,13 @@ int __bnxt_hwrm_get_tx_rings(struct bnxt *bp, u16 fid, int *tx_rings)
    enables |= tx_rings ? FUNC_VF_CFG_REQ_ENABLES_NUM_TX_RINGS : 0;
    enables |= rx_rings ? FUNC_VF_CFG_REQ_ENABLES_NUM_RX_RINGS |
                  FUNC_VF_CFG_REQ_ENABLES_NUM_RSSCOS_CTXS : 0;
+   enables |= stats ? FUNC_VF_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0;
    if (bp->flags & BNXT_FLAG_CHIP_P5) {
        enables |= tx_rings + ring_grps ?
-              FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS |
-              FUNC_VF_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0;
+              FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS : 0;
    } else {
        enables |= cp_rings ?
-              FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS |
-              FUNC_VF_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0;
+              FUNC_VF_CFG_REQ_ENABLES_NUM_CMPL_RINGS : 0;
        enables |= ring_grps ?
               FUNC_VF_CFG_REQ_ENABLES_NUM_HW_RING_GRPS : 0;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *