]> git.droids-corp.org - dpdk.git/commitdiff
net/bnxt: fix MTU calculation
authorAjit Khaparde <ajit.khaparde@broadcom.com>
Tue, 1 May 2018 01:06:11 +0000 (18:06 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 14 May 2018 21:31:49 +0000 (22:31 +0100)
We were not considering the case of nested VLANs while
calculating MTU. This patch takes care of the same.

Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Cc: stable@dpdk.org
Signed-off-by: Qingmin Liu <qingmin.liu@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Jay Ding <jay.ding@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt.h
drivers/net/bnxt/bnxt_ethdev.c
drivers/net/bnxt/bnxt_hwrm.c

index 97b0e08535538525779a6012a27b7977780b714b..110cdb9922e0ebf808e8349df747b646eced4b78 100644 (file)
@@ -23,6 +23,7 @@
 #define BNXT_MAX_MTU           9500
 #define VLAN_TAG_SIZE          4
 #define BNXT_MAX_LED           4
+#define BNXT_NUM_VLANS         2
 
 struct bnxt_led_info {
        uint8_t      led_id;
index df4bed47fb56de59ac543dae049759396f6be70b..cd5acc6c1e975b3499a7ee3e1c0ef0cb6378762c 100644 (file)
@@ -552,7 +552,8 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
        if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
                eth_dev->data->mtu =
                                eth_dev->data->dev_conf.rxmode.max_rx_pkt_len -
-                               ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE;
+                               ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE *
+                               BNXT_NUM_VLANS;
                bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu);
        }
        return 0;
index bc8773509abfe02585b9142b12ea94f84a3887f5..c136edc0691586220a555ab05ee2aa800dedf239 100644 (file)
@@ -2360,7 +2360,8 @@ static int bnxt_hwrm_pf_func_cfg(struct bnxt *bp, int tx_rings)
        req.flags = rte_cpu_to_le_32(bp->pf.func_cfg_flags);
        req.mtu = rte_cpu_to_le_16(BNXT_MAX_MTU);
        req.mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
-                                  ETHER_CRC_LEN + VLAN_TAG_SIZE);
+                                  ETHER_CRC_LEN + VLAN_TAG_SIZE *
+                                  BNXT_NUM_VLANS);
        req.num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx);
        req.num_stat_ctxs = rte_cpu_to_le_16(bp->max_stat_ctx);
        req.num_cmpl_rings = rte_cpu_to_le_16(bp->max_cp_rings);
@@ -2397,9 +2398,11 @@ static void populate_vf_func_cfg_req(struct bnxt *bp,
                        HWRM_FUNC_CFG_INPUT_ENABLES_NUM_HW_RING_GRPS);
 
        req->mtu = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
-                                   ETHER_CRC_LEN + VLAN_TAG_SIZE);
+                                   ETHER_CRC_LEN + VLAN_TAG_SIZE *
+                                   BNXT_NUM_VLANS);
        req->mru = rte_cpu_to_le_16(bp->eth_dev->data->mtu + ETHER_HDR_LEN +
-                                   ETHER_CRC_LEN + VLAN_TAG_SIZE);
+                                   ETHER_CRC_LEN + VLAN_TAG_SIZE *
+                                   BNXT_NUM_VLANS);
        req->num_rsscos_ctxs = rte_cpu_to_le_16(bp->max_rsscos_ctx /
                                                (num_vfs + 1));
        req->num_stat_ctxs = rte_cpu_to_le_16(bp->max_stat_ctx / (num_vfs + 1));