net/bnxt: fix MTU setting
authorAjit Khaparde <ajit.khaparde@broadcom.com>
Sat, 29 Sep 2018 01:59:54 +0000 (18:59 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 11 Oct 2018 16:53:48 +0000 (18:53 +0200)
The HW can support maximum frame length of 9600 bytes.
And we are currently capping the max frame size to 9500 bytes.

Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt.h
drivers/net/bnxt/bnxt_ethdev.c

index 8aae042..c580ec2 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "bnxt_cpr.h"
 
-#define BNXT_MAX_MTU           9500
+#define BNXT_MAX_MTU           9574
 #define VLAN_TAG_SIZE          4
 #define BNXT_VF_RSV_NUM_RSS_CTX        1
 #define BNXT_VF_RSV_NUM_L2_CTX 4
index 28e2be7..8c156e2 100644 (file)
@@ -451,7 +451,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
        /* Fast path specifics */
        dev_info->min_rx_bufsize = 1;
        dev_info->max_rx_pktlen = BNXT_MAX_MTU + ETHER_HDR_LEN + ETHER_CRC_LEN
-                                 + VLAN_TAG_SIZE;
+                                 + VLAN_TAG_SIZE * 2;
 
        dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT;
        if (bp->flags & BNXT_FLAG_PTP_SUPPORTED)
@@ -1564,21 +1564,17 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 {
        struct bnxt *bp = eth_dev->data->dev_private;
        struct rte_eth_dev_info dev_info;
-       uint32_t max_dev_mtu;
        uint32_t rc = 0;
        uint32_t i;
 
        bnxt_dev_info_get_op(eth_dev, &dev_info);
-       max_dev_mtu = dev_info.max_rx_pktlen -
-                     ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE * 2;
 
-       if (new_mtu < ETHER_MIN_MTU || new_mtu > max_dev_mtu) {
+       if (new_mtu < ETHER_MIN_MTU || new_mtu > BNXT_MAX_MTU) {
                PMD_DRV_LOG(ERR, "MTU requested must be within (%d, %d)\n",
-                       ETHER_MIN_MTU, max_dev_mtu);
+                       ETHER_MIN_MTU, BNXT_MAX_MTU);
                return -EINVAL;
        }
 
-
        if (new_mtu > ETHER_MTU) {
                bp->flags |= BNXT_FLAG_JUMBO;
                bp->eth_dev->data->dev_conf.rxmode.offloads |=