mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-07 13:53:24 +00:00
net: sfc: 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> Acked-by: Edward Cree <ecree.xilinx@gmail.com> Link: https://patch.msgid.link/20241105231855.235894-1-rosenp@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
7d28f4fc86
commit
9dae592105
@ -1751,7 +1751,7 @@ static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t efx_ef10_describe_stats(struct efx_nic *efx, u8 *names)
|
static size_t efx_ef10_describe_stats(struct efx_nic *efx, u8 **names)
|
||||||
{
|
{
|
||||||
DECLARE_BITMAP(mask, EF10_STAT_COUNT);
|
DECLARE_BITMAP(mask, EF10_STAT_COUNT);
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ static const struct efx_hw_stat_desc ef100_stat_desc[EF100_STAT_COUNT] = {
|
|||||||
EFX_GENERIC_SW_STAT(rx_noskb_drops),
|
EFX_GENERIC_SW_STAT(rx_noskb_drops),
|
||||||
};
|
};
|
||||||
|
|
||||||
static size_t ef100_describe_stats(struct efx_nic *efx, u8 *names)
|
static size_t ef100_describe_stats(struct efx_nic *efx, u8 **names)
|
||||||
{
|
{
|
||||||
DECLARE_BITMAP(mask, EF100_STAT_COUNT) = {};
|
DECLARE_BITMAP(mask, EF100_STAT_COUNT) = {};
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ int efx_ethtool_fill_self_tests(struct efx_nic *efx,
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t efx_describe_per_queue_stats(struct efx_nic *efx, u8 *strings)
|
static size_t efx_describe_per_queue_stats(struct efx_nic *efx, u8 **strings)
|
||||||
{
|
{
|
||||||
size_t n_stats = 0;
|
size_t n_stats = 0;
|
||||||
struct efx_channel *channel;
|
struct efx_channel *channel;
|
||||||
@ -403,24 +403,22 @@ static size_t efx_describe_per_queue_stats(struct efx_nic *efx, u8 *strings)
|
|||||||
efx_for_each_channel(channel, efx) {
|
efx_for_each_channel(channel, efx) {
|
||||||
if (efx_channel_has_tx_queues(channel)) {
|
if (efx_channel_has_tx_queues(channel)) {
|
||||||
n_stats++;
|
n_stats++;
|
||||||
if (strings != NULL) {
|
if (!strings)
|
||||||
snprintf(strings, ETH_GSTRING_LEN,
|
continue;
|
||||||
"tx-%u.tx_packets",
|
|
||||||
channel->tx_queue[0].queue /
|
|
||||||
EFX_MAX_TXQ_PER_CHANNEL);
|
|
||||||
|
|
||||||
strings += ETH_GSTRING_LEN;
|
ethtool_sprintf(strings, "tx-%u.tx_packets",
|
||||||
}
|
channel->tx_queue[0].queue /
|
||||||
|
EFX_MAX_TXQ_PER_CHANNEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
efx_for_each_channel(channel, efx) {
|
efx_for_each_channel(channel, efx) {
|
||||||
if (efx_channel_has_rx_queue(channel)) {
|
if (efx_channel_has_rx_queue(channel)) {
|
||||||
n_stats++;
|
n_stats++;
|
||||||
if (strings != NULL) {
|
if (!strings)
|
||||||
snprintf(strings, ETH_GSTRING_LEN,
|
continue;
|
||||||
"rx-%d.rx_packets", channel->channel);
|
|
||||||
strings += ETH_GSTRING_LEN;
|
ethtool_sprintf(strings, "rx-%d.rx_packets",
|
||||||
}
|
channel->channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (efx->xdp_tx_queue_count && efx->xdp_tx_queues) {
|
if (efx->xdp_tx_queue_count && efx->xdp_tx_queues) {
|
||||||
@ -428,11 +426,11 @@ static size_t efx_describe_per_queue_stats(struct efx_nic *efx, u8 *strings)
|
|||||||
|
|
||||||
for (xdp = 0; xdp < efx->xdp_tx_queue_count; xdp++) {
|
for (xdp = 0; xdp < efx->xdp_tx_queue_count; xdp++) {
|
||||||
n_stats++;
|
n_stats++;
|
||||||
if (strings) {
|
if (!strings)
|
||||||
snprintf(strings, ETH_GSTRING_LEN,
|
continue;
|
||||||
"tx-xdp-cpu-%hu.tx_packets", xdp);
|
|
||||||
strings += ETH_GSTRING_LEN;
|
ethtool_sprintf(strings, "tx-xdp-cpu-%hu.tx_packets",
|
||||||
}
|
xdp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,15 +462,11 @@ void efx_ethtool_get_strings(struct net_device *net_dev,
|
|||||||
|
|
||||||
switch (string_set) {
|
switch (string_set) {
|
||||||
case ETH_SS_STATS:
|
case ETH_SS_STATS:
|
||||||
strings += (efx->type->describe_stats(efx, strings) *
|
efx->type->describe_stats(efx, &strings);
|
||||||
ETH_GSTRING_LEN);
|
|
||||||
for (i = 0; i < EFX_ETHTOOL_SW_STAT_COUNT; i++)
|
for (i = 0; i < EFX_ETHTOOL_SW_STAT_COUNT; i++)
|
||||||
strscpy(strings + i * ETH_GSTRING_LEN,
|
ethtool_puts(&strings, efx_sw_stat_desc[i].name);
|
||||||
efx_sw_stat_desc[i].name, ETH_GSTRING_LEN);
|
efx_describe_per_queue_stats(efx, &strings);
|
||||||
strings += EFX_ETHTOOL_SW_STAT_COUNT * ETH_GSTRING_LEN;
|
efx_ptp_describe_stats(efx, &strings);
|
||||||
strings += (efx_describe_per_queue_stats(efx, strings) *
|
|
||||||
ETH_GSTRING_LEN);
|
|
||||||
efx_ptp_describe_stats(efx, strings);
|
|
||||||
break;
|
break;
|
||||||
case ETH_SS_TEST:
|
case ETH_SS_TEST:
|
||||||
efx_ethtool_fill_self_tests(efx, NULL, strings, NULL);
|
efx_ethtool_fill_self_tests(efx, NULL, strings, NULL);
|
||||||
|
@ -353,7 +353,7 @@ static int ef4_ethtool_fill_self_tests(struct ef4_nic *efx,
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t ef4_describe_per_queue_stats(struct ef4_nic *efx, u8 *strings)
|
static size_t ef4_describe_per_queue_stats(struct ef4_nic *efx, u8 **strings)
|
||||||
{
|
{
|
||||||
size_t n_stats = 0;
|
size_t n_stats = 0;
|
||||||
struct ef4_channel *channel;
|
struct ef4_channel *channel;
|
||||||
@ -361,24 +361,22 @@ static size_t ef4_describe_per_queue_stats(struct ef4_nic *efx, u8 *strings)
|
|||||||
ef4_for_each_channel(channel, efx) {
|
ef4_for_each_channel(channel, efx) {
|
||||||
if (ef4_channel_has_tx_queues(channel)) {
|
if (ef4_channel_has_tx_queues(channel)) {
|
||||||
n_stats++;
|
n_stats++;
|
||||||
if (strings != NULL) {
|
if (!strings)
|
||||||
snprintf(strings, ETH_GSTRING_LEN,
|
continue;
|
||||||
"tx-%u.tx_packets",
|
|
||||||
channel->tx_queue[0].queue /
|
|
||||||
EF4_TXQ_TYPES);
|
|
||||||
|
|
||||||
strings += ETH_GSTRING_LEN;
|
ethtool_sprintf(strings, "tx-%u.tx_packets",
|
||||||
}
|
channel->tx_queue[0].queue /
|
||||||
|
EF4_TXQ_TYPES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ef4_for_each_channel(channel, efx) {
|
ef4_for_each_channel(channel, efx) {
|
||||||
if (ef4_channel_has_rx_queue(channel)) {
|
if (ef4_channel_has_rx_queue(channel)) {
|
||||||
n_stats++;
|
n_stats++;
|
||||||
if (strings != NULL) {
|
if (!strings)
|
||||||
snprintf(strings, ETH_GSTRING_LEN,
|
continue;
|
||||||
"rx-%d.rx_packets", channel->channel);
|
|
||||||
strings += ETH_GSTRING_LEN;
|
ethtool_sprintf(strings, "rx-%d.rx_packets",
|
||||||
}
|
channel->channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return n_stats;
|
return n_stats;
|
||||||
@ -409,14 +407,10 @@ static void ef4_ethtool_get_strings(struct net_device *net_dev,
|
|||||||
|
|
||||||
switch (string_set) {
|
switch (string_set) {
|
||||||
case ETH_SS_STATS:
|
case ETH_SS_STATS:
|
||||||
strings += (efx->type->describe_stats(efx, strings) *
|
efx->type->describe_stats(efx, &strings);
|
||||||
ETH_GSTRING_LEN);
|
|
||||||
for (i = 0; i < EF4_ETHTOOL_SW_STAT_COUNT; i++)
|
for (i = 0; i < EF4_ETHTOOL_SW_STAT_COUNT; i++)
|
||||||
strscpy(strings + i * ETH_GSTRING_LEN,
|
ethtool_puts(&strings, ef4_sw_stat_desc[i].name);
|
||||||
ef4_sw_stat_desc[i].name, ETH_GSTRING_LEN);
|
ef4_describe_per_queue_stats(efx, &strings);
|
||||||
strings += EF4_ETHTOOL_SW_STAT_COUNT * ETH_GSTRING_LEN;
|
|
||||||
strings += (ef4_describe_per_queue_stats(efx, strings) *
|
|
||||||
ETH_GSTRING_LEN);
|
|
||||||
break;
|
break;
|
||||||
case ETH_SS_TEST:
|
case ETH_SS_TEST:
|
||||||
ef4_ethtool_fill_self_tests(efx, NULL, strings, NULL);
|
ef4_ethtool_fill_self_tests(efx, NULL, strings, NULL);
|
||||||
|
@ -2564,7 +2564,7 @@ static void falcon_remove_nic(struct ef4_nic *efx)
|
|||||||
efx->nic_data = NULL;
|
efx->nic_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t falcon_describe_nic_stats(struct ef4_nic *efx, u8 *names)
|
static size_t falcon_describe_nic_stats(struct ef4_nic *efx, u8 **names)
|
||||||
{
|
{
|
||||||
return ef4_nic_describe_stats(falcon_stat_desc, FALCON_STAT_COUNT,
|
return ef4_nic_describe_stats(falcon_stat_desc, FALCON_STAT_COUNT,
|
||||||
falcon_stat_mask, names);
|
falcon_stat_mask, names);
|
||||||
|
@ -1057,7 +1057,7 @@ struct ef4_nic_type {
|
|||||||
void (*finish_flush)(struct ef4_nic *efx);
|
void (*finish_flush)(struct ef4_nic *efx);
|
||||||
void (*prepare_flr)(struct ef4_nic *efx);
|
void (*prepare_flr)(struct ef4_nic *efx);
|
||||||
void (*finish_flr)(struct ef4_nic *efx);
|
void (*finish_flr)(struct ef4_nic *efx);
|
||||||
size_t (*describe_stats)(struct ef4_nic *efx, u8 *names);
|
size_t (*describe_stats)(struct ef4_nic *efx, u8 **names);
|
||||||
size_t (*update_stats)(struct ef4_nic *efx, u64 *full_stats,
|
size_t (*update_stats)(struct ef4_nic *efx, u64 *full_stats,
|
||||||
struct rtnl_link_stats64 *core_stats);
|
struct rtnl_link_stats64 *core_stats);
|
||||||
void (*start_stats)(struct ef4_nic *efx);
|
void (*start_stats)(struct ef4_nic *efx);
|
||||||
|
@ -444,18 +444,15 @@ void ef4_nic_get_regs(struct ef4_nic *efx, void *buf)
|
|||||||
* bits in the first @count bits of @mask for which a name is defined.
|
* bits in the first @count bits of @mask for which a name is defined.
|
||||||
*/
|
*/
|
||||||
size_t ef4_nic_describe_stats(const struct ef4_hw_stat_desc *desc, size_t count,
|
size_t ef4_nic_describe_stats(const struct ef4_hw_stat_desc *desc, size_t count,
|
||||||
const unsigned long *mask, u8 *names)
|
const unsigned long *mask, u8 **names)
|
||||||
{
|
{
|
||||||
size_t visible = 0;
|
size_t visible = 0;
|
||||||
size_t index;
|
size_t index;
|
||||||
|
|
||||||
for_each_set_bit(index, mask, count) {
|
for_each_set_bit(index, mask, count) {
|
||||||
if (desc[index].name) {
|
if (desc[index].name) {
|
||||||
if (names) {
|
if (names)
|
||||||
strscpy(names, desc[index].name,
|
ethtool_puts(names, desc[index].name);
|
||||||
ETH_GSTRING_LEN);
|
|
||||||
names += ETH_GSTRING_LEN;
|
|
||||||
}
|
|
||||||
++visible;
|
++visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -497,7 +497,7 @@ size_t ef4_nic_get_regs_len(struct ef4_nic *efx);
|
|||||||
void ef4_nic_get_regs(struct ef4_nic *efx, void *buf);
|
void ef4_nic_get_regs(struct ef4_nic *efx, void *buf);
|
||||||
|
|
||||||
size_t ef4_nic_describe_stats(const struct ef4_hw_stat_desc *desc, size_t count,
|
size_t ef4_nic_describe_stats(const struct ef4_hw_stat_desc *desc, size_t count,
|
||||||
const unsigned long *mask, u8 *names);
|
const unsigned long *mask, u8 **names);
|
||||||
void ef4_nic_update_stats(const struct ef4_hw_stat_desc *desc, size_t count,
|
void ef4_nic_update_stats(const struct ef4_hw_stat_desc *desc, size_t count,
|
||||||
const unsigned long *mask, u64 *stats,
|
const unsigned long *mask, u64 *stats,
|
||||||
const void *dma_buf, bool accumulate);
|
const void *dma_buf, bool accumulate);
|
||||||
|
@ -1408,7 +1408,7 @@ struct efx_nic_type {
|
|||||||
int (*fini_dmaq)(struct efx_nic *efx);
|
int (*fini_dmaq)(struct efx_nic *efx);
|
||||||
void (*prepare_flr)(struct efx_nic *efx);
|
void (*prepare_flr)(struct efx_nic *efx);
|
||||||
void (*finish_flr)(struct efx_nic *efx);
|
void (*finish_flr)(struct efx_nic *efx);
|
||||||
size_t (*describe_stats)(struct efx_nic *efx, u8 *names);
|
size_t (*describe_stats)(struct efx_nic *efx, u8 **names);
|
||||||
size_t (*update_stats)(struct efx_nic *efx, u64 *full_stats,
|
size_t (*update_stats)(struct efx_nic *efx, u64 *full_stats,
|
||||||
struct rtnl_link_stats64 *core_stats);
|
struct rtnl_link_stats64 *core_stats);
|
||||||
size_t (*update_stats_atomic)(struct efx_nic *efx, u64 *full_stats,
|
size_t (*update_stats_atomic)(struct efx_nic *efx, u64 *full_stats,
|
||||||
|
@ -299,18 +299,15 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf)
|
|||||||
* bits in the first @count bits of @mask for which a name is defined.
|
* bits in the first @count bits of @mask for which a name is defined.
|
||||||
*/
|
*/
|
||||||
size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count,
|
size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count,
|
||||||
const unsigned long *mask, u8 *names)
|
const unsigned long *mask, u8 **names)
|
||||||
{
|
{
|
||||||
size_t visible = 0;
|
size_t visible = 0;
|
||||||
size_t index;
|
size_t index;
|
||||||
|
|
||||||
for_each_set_bit(index, mask, count) {
|
for_each_set_bit(index, mask, count) {
|
||||||
if (desc[index].name) {
|
if (desc[index].name) {
|
||||||
if (names) {
|
if (names)
|
||||||
strscpy(names, desc[index].name,
|
ethtool_puts(names, desc[index].name);
|
||||||
ETH_GSTRING_LEN);
|
|
||||||
names += ETH_GSTRING_LEN;
|
|
||||||
}
|
|
||||||
++visible;
|
++visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf);
|
|||||||
#define EFX_MC_STATS_GENERATION_INVALID ((__force __le64)(-1))
|
#define EFX_MC_STATS_GENERATION_INVALID ((__force __le64)(-1))
|
||||||
|
|
||||||
size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count,
|
size_t efx_nic_describe_stats(const struct efx_hw_stat_desc *desc, size_t count,
|
||||||
const unsigned long *mask, u8 *names);
|
const unsigned long *mask, u8 **names);
|
||||||
int efx_nic_copy_stats(struct efx_nic *efx, __le64 *dest);
|
int efx_nic_copy_stats(struct efx_nic *efx, __le64 *dest);
|
||||||
void efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count,
|
void efx_nic_update_stats(const struct efx_hw_stat_desc *desc, size_t count,
|
||||||
const unsigned long *mask, u64 *stats,
|
const unsigned long *mask, u64 *stats,
|
||||||
|
@ -399,7 +399,7 @@ static const unsigned long efx_ptp_stat_mask[] = {
|
|||||||
[0 ... BITS_TO_LONGS(PTP_STAT_COUNT) - 1] = ~0UL,
|
[0 ... BITS_TO_LONGS(PTP_STAT_COUNT) - 1] = ~0UL,
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t efx_ptp_describe_stats(struct efx_nic *efx, u8 *strings)
|
size_t efx_ptp_describe_stats(struct efx_nic *efx, u8 **strings)
|
||||||
{
|
{
|
||||||
if (!efx->ptp_data)
|
if (!efx->ptp_data)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -30,7 +30,7 @@ int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,
|
|||||||
unsigned int new_mode);
|
unsigned int new_mode);
|
||||||
int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
|
int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
|
||||||
void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev);
|
void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev);
|
||||||
size_t efx_ptp_describe_stats(struct efx_nic *efx, u8 *strings);
|
size_t efx_ptp_describe_stats(struct efx_nic *efx, u8 **strings);
|
||||||
size_t efx_ptp_update_stats(struct efx_nic *efx, u64 *stats);
|
size_t efx_ptp_update_stats(struct efx_nic *efx, u64 *stats);
|
||||||
void efx_time_sync_event(struct efx_channel *channel, efx_qword_t *ev);
|
void efx_time_sync_event(struct efx_channel *channel, efx_qword_t *ev);
|
||||||
void __efx_rx_skb_attach_timestamp(struct efx_channel *channel,
|
void __efx_rx_skb_attach_timestamp(struct efx_channel *channel,
|
||||||
|
@ -395,7 +395,7 @@ void efx_siena_ethtool_self_test(struct net_device *net_dev,
|
|||||||
test->flags |= ETH_TEST_FL_FAILED;
|
test->flags |= ETH_TEST_FL_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t efx_describe_per_queue_stats(struct efx_nic *efx, u8 *strings)
|
static size_t efx_describe_per_queue_stats(struct efx_nic *efx, u8 **strings)
|
||||||
{
|
{
|
||||||
size_t n_stats = 0;
|
size_t n_stats = 0;
|
||||||
struct efx_channel *channel;
|
struct efx_channel *channel;
|
||||||
@ -403,24 +403,22 @@ static size_t efx_describe_per_queue_stats(struct efx_nic *efx, u8 *strings)
|
|||||||
efx_for_each_channel(channel, efx) {
|
efx_for_each_channel(channel, efx) {
|
||||||
if (efx_channel_has_tx_queues(channel)) {
|
if (efx_channel_has_tx_queues(channel)) {
|
||||||
n_stats++;
|
n_stats++;
|
||||||
if (strings != NULL) {
|
if (!strings)
|
||||||
snprintf(strings, ETH_GSTRING_LEN,
|
continue;
|
||||||
"tx-%u.tx_packets",
|
|
||||||
channel->tx_queue[0].queue /
|
|
||||||
EFX_MAX_TXQ_PER_CHANNEL);
|
|
||||||
|
|
||||||
strings += ETH_GSTRING_LEN;
|
ethtool_sprintf(strings, "tx-%u.tx_packets",
|
||||||
}
|
channel->tx_queue[0].queue /
|
||||||
|
EFX_MAX_TXQ_PER_CHANNEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
efx_for_each_channel(channel, efx) {
|
efx_for_each_channel(channel, efx) {
|
||||||
if (efx_channel_has_rx_queue(channel)) {
|
if (efx_channel_has_rx_queue(channel)) {
|
||||||
n_stats++;
|
n_stats++;
|
||||||
if (strings != NULL) {
|
if (!strings)
|
||||||
snprintf(strings, ETH_GSTRING_LEN,
|
continue;
|
||||||
"rx-%d.rx_packets", channel->channel);
|
|
||||||
strings += ETH_GSTRING_LEN;
|
ethtool_sprintf(strings, "rx-%d.rx_packets",
|
||||||
}
|
channel->channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (efx->xdp_tx_queue_count && efx->xdp_tx_queues) {
|
if (efx->xdp_tx_queue_count && efx->xdp_tx_queues) {
|
||||||
@ -428,11 +426,11 @@ static size_t efx_describe_per_queue_stats(struct efx_nic *efx, u8 *strings)
|
|||||||
|
|
||||||
for (xdp = 0; xdp < efx->xdp_tx_queue_count; xdp++) {
|
for (xdp = 0; xdp < efx->xdp_tx_queue_count; xdp++) {
|
||||||
n_stats++;
|
n_stats++;
|
||||||
if (strings) {
|
if (!strings)
|
||||||
snprintf(strings, ETH_GSTRING_LEN,
|
continue;
|
||||||
"tx-xdp-cpu-%hu.tx_packets", xdp);
|
|
||||||
strings += ETH_GSTRING_LEN;
|
ethtool_sprintf(strings, "tx-xdp-cpu-%hu.tx_packets",
|
||||||
}
|
xdp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,15 +462,11 @@ void efx_siena_ethtool_get_strings(struct net_device *net_dev,
|
|||||||
|
|
||||||
switch (string_set) {
|
switch (string_set) {
|
||||||
case ETH_SS_STATS:
|
case ETH_SS_STATS:
|
||||||
strings += (efx->type->describe_stats(efx, strings) *
|
efx->type->describe_stats(efx, &strings);
|
||||||
ETH_GSTRING_LEN);
|
|
||||||
for (i = 0; i < EFX_ETHTOOL_SW_STAT_COUNT; i++)
|
for (i = 0; i < EFX_ETHTOOL_SW_STAT_COUNT; i++)
|
||||||
strscpy(strings + i * ETH_GSTRING_LEN,
|
ethtool_puts(&strings, efx_sw_stat_desc[i].name);
|
||||||
efx_sw_stat_desc[i].name, ETH_GSTRING_LEN);
|
efx_describe_per_queue_stats(efx, &strings);
|
||||||
strings += EFX_ETHTOOL_SW_STAT_COUNT * ETH_GSTRING_LEN;
|
efx_siena_ptp_describe_stats(efx, &strings);
|
||||||
strings += (efx_describe_per_queue_stats(efx, strings) *
|
|
||||||
ETH_GSTRING_LEN);
|
|
||||||
efx_siena_ptp_describe_stats(efx, strings);
|
|
||||||
break;
|
break;
|
||||||
case ETH_SS_TEST:
|
case ETH_SS_TEST:
|
||||||
efx_ethtool_fill_self_tests(efx, NULL, strings, NULL);
|
efx_ethtool_fill_self_tests(efx, NULL, strings, NULL);
|
||||||
|
@ -1307,7 +1307,7 @@ struct efx_nic_type {
|
|||||||
void (*finish_flush)(struct efx_nic *efx);
|
void (*finish_flush)(struct efx_nic *efx);
|
||||||
void (*prepare_flr)(struct efx_nic *efx);
|
void (*prepare_flr)(struct efx_nic *efx);
|
||||||
void (*finish_flr)(struct efx_nic *efx);
|
void (*finish_flr)(struct efx_nic *efx);
|
||||||
size_t (*describe_stats)(struct efx_nic *efx, u8 *names);
|
size_t (*describe_stats)(struct efx_nic *efx, u8 **names);
|
||||||
size_t (*update_stats)(struct efx_nic *efx, u64 *full_stats,
|
size_t (*update_stats)(struct efx_nic *efx, u64 *full_stats,
|
||||||
struct rtnl_link_stats64 *core_stats);
|
struct rtnl_link_stats64 *core_stats);
|
||||||
size_t (*update_stats_atomic)(struct efx_nic *efx, u64 *full_stats,
|
size_t (*update_stats_atomic)(struct efx_nic *efx, u64 *full_stats,
|
||||||
|
@ -449,20 +449,20 @@ void efx_siena_get_regs(struct efx_nic *efx, void *buf)
|
|||||||
* Returns the number of visible statistics, i.e. the number of set
|
* Returns the number of visible statistics, i.e. the number of set
|
||||||
* bits in the first @count bits of @mask for which a name is defined.
|
* bits in the first @count bits of @mask for which a name is defined.
|
||||||
*/
|
*/
|
||||||
size_t efx_siena_describe_stats(const struct efx_hw_stat_desc *desc, size_t count,
|
size_t efx_siena_describe_stats(const struct efx_hw_stat_desc *desc,
|
||||||
const unsigned long *mask, u8 *names)
|
size_t count, const unsigned long *mask,
|
||||||
|
u8 **names)
|
||||||
{
|
{
|
||||||
size_t visible = 0;
|
size_t visible = 0;
|
||||||
size_t index;
|
size_t index;
|
||||||
|
|
||||||
for_each_set_bit(index, mask, count) {
|
for_each_set_bit(index, mask, count) {
|
||||||
if (desc[index].name) {
|
if (desc[index].name) {
|
||||||
if (names) {
|
|
||||||
strscpy(names, desc[index].name,
|
|
||||||
ETH_GSTRING_LEN);
|
|
||||||
names += ETH_GSTRING_LEN;
|
|
||||||
}
|
|
||||||
++visible;
|
++visible;
|
||||||
|
if (!names)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ethtool_puts(names, desc[index].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,8 +239,9 @@ void efx_siena_get_regs(struct efx_nic *efx, void *buf);
|
|||||||
|
|
||||||
#define EFX_MC_STATS_GENERATION_INVALID ((__force __le64)(-1))
|
#define EFX_MC_STATS_GENERATION_INVALID ((__force __le64)(-1))
|
||||||
|
|
||||||
size_t efx_siena_describe_stats(const struct efx_hw_stat_desc *desc, size_t count,
|
size_t efx_siena_describe_stats(const struct efx_hw_stat_desc *desc,
|
||||||
const unsigned long *mask, u8 *names);
|
size_t count, const unsigned long *mask,
|
||||||
|
u8 **names);
|
||||||
void efx_siena_update_stats(const struct efx_hw_stat_desc *desc, size_t count,
|
void efx_siena_update_stats(const struct efx_hw_stat_desc *desc, size_t count,
|
||||||
const unsigned long *mask, u64 *stats,
|
const unsigned long *mask, u64 *stats,
|
||||||
const void *dma_buf, bool accumulate);
|
const void *dma_buf, bool accumulate);
|
||||||
|
@ -393,7 +393,7 @@ static const unsigned long efx_ptp_stat_mask[] = {
|
|||||||
[0 ... BITS_TO_LONGS(PTP_STAT_COUNT) - 1] = ~0UL,
|
[0 ... BITS_TO_LONGS(PTP_STAT_COUNT) - 1] = ~0UL,
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t efx_siena_ptp_describe_stats(struct efx_nic *efx, u8 *strings)
|
size_t efx_siena_ptp_describe_stats(struct efx_nic *efx, u8 **strings)
|
||||||
{
|
{
|
||||||
if (!efx->ptp_data)
|
if (!efx->ptp_data)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -28,7 +28,7 @@ int efx_siena_ptp_change_mode(struct efx_nic *efx, bool enable_wanted,
|
|||||||
unsigned int new_mode);
|
unsigned int new_mode);
|
||||||
int efx_siena_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
|
int efx_siena_ptp_tx(struct efx_nic *efx, struct sk_buff *skb);
|
||||||
void efx_siena_ptp_event(struct efx_nic *efx, efx_qword_t *ev);
|
void efx_siena_ptp_event(struct efx_nic *efx, efx_qword_t *ev);
|
||||||
size_t efx_siena_ptp_describe_stats(struct efx_nic *efx, u8 *strings);
|
size_t efx_siena_ptp_describe_stats(struct efx_nic *efx, u8 **strings);
|
||||||
size_t efx_siena_ptp_update_stats(struct efx_nic *efx, u64 *stats);
|
size_t efx_siena_ptp_update_stats(struct efx_nic *efx, u64 *stats);
|
||||||
void efx_siena_time_sync_event(struct efx_channel *channel, efx_qword_t *ev);
|
void efx_siena_time_sync_event(struct efx_channel *channel, efx_qword_t *ev);
|
||||||
void __efx_siena_rx_skb_attach_timestamp(struct efx_channel *channel,
|
void __efx_siena_rx_skb_attach_timestamp(struct efx_channel *channel,
|
||||||
|
@ -545,7 +545,7 @@ static const unsigned long siena_stat_mask[] = {
|
|||||||
[0 ... BITS_TO_LONGS(SIENA_STAT_COUNT) - 1] = ~0UL,
|
[0 ... BITS_TO_LONGS(SIENA_STAT_COUNT) - 1] = ~0UL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static size_t siena_describe_nic_stats(struct efx_nic *efx, u8 *names)
|
static size_t siena_describe_nic_stats(struct efx_nic *efx, u8 **names)
|
||||||
{
|
{
|
||||||
return efx_siena_describe_stats(siena_stat_desc, SIENA_STAT_COUNT,
|
return efx_siena_describe_stats(siena_stat_desc, SIENA_STAT_COUNT,
|
||||||
siena_stat_mask, names);
|
siena_stat_mask, names);
|
||||||
|
Loading…
Reference in New Issue
Block a user