mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
net: hisilicon: hns: use ethtool string helpers
The latter is the preferred way to copy ethtool strings. Avoids manually incrementing the pointer. Cleans up the code quite well. Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Jijie Shao <shaojijie@huawei.com> Link: https://patch.msgid.link/20241101220023.290926-1-rosenp@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
7d1c2d517f
commit
7a4ea5da4d
@ -512,7 +512,7 @@ struct hnae_ae_ops {
|
||||
struct net_device_stats *net_stats);
|
||||
void (*get_stats)(struct hnae_handle *handle, u64 *data);
|
||||
void (*get_strings)(struct hnae_handle *handle,
|
||||
u32 stringset, u8 *data);
|
||||
u32 stringset, u8 **data);
|
||||
int (*get_sset_count)(struct hnae_handle *handle, int stringset);
|
||||
void (*update_led_status)(struct hnae_handle *handle);
|
||||
int (*set_led_id)(struct hnae_handle *handle,
|
||||
|
@ -730,15 +730,14 @@ static void hns_ae_get_stats(struct hnae_handle *handle, u64 *data)
|
||||
hns_dsaf_get_stats(vf_cb->dsaf_dev, p, vf_cb->port_index);
|
||||
}
|
||||
|
||||
static void hns_ae_get_strings(struct hnae_handle *handle,
|
||||
u32 stringset, u8 *data)
|
||||
static void hns_ae_get_strings(struct hnae_handle *handle, u32 stringset,
|
||||
u8 **data)
|
||||
{
|
||||
int port;
|
||||
int idx;
|
||||
struct hns_mac_cb *mac_cb;
|
||||
struct hns_ppe_cb *ppe_cb;
|
||||
struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev);
|
||||
u8 *p = data;
|
||||
struct hnae_vf_cb *vf_cb;
|
||||
|
||||
assert(handle);
|
||||
@ -748,19 +747,14 @@ static void hns_ae_get_strings(struct hnae_handle *handle,
|
||||
mac_cb = hns_get_mac_cb(handle);
|
||||
ppe_cb = hns_get_ppe_cb(handle);
|
||||
|
||||
for (idx = 0; idx < handle->q_num; idx++) {
|
||||
hns_rcb_get_strings(stringset, p, idx);
|
||||
p += ETH_GSTRING_LEN * hns_rcb_get_ring_sset_count(stringset);
|
||||
}
|
||||
for (idx = 0; idx < handle->q_num; idx++)
|
||||
hns_rcb_get_strings(stringset, data, idx);
|
||||
|
||||
hns_ppe_get_strings(ppe_cb, stringset, p);
|
||||
p += ETH_GSTRING_LEN * hns_ppe_get_sset_count(stringset);
|
||||
|
||||
hns_mac_get_strings(mac_cb, stringset, p);
|
||||
p += ETH_GSTRING_LEN * hns_mac_get_sset_count(mac_cb, stringset);
|
||||
hns_ppe_get_strings(ppe_cb, stringset, data);
|
||||
hns_mac_get_strings(mac_cb, stringset, data);
|
||||
|
||||
if (mac_cb->mac_type == HNAE_PORT_SERVICE)
|
||||
hns_dsaf_get_strings(stringset, p, port, dsaf_dev);
|
||||
hns_dsaf_get_strings(stringset, data, port, dsaf_dev);
|
||||
}
|
||||
|
||||
static int hns_ae_get_sset_count(struct hnae_handle *handle, int stringset)
|
||||
|
@ -669,16 +669,15 @@ static void hns_gmac_get_stats(void *mac_drv, u64 *data)
|
||||
}
|
||||
}
|
||||
|
||||
static void hns_gmac_get_strings(u32 stringset, u8 *data)
|
||||
static void hns_gmac_get_strings(u32 stringset, u8 **data)
|
||||
{
|
||||
u8 *buff = data;
|
||||
u32 i;
|
||||
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(g_gmac_stats_string); i++)
|
||||
ethtool_puts(&buff, g_gmac_stats_string[i].desc);
|
||||
ethtool_puts(data, g_gmac_stats_string[i].desc);
|
||||
}
|
||||
|
||||
static int hns_gmac_get_sset_count(int stringset)
|
||||
|
@ -1190,8 +1190,7 @@ void hns_mac_get_stats(struct hns_mac_cb *mac_cb, u64 *data)
|
||||
mac_ctrl_drv->get_ethtool_stats(mac_ctrl_drv, data);
|
||||
}
|
||||
|
||||
void hns_mac_get_strings(struct hns_mac_cb *mac_cb,
|
||||
int stringset, u8 *data)
|
||||
void hns_mac_get_strings(struct hns_mac_cb *mac_cb, int stringset, u8 **data)
|
||||
{
|
||||
struct mac_driver *mac_ctrl_drv = hns_mac_get_drv(mac_cb);
|
||||
|
||||
|
@ -378,7 +378,7 @@ struct mac_driver {
|
||||
void (*get_regs)(void *mac_drv, void *data);
|
||||
int (*get_regs_count)(void);
|
||||
/* get strings name for ethtool statistic */
|
||||
void (*get_strings)(u32 stringset, u8 *data);
|
||||
void (*get_strings)(u32 stringset, u8 **data);
|
||||
/* get the number of strings*/
|
||||
int (*get_sset_count)(int stringset);
|
||||
|
||||
@ -445,7 +445,7 @@ int hns_mac_config_mac_loopback(struct hns_mac_cb *mac_cb,
|
||||
enum hnae_loop loop, int en);
|
||||
void hns_mac_update_stats(struct hns_mac_cb *mac_cb);
|
||||
void hns_mac_get_stats(struct hns_mac_cb *mac_cb, u64 *data);
|
||||
void hns_mac_get_strings(struct hns_mac_cb *mac_cb, int stringset, u8 *data);
|
||||
void hns_mac_get_strings(struct hns_mac_cb *mac_cb, int stringset, u8 **data);
|
||||
int hns_mac_get_sset_count(struct hns_mac_cb *mac_cb, int stringset);
|
||||
void hns_mac_get_regs(struct hns_mac_cb *mac_cb, void *data);
|
||||
int hns_mac_get_regs_count(struct hns_mac_cb *mac_cb);
|
||||
|
@ -2590,55 +2590,34 @@ void hns_dsaf_get_regs(struct dsaf_device *ddev, u32 port, void *data)
|
||||
p[i] = 0xdddddddd;
|
||||
}
|
||||
|
||||
static char *hns_dsaf_get_node_stats_strings(char *data, int node,
|
||||
struct dsaf_device *dsaf_dev)
|
||||
static void hns_dsaf_get_node_stats_strings(u8 **data, int node,
|
||||
struct dsaf_device *dsaf_dev)
|
||||
{
|
||||
char *buff = data;
|
||||
int i;
|
||||
bool is_ver1 = AE_IS_VER1(dsaf_dev->dsaf_ver);
|
||||
int i;
|
||||
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_pad_drop_pkts", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_manage_pkts", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_rx_pkts", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_rx_pkt_id", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_rx_pause_frame", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_release_buf_num", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_sbm_drop_pkts", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_crc_false_pkts", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_bp_drop_pkts", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_lookup_rslt_drop_pkts", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_local_rslt_fail_pkts", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_vlan_drop_pkts", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
snprintf(buff, ETH_GSTRING_LEN, "innod%d_stp_drop_pkts", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
ethtool_sprintf(data, "innod%d_pad_drop_pkts", node);
|
||||
ethtool_sprintf(data, "innod%d_manage_pkts", node);
|
||||
ethtool_sprintf(data, "innod%d_rx_pkts", node);
|
||||
ethtool_sprintf(data, "innod%d_rx_pkt_id", node);
|
||||
ethtool_sprintf(data, "innod%d_rx_pause_frame", node);
|
||||
ethtool_sprintf(data, "innod%d_release_buf_num", node);
|
||||
ethtool_sprintf(data, "innod%d_sbm_drop_pkts", node);
|
||||
ethtool_sprintf(data, "innod%d_crc_false_pkts", node);
|
||||
ethtool_sprintf(data, "innod%d_bp_drop_pkts", node);
|
||||
ethtool_sprintf(data, "innod%d_lookup_rslt_drop_pkts", node);
|
||||
ethtool_sprintf(data, "innod%d_local_rslt_fail_pkts", node);
|
||||
ethtool_sprintf(data, "innod%d_vlan_drop_pkts", node);
|
||||
ethtool_sprintf(data, "innod%d_stp_drop_pkts", node);
|
||||
if (node < DSAF_SERVICE_NW_NUM && !is_ver1) {
|
||||
for (i = 0; i < DSAF_PRIO_NR; i++) {
|
||||
snprintf(buff + 0 * ETH_GSTRING_LEN * DSAF_PRIO_NR,
|
||||
ETH_GSTRING_LEN, "inod%d_pfc_prio%d_pkts",
|
||||
node, i);
|
||||
snprintf(buff + 1 * ETH_GSTRING_LEN * DSAF_PRIO_NR,
|
||||
ETH_GSTRING_LEN, "onod%d_pfc_prio%d_pkts",
|
||||
node, i);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
ethtool_sprintf(data, "inod%d_pfc_prio%d_pkts", node,
|
||||
i);
|
||||
ethtool_sprintf(data, "onod%d_pfc_prio%d_pkts", node,
|
||||
i);
|
||||
}
|
||||
buff += 1 * DSAF_PRIO_NR * ETH_GSTRING_LEN;
|
||||
}
|
||||
snprintf(buff, ETH_GSTRING_LEN, "onnod%d_tx_pkts", node);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
|
||||
return buff;
|
||||
ethtool_sprintf(data, "onnod%d_tx_pkts", node);
|
||||
}
|
||||
|
||||
static u64 *hns_dsaf_get_node_stats(struct dsaf_device *ddev, u64 *data,
|
||||
@ -2720,21 +2699,20 @@ int hns_dsaf_get_sset_count(struct dsaf_device *dsaf_dev, int stringset)
|
||||
*@port:port index
|
||||
*@dsaf_dev: dsaf device
|
||||
*/
|
||||
void hns_dsaf_get_strings(int stringset, u8 *data, int port,
|
||||
void hns_dsaf_get_strings(int stringset, u8 **data, int port,
|
||||
struct dsaf_device *dsaf_dev)
|
||||
{
|
||||
char *buff = (char *)data;
|
||||
int node = port;
|
||||
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
/* for ge/xge node info */
|
||||
buff = hns_dsaf_get_node_stats_strings(buff, node, dsaf_dev);
|
||||
hns_dsaf_get_node_stats_strings(data, node, dsaf_dev);
|
||||
|
||||
/* for ppe node info */
|
||||
node = port + DSAF_PPE_INODE_BASE;
|
||||
(void)hns_dsaf_get_node_stats_strings(buff, node, dsaf_dev);
|
||||
hns_dsaf_get_node_stats_strings(data, node, dsaf_dev);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -442,7 +442,7 @@ void hns_dsaf_update_stats(struct dsaf_device *dsaf_dev, u32 inode_num);
|
||||
|
||||
int hns_dsaf_get_sset_count(struct dsaf_device *dsaf_dev, int stringset);
|
||||
void hns_dsaf_get_stats(struct dsaf_device *ddev, u64 *data, int port);
|
||||
void hns_dsaf_get_strings(int stringset, u8 *data, int port,
|
||||
void hns_dsaf_get_strings(int stringset, u8 **data, int port,
|
||||
struct dsaf_device *dsaf_dev);
|
||||
|
||||
void hns_dsaf_get_regs(struct dsaf_device *ddev, u32 port, void *data);
|
||||
|
@ -457,24 +457,23 @@ int hns_ppe_get_regs_count(void)
|
||||
* @stringset: string set type
|
||||
* @data: output string
|
||||
*/
|
||||
void hns_ppe_get_strings(struct hns_ppe_cb *ppe_cb, int stringset, u8 *data)
|
||||
void hns_ppe_get_strings(struct hns_ppe_cb *ppe_cb, int stringset, u8 **data)
|
||||
{
|
||||
int index = ppe_cb->index;
|
||||
u8 *buff = data;
|
||||
|
||||
ethtool_sprintf(&buff, "ppe%d_rx_sw_pkt", index);
|
||||
ethtool_sprintf(&buff, "ppe%d_rx_pkt_ok", index);
|
||||
ethtool_sprintf(&buff, "ppe%d_rx_drop_pkt_no_bd", index);
|
||||
ethtool_sprintf(&buff, "ppe%d_rx_alloc_buf_fail", index);
|
||||
ethtool_sprintf(&buff, "ppe%d_rx_alloc_buf_wait", index);
|
||||
ethtool_sprintf(&buff, "ppe%d_rx_pkt_drop_no_buf", index);
|
||||
ethtool_sprintf(&buff, "ppe%d_rx_pkt_err_fifo_full", index);
|
||||
ethtool_sprintf(data, "ppe%d_rx_sw_pkt", index);
|
||||
ethtool_sprintf(data, "ppe%d_rx_pkt_ok", index);
|
||||
ethtool_sprintf(data, "ppe%d_rx_drop_pkt_no_bd", index);
|
||||
ethtool_sprintf(data, "ppe%d_rx_alloc_buf_fail", index);
|
||||
ethtool_sprintf(data, "ppe%d_rx_alloc_buf_wait", index);
|
||||
ethtool_sprintf(data, "ppe%d_rx_pkt_drop_no_buf", index);
|
||||
ethtool_sprintf(data, "ppe%d_rx_pkt_err_fifo_full", index);
|
||||
|
||||
ethtool_sprintf(&buff, "ppe%d_tx_bd", index);
|
||||
ethtool_sprintf(&buff, "ppe%d_tx_pkt", index);
|
||||
ethtool_sprintf(&buff, "ppe%d_tx_pkt_ok", index);
|
||||
ethtool_sprintf(&buff, "ppe%d_tx_pkt_err_fifo_empty", index);
|
||||
ethtool_sprintf(&buff, "ppe%d_tx_pkt_err_csum_fail", index);
|
||||
ethtool_sprintf(data, "ppe%d_tx_bd", index);
|
||||
ethtool_sprintf(data, "ppe%d_tx_pkt", index);
|
||||
ethtool_sprintf(data, "ppe%d_tx_pkt_ok", index);
|
||||
ethtool_sprintf(data, "ppe%d_tx_pkt_err_fifo_empty", index);
|
||||
ethtool_sprintf(data, "ppe%d_tx_pkt_err_csum_fail", index);
|
||||
}
|
||||
|
||||
void hns_ppe_get_stats(struct hns_ppe_cb *ppe_cb, u64 *data)
|
||||
|
@ -109,7 +109,7 @@ int hns_ppe_get_sset_count(int stringset);
|
||||
int hns_ppe_get_regs_count(void);
|
||||
void hns_ppe_get_regs(struct hns_ppe_cb *ppe_cb, void *data);
|
||||
|
||||
void hns_ppe_get_strings(struct hns_ppe_cb *ppe_cb, int stringset, u8 *data);
|
||||
void hns_ppe_get_strings(struct hns_ppe_cb *ppe_cb, int stringset, u8 **data);
|
||||
void hns_ppe_get_stats(struct hns_ppe_cb *ppe_cb, u64 *data);
|
||||
void hns_ppe_set_tso_enable(struct hns_ppe_cb *ppe_cb, u32 value);
|
||||
void hns_ppe_set_rss_key(struct hns_ppe_cb *ppe_cb,
|
||||
|
@ -923,44 +923,42 @@ int hns_rcb_get_ring_regs_count(void)
|
||||
*@data:strings name value
|
||||
*@index:queue index
|
||||
*/
|
||||
void hns_rcb_get_strings(int stringset, u8 *data, int index)
|
||||
void hns_rcb_get_strings(int stringset, u8 **data, int index)
|
||||
{
|
||||
u8 *buff = data;
|
||||
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
ethtool_sprintf(&buff, "tx_ring%d_rcb_pkt_num", index);
|
||||
ethtool_sprintf(&buff, "tx_ring%d_ppe_tx_pkt_num", index);
|
||||
ethtool_sprintf(&buff, "tx_ring%d_ppe_drop_pkt_num", index);
|
||||
ethtool_sprintf(&buff, "tx_ring%d_fbd_num", index);
|
||||
ethtool_sprintf(data, "tx_ring%d_rcb_pkt_num", index);
|
||||
ethtool_sprintf(data, "tx_ring%d_ppe_tx_pkt_num", index);
|
||||
ethtool_sprintf(data, "tx_ring%d_ppe_drop_pkt_num", index);
|
||||
ethtool_sprintf(data, "tx_ring%d_fbd_num", index);
|
||||
|
||||
ethtool_sprintf(&buff, "tx_ring%d_pkt_num", index);
|
||||
ethtool_sprintf(&buff, "tx_ring%d_bytes", index);
|
||||
ethtool_sprintf(&buff, "tx_ring%d_err_cnt", index);
|
||||
ethtool_sprintf(&buff, "tx_ring%d_io_err", index);
|
||||
ethtool_sprintf(&buff, "tx_ring%d_sw_err", index);
|
||||
ethtool_sprintf(&buff, "tx_ring%d_seg_pkt", index);
|
||||
ethtool_sprintf(&buff, "tx_ring%d_restart_queue", index);
|
||||
ethtool_sprintf(&buff, "tx_ring%d_tx_busy", index);
|
||||
ethtool_sprintf(data, "tx_ring%d_pkt_num", index);
|
||||
ethtool_sprintf(data, "tx_ring%d_bytes", index);
|
||||
ethtool_sprintf(data, "tx_ring%d_err_cnt", index);
|
||||
ethtool_sprintf(data, "tx_ring%d_io_err", index);
|
||||
ethtool_sprintf(data, "tx_ring%d_sw_err", index);
|
||||
ethtool_sprintf(data, "tx_ring%d_seg_pkt", index);
|
||||
ethtool_sprintf(data, "tx_ring%d_restart_queue", index);
|
||||
ethtool_sprintf(data, "tx_ring%d_tx_busy", index);
|
||||
|
||||
ethtool_sprintf(&buff, "rx_ring%d_rcb_pkt_num", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_ppe_pkt_num", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_ppe_drop_pkt_num", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_fbd_num", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_rcb_pkt_num", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_ppe_pkt_num", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_ppe_drop_pkt_num", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_fbd_num", index);
|
||||
|
||||
ethtool_sprintf(&buff, "rx_ring%d_pkt_num", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_bytes", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_err_cnt", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_io_err", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_sw_err", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_seg_pkt", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_reuse_pg", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_len_err", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_non_vld_desc_err", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_bd_num_err", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_l2_err", index);
|
||||
ethtool_sprintf(&buff, "rx_ring%d_l3l4csum_err", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_pkt_num", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_bytes", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_err_cnt", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_io_err", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_sw_err", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_seg_pkt", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_reuse_pg", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_len_err", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_non_vld_desc_err", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_bd_num_err", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_l2_err", index);
|
||||
ethtool_sprintf(data, "rx_ring%d_l3l4csum_err", index);
|
||||
}
|
||||
|
||||
void hns_rcb_get_common_regs(struct rcb_common_cb *rcb_com, void *data)
|
||||
|
@ -157,7 +157,7 @@ int hns_rcb_get_ring_regs_count(void);
|
||||
|
||||
void hns_rcb_get_ring_regs(struct hnae_queue *queue, void *data);
|
||||
|
||||
void hns_rcb_get_strings(int stringset, u8 *data, int index);
|
||||
void hns_rcb_get_strings(int stringset, u8 **data, int index);
|
||||
void hns_rcb_set_rx_ring_bs(struct hnae_queue *q, u32 buf_size);
|
||||
void hns_rcb_set_tx_ring_bs(struct hnae_queue *q, u32 buf_size);
|
||||
|
||||
|
@ -743,16 +743,15 @@ static void hns_xgmac_get_stats(void *mac_drv, u64 *data)
|
||||
*@stringset: type of values in data
|
||||
*@data:data for value of string name
|
||||
*/
|
||||
static void hns_xgmac_get_strings(u32 stringset, u8 *data)
|
||||
static void hns_xgmac_get_strings(u32 stringset, u8 **data)
|
||||
{
|
||||
u8 *buff = data;
|
||||
u32 i;
|
||||
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(g_xgmac_stats_string); i++)
|
||||
ethtool_puts(&buff, g_xgmac_stats_string[i].desc);
|
||||
ethtool_puts(data, g_xgmac_stats_string[i].desc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -903,7 +903,6 @@ static void hns_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
|
||||
{
|
||||
struct hns_nic_priv *priv = netdev_priv(netdev);
|
||||
struct hnae_handle *h = priv->ae_handle;
|
||||
u8 *buff = data;
|
||||
|
||||
if (!h->dev->ops->get_strings) {
|
||||
netdev_err(netdev, "h->dev->ops->get_strings is null!\n");
|
||||
@ -912,43 +911,43 @@ static void hns_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
|
||||
|
||||
if (stringset == ETH_SS_TEST) {
|
||||
if (priv->ae_handle->phy_if != PHY_INTERFACE_MODE_XGMII)
|
||||
ethtool_puts(&buff,
|
||||
ethtool_puts(&data,
|
||||
hns_nic_test_strs[MAC_INTERNALLOOP_MAC]);
|
||||
ethtool_puts(&buff, hns_nic_test_strs[MAC_INTERNALLOOP_SERDES]);
|
||||
ethtool_puts(&data, hns_nic_test_strs[MAC_INTERNALLOOP_SERDES]);
|
||||
if ((netdev->phydev) && (!netdev->phydev->is_c45))
|
||||
ethtool_puts(&buff,
|
||||
ethtool_puts(&data,
|
||||
hns_nic_test_strs[MAC_INTERNALLOOP_PHY]);
|
||||
|
||||
} else {
|
||||
ethtool_puts(&buff, "rx_packets");
|
||||
ethtool_puts(&buff, "tx_packets");
|
||||
ethtool_puts(&buff, "rx_bytes");
|
||||
ethtool_puts(&buff, "tx_bytes");
|
||||
ethtool_puts(&buff, "rx_errors");
|
||||
ethtool_puts(&buff, "tx_errors");
|
||||
ethtool_puts(&buff, "rx_dropped");
|
||||
ethtool_puts(&buff, "tx_dropped");
|
||||
ethtool_puts(&buff, "multicast");
|
||||
ethtool_puts(&buff, "collisions");
|
||||
ethtool_puts(&buff, "rx_over_errors");
|
||||
ethtool_puts(&buff, "rx_crc_errors");
|
||||
ethtool_puts(&buff, "rx_frame_errors");
|
||||
ethtool_puts(&buff, "rx_fifo_errors");
|
||||
ethtool_puts(&buff, "rx_missed_errors");
|
||||
ethtool_puts(&buff, "tx_aborted_errors");
|
||||
ethtool_puts(&buff, "tx_carrier_errors");
|
||||
ethtool_puts(&buff, "tx_fifo_errors");
|
||||
ethtool_puts(&buff, "tx_heartbeat_errors");
|
||||
ethtool_puts(&buff, "rx_length_errors");
|
||||
ethtool_puts(&buff, "tx_window_errors");
|
||||
ethtool_puts(&buff, "rx_compressed");
|
||||
ethtool_puts(&buff, "tx_compressed");
|
||||
ethtool_puts(&buff, "netdev_rx_dropped");
|
||||
ethtool_puts(&buff, "netdev_tx_dropped");
|
||||
ethtool_puts(&data, "rx_packets");
|
||||
ethtool_puts(&data, "tx_packets");
|
||||
ethtool_puts(&data, "rx_bytes");
|
||||
ethtool_puts(&data, "tx_bytes");
|
||||
ethtool_puts(&data, "rx_errors");
|
||||
ethtool_puts(&data, "tx_errors");
|
||||
ethtool_puts(&data, "rx_dropped");
|
||||
ethtool_puts(&data, "tx_dropped");
|
||||
ethtool_puts(&data, "multicast");
|
||||
ethtool_puts(&data, "collisions");
|
||||
ethtool_puts(&data, "rx_over_errors");
|
||||
ethtool_puts(&data, "rx_crc_errors");
|
||||
ethtool_puts(&data, "rx_frame_errors");
|
||||
ethtool_puts(&data, "rx_fifo_errors");
|
||||
ethtool_puts(&data, "rx_missed_errors");
|
||||
ethtool_puts(&data, "tx_aborted_errors");
|
||||
ethtool_puts(&data, "tx_carrier_errors");
|
||||
ethtool_puts(&data, "tx_fifo_errors");
|
||||
ethtool_puts(&data, "tx_heartbeat_errors");
|
||||
ethtool_puts(&data, "rx_length_errors");
|
||||
ethtool_puts(&data, "tx_window_errors");
|
||||
ethtool_puts(&data, "rx_compressed");
|
||||
ethtool_puts(&data, "tx_compressed");
|
||||
ethtool_puts(&data, "netdev_rx_dropped");
|
||||
ethtool_puts(&data, "netdev_tx_dropped");
|
||||
|
||||
ethtool_puts(&buff, "netdev_tx_timeout");
|
||||
ethtool_puts(&data, "netdev_tx_timeout");
|
||||
|
||||
h->dev->ops->get_strings(h, stringset, buff);
|
||||
h->dev->ops->get_strings(h, stringset, &data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -970,7 +969,7 @@ static int hns_get_sset_count(struct net_device *netdev, int stringset)
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
if (stringset == ETH_SS_TEST) {
|
||||
u32 cnt = (sizeof(hns_nic_test_strs) / ETH_GSTRING_LEN);
|
||||
u32 cnt = ARRAY_SIZE(hns_nic_test_strs);
|
||||
|
||||
if (priv->ae_handle->phy_if == PHY_INTERFACE_MODE_XGMII)
|
||||
cnt--;
|
||||
|
Loading…
Reference in New Issue
Block a user