* [dpdk-dev] [PATCH] net/liquidio: fix MTU calculation from port configuration
@ 2017-06-06 11:04 Shijith Thotton
2017-06-08 10:19 ` Ferruh Yigit
0 siblings, 1 reply; 2+ messages in thread
From: Shijith Thotton @ 2017-06-06 11:04 UTC (permalink / raw)
To: dev
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@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 436d25b..61946ac 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 @@ struct rte_lio_xstats_name_off {
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 @@ struct rte_lio_xstats_name_off {
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:
--
1.8.3.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] net/liquidio: fix MTU calculation from port configuration
2017-06-06 11:04 [dpdk-dev] [PATCH] net/liquidio: fix MTU calculation from port configuration Shijith Thotton
@ 2017-06-08 10:19 ` Ferruh Yigit
0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2017-06-08 10:19 UTC (permalink / raw)
To: Shijith Thotton, dev
On 6/6/2017 12:04 PM, Shijith Thotton wrote:
> 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@caviumnetworks.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-08 10:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-06 11:04 [dpdk-dev] [PATCH] net/liquidio: fix MTU calculation from port configuration Shijith Thotton
2017-06-08 10:19 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).