Commit 0a8b7019 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: abm: expose the internal stats in ethtool

There is a handful of statistics exposing some internal details
of the implementation.  Expose those via ethtool.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 21f31bc0
......@@ -50,6 +50,8 @@
#define NFP_QMSTAT_SYM_NAME "_abi_nfdqm%u_stats"
#define NFP_QMSTAT_STRIDE 32
#define NFP_QMSTAT_NON_STO 0
#define NFP_QMSTAT_STO 8
#define NFP_QMSTAT_DROP 16
#define NFP_QMSTAT_ECN 24
......@@ -142,6 +144,26 @@ int nfp_abm_ctrl_set_all_q_lvls(struct nfp_abm_link *alink, u32 val)
return 0;
}
u64 nfp_abm_ctrl_stat_non_sto(struct nfp_abm_link *alink, unsigned int i)
{
u64 val;
if (nfp_abm_ctrl_stat(alink, alink->abm->qm_stats, NFP_QMSTAT_STRIDE,
NFP_QMSTAT_NON_STO, i, true, &val))
return 0;
return val;
}
u64 nfp_abm_ctrl_stat_sto(struct nfp_abm_link *alink, unsigned int i)
{
u64 val;
if (nfp_abm_ctrl_stat(alink, alink->abm->qm_stats, NFP_QMSTAT_STRIDE,
NFP_QMSTAT_STO, i, true, &val))
return 0;
return val;
}
int nfp_abm_ctrl_read_stats(struct nfp_abm_link *alink,
struct nfp_alink_stats *stats)
{
......
......@@ -497,6 +497,53 @@ static void nfp_abm_vnic_free(struct nfp_app *app, struct nfp_net *nn)
kfree(alink);
}
static u64 *
nfp_abm_port_get_stats(struct nfp_app *app, struct nfp_port *port, u64 *data)
{
struct nfp_repr *repr = netdev_priv(port->netdev);
struct nfp_abm_link *alink;
unsigned int i;
if (port->type != NFP_PORT_PF_PORT)
return data;
alink = repr->app_priv;
for (i = 0; i < alink->vnic->dp.num_r_vecs; i++) {
*data++ = nfp_abm_ctrl_stat_non_sto(alink, i);
*data++ = nfp_abm_ctrl_stat_sto(alink, i);
}
return data;
}
static int
nfp_abm_port_get_stats_count(struct nfp_app *app, struct nfp_port *port)
{
struct nfp_repr *repr = netdev_priv(port->netdev);
struct nfp_abm_link *alink;
if (port->type != NFP_PORT_PF_PORT)
return 0;
alink = repr->app_priv;
return alink->vnic->dp.num_r_vecs * 2;
}
static u8 *
nfp_abm_port_get_stats_strings(struct nfp_app *app, struct nfp_port *port,
u8 *data)
{
struct nfp_repr *repr = netdev_priv(port->netdev);
struct nfp_abm_link *alink;
unsigned int i;
if (port->type != NFP_PORT_PF_PORT)
return data;
alink = repr->app_priv;
for (i = 0; i < alink->vnic->dp.num_r_vecs; i++) {
data = nfp_pr_et(data, "q%u_no_wait", i);
data = nfp_pr_et(data, "q%u_delayed", i);
}
return data;
}
static int nfp_abm_init(struct nfp_app *app)
{
struct nfp_pf *pf = app->pf;
......@@ -575,6 +622,10 @@ const struct nfp_app_type app_abm = {
.vnic_alloc = nfp_abm_vnic_alloc,
.vnic_free = nfp_abm_vnic_free,
.port_get_stats = nfp_abm_port_get_stats,
.port_get_stats_count = nfp_abm_port_get_stats_count,
.port_get_stats_strings = nfp_abm_port_get_stats_strings,
.setup_tc = nfp_abm_setup_tc,
.eswitch_mode_get = nfp_abm_eswitch_mode_get,
......
......@@ -123,6 +123,8 @@ int nfp_abm_ctrl_read_stats(struct nfp_abm_link *alink,
struct nfp_alink_stats *stats);
int nfp_abm_ctrl_read_xstats(struct nfp_abm_link *alink,
struct nfp_alink_xstats *xstats);
u64 nfp_abm_ctrl_stat_non_sto(struct nfp_abm_link *alink, unsigned int i);
u64 nfp_abm_ctrl_stat_sto(struct nfp_abm_link *alink, unsigned int i);
int nfp_abm_ctrl_qm_enable(struct nfp_abm *abm);
int nfp_abm_ctrl_qm_disable(struct nfp_abm *abm);
#endif
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