mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 20:48:49 +08:00
net: atlantic: use ethtool_sprintf
Allows simplifying get_strings and avoids manual pointer manipulation. Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Joe Damato <jdamato@fastly.com> Link: https://patch.msgid.link/20240807190303.6143-1-rosenp@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a39036847f
commit
df665ab188
@ -279,18 +279,16 @@ static void aq_ethtool_get_strings(struct net_device *ndev,
|
||||
|
||||
for (i = 0; i < cfg->vecs; i++) {
|
||||
for (si = 0; si < rx_stat_cnt; si++) {
|
||||
snprintf(p, ETH_GSTRING_LEN,
|
||||
ethtool_sprintf(&p,
|
||||
aq_ethtool_queue_rx_stat_names[si],
|
||||
tc_string,
|
||||
AQ_NIC_CFG_TCVEC2RING(cfg, tc, i));
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
for (si = 0; si < tx_stat_cnt; si++) {
|
||||
snprintf(p, ETH_GSTRING_LEN,
|
||||
ethtool_sprintf(&p,
|
||||
aq_ethtool_queue_tx_stat_names[si],
|
||||
tc_string,
|
||||
AQ_NIC_CFG_TCVEC2RING(cfg, tc, i));
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -305,20 +303,18 @@ static void aq_ethtool_get_strings(struct net_device *ndev,
|
||||
|
||||
for (i = 0; i < max(rx_ring_cnt, tx_ring_cnt); i++) {
|
||||
for (si = 0; si < rx_stat_cnt; si++) {
|
||||
snprintf(p, ETH_GSTRING_LEN,
|
||||
ethtool_sprintf(&p,
|
||||
aq_ethtool_queue_rx_stat_names[si],
|
||||
tc_string,
|
||||
i ? PTP_HWST_RING_IDX : ptp_ring_idx);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
if (i >= tx_ring_cnt)
|
||||
continue;
|
||||
for (si = 0; si < tx_stat_cnt; si++) {
|
||||
snprintf(p, ETH_GSTRING_LEN,
|
||||
ethtool_sprintf(&p,
|
||||
aq_ethtool_queue_tx_stat_names[si],
|
||||
tc_string,
|
||||
i ? PTP_HWST_RING_IDX : ptp_ring_idx);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -338,9 +334,8 @@ static void aq_ethtool_get_strings(struct net_device *ndev,
|
||||
for (si = 0;
|
||||
si < ARRAY_SIZE(aq_macsec_txsc_stat_names);
|
||||
si++) {
|
||||
snprintf(p, ETH_GSTRING_LEN,
|
||||
ethtool_sprintf(&p,
|
||||
aq_macsec_txsc_stat_names[si], i);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
aq_txsc = &nic->macsec_cfg->aq_txsc[i];
|
||||
for (sa = 0; sa < MACSEC_NUM_AN; sa++) {
|
||||
@ -349,10 +344,9 @@ static void aq_ethtool_get_strings(struct net_device *ndev,
|
||||
for (si = 0;
|
||||
si < ARRAY_SIZE(aq_macsec_txsa_stat_names);
|
||||
si++) {
|
||||
snprintf(p, ETH_GSTRING_LEN,
|
||||
ethtool_sprintf(&p,
|
||||
aq_macsec_txsa_stat_names[si],
|
||||
i, sa);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -369,10 +363,9 @@ static void aq_ethtool_get_strings(struct net_device *ndev,
|
||||
for (si = 0;
|
||||
si < ARRAY_SIZE(aq_macsec_rxsa_stat_names);
|
||||
si++) {
|
||||
snprintf(p, ETH_GSTRING_LEN,
|
||||
ethtool_sprintf(&p,
|
||||
aq_macsec_rxsa_stat_names[si],
|
||||
i, sa);
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user