DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/enic: fix max MTU calculation
@ 2019-03-14 11:05 Hyong Youb Kim
  2019-03-14 11:05 ` Hyong Youb Kim
  2019-03-20 14:30 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  0 siblings, 2 replies; 4+ messages in thread
From: Hyong Youb Kim @ 2019-03-14 11:05 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, John Daley, Hyong Youb Kim, stable

The maximum packet length (max_pkt_len) from the firmware does not
include CRC, so do not subtract 4 when deriving the max MTU. This
change effectively increases the max MTU by 4B. Apps often assume max
MTU = max_rx_pkt_len - 14 (ethernet header), and attempt to set the
MTU to that value (i.e. set MTU to max HW value). This change
incidentally allows such apps to change MTU to max value successfully.

Fixes: bb34ffb848a0 ("net/enic: determine max egress packet size and max MTU")
Cc: stable@dpdk.org

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/enic.h     | 4 ++--
 drivers/net/enic/enic_res.c | 5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index fa4d5590e..9193fb038 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -203,8 +203,8 @@ struct enic {
 /* Compute ethdev's max packet size from MTU */
 static inline uint32_t enic_mtu_to_max_rx_pktlen(uint32_t mtu)
 {
-	/* ethdev max size includes eth and crc whereas NIC MTU does not */
-	return mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+	/* ethdev max size includes eth whereas NIC MTU does not */
+	return mtu + ETHER_HDR_LEN;
 }
 
 /* Get the CQ index from a Start of Packet(SOP) RQ index */
diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c
index d289f3da8..f7cbc90fb 100644
--- a/drivers/net/enic/enic_res.c
+++ b/drivers/net/enic/enic_res.c
@@ -61,10 +61,9 @@ int enic_get_vnic_config(struct enic *enic)
 	 * and will be 0 for legacy firmware and VICs
 	 */
 	if (c->max_pkt_size > ENIC_DEFAULT_RX_MAX_PKT_SIZE)
-		enic->max_mtu = c->max_pkt_size - (ETHER_HDR_LEN + 4);
+		enic->max_mtu = c->max_pkt_size - ETHER_HDR_LEN;
 	else
-		enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE
-				- (ETHER_HDR_LEN + 4);
+		enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE - ETHER_HDR_LEN;
 	if (c->mtu == 0)
 		c->mtu = 1500;
 
-- 
2.16.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH] net/enic: fix max MTU calculation
  2019-03-14 11:05 [dpdk-dev] [PATCH] net/enic: fix max MTU calculation Hyong Youb Kim
@ 2019-03-14 11:05 ` Hyong Youb Kim
  2019-03-20 14:30 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  1 sibling, 0 replies; 4+ messages in thread
From: Hyong Youb Kim @ 2019-03-14 11:05 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, John Daley, Hyong Youb Kim, stable

The maximum packet length (max_pkt_len) from the firmware does not
include CRC, so do not subtract 4 when deriving the max MTU. This
change effectively increases the max MTU by 4B. Apps often assume max
MTU = max_rx_pkt_len - 14 (ethernet header), and attempt to set the
MTU to that value (i.e. set MTU to max HW value). This change
incidentally allows such apps to change MTU to max value successfully.

Fixes: bb34ffb848a0 ("net/enic: determine max egress packet size and max MTU")
Cc: stable@dpdk.org

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/enic.h     | 4 ++--
 drivers/net/enic/enic_res.c | 5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index fa4d5590e..9193fb038 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -203,8 +203,8 @@ struct enic {
 /* Compute ethdev's max packet size from MTU */
 static inline uint32_t enic_mtu_to_max_rx_pktlen(uint32_t mtu)
 {
-	/* ethdev max size includes eth and crc whereas NIC MTU does not */
-	return mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+	/* ethdev max size includes eth whereas NIC MTU does not */
+	return mtu + ETHER_HDR_LEN;
 }
 
 /* Get the CQ index from a Start of Packet(SOP) RQ index */
diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c
index d289f3da8..f7cbc90fb 100644
--- a/drivers/net/enic/enic_res.c
+++ b/drivers/net/enic/enic_res.c
@@ -61,10 +61,9 @@ int enic_get_vnic_config(struct enic *enic)
 	 * and will be 0 for legacy firmware and VICs
 	 */
 	if (c->max_pkt_size > ENIC_DEFAULT_RX_MAX_PKT_SIZE)
-		enic->max_mtu = c->max_pkt_size - (ETHER_HDR_LEN + 4);
+		enic->max_mtu = c->max_pkt_size - ETHER_HDR_LEN;
 	else
-		enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE
-				- (ETHER_HDR_LEN + 4);
+		enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE - ETHER_HDR_LEN;
 	if (c->mtu == 0)
 		c->mtu = 1500;
 
-- 
2.16.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] net/enic: fix max MTU calculation
  2019-03-14 11:05 [dpdk-dev] [PATCH] net/enic: fix max MTU calculation Hyong Youb Kim
  2019-03-14 11:05 ` Hyong Youb Kim
@ 2019-03-20 14:30 ` Ferruh Yigit
  2019-03-20 14:30   ` Ferruh Yigit
  1 sibling, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2019-03-20 14:30 UTC (permalink / raw)
  To: Hyong Youb Kim; +Cc: dev, John Daley, stable

On 3/14/2019 11:05 AM, Hyong Youb Kim wrote:
> The maximum packet length (max_pkt_len) from the firmware does not
> include CRC, so do not subtract 4 when deriving the max MTU. This
> change effectively increases the max MTU by 4B. Apps often assume max
> MTU = max_rx_pkt_len - 14 (ethernet header), and attempt to set the
> MTU to that value (i.e. set MTU to max HW value). This change
> incidentally allows such apps to change MTU to max value successfully.
> 
> Fixes: bb34ffb848a0 ("net/enic: determine max egress packet size and max MTU")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
> Reviewed-by: John Daley <johndale@cisco.com>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] net/enic: fix max MTU calculation
  2019-03-20 14:30 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
@ 2019-03-20 14:30   ` Ferruh Yigit
  0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2019-03-20 14:30 UTC (permalink / raw)
  To: Hyong Youb Kim; +Cc: dev, John Daley, stable

On 3/14/2019 11:05 AM, Hyong Youb Kim wrote:
> The maximum packet length (max_pkt_len) from the firmware does not
> include CRC, so do not subtract 4 when deriving the max MTU. This
> change effectively increases the max MTU by 4B. Apps often assume max
> MTU = max_rx_pkt_len - 14 (ethernet header), and attempt to set the
> MTU to that value (i.e. set MTU to max HW value). This change
> incidentally allows such apps to change MTU to max value successfully.
> 
> Fixes: bb34ffb848a0 ("net/enic: determine max egress packet size and max MTU")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
> Reviewed-by: John Daley <johndale@cisco.com>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-20 14:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14 11:05 [dpdk-dev] [PATCH] net/enic: fix max MTU calculation Hyong Youb Kim
2019-03-14 11:05 ` Hyong Youb Kim
2019-03-20 14:30 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2019-03-20 14:30   ` 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).