net/hinic: fix jumbo frame flag condition for MTU set

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: 254bd849b1 ("net/hinic: set jumbo frame offload flag")
Cc: stable@dpdk.org

Signed-off-by: Steve Yang <stevex.yang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Steve Yang 2021-01-18 07:04:26 +00:00 committed by Ferruh Yigit
parent 4d44217b06
commit e542ab51ab

View File

@ -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
@ -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