bnxt_en: Set hwrm_intr_seq_id value to its inverted value.
authorVenkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Thu, 20 Dec 2018 08:38:44 +0000 (03:38 -0500)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Dec 2018 16:26:15 +0000 (08:26 -0800)
Set hwrm_intr_seq_id value to its inverted value instead of
HWRM_SEQ_INVALID, when an hwrm completion of type
CMPL_BASE_TYPE_HWRM_DONE is received. This will enable us to use
the complete 16-bit sequence ID space.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h

index 218a6dff3efc901376e0e39e1d68169231c5a74f..72ba07cb39d37c40eecbaad980fd8d3b5557d56b 100644 (file)
@@ -1812,7 +1812,7 @@ static int bnxt_hwrm_handler(struct bnxt *bp, struct tx_cmp *txcmp)
        case CMPL_BASE_TYPE_HWRM_DONE:
                seq_id = le16_to_cpu(h_cmpl->sequence_id);
                if (seq_id == bp->hwrm_intr_seq_id)
-                       bp->hwrm_intr_seq_id = HWRM_SEQ_ID_INVALID;
+                       bp->hwrm_intr_seq_id = (u16)~bp->hwrm_intr_seq_id;
                else
                        netdev_err(bp->dev, "Invalid hwrm seq id %d\n", seq_id);
                break;
@@ -3827,8 +3827,10 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
        tmo_count += DIV_ROUND_UP(timeout, HWRM_MIN_TIMEOUT);
        resp_len = bp->hwrm_cmd_resp_addr + HWRM_RESP_LEN_OFFSET;
        if (intr_process) {
+               u16 seq_id = bp->hwrm_intr_seq_id;
+
                /* Wait until hwrm response cmpl interrupt is processed */
-               while (bp->hwrm_intr_seq_id != HWRM_SEQ_ID_INVALID &&
+               while (bp->hwrm_intr_seq_id != (u16)~seq_id &&
                       i++ < tmo_count) {
                        /* on first few passes, just barely sleep */
                        if (i < HWRM_SHORT_TIMEOUT_COUNTER)
@@ -3839,7 +3841,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
                                             HWRM_MAX_TIMEOUT);
                }
 
-               if (bp->hwrm_intr_seq_id != HWRM_SEQ_ID_INVALID) {
+               if (bp->hwrm_intr_seq_id != (u16)~seq_id) {
                        netdev_err(bp->dev, "Resp cmpl intr err msg: 0x%x\n",
                                   le16_to_cpu(req->req_type));
                        return -1;
index 4fdfd7a87805c4ef2b4c1bd98bbd90c4001f8ecc..7a75977c1729742c7b03b317b51a5559e1fb2832 100644 (file)
@@ -567,7 +567,6 @@ struct nqe_cn {
 #define HWRM_RESP_LEN_MASK             0xffff0000
 #define HWRM_RESP_LEN_SFT              16
 #define HWRM_RESP_VALID_MASK           0xff000000
-#define HWRM_SEQ_ID_INVALID            -1
 #define BNXT_HWRM_REQ_MAX_SIZE         128
 #define BNXT_HWRM_REQS_PER_PAGE                (BNXT_PAGE_SIZE /       \
                                         BNXT_HWRM_REQ_MAX_SIZE)
@@ -1466,7 +1465,7 @@ struct bnxt {
 #define BNXT_NEW_RM(bp)                ((bp)->fw_cap & BNXT_FW_CAP_NEW_RM)
        u32                     hwrm_spec_code;
        u16                     hwrm_cmd_seq;
-       u32                     hwrm_intr_seq_id;
+       u16                     hwrm_intr_seq_id;
        void                    *hwrm_short_cmd_req_addr;
        dma_addr_t              hwrm_short_cmd_req_dma_addr;
        void                    *hwrm_cmd_resp_addr;