From: Ajit Khaparde Date: Sat, 29 Sep 2018 01:59:54 +0000 (-0700) Subject: net/bnxt: fix MTU setting X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=80ad678ae715c8bee2f7a396431d3703df245f5a;p=dpdk.git net/bnxt: fix MTU setting 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 --- diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 8aae0426ac..c580ec22b0 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -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 diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 28e2be7e85..8c156e263c 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -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 |=