Skip to contentSkip to conversation

net/af_packet: fix driver init with default MTU

PATCH Superseded Ferruh Yigit 4 participants 10 messages Oct 26, 2021 – Oct 27, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net/af_packet: fix driver init with default MTU

Driver is using 'ETH_FRAME_LEN' Linux defined value as max frame length, which doesn't include FCS (4 bytes CRC). But ethdev by default uses frame size with FCS when application doesn't define any explicit value.

As a result device configuration fails because device is tried to be configured with a frame size length that is bigger than what device reported as supported. Device reports as max supported frame size is 1514 but configured value is 1518.

Instead use DPDK macro, 'RTE_ETHER_MAX_LEN', that includes FCS in the driver to report the max supported frame size, this matches to the initial intention.

Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")
---
 drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/af_packet/rte_eth_af_packet.c +1 -1
index 559f5a03e509..5a820829143a 100644
@@ -342,7 +342,7 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->if_index = internals->if_index;
 	dev_info->max_mac_addrs = 1;
-	dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
+	dev_info->max_rx_pktlen = (uint32_t)RTE_ETHER_MAX_LEN;
 	dev_info->max_rx_queues = (uint16_t)internals->nb_queues;
 	dev_info->max_tx_queues = (uint16_t)internals->nb_queues;
 	dev_info->min_rx_bufsize = 0;
Signature · 1 line
2.31.1
#1 lore raw

PATCH 2/2 net/memif: fix driver init with default MTU

Driver is using 'ETH_FRAME_LEN' Linux defined value as max frame length, which doesn't include FCS (4 bytes CRC). But ethdev by default uses frame size with FCS when application doesn't define any explicit value.

As a result device configuration fails because device is tried to be configured with a frame size length that is bigger than what device reported as supported. Device reports as max supported frame size is 1514 but configured value is 1518.

Instead use DPDK macro, 'RTE_ETHER_MAX_LEN', that includes FCS in the driver to report the max supported frame size, this matches to the initial intention.

Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")
---
 drivers/net/memif/rte_eth_memif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/memif/rte_eth_memif.c +1 -1
index 8cec493ffdb9..cbc99067c1c8 100644
@@ -195,7 +195,7 @@ static int
 memif_dev_info(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info)
 {
 	dev_info->max_mac_addrs = 1;
-	dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
+	dev_info->max_rx_pktlen = (uint32_t)RTE_ETHER_MAX_LEN;
 	dev_info->max_rx_queues = ETH_MEMIF_MAX_NUM_Q_PAIRS;
 	dev_info->max_tx_queues = ETH_MEMIF_MAX_NUM_Q_PAIRS;
 	dev_info->min_rx_bufsize = 0;
Signature · 1 line
2.31.1
Tested-by on v1 2/2
#2 lore raw

Re: [dpdk-dev] [PATCH 2/2] net/memif: fix driver init with default MTU

Quoted 27 lines · Ferruh Yigit

Driver is using 'ETH_FRAME_LEN' Linux defined value as max frame length, which doesn't include FCS (4 bytes CRC). But ethdev by default uses frame size with FCS when application doesn't define any explicit value.

As a result device configuration fails because device is tried to be configured with a frame size length that is bigger than what device reported as supported. Device reports as max supported frame size is 1514 but configured value is 1518.

Instead use DPDK macro, 'RTE_ETHER_MAX_LEN', that includes FCS in the driver to report the max supported frame size, this matches to the initial intention.

Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")
---
  drivers/net/memif/rte_eth_memif.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/memif/rte_eth_memif.c +0 -0
index 8cec493ffdb9..cbc99067c1c8 100644

drivers/net/memif/rte_eth_memif.c static int · line 201

Quoted 8 lines
drivers/net/memif/rte_eth_memif.c +1 -1
@@ -195,7 +195,7 @@ static int
  memif_dev_info(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info)
  {
  	dev_info->max_mac_addrs = 1;
-	dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
+	dev_info->max_rx_pktlen = (uint32_t)RTE_ETHER_MAX_LEN;
  	dev_info->max_rx_queues = ETH_MEMIF_MAX_NUM_Q_PAIRS;
  	dev_info->max_tx_queues = ETH_MEMIF_MAX_NUM_Q_PAIRS;
  	dev_info->min_rx_bufsize = 0;
#3 lore raw

Re: [dpdk-dev] [PATCH 2/2] net/memif: fix driver init with default MTU

In reply to Ferruh Yigit

drivers/net/memif/rte_eth_memif.c static int · line 198

Quoted 10 lines · On Tue, 26 Oct 2021 16:38:01 +0100 Ferruh Yigit <[email protected]> wrote:
drivers/net/memif/rte_eth_memif.c +1 -1
index 8cec493ffdb9..cbc99067c1c8 100644
@@ -195,7 +195,7 @@ static int
 memif_dev_info(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info)
 {
 	dev_info->max_mac_addrs = 1;
-	dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
+	dev_info->max_rx_pktlen = (uint32_t)RTE_ETHER_MAX_LEN;

The cast is not necessary here. Not sure why the original code had it?

#4 lore raw

Re: [dpdk-dev] [PATCH 2/2] net/memif: fix driver init with default MTU

Quoted 16 lines · Stephen Hemminger

drivers/net/memif/rte_eth_memif.c static int · line 198

Quoted 10 lines · On Tue, 26 Oct 2021 16:38:01 +0100 Ferruh Yigit <[email protected]> wrote:
drivers/net/memif/rte_eth_memif.c +1 -1
index 8cec493ffdb9..cbc99067c1c8 100644
@@ -195,7 +195,7 @@ static int
  memif_dev_info(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info)
  {
  	dev_info->max_mac_addrs = 1;
-	dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
+	dev_info->max_rx_pktlen = (uint32_t)RTE_ETHER_MAX_LEN;

The cast is not necessary here. Not sure why the original code had it?

ack.

I will send a new version to remove the cast, since touching those lines.

#5 lore raw

PATCH v2 1/2 net/af_packet: fix driver init with default MTU

In reply to Ferruh Yigit

Driver is using 'ETH_FRAME_LEN' Linux defined value as max frame length, which doesn't include FCS (4 bytes CRC). But ethdev by default uses frame size with FCS when application doesn't define any explicit value.

As a result device configuration fails because device is tried to be configured with a frame size length that is bigger than what device reported as supported. Device reports as max supported frame size is 1514 but configured value is 1518.

Instead use DPDK macro, 'RTE_ETHER_MAX_LEN', that includes FCS in the driver to report the max supported frame size, this matches to the initial intention.

Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")

---
v2:
* Remove unnecessary cast

---
 drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/af_packet/rte_eth_af_packet.c +1 -1
index 559f5a03e509..cea7091c0639 100644
@@ -342,7 +342,7 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->if_index = internals->if_index;
 	dev_info->max_mac_addrs = 1;
-	dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
+	dev_info->max_rx_pktlen = RTE_ETHER_MAX_LEN;
 	dev_info->max_rx_queues = (uint16_t)internals->nb_queues;
 	dev_info->max_tx_queues = (uint16_t)internals->nb_queues;
 	dev_info->min_rx_bufsize = 0;
Signature · 1 line
2.31.1
#6 lore raw

PATCH v2 2/2 net/memif: fix driver init with default MTU

Driver is using 'ETH_FRAME_LEN' Linux defined value as max frame length, which doesn't include FCS (4 bytes CRC). But ethdev by default uses frame size with FCS when application doesn't define any explicit value.

As a result device configuration fails because device is tried to be configured with a frame size length that is bigger than what device reported as supported. Device reports as max supported frame size is 1514 but configured value is 1518.

Instead use DPDK macro, 'RTE_ETHER_MAX_LEN', that includes FCS in the driver to report the max supported frame size, this matches to the initial intention.

Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")

---
v2:
* Remove unnecessary cast

---
 drivers/net/memif/rte_eth_memif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/memif/rte_eth_memif.c +1 -1
index 8cec493ffdb9..e4ebabec6ad6 100644
@@ -195,7 +195,7 @@ static int
 memif_dev_info(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info)
 {
 	dev_info->max_mac_addrs = 1;
-	dev_info->max_rx_pktlen = (uint32_t)ETH_FRAME_LEN;
+	dev_info->max_rx_pktlen = RTE_ETHER_MAX_LEN;
 	dev_info->max_rx_queues = ETH_MEMIF_MAX_NUM_Q_PAIRS;
 	dev_info->max_tx_queues = ETH_MEMIF_MAX_NUM_Q_PAIRS;
 	dev_info->min_rx_bufsize = 0;
Signature · 1 line
2.31.1
Reviewed-by on v2 2/2
#7 lore raw

Re: [dpdk-dev] [PATCH v2 2/2] net/memif: fix driver init with default MTU

Quoted 13 lines · Ferruh Yigit

Driver is using 'ETH_FRAME_LEN' Linux defined value as max frame length, which doesn't include FCS (4 bytes CRC). But ethdev by default uses frame size with FCS when application doesn't define any explicit value.

As a result device configuration fails because device is tried to be configured with a frame size length that is bigger than what device reported as supported. Device reports as max supported frame size is 1514 but configured value is 1518.

Instead use DPDK macro, 'RTE_ETHER_MAX_LEN', that includes FCS in the driver to report the max supported frame size, this matches to the initial intention.

Quoted 5 lines
Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")
Reviewed-by on v2 1/2
#8 lore raw
In reply to Ferruh Yigit
Quoted 9 lines · Ferruh Yigit

Driver is using 'ETH_FRAME_LEN' Linux defined value as max frame length, which doesn't include FCS (4 bytes CRC). But ethdev by default uses frame size with FCS when application doesn't define any explicit value.

As a result device configuration fails because device is tried to be configured with a frame size length that is bigger than what device reported as supported. Device reports as max supported frame size is 1514 but configured value is 1518.

Quoted 8 lines

Instead use DPDK macro, 'RTE_ETHER_MAX_LEN', that includes FCS in the driver to report the max supported frame size, this matches to the initial intention.

Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")
#9 lore raw
Quoted 14 lines · Andrew Rybchenko
Quoted 13 lines · Ferruh Yigit

Driver is using 'ETH_FRAME_LEN' Linux defined value as max frame length, which doesn't include FCS (4 bytes CRC). But ethdev by default uses frame size with FCS when application doesn't define any explicit value.

As a result device configuration fails because device is tried to be configured with a frame size length that is bigger than what device reported as supported. Device reports as max supported frame size is 1514 but configured value is 1518.

Instead use DPDK macro, 'RTE_ETHER_MAX_LEN', that includes FCS in the driver to report the max supported frame size, this matches to the initial intention.

Quoted 7 lines
Quoted 4 lines
Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")

Series applied to dpdk-next-net/main, thanks.