[dpdk-stable] patch 'net/liquidio: fix MTU calculation from port configuration' has been queued to stable release 17.05.1

Yuanhan Liu yliu at fridaylinux.org
Tue Jun 20 13:35:41 CEST 2017


Hi,

FYI, your patch has been queued to stable release 17.05.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/22/17. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>From 4cc4cd67f6cf6863d2bfa646eb9aa2f9dce711fa Mon Sep 17 00:00:00 2001
From: Shijith Thotton <shijith.thotton at caviumnetworks.com>
Date: Tue, 6 Jun 2017 16:34:34 +0530
Subject: [PATCH] net/liquidio: fix MTU calculation from port configuration

[ upstream commit dc7037ba73f84c8bc5923813e0398f3c1c28de9d ]

max_rx_pkt_len member of port RX configuration indicates max frame
length. Ethernet header and CRC length should be subtracted from it to
find MTU.

Fixes: 605164c8e79d ("net/liquidio: add API to validate VF MTU")

Signed-off-by: Shijith Thotton <shijith.thotton at caviumnetworks.com>
---
 drivers/net/liquidio/lio_ethdev.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 269a5f2..c7f1fb6 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -36,6 +36,7 @@
 #include <rte_cycles.h>
 #include <rte_malloc.h>
 #include <rte_alarm.h>
+#include <rte_ether.h>
 
 #include "lio_logs.h"
 #include "lio_23xx_vf.h"
@@ -1348,7 +1349,8 @@ lio_sync_link_state_check(void *eth_dev)
 static int
 lio_dev_start(struct rte_eth_dev *eth_dev)
 {
-	uint16_t mtu = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;
+	uint16_t mtu;
+	uint32_t frame_len = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len;
 	struct lio_device *lio_dev = LIO_DEV(eth_dev);
 	uint16_t timeout = LIO_MAX_CMD_TIMEOUT;
 	int ret = 0;
@@ -1386,12 +1388,29 @@ lio_dev_start(struct rte_eth_dev *eth_dev)
 		goto dev_mtu_check_error;
 	}
 
+	if (eth_dev->data->dev_conf.rxmode.jumbo_frame == 1) {
+		if (frame_len <= ETHER_MAX_LEN ||
+		    frame_len > LIO_MAX_RX_PKTLEN) {
+			lio_dev_err(lio_dev, "max packet length should be >= %d and < %d when jumbo frame is enabled\n",
+				    ETHER_MAX_LEN, LIO_MAX_RX_PKTLEN);
+			ret = -EINVAL;
+			goto dev_mtu_check_error;
+		}
+		mtu = (uint16_t)(frame_len - ETHER_HDR_LEN - ETHER_CRC_LEN);
+	} else {
+		/* default MTU */
+		mtu = ETHER_MTU;
+		eth_dev->data->dev_conf.rxmode.max_rx_pkt_len = ETHER_MAX_LEN;
+	}
+
 	if (lio_dev->linfo.link.s.mtu != mtu) {
 		ret = lio_dev_validate_vf_mtu(eth_dev, mtu);
 		if (ret)
 			goto dev_mtu_check_error;
 	}
 
+	eth_dev->data->mtu = mtu;
+
 	return 0;
 
 dev_mtu_check_error:
-- 
2.7.4



More information about the stable mailing list