if_bnxt: Add support for smaller backing_store_cfg message size

Add compat logic to fallback to the older/smaller backing_store_cfg
message size.

Reviewed by: imp
Differentil Revision: https://reviews.freebsd.org/D36447
This commit is contained in:
Sumit Saxena 2022-11-04 16:33:21 -06:00 committed by Warner Losh
parent 19a57f85ba
commit 2ed061f08d
2 changed files with 7 additions and 2 deletions

View File

@ -394,7 +394,7 @@ int bnxt_hwrm_func_backing_store_cfg(struct bnxt_softc *softc, uint32_t enables)
struct hwrm_func_backing_store_cfg_input req = {0};
struct bnxt_ctx_mem_info *ctx = softc->ctx_mem;
struct bnxt_ctx_pg_info *ctx_pg;
uint32_t *num_entries;
uint32_t *num_entries, req_len = sizeof(req);
uint64_t *pg_dir;
uint8_t *pg_attr;
int i, rc;
@ -481,7 +481,11 @@ int bnxt_hwrm_func_backing_store_cfg(struct bnxt_softc *softc, uint32_t enables)
*num_entries = htole32(ctx_pg->entries);
bnxt_hwrm_set_pg_attr(&ctx_pg->ring_mem, pg_attr, pg_dir);
}
rc = hwrm_send_message(softc, &req, sizeof(req));
if (req_len > softc->hwrm_max_ext_req_len)
req_len = BNXT_BACKING_STORE_CFG_LEGACY_LEN;
rc = hwrm_send_message(softc, &req, req_len);
if (rc)
rc = -EIO;
return rc;

View File

@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#define BNXT_AUTO_PAUSE_AUTONEG_PAUSE \
(HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_AUTONEG_PAUSE)
#define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input)
#define BNXT_BACKING_STORE_CFG_LEGACY_LEN 256
/* HWRM Function Prototypes */
int bnxt_alloc_hwrm_dma_mem(struct bnxt_softc *softc);