net/hns3: fix traffic management
PATCH 1/1 net/hns3: fix traffic management
From: Huisong Li <[email protected]>
In a multi-TC scenario, if the length of packets destined for different TCs is different, for example, 64B and 1500B packets destined for TC0 and TC1 respectively. There is a problem that the bandwidth of the TC to which large packets are sent is preempted by the TC to which small packets are sent on the Kunpeng 920 network engine. As a result, the TC bandwidth accuracy is inaccurate.
To solve this problem, this patch made the following adjustments:
1/ During initialization, firmware reports the capability bit indicating whether the TM function is supported.
2/ The command word for configuring TC and port rate limiting is added, instead of reusing the existing command word. And firmware configured to the correct module.
3/ When the PF driver is loaded, firmware completes the default initialization of the TC and port.
--- drivers/net/hns3/hns3_cmd.c | 5 ++- drivers/net/hns3/hns3_cmd.h | 4 +++ drivers/net/hns3/hns3_dcb.c | 4 +-- drivers/net/hns3/hns3_dcb.h | 2 -- drivers/net/hns3/hns3_ethdev.h | 4 +++ drivers/net/hns3/hns3_tm.c | 69 +++++++++++++++++++++++++++++------------- drivers/net/hns3/hns3_tm.h | 12 ++++++++ 7 files changed, 74 insertions(+), 26 deletions(-)
drivers/net/hns3/hns3_cmd.c +4 -1
@@ -427,7 +427,8 @@ hns3_get_caps_name(uint32_t caps_id) { HNS3_CAPS_STASH_B, "stash" }, { HNS3_CAPS_UDP_TUNNEL_CSUM_B, "udp_tunnel_csum" }, { HNS3_CAPS_RAS_IMP_B, "ras_imp" }, - { HNS3_CAPS_RXD_ADV_LAYOUT_B, "rxd_adv_layout" } + { HNS3_CAPS_RXD_ADV_LAYOUT_B, "rxd_adv_layout" }, + { HNS3_CAPS_TM_B, "tm_capability" } };uint32_t i;
@@ -503,6 +504,8 @@ hns3_parse_capability(struct hns3_hw *hw, HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, 1);if (hns3_get_bit (caps,HNS3_CAPS_RAS_IMP_B ))hns3_set_bit (hw->capability,HNS3_DEV_SUPPORT_RAS_IMP_B ,1 ); +if (hns3_get_bit (caps,HNS3_CAPS_TM_B )) +hns3_set_bit (hw->capability,HNS3_DEV_SUPPORT_TM_B ,1 ); } static uint32_t
drivers/net/hns3/hns3_cmd.h +4 -0
@@ -162,6 +162,9 @@ enum hns3_opcode_type {HNS3_OPC_TM_INTERNAL_CNT =0x0851 ,HNS3_OPC_TM_INTERNAL_STS_1 =0x0852 , +HNS3_OPC_TM_PORT_LIMIT_RATE =0x0870 , +HNS3_OPC_TM_TC_LIMIT_RATE =0x0871 , +/* Mailbox cmd */ HNS3_OPC_MBX_VF_TO_PF = 0x2001,
@@ -319,6 +322,7 @@ enum HNS3_CAPS_BITS {HNS3_CAPS_UDP_TUNNEL_CSUM_B ,HNS3_CAPS_RAS_IMP_B ,HNS3_CAPS_RXD_ADV_LAYOUT_B =15 , + HNS3_CAPS_TM_B = 17, }; enum HNS3_API_CAP_BITS {
drivers/net/hns3/hns3_dcb.c +2 -2
@@ -415,7 +415,7 @@ hns3_dcb_pg_shapping_cfg(struct hns3_hw *hw, enum hns3_shap_bucket bucket,return hns3_cmd_send (hw, &desc,1 ); } -int +static int hns3_pg_shaper_rate_cfg (struct hns3_hw *hw,uint8_t pg_id,uint32_t rate) {struct hns3_shaper_parameter shaper_parameter;
@@ -551,7 +551,7 @@ hns3_dcb_pri_shapping_cfg(struct hns3_hw *hw, enum hns3_shap_bucket bucket,return hns3_cmd_send (hw, &desc,1 ); } -int +static int hns3_pri_shaper_rate_cfg (struct hns3_hw *hw,uint8_t tc_no,uint32_t rate) {struct hns3_shaper_parameter shaper_parameter;
drivers/net/hns3/hns3_dcb.h +0 -2
@@ -209,8 +209,6 @@ int hns3_queue_to_tc_mapping(struct hns3_hw *hw, uint16_t nb_rx_q,int hns3_update_queue_map_configure (struct hns3_adapter *hns);int hns3_port_shaper_update (struct hns3_hw *hw,uint32_t speed); -int hns3_pg_shaper_rate_cfg (struct hns3_hw *hw,uint8_t pg_id,uint32_t rate); -int hns3_pri_shaper_rate_cfg (struct hns3_hw *hw,uint8_t tc_no,uint32_t rate);uint8_t hns3_txq_mapped_tc_get (struct hns3_hw *hw,uint16_t txq_no);#endif /* _HNS3_DCB_H_ */
drivers/net/hns3/hns3_ethdev.h +4 -0
@@ -868,6 +868,7 @@ enum {HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B ,HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B ,HNS3_DEV_SUPPORT_RAS_IMP_B , + HNS3_DEV_SUPPORT_TM_B, };#define hns3_dev_dcb_supported (hw) \
@@ -904,6 +905,9 @@ enum {#define hns3_dev_tx_push_supported (hw) \ hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_TX_PUSH_B) +#define hns3_dev_tm_supported (hw) \ + hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_TM_B) +#define HNS3_DEV_PRIVATE_TO_HW (adapter) \ (&((struct hns3_adapter *)adapter)->hw)#define HNS3_DEV_PRIVATE_TO_PF (adapter) \
drivers/net/hns3/hns3_tm.c +48 -21
136 lines not on this page · raw message
drivers/net/hns3/hns3_tm.h +12 -0
@@ -9,6 +9,18 @@#include <rte_tailq.h> #include <rte_tm_driver.h> +struct hns3_port_limit_rate_cmd { +uint32_t speed;/* Unit Mbps */ +uint32_t rsvd[5 ]; +}; + +struct hns3_tc_limit_rate_cmd { +uint32_t speed;/* Unit Mbps */ +uint8_t tc_id; +uint8_t rsvd[3 ]; +uint32_t rsvd1[4 ]; +}; +enum hns3_tm_node_type {HNS3_TM_NODE_TYPE_PORT ,HNS3_TM_NODE_TYPE_TC ,
Signature · 1 line
2.7.4
Andrew Rybchenko
AppliedQuoted 18 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
In a multi-TC scenario, if the length of packets destined for different TCs is different, for example, 64B and 1500B packets destined for TC0 and TC1 respectively. There is a problem that the bandwidth of the TC to which large packets are sent is preempted by the TC to which small packets are sent on the Kunpeng 920 network engine. As a result, the TC bandwidth accuracy is inaccurate.
To solve this problem, this patch made the following adjustments:
1/ During initialization, firmware reports the capability bit indicating whether the TM function is supported.
2/ The command word for configuring TC and port rate limiting is added, instead of reusing the existing command word. And firmware configured to the correct module.
3/ When the PF driver is loaded, firmware completes the default initialization of the TC and port.
Quoted 4 lines
Fixes c09c7847d892 ("net/hns3: support traffic management")Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>
Applied, thanks.