Commit a6c51c26 authored by Jian Shen's avatar Jian Shen Committed by David S. Miller

net: hns3: Unify the strings display of packet statistics

Some members of packet statistics are named in different styles.
This patch unifies them with new internal name rules, the main
modification are below:
trans --> tx
rcv --> rx
rcb_q%d_tx -->  txq#%d
rcb_q%d_rx -->  rxq#%d
sw_err_cnt(tx side) --> tx_dropped
sw_err_cnt(rx side) --> rx_dropped
pkts --> packets
tx_err_cnt --> errors
rx_err_cnt --> errors
Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 30ba2ab9
...@@ -28,13 +28,13 @@ struct hns3_stats { ...@@ -28,13 +28,13 @@ struct hns3_stats {
static const struct hns3_stats hns3_txq_stats[] = { static const struct hns3_stats hns3_txq_stats[] = {
/* Tx per-queue statistics */ /* Tx per-queue statistics */
HNS3_TQP_STAT("tx_io_err_cnt", io_err_cnt), HNS3_TQP_STAT("io_err_cnt", io_err_cnt),
HNS3_TQP_STAT("tx_sw_err_cnt", sw_err_cnt), HNS3_TQP_STAT("tx_dropped", sw_err_cnt),
HNS3_TQP_STAT("tx_seg_pkt_cnt", seg_pkt_cnt), HNS3_TQP_STAT("seg_pkt_cnt", seg_pkt_cnt),
HNS3_TQP_STAT("tx_pkts", tx_pkts), HNS3_TQP_STAT("packets", tx_pkts),
HNS3_TQP_STAT("tx_bytes", tx_bytes), HNS3_TQP_STAT("bytes", tx_bytes),
HNS3_TQP_STAT("tx_err_cnt", tx_err_cnt), HNS3_TQP_STAT("errors", tx_err_cnt),
HNS3_TQP_STAT("tx_restart_queue", restart_queue), HNS3_TQP_STAT("tx_wake", restart_queue),
HNS3_TQP_STAT("tx_busy", tx_busy), HNS3_TQP_STAT("tx_busy", tx_busy),
}; };
...@@ -42,18 +42,18 @@ static const struct hns3_stats hns3_txq_stats[] = { ...@@ -42,18 +42,18 @@ static const struct hns3_stats hns3_txq_stats[] = {
static const struct hns3_stats hns3_rxq_stats[] = { static const struct hns3_stats hns3_rxq_stats[] = {
/* Rx per-queue statistics */ /* Rx per-queue statistics */
HNS3_TQP_STAT("rx_io_err_cnt", io_err_cnt), HNS3_TQP_STAT("io_err_cnt", io_err_cnt),
HNS3_TQP_STAT("rx_sw_err_cnt", sw_err_cnt), HNS3_TQP_STAT("rx_dropped", sw_err_cnt),
HNS3_TQP_STAT("rx_seg_pkt_cnt", seg_pkt_cnt), HNS3_TQP_STAT("seg_pkt_cnt", seg_pkt_cnt),
HNS3_TQP_STAT("rx_pkts", rx_pkts), HNS3_TQP_STAT("packets", rx_pkts),
HNS3_TQP_STAT("rx_bytes", rx_bytes), HNS3_TQP_STAT("bytes", rx_bytes),
HNS3_TQP_STAT("rx_err_cnt", rx_err_cnt), HNS3_TQP_STAT("errors", rx_err_cnt),
HNS3_TQP_STAT("rx_reuse_pg_cnt", reuse_pg_cnt), HNS3_TQP_STAT("reuse_pg_cnt", reuse_pg_cnt),
HNS3_TQP_STAT("rx_err_pkt_len", err_pkt_len), HNS3_TQP_STAT("err_pkt_len", err_pkt_len),
HNS3_TQP_STAT("rx_non_vld_descs", non_vld_descs), HNS3_TQP_STAT("non_vld_descs", non_vld_descs),
HNS3_TQP_STAT("rx_err_bd_num", err_bd_num), HNS3_TQP_STAT("err_bd_num", err_bd_num),
HNS3_TQP_STAT("rx_l2_err", l2_err), HNS3_TQP_STAT("l2_err", l2_err),
HNS3_TQP_STAT("rx_l3l4_csum_err", l3l4_csum_err), HNS3_TQP_STAT("l3l4_csum_err", l3l4_csum_err),
}; };
#define HNS3_RXQ_STATS_COUNT ARRAY_SIZE(hns3_rxq_stats) #define HNS3_RXQ_STATS_COUNT ARRAY_SIZE(hns3_rxq_stats)
...@@ -389,9 +389,9 @@ static int hns3_get_sset_count(struct net_device *netdev, int stringset) ...@@ -389,9 +389,9 @@ static int hns3_get_sset_count(struct net_device *netdev, int stringset)
} }
static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats, static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats,
u32 stat_count, u32 num_tqps) u32 stat_count, u32 num_tqps, const char *prefix)
{ {
#define MAX_PREFIX_SIZE (8 + 4) #define MAX_PREFIX_SIZE (6 + 4)
u32 size_left; u32 size_left;
u32 i, j; u32 i, j;
u32 n1; u32 n1;
...@@ -401,7 +401,8 @@ static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats, ...@@ -401,7 +401,8 @@ static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats,
data[ETH_GSTRING_LEN - 1] = '\0'; data[ETH_GSTRING_LEN - 1] = '\0';
/* first, prepend the prefix string */ /* first, prepend the prefix string */
n1 = snprintf(data, MAX_PREFIX_SIZE, "rcb_q%d_", i); n1 = snprintf(data, MAX_PREFIX_SIZE, "%s#%d_",
prefix, i);
n1 = min_t(uint, n1, MAX_PREFIX_SIZE - 1); n1 = min_t(uint, n1, MAX_PREFIX_SIZE - 1);
size_left = (ETH_GSTRING_LEN - 1) - n1; size_left = (ETH_GSTRING_LEN - 1) - n1;
...@@ -417,14 +418,16 @@ static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats, ...@@ -417,14 +418,16 @@ static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats,
static u8 *hns3_get_strings_tqps(struct hnae3_handle *handle, u8 *data) static u8 *hns3_get_strings_tqps(struct hnae3_handle *handle, u8 *data)
{ {
struct hnae3_knic_private_info *kinfo = &handle->kinfo; struct hnae3_knic_private_info *kinfo = &handle->kinfo;
const char tx_prefix[] = "txq";
const char rx_prefix[] = "rxq";
/* get strings for Tx */ /* get strings for Tx */
data = hns3_update_strings(data, hns3_txq_stats, HNS3_TXQ_STATS_COUNT, data = hns3_update_strings(data, hns3_txq_stats, HNS3_TXQ_STATS_COUNT,
kinfo->num_tqps); kinfo->num_tqps, tx_prefix);
/* get strings for Rx */ /* get strings for Rx */
data = hns3_update_strings(data, hns3_rxq_stats, HNS3_RXQ_STATS_COUNT, data = hns3_update_strings(data, hns3_rxq_stats, HNS3_RXQ_STATS_COUNT,
kinfo->num_tqps); kinfo->num_tqps, rx_prefix);
return data; return data;
} }
......
...@@ -332,30 +332,30 @@ static const struct hclge_comm_stats_str g_mac_stats_string[] = { ...@@ -332,30 +332,30 @@ static const struct hclge_comm_stats_str g_mac_stats_string[] = {
{"mac_rx_1519_max_oct_pkt_num", {"mac_rx_1519_max_oct_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_rx_1519_max_oct_pkt_num)}, HCLGE_MAC_STATS_FIELD_OFF(mac_rx_1519_max_oct_pkt_num)},
{"mac_trans_fragment_pkt_num", {"mac_tx_fragment_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_trans_fragment_pkt_num)}, HCLGE_MAC_STATS_FIELD_OFF(mac_tx_fragment_pkt_num)},
{"mac_trans_undermin_pkt_num", {"mac_tx_undermin_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_trans_undermin_pkt_num)}, HCLGE_MAC_STATS_FIELD_OFF(mac_tx_undermin_pkt_num)},
{"mac_trans_jabber_pkt_num", {"mac_tx_jabber_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_trans_jabber_pkt_num)}, HCLGE_MAC_STATS_FIELD_OFF(mac_tx_jabber_pkt_num)},
{"mac_trans_err_all_pkt_num", {"mac_tx_err_all_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_trans_err_all_pkt_num)}, HCLGE_MAC_STATS_FIELD_OFF(mac_tx_err_all_pkt_num)},
{"mac_trans_from_app_good_pkt_num", {"mac_tx_from_app_good_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_trans_from_app_good_pkt_num)}, HCLGE_MAC_STATS_FIELD_OFF(mac_tx_from_app_good_pkt_num)},
{"mac_trans_from_app_bad_pkt_num", {"mac_tx_from_app_bad_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_trans_from_app_bad_pkt_num)}, HCLGE_MAC_STATS_FIELD_OFF(mac_tx_from_app_bad_pkt_num)},
{"mac_rcv_fragment_pkt_num", {"mac_rx_fragment_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_rcv_fragment_pkt_num)}, HCLGE_MAC_STATS_FIELD_OFF(mac_rx_fragment_pkt_num)},
{"mac_rcv_undermin_pkt_num", {"mac_rx_undermin_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_rcv_undermin_pkt_num)}, HCLGE_MAC_STATS_FIELD_OFF(mac_rx_undermin_pkt_num)},
{"mac_rcv_jabber_pkt_num", {"mac_rx_jabber_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_rcv_jabber_pkt_num)}, HCLGE_MAC_STATS_FIELD_OFF(mac_rx_jabber_pkt_num)},
{"mac_rcv_fcs_err_pkt_num", {"mac_rx_fcs_err_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_rcv_fcs_err_pkt_num)}, HCLGE_MAC_STATS_FIELD_OFF(mac_rx_fcs_err_pkt_num)},
{"mac_rcv_send_app_good_pkt_num", {"mac_rx_send_app_good_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_rcv_send_app_good_pkt_num)}, HCLGE_MAC_STATS_FIELD_OFF(mac_rx_send_app_good_pkt_num)},
{"mac_rcv_send_app_bad_pkt_num", {"mac_rx_send_app_bad_pkt_num",
HCLGE_MAC_STATS_FIELD_OFF(mac_rcv_send_app_bad_pkt_num)} HCLGE_MAC_STATS_FIELD_OFF(mac_rx_send_app_bad_pkt_num)}
}; };
static int hclge_64_bit_update_stats(struct hclge_dev *hdev) static int hclge_64_bit_update_stats(struct hclge_dev *hdev)
...@@ -587,7 +587,7 @@ static u8 *hclge_tqps_get_strings(struct hnae3_handle *handle, u8 *data) ...@@ -587,7 +587,7 @@ static u8 *hclge_tqps_get_strings(struct hnae3_handle *handle, u8 *data)
for (i = 0; i < kinfo->num_tqps; i++) { for (i = 0; i < kinfo->num_tqps; i++) {
struct hclge_tqp *tqp = container_of(handle->kinfo.tqp[i], struct hclge_tqp *tqp = container_of(handle->kinfo.tqp[i],
struct hclge_tqp, q); struct hclge_tqp, q);
snprintf(buff, ETH_GSTRING_LEN, "rcb_q%d_tx_pktnum_rcd", snprintf(buff, ETH_GSTRING_LEN, "txq#%d_pktnum_rcd",
tqp->index); tqp->index);
buff = buff + ETH_GSTRING_LEN; buff = buff + ETH_GSTRING_LEN;
} }
...@@ -595,7 +595,7 @@ static u8 *hclge_tqps_get_strings(struct hnae3_handle *handle, u8 *data) ...@@ -595,7 +595,7 @@ static u8 *hclge_tqps_get_strings(struct hnae3_handle *handle, u8 *data)
for (i = 0; i < kinfo->num_tqps; i++) { for (i = 0; i < kinfo->num_tqps; i++) {
struct hclge_tqp *tqp = container_of(kinfo->tqp[i], struct hclge_tqp *tqp = container_of(kinfo->tqp[i],
struct hclge_tqp, q); struct hclge_tqp, q);
snprintf(buff, ETH_GSTRING_LEN, "rcb_q%d_rx_pktnum_rcd", snprintf(buff, ETH_GSTRING_LEN, "rxq#%d_pktnum_rcd",
tqp->index); tqp->index);
buff = buff + ETH_GSTRING_LEN; buff = buff + ETH_GSTRING_LEN;
} }
...@@ -648,12 +648,12 @@ static void hclge_update_netstat(struct hclge_hw_stats *hw_stats, ...@@ -648,12 +648,12 @@ static void hclge_update_netstat(struct hclge_hw_stats *hw_stats,
net_stats->rx_errors += hw_stats->all_32_bit_stats.igu_rx_err_pkt; net_stats->rx_errors += hw_stats->all_32_bit_stats.igu_rx_err_pkt;
net_stats->rx_errors += hw_stats->all_32_bit_stats.igu_rx_no_eof_pkt; net_stats->rx_errors += hw_stats->all_32_bit_stats.igu_rx_no_eof_pkt;
net_stats->rx_errors += hw_stats->all_32_bit_stats.igu_rx_no_sof_pkt; net_stats->rx_errors += hw_stats->all_32_bit_stats.igu_rx_no_sof_pkt;
net_stats->rx_errors += hw_stats->mac_stats.mac_rcv_fcs_err_pkt_num; net_stats->rx_errors += hw_stats->mac_stats.mac_rx_fcs_err_pkt_num;
net_stats->multicast = hw_stats->mac_stats.mac_tx_multi_pkt_num; net_stats->multicast = hw_stats->mac_stats.mac_tx_multi_pkt_num;
net_stats->multicast += hw_stats->mac_stats.mac_rx_multi_pkt_num; net_stats->multicast += hw_stats->mac_stats.mac_rx_multi_pkt_num;
net_stats->rx_crc_errors = hw_stats->mac_stats.mac_rcv_fcs_err_pkt_num; net_stats->rx_crc_errors = hw_stats->mac_stats.mac_rx_fcs_err_pkt_num;
net_stats->rx_length_errors = net_stats->rx_length_errors =
hw_stats->mac_stats.mac_rx_undersize_pkt_num; hw_stats->mac_stats.mac_rx_undersize_pkt_num;
net_stats->rx_length_errors += net_stats->rx_length_errors +=
......
...@@ -408,18 +408,18 @@ struct hclge_mac_stats { ...@@ -408,18 +408,18 @@ struct hclge_mac_stats {
u64 mac_rx_1024_1518_oct_pkt_num; u64 mac_rx_1024_1518_oct_pkt_num;
u64 mac_rx_1519_max_oct_pkt_num; u64 mac_rx_1519_max_oct_pkt_num;
u64 mac_trans_fragment_pkt_num; u64 mac_tx_fragment_pkt_num;
u64 mac_trans_undermin_pkt_num; u64 mac_tx_undermin_pkt_num;
u64 mac_trans_jabber_pkt_num; u64 mac_tx_jabber_pkt_num;
u64 mac_trans_err_all_pkt_num; u64 mac_tx_err_all_pkt_num;
u64 mac_trans_from_app_good_pkt_num; u64 mac_tx_from_app_good_pkt_num;
u64 mac_trans_from_app_bad_pkt_num; u64 mac_tx_from_app_bad_pkt_num;
u64 mac_rcv_fragment_pkt_num; u64 mac_rx_fragment_pkt_num;
u64 mac_rcv_undermin_pkt_num; u64 mac_rx_undermin_pkt_num;
u64 mac_rcv_jabber_pkt_num; u64 mac_rx_jabber_pkt_num;
u64 mac_rcv_fcs_err_pkt_num; u64 mac_rx_fcs_err_pkt_num;
u64 mac_rcv_send_app_good_pkt_num; u64 mac_rx_send_app_good_pkt_num;
u64 mac_rcv_send_app_bad_pkt_num; u64 mac_rx_send_app_bad_pkt_num;
}; };
struct hclge_hw_stats { struct hclge_hw_stats {
......
...@@ -105,7 +105,7 @@ static u8 *hclgevf_tqps_get_strings(struct hnae3_handle *handle, u8 *data) ...@@ -105,7 +105,7 @@ static u8 *hclgevf_tqps_get_strings(struct hnae3_handle *handle, u8 *data)
for (i = 0; i < hdev->num_tqps; i++) { for (i = 0; i < hdev->num_tqps; i++) {
struct hclgevf_tqp *tqp = container_of(handle->kinfo.tqp[i], struct hclgevf_tqp *tqp = container_of(handle->kinfo.tqp[i],
struct hclgevf_tqp, q); struct hclgevf_tqp, q);
snprintf(buff, ETH_GSTRING_LEN, "rcb_q%d_tx_pktnum_rcd", snprintf(buff, ETH_GSTRING_LEN, "txq#%d_pktnum_rcd",
tqp->index); tqp->index);
buff += ETH_GSTRING_LEN; buff += ETH_GSTRING_LEN;
} }
...@@ -113,7 +113,7 @@ static u8 *hclgevf_tqps_get_strings(struct hnae3_handle *handle, u8 *data) ...@@ -113,7 +113,7 @@ static u8 *hclgevf_tqps_get_strings(struct hnae3_handle *handle, u8 *data)
for (i = 0; i < hdev->num_tqps; i++) { for (i = 0; i < hdev->num_tqps; i++) {
struct hclgevf_tqp *tqp = container_of(handle->kinfo.tqp[i], struct hclgevf_tqp *tqp = container_of(handle->kinfo.tqp[i],
struct hclgevf_tqp, q); struct hclgevf_tqp, q);
snprintf(buff, ETH_GSTRING_LEN, "rcb_q%d_rx_pktnum_rcd", snprintf(buff, ETH_GSTRING_LEN, "rxq#%d_pktnum_rcd",
tqp->index); tqp->index);
buff += ETH_GSTRING_LEN; buff += ETH_GSTRING_LEN;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment