From: Kalesh AP Date: Mon, 12 Jul 2021 08:04:33 +0000 (+0530) Subject: net/bnxt: inform firmware about host MTU X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8fd709a10b25d6d3fe293b3f8343c179d85631df;p=dpdk.git net/bnxt: inform firmware about host MTU This enables device firmware to respond appropriately to BMC queries about the driver's configured MTU. Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde Reviewed-by: Lance Richardson --- diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 19d52fa82b..de34a2f0bb 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -3062,6 +3062,9 @@ int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) if (!rc) eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = new_pkt_size; + if (bnxt_hwrm_config_host_mtu(bp)) + PMD_DRV_LOG(WARNING, "Failed to configure host MTU\n"); + PMD_DRV_LOG(INFO, "New MTU is %d\n", new_mtu); return rc; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 0568476135..d583839cb0 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -3469,6 +3469,7 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, int rc; enables = HWRM_FUNC_CFG_INPUT_ENABLES_ADMIN_MTU | + HWRM_FUNC_CFG_INPUT_ENABLES_HOST_MTU | HWRM_FUNC_CFG_INPUT_ENABLES_MRU | HWRM_FUNC_CFG_INPUT_ENABLES_NUM_RSSCOS_CTXS | HWRM_FUNC_CFG_INPUT_ENABLES_NUM_STAT_CTXS | @@ -3489,6 +3490,7 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, req.flags = rte_cpu_to_le_32(bp->pf->func_cfg_flags); req.admin_mtu = rte_cpu_to_le_16(BNXT_MAX_MTU); + req.host_mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu); req.mru = rte_cpu_to_le_16(BNXT_VNIC_MRU(bp->eth_dev->data->mtu)); req.num_rsscos_ctxs = rte_cpu_to_le_16(pf_resc->num_rsscos_ctxs); req.num_stat_ctxs = rte_cpu_to_le_16(pf_resc->num_stat_ctxs); @@ -6203,3 +6205,25 @@ void bnxt_free_hwrm_tx_ring(struct bnxt *bp, int queue_index) bnxt_free_cp_ring(bp, cpr); } + +int bnxt_hwrm_config_host_mtu(struct bnxt *bp) +{ + struct hwrm_func_cfg_input req = {0}; + struct hwrm_func_cfg_output *resp = bp->hwrm_cmd_resp_addr; + int rc; + + if (!BNXT_PF(bp)) + return 0; + + HWRM_PREP(&req, HWRM_FUNC_CFG, BNXT_USE_CHIMP_MB); + + req.fid = rte_cpu_to_le_16(0xffff); + req.enables = rte_cpu_to_le_32(HWRM_FUNC_CFG_INPUT_ENABLES_HOST_MTU); + req.host_mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu); + + rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB); + HWRM_CHECK_RESULT(); + HWRM_UNLOCK(); + + return rc; +} diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index ec3414f0c6..80e3128140 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -307,4 +307,5 @@ int bnxt_hwrm_read_sfp_module_eeprom_info(struct bnxt *bp, uint16_t i2c_addr, int bnxt_hwrm_stat_ctx_alloc(struct bnxt *bp, struct bnxt_cp_ring_info *cpr); void bnxt_free_hwrm_tx_ring(struct bnxt *bp, int queue_index); int bnxt_alloc_hwrm_tx_ring(struct bnxt *bp, int queue_index); +int bnxt_hwrm_config_host_mtu(struct bnxt *bp); #endif