Skip to content

Commit

Permalink
net/hinic: fix jumbo frame flag condition for MTU set
Browse files Browse the repository at this point in the history
[ upstream commit e542ab5 ]

The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition.
If the Ether overhead is larger than 18 when it supports VLAN tag,
that will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will normalize the boundary condition with 'RTE_ETHER_MTU'
and overhead even though current overhead is 18.

Fixes: 254bd84 ("net/hinic: set jumbo frame offload flag")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  • Loading branch information
Steve Yang authored and bluca committed Feb 4, 2021
1 parent b60c9ab commit 4d55d2f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/hinic/hinic_pmd_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
#define HINIC_PKTLEN_TO_MTU(pktlen) \
((pktlen) - (ETH_HLEN + ETH_CRC_LEN))

/* The max frame size with default MTU */
#define HINIC_ETH_MAX_LEN (RTE_ETHER_MTU + ETH_HLEN + ETH_CRC_LEN)

/* lro numer limit for one packet */
#define HINIC_LRO_WQE_NUM_DEFAULT 8

Expand Down Expand Up @@ -1556,7 +1559,7 @@ static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)

/* update max frame size */
frame_size = HINIC_MTU_TO_PKTLEN(mtu);
if (frame_size > RTE_ETHER_MAX_LEN)
if (frame_size > HINIC_ETH_MAX_LEN)
dev->data->dev_conf.rxmode.offloads |=
DEV_RX_OFFLOAD_JUMBO_FRAME;
else
Expand Down

0 comments on commit 4d55d2f

Please sign in to comment.