From: Somnath Kotur Date: Sat, 8 Jun 2019 19:22:05 +0000 (+0400) Subject: net/bnxt: use configured MTU during load X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=905cd45ce30e;p=dpdk.git net/bnxt: use configured MTU during load The MTU value of a port can be (re)configured out-of-band. FW will be returning this configured MTU as part of func_qcfg cmd. Driver to use this value during load time. Signed-off-by: Somnath Kotur Signed-off-by: Kalesh AP Reviewed-by: Lance Richardson Signed-off-by: Ajit Khaparde --- diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c index 0fd6e51e51..655bcf1a8d 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c @@ -35,7 +35,7 @@ void bnxt_handle_async_event(struct bnxt *bp, break; case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE: PMD_DRV_LOG(INFO, "Async event: VF config changed\n"); - bnxt_hwrm_func_qcfg(bp); + bnxt_hwrm_func_qcfg(bp, NULL); break; case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED: PMD_DRV_LOG(INFO, "Port conn async event\n"); diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index ee775b1252..2254872390 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -3654,6 +3654,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) uint32_t total_alloc_len; rte_iova_t mz_phys_addr; struct bnxt *bp; + uint16_t mtu; int rc; if (version_printed++ == 0) @@ -3906,12 +3907,16 @@ skip_ext_stats: pci_dev->mem_resource[0].phys_addr, pci_dev->mem_resource[0].addr); - rc = bnxt_hwrm_func_qcfg(bp); + rc = bnxt_hwrm_func_qcfg(bp, &mtu); if (rc) { PMD_DRV_LOG(ERR, "hwrm func qcfg failed\n"); goto error_free; } + if (mtu >= RTE_ETHER_MIN_MTU && mtu <= BNXT_MAX_MTU && + mtu != eth_dev->data->mtu) + eth_dev->data->mtu = mtu; + if (BNXT_PF(bp)) { //if (bp->pf.active_vfs) { // TODO: Deallocate VF resources? diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 09fee3d39d..696974c834 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -2638,7 +2638,7 @@ error: } /* JIRA 22088 */ -int bnxt_hwrm_func_qcfg(struct bnxt *bp) +int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu) { struct hwrm_func_qcfg_input req = {0}; struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr; @@ -2663,6 +2663,9 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp) PMD_DRV_LOG(INFO, "Trusted VF cap enabled\n"); } + if (mtu) + *mtu = resp->mtu; + switch (resp->port_partition_type) { case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_0: case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_5: diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index cd8bb79f9a..e35462cb4f 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -127,7 +127,7 @@ void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index); int bnxt_alloc_hwrm_resources(struct bnxt *bp); int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link); int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up); -int bnxt_hwrm_func_qcfg(struct bnxt *bp); +int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu); int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp); int bnxt_hwrm_func_reserve_vf_resc(struct bnxt *bp, bool test); int bnxt_hwrm_allocate_pf_only(struct bnxt *bp);