Skip to content

Commit 18f7619

Browse files
Jakub Kicinskidavem330
authored andcommitted
nfp: improve defines for constants in ethtool
We split rvector stats into two categories - per queue and stats which are added up into one total counter. Improve the defines denoting their number. Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 16f50cd commit 18f7619

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ static const struct nfp_et_stat nfp_mac_et_stats[] = {
181181

182182
#define NN_ET_GLOBAL_STATS_LEN ARRAY_SIZE(nfp_net_et_stats)
183183
#define NN_ET_SWITCH_STATS_LEN 9
184-
#define NN_ET_RVEC_GATHER_STATS 8
184+
#define NN_RVEC_GATHER_STATS 8
185+
#define NN_RVEC_PER_Q_STATS 3
185186

186187
static void nfp_net_get_nspinfo(struct nfp_app *app, char *version)
187188
{
@@ -427,7 +428,7 @@ static unsigned int nfp_vnic_get_sw_stats_count(struct net_device *netdev)
427428
{
428429
struct nfp_net *nn = netdev_priv(netdev);
429430

430-
return NN_ET_RVEC_GATHER_STATS + nn->dp.num_r_vecs * 3;
431+
return NN_RVEC_GATHER_STATS + nn->dp.num_r_vecs * NN_RVEC_PER_Q_STATS;
431432
}
432433

433434
static u8 *nfp_vnic_get_sw_stats_strings(struct net_device *netdev, u8 *data)
@@ -455,9 +456,9 @@ static u8 *nfp_vnic_get_sw_stats_strings(struct net_device *netdev, u8 *data)
455456

456457
static u64 *nfp_vnic_get_sw_stats(struct net_device *netdev, u64 *data)
457458
{
458-
u64 gathered_stats[NN_ET_RVEC_GATHER_STATS] = {};
459+
u64 gathered_stats[NN_RVEC_GATHER_STATS] = {};
459460
struct nfp_net *nn = netdev_priv(netdev);
460-
u64 tmp[NN_ET_RVEC_GATHER_STATS];
461+
u64 tmp[NN_RVEC_GATHER_STATS];
461462
unsigned int i, j;
462463

463464
for (i = 0; i < nn->dp.num_r_vecs; i++) {
@@ -482,13 +483,13 @@ static u64 *nfp_vnic_get_sw_stats(struct net_device *netdev, u64 *data)
482483
tmp[7] = nn->r_vecs[i].tx_lso;
483484
} while (u64_stats_fetch_retry(&nn->r_vecs[i].tx_sync, start));
484485

485-
data += 3;
486+
data += NN_RVEC_PER_Q_STATS;
486487

487-
for (j = 0; j < NN_ET_RVEC_GATHER_STATS; j++)
488+
for (j = 0; j < NN_RVEC_GATHER_STATS; j++)
488489
gathered_stats[j] += tmp[j];
489490
}
490491

491-
for (j = 0; j < NN_ET_RVEC_GATHER_STATS; j++)
492+
for (j = 0; j < NN_RVEC_GATHER_STATS; j++)
492493
*data++ = gathered_stats[j];
493494

494495
return data;

0 commit comments

Comments
 (0)