>On Mon, Sep 16, 2024 at 9:46 AM Eelco Chaudron <[email protected]> wrote:
> > On 14 Sep 2024, at 7:26, Jun Wang wrote:
> >
> > > For many network cards, xstat statistics cannot be queried in the
> > > ovs interface. A new interface is added to retrieve all xstat
> > > information of the network card.
> > Hi Jun,
> >
> > Isn’t this already handled with netdev_dpdk_get_custom_stats()? I think you 
> > can see them with ‘ovs-vsctl get Interface <port> statistics.
> >
> > If this is not the case this is what we should enhance.
> 
> xstats are currently filtered to only save per queue stats and some
> common counters.

> static bool
> is_queue_stat(const char *s)
> {
>     uint16_t tmp;
> 
>     return (s[0] == 'r' || s[0] == 't') &&
>             (ovs_scan(s + 1, "x_q%"SCNu16"_packets", &tmp) ||
>              ovs_scan(s + 1, "x_q%"SCNu16"_bytes", &tmp));
> }
> 
> static void
> netdev_dpdk_configure_xstats(struct netdev_dpdk *dev)
>     OVS_REQUIRES(dev->mutex)
> {
> ...
> 
>         /* For custom stats, we filter out everything except per
> rxq/txq basic
>          * stats, and dropped, error and management counters. */
>         if (is_queue_stat(name) ||
>             string_ends_with(name, "_errors") ||
>             strstr(name, "_management_") ||
>             string_ends_with(name, "_dropped")) {
> 
>             dev->rte_xstats_ids[dev->rte_xstats_ids_size] = id;
>             dev->rte_xstats_ids_size++;
>         }
> 
> 
> Could you explain which stats you are missing?

Hi David,
As you mentioned, I also found that the results obtained by 
netdev_dpdk_get_custom_stats are filtered. However, I noticed that in
DPDK, different net drivers handle xstats commands in various ways.
If we apply a unified filtering process, it may result in not being
able to retrieve the desired results for different net drivers.
Therefore, I believe adding a new interface might be a suitable
solution. For example, the xstats of the ixgbe/i40e/txgbe driver.

ixgbe driver:
static const struct rte_ixgbe_xstats_name_off rte_ixgbe_txq_strings[] = {
{"xon_packets", offsetof(struct ixgbe_hw_stats, pxontxc)},
{"xoff_packets", offsetof(struct ixgbe_hw_stats, pxofftxc)},
{"xon_to_xoff_packets", offsetof(struct ixgbe_hw_stats,
pxon2offc)},
};
/* Per-queue statistics */
static const struct rte_ixgbe_xstats_name_off rte_ixgbe_rxq_strings[] = {
{"mbuf_allocation_errors", offsetof(struct ixgbe_hw_stats, rnbc)},
{"dropped", offsetof(struct ixgbe_hw_stats, mpc)},
{"xon_packets", offsetof(struct ixgbe_hw_stats, pxonrxc)},
{"xoff_packets", offsetof(struct ixgbe_hw_stats, pxoffrxc)},
};

i40e driver:
static const struct rte_i40e_xstats_name_off rte_i40e_rxq_prio_strings[] = {
{"xon_packets", offsetof(struct i40e_hw_port_stats,
priority_xon_rx)},
{"xoff_packets", offsetof(struct i40e_hw_port_stats,
priority_xoff_rx)},
};
static const struct rte_i40e_xstats_name_off rte_i40e_txq_prio_strings[] = {
{"xon_packets", offsetof(struct i40e_hw_port_stats,
priority_xon_tx)},
{"xoff_packets", offsetof(struct i40e_hw_port_stats,
priority_xoff_tx)},
{"xon_to_xoff_packets", offsetof(struct i40e_hw_port_stats,
priority_xon_2_xoff)},
};

txgbe driver:
if (id < TXGBE_NB_HW_STATS) {
snprintf(name, size, "[hw]%s",
rte_txgbe_stats_strings[id].name);
return 0;
}
id -= TXGBE_NB_HW_STATS;

/* Priority Stats */
if (id < TXGBE_NB_UP_STATS * TXGBE_MAX_UP) {
nb = id / TXGBE_NB_UP_STATS;
st = id % TXGBE_NB_UP_STATS;
snprintf(name, size, "[p%u]%s", nb,
rte_txgbe_up_strings[st].name);
return 0;
}
id -= TXGBE_NB_UP_STATS * TXGBE_MAX_UP;

/* Queue Stats */
if (id < TXGBE_NB_QP_STATS * TXGBE_MAX_QP) {
nb = id / TXGBE_NB_QP_STATS;
st = id % TXGBE_NB_QP_STATS;
snprintf(name, size, "[q%u]%s", nb,
rte_txgbe_qp_strings[st].name);
return 0;
}




Jun Wang
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to