Skip to content

Commit

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

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

This fix will change the boundary condition with 'HSN3_DEFAULT_FRAME_LEN',
that perhaps impacts the cases of the jumbo frame related.

Fixes: 1f5ca0b ("net/hns3: support some device operations")
Fixes: a5475d6 ("net/hns3: support VF")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
Acked-by: Lijun Ou <oulijun@huawei.com>
  • Loading branch information
Steve Yang authored and cpaelzer committed Feb 3, 2021
1 parent d369e76 commit cbb54ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/net/hns3/hns3_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2420,7 +2420,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
}

rte_spinlock_lock(&hw->lock);
is_jumbo_frame = frame_size > RTE_ETHER_MAX_LEN ? true : false;
is_jumbo_frame = frame_size > HNS3_DEFAULT_FRAME_LEN ? true : false;
frame_size = RTE_MAX(frame_size, HNS3_DEFAULT_FRAME_LEN);

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/hns3/hns3_ethdev_vf.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ hns3vf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
rte_spinlock_unlock(&hw->lock);
return ret;
}
if (frame_size > RTE_ETHER_MAX_LEN)
if (mtu > RTE_ETHER_MTU)
dev->data->dev_conf.rxmode.offloads |=
DEV_RX_OFFLOAD_JUMBO_FRAME;
else
Expand Down

0 comments on commit cbb54ee

Please sign in to comment.