[v2,1/2] net/af_packet: fix driver init with default MTU

Message ID 20211027091429.2996153-1-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v2,1/2] net/af_packet: fix driver init with default MTU |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ferruh Yigit Oct. 27, 2021, 9:14 a.m. UTC
  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")

Reported-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2:
* Remove unnecessary cast
---
 drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Andrew Rybchenko Oct. 27, 2021, 3:12 p.m. UTC | #1
On 10/27/21 12:14 PM, Ferruh Yigit wrote:
> 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")
> 
> Reported-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
  
Ferruh Yigit Oct. 27, 2021, 3:51 p.m. UTC | #2
On 10/27/2021 4:12 PM, Andrew Rybchenko wrote:
> On 10/27/21 12:14 PM, Ferruh Yigit wrote:
>> 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")
>>
>> Reported-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> 

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

Patch

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 559f5a03e509..cea7091c0639 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -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;