net/bnxt: use configured MTU during load
authorSomnath Kotur <somnath.kotur@broadcom.com>
Sat, 8 Jun 2019 19:22:05 +0000 (23:22 +0400)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 13 Jun 2019 15:01:06 +0000 (00:01 +0900)
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 <somnath.kotur@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_cpr.c
drivers/net/bnxt/bnxt_ethdev.c
drivers/net/bnxt/bnxt_hwrm.c
drivers/net/bnxt/bnxt_hwrm.h

index 0fd6e51..655bcf1 100644 (file)
@@ -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");
index ee775b1..2254872 100644 (file)
@@ -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?
index 09fee3d..696974c 100644 (file)
@@ -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:
index cd8bb79..e35462c 100644 (file)
@@ -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);