Commit 6c172d59 authored by Edwin Peer's avatar Edwin Peer Committed by David S. Miller

bnxt_en: remove DMA mapping for KONG response

The additional response buffer serves no useful purpose. There can
be only one firmware command in flight due to the hwrm_cmd_lock mutex,
which is taken for the entire duration of any command completion,
KONG or otherwise. It is thus safe to share a single DMA buffer.

Removing the code associated with the additional mapping will simplify
matters in the next patch, which allocates response buffers from DMA
pools on a per request basis.
Signed-off-by: default avatarEdwin Peer <edwin.peer@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eaf2aaec
...@@ -3962,30 +3962,6 @@ static void bnxt_free_hwrm_resources(struct bnxt *bp) ...@@ -3962,30 +3962,6 @@ static void bnxt_free_hwrm_resources(struct bnxt *bp)
bp->hwrm_cmd_resp_dma_addr); bp->hwrm_cmd_resp_dma_addr);
bp->hwrm_cmd_resp_addr = NULL; bp->hwrm_cmd_resp_addr = NULL;
} }
if (bp->hwrm_cmd_kong_resp_addr) {
dma_free_coherent(&pdev->dev, PAGE_SIZE,
bp->hwrm_cmd_kong_resp_addr,
bp->hwrm_cmd_kong_resp_dma_addr);
bp->hwrm_cmd_kong_resp_addr = NULL;
}
}
static int bnxt_alloc_kong_hwrm_resources(struct bnxt *bp)
{
struct pci_dev *pdev = bp->pdev;
if (bp->hwrm_cmd_kong_resp_addr)
return 0;
bp->hwrm_cmd_kong_resp_addr =
dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
&bp->hwrm_cmd_kong_resp_dma_addr,
GFP_KERNEL);
if (!bp->hwrm_cmd_kong_resp_addr)
return -ENOMEM;
return 0;
} }
static int bnxt_alloc_hwrm_resources(struct bnxt *bp) static int bnxt_alloc_hwrm_resources(struct bnxt *bp)
...@@ -4581,9 +4557,6 @@ void bnxt_hwrm_cmd_hdr_init(struct bnxt *bp, void *request, u16 req_type, ...@@ -4581,9 +4557,6 @@ void bnxt_hwrm_cmd_hdr_init(struct bnxt *bp, void *request, u16 req_type,
req->req_type = cpu_to_le16(req_type); req->req_type = cpu_to_le16(req_type);
req->cmpl_ring = cpu_to_le16(cmpl_ring); req->cmpl_ring = cpu_to_le16(cmpl_ring);
req->target_id = cpu_to_le16(target_id); req->target_id = cpu_to_le16(target_id);
if (bnxt_kong_hwrm_message(bp, req))
req->resp_addr = cpu_to_le64(bp->hwrm_cmd_kong_resp_dma_addr);
else
req->resp_addr = cpu_to_le64(bp->hwrm_cmd_resp_dma_addr); req->resp_addr = cpu_to_le64(bp->hwrm_cmd_resp_dma_addr);
} }
...@@ -4641,11 +4614,10 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, ...@@ -4641,11 +4614,10 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
return -EINVAL; return -EINVAL;
} }
if (bnxt_hwrm_kong_chnl(bp, req)) { if (bnxt_kong_hwrm_message(bp, req)) {
dst = BNXT_HWRM_CHNL_KONG; dst = BNXT_HWRM_CHNL_KONG;
bar_offset = BNXT_GRCPF_REG_KONG_COMM; bar_offset = BNXT_GRCPF_REG_KONG_COMM;
doorbell_offset = BNXT_GRCPF_REG_KONG_COMM_TRIGGER; doorbell_offset = BNXT_GRCPF_REG_KONG_COMM_TRIGGER;
resp = bp->hwrm_cmd_kong_resp_addr;
} }
memset(resp, 0, PAGE_SIZE); memset(resp, 0, PAGE_SIZE);
...@@ -11948,12 +11920,6 @@ static int bnxt_fw_init_one_p1(struct bnxt *bp) ...@@ -11948,12 +11920,6 @@ static int bnxt_fw_init_one_p1(struct bnxt *bp)
return rc; return rc;
} }
if (bp->fw_cap & BNXT_FW_CAP_KONG_MB_CHNL) {
rc = bnxt_alloc_kong_hwrm_resources(bp);
if (rc)
bp->fw_cap &= ~BNXT_FW_CAP_KONG_MB_CHNL;
}
if ((bp->fw_cap & BNXT_FW_CAP_SHORT_CMD) || if ((bp->fw_cap & BNXT_FW_CAP_SHORT_CMD) ||
bp->hwrm_max_ext_req_len > BNXT_HWRM_MAX_REQ_LEN) { bp->hwrm_max_ext_req_len > BNXT_HWRM_MAX_REQ_LEN) {
rc = bnxt_alloc_hwrm_short_cmd_req(bp); rc = bnxt_alloc_hwrm_short_cmd_req(bp);
...@@ -12136,8 +12102,8 @@ static void bnxt_reset_all(struct bnxt *bp) ...@@ -12136,8 +12102,8 @@ static void bnxt_reset_all(struct bnxt *bp)
} else if (fw_health->flags & ERROR_RECOVERY_QCFG_RESP_FLAGS_CO_CPU) { } else if (fw_health->flags & ERROR_RECOVERY_QCFG_RESP_FLAGS_CO_CPU) {
struct hwrm_fw_reset_input req = {0}; struct hwrm_fw_reset_input req = {0};
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FW_RESET, -1, -1); bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FW_RESET, -1,
req.resp_addr = cpu_to_le64(bp->hwrm_cmd_kong_resp_dma_addr); HWRM_TARGET_ID_KONG);
req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_CHIP; req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_CHIP;
req.selfrst_status = FW_RESET_REQ_SELFRST_STATUS_SELFRSTASAP; req.selfrst_status = FW_RESET_REQ_SELFRST_STATUS_SELFRSTASAP;
req.flags = FW_RESET_REQ_FLAGS_RESET_GRACEFUL; req.flags = FW_RESET_REQ_FLAGS_RESET_GRACEFUL;
......
...@@ -1915,8 +1915,6 @@ struct bnxt { ...@@ -1915,8 +1915,6 @@ struct bnxt {
dma_addr_t hwrm_short_cmd_req_dma_addr; dma_addr_t hwrm_short_cmd_req_dma_addr;
void *hwrm_cmd_resp_addr; void *hwrm_cmd_resp_addr;
dma_addr_t hwrm_cmd_resp_dma_addr; dma_addr_t hwrm_cmd_resp_dma_addr;
void *hwrm_cmd_kong_resp_addr;
dma_addr_t hwrm_cmd_kong_resp_dma_addr;
struct rtnl_link_stats64 net_stats_prev; struct rtnl_link_stats64 net_stats_prev;
struct bnxt_stats_mem port_stats; struct bnxt_stats_mem port_stats;
...@@ -2216,20 +2214,12 @@ static inline bool bnxt_cfa_hwrm_message(u16 req_type) ...@@ -2216,20 +2214,12 @@ static inline bool bnxt_cfa_hwrm_message(u16 req_type)
static inline bool bnxt_kong_hwrm_message(struct bnxt *bp, struct input *req) static inline bool bnxt_kong_hwrm_message(struct bnxt *bp, struct input *req)
{ {
return (bp->fw_cap & BNXT_FW_CAP_KONG_MB_CHNL && return (bp->fw_cap & BNXT_FW_CAP_KONG_MB_CHNL &&
bnxt_cfa_hwrm_message(le16_to_cpu(req->req_type))); (bnxt_cfa_hwrm_message(le16_to_cpu(req->req_type)) ||
} le16_to_cpu(req->target_id) == HWRM_TARGET_ID_KONG));
static inline bool bnxt_hwrm_kong_chnl(struct bnxt *bp, struct input *req)
{
return (bp->fw_cap & BNXT_FW_CAP_KONG_MB_CHNL &&
req->resp_addr == cpu_to_le64(bp->hwrm_cmd_kong_resp_dma_addr));
} }
static inline void *bnxt_get_hwrm_resp_addr(struct bnxt *bp, void *req) static inline void *bnxt_get_hwrm_resp_addr(struct bnxt *bp, void *req)
{ {
if (bnxt_hwrm_kong_chnl(bp, (struct input *)req))
return bp->hwrm_cmd_kong_resp_addr;
else
return bp->hwrm_cmd_resp_addr; return bp->hwrm_cmd_resp_addr;
} }
......
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