Skip to content

Commit

Permalink
net/hinic: fix MTU consistency with firmware
Browse files Browse the repository at this point in the history
[ upstream commit 3596d7b ]

The configuration of MTU is inconsistent in the driver and
firmware when the port is stopped, started and reconfigured.
Before, HINIC_MAX_JUMBO_FRAME_SIZE include VLAN tag, but when
frame and pktlen are converted to each other do not include
VLAN tag. And port_mtu_set function will use HINIC_MAX_JUMBO_FRAME_SIZE
to calculate eth_overhead, so MTU will be inconsistent in the driver and
firmware.

Fixes: e542ab5 ("net/hinic: fix jumbo frame flag condition for MTU set")

Signed-off-by: Guoyang Zhou <zhouguoyang@huawei.com>
  • Loading branch information
Guoyang Zhou authored and bluca committed Jul 26, 2021
1 parent 3e6a9fa commit f91f60b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
9 changes: 0 additions & 9 deletions drivers/net/hinic/base/hinic_pmd_niccfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,6 @@ enum hinic_link_mode {
#define HINIC_DEFAULT_RX_MODE (HINIC_RX_MODE_UC | HINIC_RX_MODE_MC | \
HINIC_RX_MODE_BC)

#define HINIC_MAX_MTU_SIZE (9600)
#define HINIC_MIN_MTU_SIZE (256)

/* MIN_MTU + ETH_HLEN + CRC (256+14+4) */
#define HINIC_MIN_FRAME_SIZE 274

/* MAX_MTU + ETH_HLEN + CRC + VLAN(9600+14+4+4) */
#define HINIC_MAX_JUMBO_FRAME_SIZE (9622)

#define HINIC_PORT_DISABLE 0x0
#define HINIC_PORT_ENABLE 0x3

Expand Down
9 changes: 0 additions & 9 deletions drivers/net/hinic/hinic_pmd_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,6 @@

#define HINIC_VLAN_FILTER_EN (1U << 0)

#define HINIC_MTU_TO_PKTLEN(mtu) \
((mtu) + ETH_HLEN + ETH_CRC_LEN)

#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
17 changes: 17 additions & 0 deletions drivers/net/hinic/hinic_pmd_ethdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@
#define HINIC_UINT32_BIT_SIZE (CHAR_BIT * sizeof(uint32_t))
#define HINIC_VFTA_SIZE (4096 / HINIC_UINT32_BIT_SIZE)

#define HINIC_MAX_MTU_SIZE 9600
#define HINIC_MIN_MTU_SIZE 256

#define HINIC_VLAN_TAG_SIZE 4
#define HINIC_ETH_OVERHEAD \
(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + HINIC_VLAN_TAG_SIZE * 2)

#define HINIC_MIN_FRAME_SIZE (HINIC_MIN_MTU_SIZE + HINIC_ETH_OVERHEAD)
#define HINIC_MAX_JUMBO_FRAME_SIZE (HINIC_MAX_MTU_SIZE + HINIC_ETH_OVERHEAD)

#define HINIC_MTU_TO_PKTLEN(mtu) ((mtu) + HINIC_ETH_OVERHEAD)

#define HINIC_PKTLEN_TO_MTU(pktlen) ((pktlen) - HINIC_ETH_OVERHEAD)

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

enum hinic_dev_status {
HINIC_DEV_INIT,
HINIC_DEV_CLOSE,
Expand Down

0 comments on commit f91f60b

Please sign in to comment.