|
|
ab2f3a |
From 19a1808003af3e87f903a053b2207a59f6bb3456 Mon Sep 17 00:00:00 2001
|
|
|
ab2f3a |
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
|
|
|
ab2f3a |
Date: Thu, 28 Jun 2018 13:15:43 -0700
|
|
|
ab2f3a |
Subject: [PATCH] net/bnxt: fix set MTU
|
|
|
ab2f3a |
|
|
|
ab2f3a |
There is no need to update bnxt_hwrm_vnic_plcmode_cfg if new MTU is
|
|
|
ab2f3a |
not greater than the max data the mbuf can accommodate.
|
|
|
ab2f3a |
|
|
|
ab2f3a |
Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
|
|
|
ab2f3a |
Cc: stable@dpdk.org
|
|
|
ab2f3a |
|
|
|
ab2f3a |
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
|
|
|
ab2f3a |
(cherry picked from commit 42e4af421e80ee4a07730a83fd9a7a6b9a1fbe26)
|
|
|
ab2f3a |
---
|
|
|
ab2f3a |
drivers/net/bnxt/bnxt_ethdev.c | 12 +++++++++---
|
|
|
ab2f3a |
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
ab2f3a |
|
|
|
ab2f3a |
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
|
|
|
ab2f3a |
index 9a6209d6c..775b99cab 100644
|
|
|
ab2f3a |
--- a/drivers/net/bnxt/bnxt_ethdev.c
|
|
|
ab2f3a |
+++ b/drivers/net/bnxt/bnxt_ethdev.c
|
|
|
ab2f3a |
@@ -1537,6 +1537,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
|
|
|
ab2f3a |
|
|
|
ab2f3a |
for (i = 0; i < bp->nr_vnics; i++) {
|
|
|
ab2f3a |
struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
|
|
|
ab2f3a |
+ uint16_t size = 0;
|
|
|
ab2f3a |
|
|
|
ab2f3a |
vnic->mru = bp->eth_dev->data->mtu + ETHER_HDR_LEN +
|
|
|
ab2f3a |
ETHER_CRC_LEN + VLAN_TAG_SIZE * 2;
|
|
|
ab2f3a |
@@ -1544,9 +1545,14 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
|
|
|
ab2f3a |
if (rc)
|
|
|
ab2f3a |
break;
|
|
|
ab2f3a |
|
|
|
ab2f3a |
- rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
|
|
|
ab2f3a |
- if (rc)
|
|
|
ab2f3a |
- return rc;
|
|
|
ab2f3a |
+ size = rte_pktmbuf_data_room_size(bp->rx_queues[0]->mb_pool);
|
|
|
ab2f3a |
+ size -= RTE_PKTMBUF_HEADROOM;
|
|
|
ab2f3a |
+
|
|
|
ab2f3a |
+ if (size < new_mtu) {
|
|
|
ab2f3a |
+ rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
|
|
|
ab2f3a |
+ if (rc)
|
|
|
ab2f3a |
+ return rc;
|
|
|
ab2f3a |
+ }
|
|
|
ab2f3a |
}
|
|
|
ab2f3a |
|
|
|
ab2f3a |
return rc;
|
|
|
ab2f3a |
--
|
|
|
ab2f3a |
2.17.1
|
|
|
ab2f3a |
|