fix some problems of mtu, vlan, lro
cover fix some problems of mtu, vlan, lro
The vlan id 0 can not be deleted, and the rx queue must config as ceq disable, and must set msix state disable because of lro function, and fix the problem of MTU inconsistent in the driver and firmware.
--
v1:
- increase the protection of the VLAN interface
- fix the problem of LRO
- fix the problem of MTU inconsistent
Guoyang Zhou (3):
net/hinic: increase the protection of the VLAN
net/hinic/base: fix the problem of LRO
net/hinic: fix the problem of MTU inconsistent
drivers/net/hinic/base/hinic_pmd_niccfg.h | 9 --------- drivers/net/hinic/base/hinic_pmd_nicio.c | 4 ++-- drivers/net/hinic/hinic_pmd_ethdev.c | 12 +++--------- drivers/net/hinic/hinic_pmd_ethdev.h | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 20 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/3 net/hinic: increase the protection of the VLAN
If the vlan id 0 is deleted for hinic, all packets without vlan will be discarded when the vlan filter is turned on.
--- drivers/net/hinic/hinic_pmd_ethdev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/hinic/hinic_pmd_ethdev.c +3 -0
@@ -1617,6 +1617,9 @@ static int hinic_vlan_filter_set(struct rte_eth_dev *dev,if (vlan_id >RTE_ETHER_MAX_VLAN_ID )return -EINVAL ; +if (vlan_id ==0 ) +return 0 ; + func_id =hinic_global_func_id (nic_dev->hwdev);if (enable) {
Signature · 1 line
1.8.3.1
PATCH 2/3 net/hinic/base: fix the problem of LRO
In reply to Guoyang ZhouThe rx queue must config as ceq disable, and must set msix state disable. Otherwise when lro is enable, there will be problems with packet aggregation because of firmware.
--- drivers/net/hinic/base/hinic_pmd_nicio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/hinic/base/hinic_pmd_nicio.c +2 -2
@@ -230,8 +230,8 @@ static void hinic_rq_prepare_ctxt(struct hinic_rq *rq, wq_block_pfn_hi =upper_32_bits (wq_block_pfn); wq_block_pfn_lo =lower_32_bits (wq_block_pfn); -/* must config as ceq enable but do not generate ceq */ - rq_ctxt->ceq_attr =RQ_CTXT_CEQ_ATTR_SET (1 ,EN ) | +/* config as ceq disable, but must set msix state disable */ + rq_ctxt->ceq_attr =RQ_CTXT_CEQ_ATTR_SET (0 ,EN ) |RQ_CTXT_CEQ_ATTR_SET (1 ,OWNER ); rq_ctxt->pi_intr_attr = RQ_CTXT_PI_SET(pi_start, IDX) |
Signature · 1 line
1.8.3.1
PATCH 3/3 net/hinic: fix the problem of MTU inconsistent
In reply to Guoyang ZhouThe 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.
--- drivers/net/hinic/base/hinic_pmd_niccfg.h | 9 --------- drivers/net/hinic/hinic_pmd_ethdev.c | 9 --------- drivers/net/hinic/hinic_pmd_ethdev.h | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 18 deletions(-)
drivers/net/hinic/base/hinic_pmd_niccfg.h +0 -9
@@ -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
drivers/net/hinic/hinic_pmd_ethdev.c +0 -9
@@ -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
drivers/net/hinic/hinic_pmd_ethdev.h +17 -0
@@ -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 ,
Signature · 1 line
1.8.3.1
Thomas Monjalon
Applied16/07/2021 11:54, Guoyang Zhou:
Quoted 9 lines
The vlan id 0 can not be deleted, and the rx queue must config as ceq disable, and must set msix state disable because of lro function, and fix the problem of MTU inconsistent in the driver and firmware.
Guoyang Zhou (3):
net/hinic: increase the protection of the VLAN
net/hinic/base: fix the problem of LRO
net/hinic: fix the problem of MTU inconsistent
Applied, thanks.