* [PATCH 2/5] net/hns3: fix code check warning
2022-07-13 11:49 [PATCH 0/5] some bugfixes and clean code for hns3 Dongdong Liu
2022-07-13 11:49 ` [PATCH 1/5] net/hns3: rename hns3 dump file Dongdong Liu
@ 2022-07-13 11:49 ` Dongdong Liu
2022-07-13 11:50 ` [PATCH 3/5] net/hns3: adjust code for dump file Dongdong Liu
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dongdong Liu @ 2022-07-13 11:49 UTC (permalink / raw)
To: dev, ferruh.yigit, andrew.rybchenko, thomas
Cc: stable, Min Hu (Connor), Dongdong Liu, Yisen Zhuang
From: "Min Hu (Connor)" <humin29@huawei.com>
This patch fixed code check warning according to this:
function should have same name with previous declaration.
local variable should no be referenced in macro referenced.
macro argument 'adapter' should be enclosed in parentheses.
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
drivers/net/hns3/hns3_common.c | 4 ++--
drivers/net/hns3/hns3_dump.c | 4 ++--
drivers/net/hns3/hns3_ethdev.h | 14 +++++++-------
drivers/net/hns3/hns3_flow.c | 4 ++--
drivers/net/hns3/hns3_intr.c | 27 ++++++++++++---------------
drivers/net/hns3/hns3_intr.h | 4 ++--
drivers/net/hns3/hns3_regs.c | 4 ++--
| 2 +-
| 2 +-
drivers/net/hns3/hns3_rxtx.c | 4 ++--
drivers/net/hns3/hns3_rxtx.h | 14 +++++++++-----
drivers/net/hns3/hns3_stats.h | 5 +++--
12 files changed, 45 insertions(+), 43 deletions(-)
diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
index 424205356e..d8605204a6 100644
--- a/drivers/net/hns3/hns3_common.c
+++ b/drivers/net/hns3/hns3_common.c
@@ -493,7 +493,7 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del)
if (ret) {
hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE,
addr);
- hns3_err(hw, "failed to %s mac addr(%s) index:%d ret = %d.",
+ hns3_err(hw, "failed to %s mac addr(%s) index:%u ret = %d.",
del ? "remove" : "restore", mac_str, i, ret);
}
}
@@ -680,7 +680,7 @@ hns3_init_ring_with_vector(struct hns3_hw *hw)
ret = hw->ops.bind_ring_with_vector(hw, vec, false,
HNS3_RING_TYPE_TX, i);
if (ret) {
- PMD_INIT_LOG(ERR, "fail to unbind TX ring(%d) with vector: %u, ret=%d",
+ PMD_INIT_LOG(ERR, "fail to unbind TX ring(%u) with vector: %u, ret=%d",
i, vec, ret);
return ret;
}
diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c
index 2cfab429af..1738d3cd4e 100644
--- a/drivers/net/hns3/hns3_dump.c
+++ b/drivers/net/hns3/hns3_dump.c
@@ -342,7 +342,7 @@ static void
print_queue_state_perline(FILE *file, const uint32_t *queue_state,
uint32_t nb_queues, uint32_t line_num)
{
-#define NUM_QUEUE_PER_LINE (sizeof(*queue_state) * CHAR_BIT)
+#define NUM_QUEUE_PER_LINE (sizeof(uint32_t) * HNS3_UINT8_BIT)
uint32_t qid = line_num * NUM_QUEUE_PER_LINE;
uint32_t j;
@@ -365,7 +365,7 @@ static void
display_queue_enable_state(FILE *file, const uint32_t *queue_state,
uint32_t nb_queues, bool is_rxq)
{
-#define NUM_QUEUE_PER_LINE (sizeof(*queue_state) * CHAR_BIT)
+#define NUM_QUEUE_PER_LINE (sizeof(uint32_t) * HNS3_UINT8_BIT)
uint32_t i;
if (nb_queues == 0) {
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 8de5a712f4..bd5fc689f8 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -898,11 +898,11 @@ enum hns3_dev_cap {
hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_##_name##_B)
#define HNS3_DEV_PRIVATE_TO_HW(adapter) \
- (&((struct hns3_adapter *)adapter)->hw)
+ (&((struct hns3_adapter *)(adapter))->hw)
#define HNS3_DEV_PRIVATE_TO_PF(adapter) \
- (&((struct hns3_adapter *)adapter)->pf)
+ (&((struct hns3_adapter *)(adapter))->pf)
#define HNS3_DEV_PRIVATE_TO_VF(adapter) \
- (&((struct hns3_adapter *)adapter)->vf)
+ (&((struct hns3_adapter *)(adapter))->vf)
#define HNS3_DEV_HW_TO_ADAPTER(hw) \
container_of(hw, struct hns3_adapter, hw)
@@ -999,10 +999,10 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg)
#define NEXT_ITEM_OF_ACTION(act, actions, index) \
do { \
- act = (actions) + (index); \
- while (act->type == RTE_FLOW_ACTION_TYPE_VOID) { \
+ (act) = (actions) + (index); \
+ while ((act)->type == RTE_FLOW_ACTION_TYPE_VOID) { \
(index)++; \
- act = actions + index; \
+ (act) = (actions) + (index); \
} \
} while (0)
@@ -1027,7 +1027,7 @@ hns3_atomic_clear_bit(unsigned int nr, volatile uint64_t *addr)
__atomic_fetch_and(addr, ~(1UL << nr), __ATOMIC_RELAXED);
}
-static inline int64_t
+static inline uint64_t
hns3_test_and_clear_bit(unsigned int nr, volatile uint64_t *addr)
{
uint64_t mask = (1UL << nr);
diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index fb9354fe7f..b84f26c26c 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -66,7 +66,7 @@ static enum rte_flow_item_type tunnel_next_items[] = {
struct items_step_mngr {
enum rte_flow_item_type *items;
- int count;
+ size_t count;
};
static inline void
@@ -1141,7 +1141,7 @@ hns3_validate_item(const struct rte_flow_item *item,
struct items_step_mngr step_mngr,
struct rte_flow_error *error)
{
- int i;
+ uint32_t i;
if (item->last)
return rte_flow_error_set(error, ENOTSUP,
diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c
index 3ca2e1e338..4bdcd6070b 100644
--- a/drivers/net/hns3/hns3_intr.c
+++ b/drivers/net/hns3/hns3_intr.c
@@ -16,12 +16,6 @@
#define SWITCH_CONTEXT_US 10
-#define HNS3_CHECK_MERGE_CNT(val) \
- do { \
- if (val) \
- hw->reset.stats.merge_cnt++; \
- } while (0)
-
static const char *reset_string[HNS3_MAX_RESET] = {
"flr", "vf_func", "vf_pf_func", "vf_full", "vf_global",
"pf_func", "global", "IMP", "none",
@@ -2525,20 +2519,20 @@ static void
hns3_clear_reset_level(struct hns3_hw *hw, uint64_t *levels)
{
uint64_t merge_cnt = hw->reset.stats.merge_cnt;
- int64_t tmp;
+ uint64_t tmp;
switch (hw->reset.level) {
case HNS3_IMP_RESET:
hns3_atomic_clear_bit(HNS3_IMP_RESET, levels);
tmp = hns3_test_and_clear_bit(HNS3_GLOBAL_RESET, levels);
- HNS3_CHECK_MERGE_CNT(tmp);
+ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt;
tmp = hns3_test_and_clear_bit(HNS3_FUNC_RESET, levels);
- HNS3_CHECK_MERGE_CNT(tmp);
+ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt;
break;
case HNS3_GLOBAL_RESET:
hns3_atomic_clear_bit(HNS3_GLOBAL_RESET, levels);
tmp = hns3_test_and_clear_bit(HNS3_FUNC_RESET, levels);
- HNS3_CHECK_MERGE_CNT(tmp);
+ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt;
break;
case HNS3_FUNC_RESET:
hns3_atomic_clear_bit(HNS3_FUNC_RESET, levels);
@@ -2546,19 +2540,19 @@ hns3_clear_reset_level(struct hns3_hw *hw, uint64_t *levels)
case HNS3_VF_RESET:
hns3_atomic_clear_bit(HNS3_VF_RESET, levels);
tmp = hns3_test_and_clear_bit(HNS3_VF_PF_FUNC_RESET, levels);
- HNS3_CHECK_MERGE_CNT(tmp);
+ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt;
tmp = hns3_test_and_clear_bit(HNS3_VF_FUNC_RESET, levels);
- HNS3_CHECK_MERGE_CNT(tmp);
+ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt;
break;
case HNS3_VF_FULL_RESET:
hns3_atomic_clear_bit(HNS3_VF_FULL_RESET, levels);
tmp = hns3_test_and_clear_bit(HNS3_VF_FUNC_RESET, levels);
- HNS3_CHECK_MERGE_CNT(tmp);
+ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt;
break;
case HNS3_VF_PF_FUNC_RESET:
hns3_atomic_clear_bit(HNS3_VF_PF_FUNC_RESET, levels);
tmp = hns3_test_and_clear_bit(HNS3_VF_FUNC_RESET, levels);
- HNS3_CHECK_MERGE_CNT(tmp);
+ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt;
break;
case HNS3_VF_FUNC_RESET:
hns3_atomic_clear_bit(HNS3_VF_FUNC_RESET, levels);
@@ -2570,13 +2564,16 @@ hns3_clear_reset_level(struct hns3_hw *hw, uint64_t *levels)
default:
return;
};
- if (merge_cnt != hw->reset.stats.merge_cnt)
+
+ if (merge_cnt != hw->reset.stats.merge_cnt) {
hns3_warn(hw,
"No need to do low-level reset after %s reset. "
"merge cnt: %" PRIu64 " total merge cnt: %" PRIu64,
reset_string[hw->reset.level],
hw->reset.stats.merge_cnt - merge_cnt,
hw->reset.stats.merge_cnt);
+ hw->reset.stats.merge_cnt = merge_cnt;
+ }
}
static bool
diff --git a/drivers/net/hns3/hns3_intr.h b/drivers/net/hns3/hns3_intr.h
index 1a0f196614..1490a5e387 100644
--- a/drivers/net/hns3/hns3_intr.h
+++ b/drivers/net/hns3/hns3_intr.h
@@ -170,7 +170,7 @@ struct hns3_hw_error_desc {
const struct hns3_hw_error *hw_err;
};
-int hns3_enable_hw_error_intr(struct hns3_adapter *hns, bool state);
+int hns3_enable_hw_error_intr(struct hns3_adapter *hns, bool en);
void hns3_handle_msix_error(struct hns3_adapter *hns, uint64_t *levels);
void hns3_handle_ras_error(struct hns3_adapter *hns, uint64_t *levels);
void hns3_config_mac_tnl_int(struct hns3_hw *hw, bool en);
@@ -185,7 +185,7 @@ void hns3_schedule_reset(struct hns3_adapter *hns);
void hns3_schedule_delayed_reset(struct hns3_adapter *hns);
int hns3_reset_req_hw_reset(struct hns3_adapter *hns);
int hns3_reset_process(struct hns3_adapter *hns,
- enum hns3_reset_level reset_level);
+ enum hns3_reset_level new_level);
void hns3_reset_abort(struct hns3_adapter *hns);
void hns3_start_report_lse(struct rte_eth_dev *dev);
void hns3_stop_report_lse(struct rte_eth_dev *dev);
diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c
index 6778e4cfc2..33392fd1f0 100644
--- a/drivers/net/hns3/hns3_regs.c
+++ b/drivers/net/hns3/hns3_regs.c
@@ -15,7 +15,7 @@
#define REG_NUM_PER_LINE 4
#define REG_LEN_PER_LINE (REG_NUM_PER_LINE * sizeof(uint32_t))
-static int hns3_get_dfx_reg_line(struct hns3_hw *hw, uint32_t *length);
+static int hns3_get_dfx_reg_line(struct hns3_hw *hw, uint32_t *lines);
static const uint32_t cmdq_reg_addrs[] = {HNS3_CMDQ_TX_ADDR_L_REG,
HNS3_CMDQ_TX_ADDR_H_REG,
@@ -295,7 +295,7 @@ hns3_direct_access_regs(struct hns3_hw *hw, uint32_t *data)
uint32_t *origin_data_ptr = data;
uint32_t reg_offset;
uint16_t i, j;
- int reg_num;
+ size_t reg_num;
/* fetching per-PF registers values from PF PCIe register space */
reg_num = sizeof(cmdq_reg_addrs) / sizeof(uint32_t);
--git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c
index 1003daf03e..fc912ed2e8 100644
--- a/drivers/net/hns3/hns3_rss.c
+++ b/drivers/net/hns3/hns3_rss.c
@@ -10,7 +10,7 @@
#include "hns3_logs.h"
/* Default hash keys */
-const uint8_t hns3_hash_key[] = {
+const uint8_t hns3_hash_key[HNS3_RSS_KEY_SIZE] = {
0x6D, 0x5A, 0x56, 0xDA, 0x25, 0x5B, 0x0E, 0xC2,
0x41, 0x67, 0x25, 0x3D, 0x43, 0xA3, 0x8F, 0xB0,
0xD0, 0xCA, 0x2B, 0xCB, 0xAE, 0x7B, 0x30, 0xB4,
--git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h
index 56627cbd4c..39af01ef13 100644
--- a/drivers/net/hns3/hns3_rss.h
+++ b/drivers/net/hns3/hns3_rss.h
@@ -88,7 +88,7 @@ static inline uint32_t roundup_pow_of_two(uint32_t x)
return 1UL << fls(x - 1);
}
-extern const uint8_t hns3_hash_key[];
+extern const uint8_t hns3_hash_key[HNS3_RSS_KEY_SIZE];
struct hns3_adapter;
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 95f711e7eb..731f1bc0ef 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2759,7 +2759,7 @@ hns3_rx_check_vec_support(__rte_unused struct rte_eth_dev *dev)
}
uint16_t __rte_weak
-hns3_recv_pkts_vec(__rte_unused void *tx_queue,
+hns3_recv_pkts_vec(__rte_unused void *rx_queue,
__rte_unused struct rte_mbuf **rx_pkts,
__rte_unused uint16_t nb_pkts)
{
@@ -2767,7 +2767,7 @@ hns3_recv_pkts_vec(__rte_unused void *tx_queue,
}
uint16_t __rte_weak
-hns3_recv_pkts_vec_sve(__rte_unused void *tx_queue,
+hns3_recv_pkts_vec_sve(__rte_unused void *rx_queue,
__rte_unused struct rte_mbuf **rx_pkts,
__rte_unused uint16_t nb_pkts)
{
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
index 62efc854e4..455f8b9419 100644
--- a/drivers/net/hns3/hns3_rxtx.h
+++ b/drivers/net/hns3/hns3_rxtx.h
@@ -691,10 +691,12 @@ int hns3_rxq_iterate(struct rte_eth_dev *dev,
int (*callback)(struct hns3_rx_queue *, void *), void *arg);
void hns3_dev_release_mbufs(struct hns3_adapter *hns);
int hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
- unsigned int socket, const struct rte_eth_rxconf *conf,
+ unsigned int socket_id,
+ const struct rte_eth_rxconf *conf,
struct rte_mempool *mp);
int hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
- unsigned int socket, const struct rte_eth_txconf *conf);
+ unsigned int socket_id,
+ const struct rte_eth_txconf *conf);
uint32_t hns3_rx_queue_count(void *rx_queue);
int hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
int hns3_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
@@ -704,9 +706,11 @@ uint16_t hns3_recv_pkts_simple(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
uint16_t hns3_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
-uint16_t hns3_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+uint16_t hns3_recv_pkts_vec(void *__restrict rx_queue,
+ struct rte_mbuf **__restrict rx_pkts,
uint16_t nb_pkts);
-uint16_t hns3_recv_pkts_vec_sve(void *rx_queue, struct rte_mbuf **rx_pkts,
+uint16_t hns3_recv_pkts_vec_sve(void *__restrict rx_queue,
+ struct rte_mbuf **__restrict rx_pkts,
uint16_t nb_pkts);
int hns3_rx_burst_mode_get(struct rte_eth_dev *dev,
__rte_unused uint16_t queue_id,
@@ -751,7 +755,7 @@ void hns3_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo);
void hns3_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_txq_info *qinfo);
-uint32_t hns3_get_tqp_reg_offset(uint16_t idx);
+uint32_t hns3_get_tqp_reg_offset(uint16_t queue_id);
int hns3_start_all_txqs(struct rte_eth_dev *dev);
int hns3_start_all_rxqs(struct rte_eth_dev *dev);
void hns3_stop_all_txqs(struct rte_eth_dev *dev);
diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h
index b5cd6188b4..9d84072205 100644
--- a/drivers/net/hns3/hns3_stats.h
+++ b/drivers/net/hns3/hns3_stats.h
@@ -145,7 +145,8 @@ struct hns3_reset_stats;
#define HNS3_IMISSED_STATS_FIELD_OFFSET(f) \
(offsetof(struct hns3_rx_missed_stats, f))
-int hns3_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats);
+int hns3_stats_get(struct rte_eth_dev *eth_dev,
+ struct rte_eth_stats *rte_stats);
int hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
unsigned int n);
int hns3_dev_xstats_reset(struct rte_eth_dev *dev);
@@ -160,7 +161,7 @@ int hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
uint32_t size);
-int hns3_stats_reset(struct rte_eth_dev *dev);
+int hns3_stats_reset(struct rte_eth_dev *eth_dev);
int hns3_stats_init(struct hns3_hw *hw);
void hns3_stats_uninit(struct hns3_hw *hw);
int hns3_query_mac_stats_reg_num(struct hns3_hw *hw);
--
2.22.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/5] net/hns3: adjust code for dump file
2022-07-13 11:49 [PATCH 0/5] some bugfixes and clean code for hns3 Dongdong Liu
2022-07-13 11:49 ` [PATCH 1/5] net/hns3: rename hns3 dump file Dongdong Liu
2022-07-13 11:49 ` [PATCH 2/5] net/hns3: fix code check warning Dongdong Liu
@ 2022-07-13 11:50 ` Dongdong Liu
2022-07-13 11:50 ` [PATCH 4/5] net/hns3: add dump of VF vlan filter modify capability Dongdong Liu
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dongdong Liu @ 2022-07-13 11:50 UTC (permalink / raw)
To: dev, ferruh.yigit, andrew.rybchenko, thomas
Cc: stable, Dongdong Liu, Min Hu, Yisen Zhuang
Rename the function name with prefix hns3_ to keep the same code
style with other files and adjust some code to make it more readable.
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
drivers/net/hns3/hns3_dump.c | 289 +++++++++++++++++++----------------
1 file changed, 154 insertions(+), 135 deletions(-)
diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c
index 1738d3cd4e..5ce0530ef6 100644
--- a/drivers/net/hns3/hns3_dump.c
+++ b/drivers/net/hns3/hns3_dump.c
@@ -2,6 +2,8 @@
* Copyright(C) 2022 HiSilicon Limited
*/
+#include <rte_malloc.h>
+
#include "hns3_common.h"
#include "hns3_logs.h"
#include "hns3_regs.h"
@@ -9,7 +11,7 @@
#include "hns3_dump.h"
static const char *
-get_adapter_state_name(enum hns3_adapter_state state)
+hns3_get_adapter_state_name(enum hns3_adapter_state state)
{
const struct {
enum hns3_adapter_state state;
@@ -37,7 +39,7 @@ get_adapter_state_name(enum hns3_adapter_state state)
}
static const char *
-get_io_func_hint_name(uint32_t hint)
+hns3_get_io_func_hint_name(uint32_t hint)
{
switch (hint) {
case HNS3_IO_FUNC_HINT_NONE:
@@ -56,7 +58,7 @@ get_io_func_hint_name(uint32_t hint)
}
static void
-get_dev_mac_info(FILE *file, struct hns3_adapter *hns)
+hns3_get_dev_mac_info(FILE *file, struct hns3_adapter *hns)
{
struct hns3_hw *hw = &hns->hw;
struct hns3_pf *pf = &hns->pf;
@@ -78,7 +80,7 @@ get_dev_mac_info(FILE *file, struct hns3_adapter *hns)
}
static void
-get_dev_feature_capability(FILE *file, struct hns3_hw *hw)
+hns3_get_dev_feature_capability(FILE *file, struct hns3_hw *hw)
{
const struct {
enum hns3_dev_cap cap;
@@ -106,9 +108,9 @@ get_dev_feature_capability(FILE *file, struct hns3_hw *hw)
}
static const char *
-get_fdir_tuple_name(uint32_t index)
+hns3_get_fdir_tuple_name(uint32_t index)
{
- static const char * const tuple_name[] = {
+ const char * const tuple_name[] = {
"outer_dst_mac",
"outer_src_mac",
"outer_vlan_1st_tag",
@@ -147,12 +149,10 @@ get_fdir_tuple_name(uint32_t index)
}
static void
-get_fdir_basic_info(FILE *file, struct hns3_pf *pf)
+hns3_get_fdir_basic_info(FILE *file, struct hns3_pf *pf)
{
-#define TMPBUF_SIZE 2048
-#define PERLINE_TUPLE_NAMES 4
+#define HNS3_PERLINE_TUPLE_NAME_LEN 4
struct hns3_fd_cfg *fdcfg = &pf->fdir.fd_cfg;
- char tmpbuf[TMPBUF_SIZE] = {0};
uint32_t i, count = 0;
fprintf(file, " - Fdir Info:\n");
@@ -175,21 +175,19 @@ get_fdir_basic_info(FILE *file, struct hns3_pf *pf)
for (i = 0; i < MAX_TUPLE; i++) {
if (!(fdcfg->key_cfg[HNS3_FD_STAGE_1].tuple_active & BIT(i)))
continue;
- if (count % PERLINE_TUPLE_NAMES == 0)
+ if (count % HNS3_PERLINE_TUPLE_NAME_LEN == 0)
fprintf(file, "\t ");
- fprintf(file, " %s", get_fdir_tuple_name(i));
+ fprintf(file, " %s", hns3_get_fdir_tuple_name(i));
count++;
- if (count % PERLINE_TUPLE_NAMES == 0)
+ if (count % HNS3_PERLINE_TUPLE_NAME_LEN == 0)
fprintf(file, "\n");
}
- if (count % PERLINE_TUPLE_NAMES)
+ if (count % HNS3_PERLINE_TUPLE_NAME_LEN)
fprintf(file, "\n");
-
- fprintf(file, "%s", tmpbuf);
}
static void
-get_device_basic_info(FILE *file, struct rte_eth_dev *dev)
+hns3_get_device_basic_info(FILE *file, struct rte_eth_dev *dev)
{
struct hns3_adapter *hns = dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
@@ -209,7 +207,7 @@ get_device_basic_info(FILE *file, struct rte_eth_dev *dev)
"\t -- dev_flags: lsc=%d\n"
"\t -- intr_conf: lsc=%u rxq=%u\n",
dev->data->name,
- get_adapter_state_name(hw->adapter_state),
+ hns3_get_adapter_state_name(hw->adapter_state),
dev->data->nb_rx_queues, dev->data->nb_tx_queues,
hw->total_tqps_num, hw->tqps_num, hw->intr_tqps_num,
hw->rss_size_max, hw->alloc_rss_size, hw->tx_qnum_per_tc,
@@ -217,15 +215,15 @@ get_device_basic_info(FILE *file, struct rte_eth_dev *dev)
hw->tso_mode, hw->max_non_tso_bd_num,
hw->max_tm_rate,
hw->set_link_down ? "Yes" : "No",
- get_io_func_hint_name(hns->rx_func_hint),
- get_io_func_hint_name(hns->tx_func_hint),
+ hns3_get_io_func_hint_name(hns->rx_func_hint),
+ hns3_get_io_func_hint_name(hns->tx_func_hint),
!!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC),
dev->data->dev_conf.intr_conf.lsc,
dev->data->dev_conf.intr_conf.rxq);
}
static struct hns3_rx_queue *
-get_rx_queue(struct rte_eth_dev *dev)
+hns3_get_rx_queue(struct rte_eth_dev *dev)
{
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct hns3_rx_queue *rxq;
@@ -250,7 +248,7 @@ get_rx_queue(struct rte_eth_dev *dev)
}
static struct hns3_tx_queue *
-get_tx_queue(struct rte_eth_dev *dev)
+hns3_get_tx_queue(struct rte_eth_dev *dev)
{
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct hns3_tx_queue *txq;
@@ -275,7 +273,7 @@ get_tx_queue(struct rte_eth_dev *dev)
}
static void
-get_rxtx_fake_queue_info(FILE *file, struct rte_eth_dev *dev)
+hns3_get_rxtx_fake_queue_info(FILE *file, struct rte_eth_dev *dev)
{
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct hns3_rx_queue *rxq;
@@ -317,10 +315,10 @@ get_rxtx_fake_queue_info(FILE *file, struct rte_eth_dev *dev)
}
static void
-get_queue_enable_state(struct hns3_hw *hw, uint32_t *queue_state,
- uint32_t nb_queues, bool is_rxq)
+hns3_get_queue_enable_state(struct hns3_hw *hw, uint32_t *queue_state,
+ uint32_t nb_queues, bool is_rxq)
{
-#define STATE_SIZE (sizeof(*queue_state) * CHAR_BIT)
+#define HNS3_QUEUE_NUM_PER_STATS (sizeof(*queue_state) * HNS3_UINT8_BIT)
uint32_t queue_en_reg;
uint32_t reg_offset;
uint32_t state;
@@ -333,28 +331,28 @@ get_queue_enable_state(struct hns3_hw *hw, uint32_t *queue_state,
if (hns3_dev_get_support(hw, INDEP_TXRX))
state = state && hns3_read_dev(hw, reg_offset +
queue_en_reg);
- hns3_set_bit(queue_state[i / STATE_SIZE],
- i % STATE_SIZE, state);
+ hns3_set_bit(queue_state[i / HNS3_QUEUE_NUM_PER_STATS],
+ i % HNS3_QUEUE_NUM_PER_STATS, state);
}
}
static void
-print_queue_state_perline(FILE *file, const uint32_t *queue_state,
- uint32_t nb_queues, uint32_t line_num)
+hns3_print_queue_state_perline(FILE *file, const uint32_t *queue_state,
+ uint32_t nb_queues, uint32_t line_num)
{
-#define NUM_QUEUE_PER_LINE (sizeof(uint32_t) * HNS3_UINT8_BIT)
- uint32_t qid = line_num * NUM_QUEUE_PER_LINE;
- uint32_t j;
+#define HNS3_NUM_QUEUE_PER_LINE (sizeof(uint32_t) * HNS3_UINT8_BIT)
+ uint32_t id = line_num * HNS3_NUM_QUEUE_PER_LINE;
+ uint32_t i;
- for (j = 0; j < NUM_QUEUE_PER_LINE; j++) {
- fprintf(file, "%1lx", hns3_get_bit(queue_state[line_num], j));
+ for (i = 0; i < HNS3_NUM_QUEUE_PER_LINE; i++) {
+ fprintf(file, "%1lx", hns3_get_bit(queue_state[line_num], i));
- if (qid % CHAR_BIT == CHAR_BIT - 1) {
+ if (id % HNS3_UINT8_BIT == HNS3_UINT8_BIT - 1) {
fprintf(file, "%s",
- j == NUM_QUEUE_PER_LINE - 1 ? "\n" : ":");
+ i == HNS3_NUM_QUEUE_PER_LINE - 1 ? "\n" : ":");
}
- qid++;
- if (qid >= nb_queues) {
+ id++;
+ if (id >= nb_queues) {
fprintf(file, "\n");
break;
}
@@ -362,66 +360,83 @@ print_queue_state_perline(FILE *file, const uint32_t *queue_state,
}
static void
-display_queue_enable_state(FILE *file, const uint32_t *queue_state,
- uint32_t nb_queues, bool is_rxq)
+hns3_display_queue_enable_state(FILE *file, const uint32_t *queue_state,
+ uint32_t nb_queues, bool is_rxq)
{
-#define NUM_QUEUE_PER_LINE (sizeof(uint32_t) * HNS3_UINT8_BIT)
+#define HNS3_NUM_QUEUE_PER_LINE (sizeof(uint32_t) * HNS3_UINT8_BIT)
uint32_t i;
- if (nb_queues == 0) {
- fprintf(file, "\t %s queue number is 0\n",
- is_rxq ? "Rx" : "Tx");
- return;
- }
-
fprintf(file, "\t %s queue id | enable state bitMap\n",
- is_rxq ? "rx" : "tx");
+ is_rxq ? "Rx" : "Tx");
- for (i = 0; i < (nb_queues - 1) / NUM_QUEUE_PER_LINE + 1; i++) {
- uint32_t line_end = (i + 1) * NUM_QUEUE_PER_LINE - 1;
- uint32_t line_start = i * NUM_QUEUE_PER_LINE;
+ for (i = 0; i < (nb_queues - 1) / HNS3_NUM_QUEUE_PER_LINE + 1; i++) {
+ uint32_t line_end = (i + 1) * HNS3_NUM_QUEUE_PER_LINE - 1;
+ uint32_t line_start = i * HNS3_NUM_QUEUE_PER_LINE;
fprintf(file, "\t %04u - %04u | ", line_start,
nb_queues - 1 > line_end ? line_end : nb_queues - 1);
-
- print_queue_state_perline(file, queue_state, nb_queues, i);
+ hns3_print_queue_state_perline(file, queue_state, nb_queues, i);
}
}
static void
-get_rxtx_queue_enable_state(FILE *file, struct rte_eth_dev *dev)
+hns3_get_rxtx_queue_enable_state(FILE *file, struct rte_eth_dev *dev)
{
-#define MAX_TQP_NUM 1280
-#define QUEUE_BITMAP_SIZE (MAX_TQP_NUM / 32)
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- uint32_t rx_queue_state[QUEUE_BITMAP_SIZE] = {0};
- uint32_t tx_queue_state[QUEUE_BITMAP_SIZE] = {0};
+ uint32_t *rx_queue_state;
+ uint32_t *tx_queue_state;
uint32_t nb_rx_queues;
uint32_t nb_tx_queues;
+ uint32_t bitmap_size;
nb_rx_queues = dev->data->nb_rx_queues;
nb_tx_queues = dev->data->nb_tx_queues;
+ if (nb_rx_queues == 0) {
+ fprintf(file, "\t -- Rx queue number is 0\n");
+ return;
+ }
+ if (nb_tx_queues == 0) {
+ fprintf(file, "\t -- Tx queue number is 0\n");
+ return;
+ }
+
+ bitmap_size = (hw->tqps_num * sizeof(uint32_t) + HNS3_UINT32_BIT) /
+ HNS3_UINT32_BIT;
+ rx_queue_state = (uint32_t *)rte_zmalloc(NULL, bitmap_size, 0);
+ if (rx_queue_state == NULL) {
+ hns3_err(hw, "Failed to allocate memory for rx queue state!");
+ return;
+ }
+
+ tx_queue_state = (uint32_t *)rte_zmalloc(NULL, bitmap_size, 0);
+ if (tx_queue_state == NULL) {
+ hns3_err(hw, "Failed to allocate memory for tx queue state!");
+ rte_free(rx_queue_state);
+ return;
+ }
fprintf(file, "\t -- enable state:\n");
- get_queue_enable_state(hw, rx_queue_state, nb_rx_queues, true);
- display_queue_enable_state(file, rx_queue_state, nb_rx_queues,
+ hns3_get_queue_enable_state(hw, rx_queue_state, nb_rx_queues, true);
+ hns3_display_queue_enable_state(file, rx_queue_state, nb_rx_queues,
true);
- get_queue_enable_state(hw, tx_queue_state, nb_tx_queues, false);
- display_queue_enable_state(file, tx_queue_state, nb_tx_queues,
+ hns3_get_queue_enable_state(hw, tx_queue_state, nb_tx_queues, false);
+ hns3_display_queue_enable_state(file, tx_queue_state, nb_tx_queues,
false);
+ rte_free(rx_queue_state);
+ rte_free(tx_queue_state);
}
static void
-get_rxtx_queue_info(FILE *file, struct rte_eth_dev *dev)
+hns3_get_rxtx_queue_info(FILE *file, struct rte_eth_dev *dev)
{
struct hns3_rx_queue *rxq;
struct hns3_tx_queue *txq;
- rxq = get_rx_queue(dev);
+ rxq = hns3_get_rx_queue(dev);
if (rxq == NULL)
return;
- txq = get_tx_queue(dev);
+ txq = hns3_get_tx_queue(dev);
if (txq == NULL)
return;
fprintf(file, " - Rx/Tx Queue Info:\n");
@@ -434,12 +449,12 @@ get_rxtx_queue_info(FILE *file, struct rte_eth_dev *dev)
txq->port_id, txq->nb_tx_desc,
txq->tx_push_enable ? "enabled" : "disabled");
- get_rxtx_fake_queue_info(file, dev);
- get_rxtx_queue_enable_state(file, dev);
+ hns3_get_rxtx_fake_queue_info(file, dev);
+ hns3_get_rxtx_queue_enable_state(file, dev);
}
static int
-get_vlan_filter_cfg(FILE *file, struct hns3_hw *hw)
+hns3_get_vlan_filter_cfg(FILE *file, struct hns3_hw *hw)
{
#define HNS3_FILTER_TYPE_VF 0
#define HNS3_FILTER_TYPE_PORT 1
@@ -484,7 +499,7 @@ get_vlan_filter_cfg(FILE *file, struct hns3_hw *hw)
}
static int
-get_vlan_rx_offload_cfg(FILE *file, struct hns3_hw *hw)
+hns3_get_vlan_rx_offload_cfg(FILE *file, struct hns3_hw *hw)
{
struct hns3_vport_vtag_rx_cfg_cmd *req;
struct hns3_cmd_desc desc;
@@ -506,8 +521,8 @@ get_vlan_rx_offload_cfg(FILE *file, struct hns3_hw *hw)
ret = hns3_cmd_send(hw, &desc, 1);
if (ret != 0) {
hns3_err(hw,
- "NIC IMP exec ret=%d desc_num=%d optcode=0x%x!",
- ret, 1, rte_le_to_cpu_16(desc.opcode));
+ "NIC firmware exec ret=%d optcode=0x%x!", ret,
+ rte_le_to_cpu_16(desc.opcode));
return ret;
}
@@ -536,7 +551,7 @@ get_vlan_rx_offload_cfg(FILE *file, struct hns3_hw *hw)
}
static void
-parse_tx_vlan_cfg(FILE *file, struct hns3_vport_vtag_tx_cfg_cmd *req)
+hns3_parse_tx_vlan_cfg(FILE *file, struct hns3_vport_vtag_tx_cfg_cmd *req)
{
#define VLAN_VID_MASK 0x0fff
#define VLAN_PRIO_SHIFT 13
@@ -574,7 +589,7 @@ parse_tx_vlan_cfg(FILE *file, struct hns3_vport_vtag_tx_cfg_cmd *req)
}
static int
-get_vlan_tx_offload_cfg(FILE *file, struct hns3_hw *hw)
+hns3_get_vlan_tx_offload_cfg(FILE *file, struct hns3_hw *hw)
{
struct hns3_vport_vtag_tx_cfg_cmd *req;
struct hns3_cmd_desc desc;
@@ -595,50 +610,50 @@ get_vlan_tx_offload_cfg(FILE *file, struct hns3_hw *hw)
ret = hns3_cmd_send(hw, &desc, 1);
if (ret != 0) {
hns3_err(hw,
- "NIC IMP exec ret=%d desc_num=%d optcode=0x%x!",
+ "NIC firmware exec ret=%d desc_num=%d optcode=0x%x!",
ret, 1, rte_le_to_cpu_16(desc.opcode));
return ret;
}
- parse_tx_vlan_cfg(file, req);
+ hns3_parse_tx_vlan_cfg(file, req);
return 0;
}
static void
-get_port_pvid_info(FILE *file, struct hns3_hw *hw)
+hns3_get_port_pvid_info(FILE *file, struct hns3_hw *hw)
{
- fprintf(file, "\t -- pvid status: %s\n",
- hw->port_base_vlan_cfg.state ? "on" : "off");
+ fprintf(file, " - pvid status: %s\n",
+ hw->port_base_vlan_cfg.state ? "On" : "Off");
}
static void
-get_vlan_config_info(FILE *file, struct hns3_hw *hw)
+hns3_get_vlan_config_info(FILE *file, struct hns3_hw *hw)
{
int ret;
fprintf(file, " - VLAN Config Info:\n");
- ret = get_vlan_filter_cfg(file, hw);
+ ret = hns3_get_vlan_filter_cfg(file, hw);
if (ret < 0)
return;
- ret = get_vlan_rx_offload_cfg(file, hw);
+ ret = hns3_get_vlan_rx_offload_cfg(file, hw);
if (ret < 0)
return;
- ret = get_vlan_tx_offload_cfg(file, hw);
+ ret = hns3_get_vlan_tx_offload_cfg(file, hw);
if (ret < 0)
return;
}
static void
-get_tm_conf_shaper_info(FILE *file, struct hns3_tm_conf *conf)
+hns3_get_tm_conf_shaper_info(FILE *file, struct hns3_tm_conf *conf)
{
struct hns3_shaper_profile_list *shaper_profile_list =
&conf->shaper_profile_list;
struct hns3_tm_shaper_profile *shaper_profile;
- if (!conf->nb_shaper_profile)
+ if (conf->nb_shaper_profile == 0)
return;
fprintf(file, " shaper_profile:\n");
@@ -652,9 +667,9 @@ get_tm_conf_shaper_info(FILE *file, struct hns3_tm_conf *conf)
}
static void
-get_tm_conf_port_node_info(FILE *file, struct hns3_tm_conf *conf)
+hns3_get_tm_conf_port_node_info(FILE *file, struct hns3_tm_conf *conf)
{
- if (!conf->root)
+ if (conf->root == NULL)
return;
fprintf(file,
@@ -666,14 +681,14 @@ get_tm_conf_port_node_info(FILE *file, struct hns3_tm_conf *conf)
}
static void
-get_tm_conf_tc_node_info(FILE *file, struct hns3_tm_conf *conf)
+hns3_get_tm_conf_tc_node_info(FILE *file, struct hns3_tm_conf *conf)
{
struct hns3_tm_node_list *tc_list = &conf->tc_list;
struct hns3_tm_node *tc_node[HNS3_MAX_TC_NUM];
struct hns3_tm_node *tm_node;
uint32_t tidx;
- if (!conf->nb_tc_node)
+ if (conf->nb_tc_node == 0)
return;
fprintf(file, " tc_node:\n");
@@ -700,25 +715,27 @@ get_tm_conf_tc_node_info(FILE *file, struct hns3_tm_conf *conf)
}
static void
-get_tm_conf_queue_format_info(FILE *file, struct hns3_tm_node **queue_node,
- uint32_t *queue_node_tc, uint32_t nb_tx_queues)
+hns3_get_tm_conf_queue_format_info(FILE *file, struct hns3_tm_node **queue_node,
+ uint32_t *queue_node_tc,
+ uint32_t nb_tx_queues)
{
-#define PERLINE_QUEUES 32
-#define PERLINE_STRIDE 8
-#define LINE_BUF_SIZE 1024
- uint32_t i, j, line_num, start_queue, end_queue;
+#define HNS3_PERLINE_QUEUES 32
+#define HNS3_PERLINE_STRIDE 8
+ uint32_t i, j, line_num, start_queue_id, end_queue_id;
- line_num = (nb_tx_queues + PERLINE_QUEUES - 1) / PERLINE_QUEUES;
+ line_num = (nb_tx_queues + HNS3_PERLINE_QUEUES - 1) /
+ HNS3_PERLINE_QUEUES;
for (i = 0; i < line_num; i++) {
- start_queue = i * PERLINE_QUEUES;
- end_queue = (i + 1) * PERLINE_QUEUES - 1;
- if (end_queue > nb_tx_queues - 1)
- end_queue = nb_tx_queues - 1;
- fprintf(file, " %04u - %04u | ", start_queue, end_queue);
- for (j = start_queue; j < nb_tx_queues; j++) {
- if (j >= end_queue + 1)
+ start_queue_id = i * HNS3_PERLINE_QUEUES;
+ end_queue_id = (i + 1) * HNS3_PERLINE_QUEUES - 1;
+ if (end_queue_id > nb_tx_queues - 1)
+ end_queue_id = nb_tx_queues - 1;
+ fprintf(file, " %04u - %04u | ", start_queue_id,
+ end_queue_id);
+ for (j = start_queue_id; j < nb_tx_queues; j++) {
+ if (j >= end_queue_id + 1)
break;
- if (j > start_queue && j % PERLINE_STRIDE == 0)
+ if (j > start_queue_id && j % HNS3_PERLINE_STRIDE == 0)
fprintf(file, ":");
fprintf(file, "%u",
queue_node[j] ? queue_node_tc[j] :
@@ -729,8 +746,8 @@ get_tm_conf_queue_format_info(FILE *file, struct hns3_tm_node **queue_node,
}
static void
-get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf,
- uint32_t nb_tx_queues)
+hns3_get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf,
+ uint32_t nb_tx_queues)
{
struct hns3_tm_node_list *queue_list = &conf->queue_list;
uint32_t nb_queue_node = conf->nb_leaf_nodes_max + 1;
@@ -738,7 +755,7 @@ get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf,
uint32_t queue_node_tc[nb_queue_node];
struct hns3_tm_node *tm_node;
- if (!conf->nb_queue_node)
+ if (conf->nb_queue_node == 0)
return;
fprintf(file,
@@ -757,12 +774,12 @@ get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf,
nb_tx_queues = RTE_MAX(nb_tx_queues, tm_node->id + 1);
}
- get_tm_conf_queue_format_info(file, queue_node, queue_node_tc,
+ hns3_get_tm_conf_queue_format_info(file, queue_node, queue_node_tc,
nb_tx_queues);
}
static void
-get_tm_conf_info(FILE *file, struct rte_eth_dev *dev)
+hns3_get_tm_conf_info(FILE *file, struct rte_eth_dev *dev)
{
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -780,10 +797,10 @@ get_tm_conf_info(FILE *file, struct rte_eth_dev *dev)
conf->nb_shaper_profile, conf->nb_tc_node, conf->nb_queue_node,
conf->committed);
- get_tm_conf_shaper_info(file, conf);
- get_tm_conf_port_node_info(file, conf);
- get_tm_conf_tc_node_info(file, conf);
- get_tm_conf_queue_node_info(file, conf, dev->data->nb_tx_queues);
+ hns3_get_tm_conf_shaper_info(file, conf);
+ hns3_get_tm_conf_port_node_info(file, conf);
+ hns3_get_tm_conf_tc_node_info(file, conf);
+ hns3_get_tm_conf_queue_node_info(file, conf, dev->data->nb_tx_queues);
}
static void
@@ -815,7 +832,7 @@ hns3_fc_mode_to_rxtx_pause(enum hns3_fc_mode fc_mode, bool *rx_pause,
}
static bool
-is_link_fc_mode(struct hns3_adapter *hns)
+hns3_is_link_fc_mode(struct hns3_adapter *hns)
{
struct hns3_hw *hw = &hns->hw;
struct hns3_pf *pf = &hns->pf;
@@ -830,21 +847,21 @@ is_link_fc_mode(struct hns3_adapter *hns)
}
static void
-get_link_fc_info(FILE *file, struct rte_eth_dev *dev)
+hns3_get_link_fc_info(FILE *file, struct rte_eth_dev *dev)
{
struct hns3_adapter *hns = dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
- struct rte_eth_fc_conf fc_conf;
+ struct rte_eth_fc_conf cur_fc_conf;
bool rx_pause1;
bool tx_pause1;
bool rx_pause2;
bool tx_pause2;
int ret;
- if (!is_link_fc_mode(hns))
+ if (!hns3_is_link_fc_mode(hns))
return;
- ret = hns3_flow_ctrl_get(dev, &fc_conf);
+ ret = hns3_flow_ctrl_get(dev, &cur_fc_conf);
if (ret) {
fprintf(file, "get device flow control info fail!\n");
return;
@@ -852,7 +869,7 @@ get_link_fc_info(FILE *file, struct rte_eth_dev *dev)
hns3_fc_mode_to_rxtx_pause(hw->requested_fc_mode,
&rx_pause1, &tx_pause1);
- hns3_fc_mode_to_rxtx_pause((enum hns3_fc_mode)fc_conf.mode,
+ hns3_fc_mode_to_rxtx_pause((enum hns3_fc_mode)cur_fc_conf.mode,
&rx_pause2, &tx_pause2);
fprintf(file,
@@ -867,15 +884,14 @@ get_link_fc_info(FILE *file, struct rte_eth_dev *dev)
"\t Pause time: 0x%x\n",
rx_pause1 ? "On" : "Off", tx_pause1 ? "On" : "Off",
rx_pause2 ? "On" : "Off", tx_pause2 ? "On" : "Off",
- fc_conf.autoneg == RTE_ETH_LINK_AUTONEG ? "On" : "Off",
- fc_conf.pause_time);
+ cur_fc_conf.autoneg == RTE_ETH_LINK_AUTONEG ? "On" : "Off",
+ cur_fc_conf.pause_time);
}
static void
-get_flow_ctrl_info(FILE *file, struct rte_eth_dev *dev)
+hns3_get_flow_ctrl_info(FILE *file, struct rte_eth_dev *dev)
{
- struct hns3_adapter *hns = dev->data->dev_private;
- struct hns3_hw *hw = &hns->hw;
+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
fprintf(file, " - Flow Ctrl Info:\n");
fprintf(file,
@@ -885,7 +901,7 @@ get_flow_ctrl_info(FILE *file, struct rte_eth_dev *dev)
hw->current_fc_status,
hw->requested_fc_mode);
- get_link_fc_info(file, dev);
+ hns3_get_link_fc_info(file, dev);
}
int
@@ -894,20 +910,23 @@ hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file)
struct hns3_adapter *hns = dev->data->dev_private;
struct hns3_hw *hw = &hns->hw;
- get_device_basic_info(file, dev);
- get_dev_feature_capability(file, hw);
- get_rxtx_queue_info(file, dev);
- get_port_pvid_info(file, hw);
+ hns3_get_device_basic_info(file, dev);
+ hns3_get_dev_feature_capability(file, hw);
+ hns3_get_rxtx_queue_info(file, dev);
+ hns3_get_port_pvid_info(file, hw);
- /* VF only supports dumping basic info and feaure capability */
+ /*
+ * VF only supports dumping basic info, feature capability and queue
+ * info.
+ */
if (hns->is_vf)
return 0;
- get_dev_mac_info(file, hns);
- get_vlan_config_info(file, hw);
- get_fdir_basic_info(file, &hns->pf);
- get_tm_conf_info(file, dev);
- get_flow_ctrl_info(file, dev);
+ hns3_get_dev_mac_info(file, hns);
+ hns3_get_vlan_config_info(file, hw);
+ hns3_get_fdir_basic_info(file, &hns->pf);
+ hns3_get_tm_conf_info(file, dev);
+ hns3_get_flow_ctrl_info(file, dev);
return 0;
}
--
2.22.0
^ permalink raw reply [flat|nested] 8+ messages in thread