Message ID | 1439986979-32225-1-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | New |
Headers | show |
On Wed, Aug 19, 2015 at 03:22:59PM +0300, Maxim Uvarov wrote: > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > --- > include/odp/api/packet_io_stats.h | 77 ++++++++++++++++++++++++++ > platform/linux-generic/include/odp/packet_io.h | 1 + > 2 files changed, 78 insertions(+) > create mode 100644 include/odp/api/packet_io_stats.h > > diff --git a/include/odp/api/packet_io_stats.h b/include/odp/api/packet_io_stats.h > new file mode 100644 > index 0000000..731a96f > --- /dev/null > +++ b/include/odp/api/packet_io_stats.h > @@ -0,0 +1,77 @@ > +/* Copyright (c) 2015, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +/** > + * @file > + * > + * ODP Packet IO > + */ > + > +#ifndef ODP_API_PACKET_IO_STATS_H_ > +#define ODP_API_PACKET_IO_STATS_H_ > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/** @defgroup odp_packet_io ODP PACKET IO > + * @{ > + */ > + > +/** > + * Packet IO statistics > + * > + */ > +typedef struct odp_pktio_stats_t { > + uint64_t collisions; /**< number of collisions */ > + uint64_t multicast; /**< multicast packets received */ > + > + uint64_t rx_bytes; /**< total bytes received */ > + uint64_t rx_crc_errors; /**< received packets with crc error */ > + uint64_t rx_dropped; /**< no space in buffers */ > + uint64_t rx_errors; /**< bad packets received */ > + uint64_t rx_fifo_errors; /**< recv'r fifo overrun */ > + uint64_t rx_frame_errors; /**< recv'd frame alignment error */ > + uint64_t rx_length_errors; /**< bad packets length */ > + uint64_t rx_missed_errors; /**< receiver missed packet */ > + uint64_t rx_over_errors; /**< receiver ring buff overflow */ > + uint64_t rx_packets; /**< total packets received */ > + > + uint64_t tx_aborted_errors; /**< packets aborted during > + transmission by a network device (e.g: > + because of a medium collision) */ > + uint64_t tx_bytes; /**< total bytes transmitted */ > + uint64_t tx_carrier_errors; /**< not transmitted packets because of > + carrier errors (e.g: physical link down) */ > + uint64_t tx_dropped; /**< no resources to transmit packet*/ > + uint64_t tx_errors; /**< packets transmit problems */ > + uint64_t tx_fifo_errors; /**< packets transmit FIFO errors */ > + uint64_t tx_heartbeat_errors; /**< packets transmitted that have been > + reported as heartbeat errors */ > + uint64_t tx_packets; /**< total packets transmitted */ > + uint64_t tx_window_errors; /**< number of packets not successfully > + transmitted due to a window collision.*/ > +} odp_pktio_stats_t; Are all pktios required to support all of these stats? (some of them seem to be Ethernet specific) If not, how do I tell which ones are supported? Are they always enabled or can they be enabled/disabled at build or run time? > + > +/** > + * Get statistics for pktio handle > + * > + * @param pktio Packet IO handle > + * @param[out] *stats Output buffer > + * @retval 0 on success > + * @retval <0 on failure > + */ > +int odp_pktio_stats(odp_pktio_t pktio, odp_pktio_stats_t *stats); What about resetting the stats?
Somehow my answers did not send. Please see comments bellow. On 08/20/15 16:16, Stuart Haslam wrote: > On Wed, Aug 19, 2015 at 03:22:59PM +0300, Maxim Uvarov wrote: >> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> >> --- >> include/odp/api/packet_io_stats.h | 77 ++++++++++++++++++++++++++ >> platform/linux-generic/include/odp/packet_io.h | 1 + >> 2 files changed, 78 insertions(+) >> create mode 100644 include/odp/api/packet_io_stats.h >> >> diff --git a/include/odp/api/packet_io_stats.h b/include/odp/api/packet_io_stats.h >> new file mode 100644 >> index 0000000..731a96f >> --- /dev/null >> +++ b/include/odp/api/packet_io_stats.h >> @@ -0,0 +1,77 @@ >> +/* Copyright (c) 2015, Linaro Limited >> + * All rights reserved. >> + * >> + * SPDX-License-Identifier: BSD-3-Clause >> + */ >> + >> +/** >> + * @file >> + * >> + * ODP Packet IO >> + */ >> + >> +#ifndef ODP_API_PACKET_IO_STATS_H_ >> +#define ODP_API_PACKET_IO_STATS_H_ >> + >> +#ifdef __cplusplus >> +extern "C" { >> +#endif >> + >> +/** @defgroup odp_packet_io ODP PACKET IO >> + * @{ >> + */ >> + >> +/** >> + * Packet IO statistics >> + * >> + */ >> +typedef struct odp_pktio_stats_t { >> + uint64_t collisions; /**< number of collisions */ >> + uint64_t multicast; /**< multicast packets received */ >> + >> + uint64_t rx_bytes; /**< total bytes received */ >> + uint64_t rx_crc_errors; /**< received packets with crc error */ >> + uint64_t rx_dropped; /**< no space in buffers */ >> + uint64_t rx_errors; /**< bad packets received */ >> + uint64_t rx_fifo_errors; /**< recv'r fifo overrun */ >> + uint64_t rx_frame_errors; /**< recv'd frame alignment error */ >> + uint64_t rx_length_errors; /**< bad packets length */ >> + uint64_t rx_missed_errors; /**< receiver missed packet */ >> + uint64_t rx_over_errors; /**< receiver ring buff overflow */ >> + uint64_t rx_packets; /**< total packets received */ >> + >> + uint64_t tx_aborted_errors; /**< packets aborted during >> + transmission by a network device (e.g: >> + because of a medium collision) */ >> + uint64_t tx_bytes; /**< total bytes transmitted */ >> + uint64_t tx_carrier_errors; /**< not transmitted packets because of >> + carrier errors (e.g: physical link down) */ >> + uint64_t tx_dropped; /**< no resources to transmit packet*/ >> + uint64_t tx_errors; /**< packets transmit problems */ >> + uint64_t tx_fifo_errors; /**< packets transmit FIFO errors */ >> + uint64_t tx_heartbeat_errors; /**< packets transmitted that have been >> + reported as heartbeat errors */ >> + uint64_t tx_packets; /**< total packets transmitted */ >> + uint64_t tx_window_errors; /**< number of packets not successfully >> + transmitted due to a window collision.*/ >> +} odp_pktio_stats_t; > Are all pktios required to support all of these stats? (some of them > seem to be Ethernet specific) If not, how do I tell which ones are > supported? > > Are they always enabled or can they be enabled/disabled at build or run > time? I think that odp api returns all possible counters. On some platforms some counters not supported and they will be always 0. Counters which are supported will increase. > >> + >> +/** >> + * Get statistics for pktio handle >> + * >> + * @param pktio Packet IO handle >> + * @param[out] *stats Output buffer >> + * @retval 0 on success >> + * @retval <0 on failure >> + */ >> +int odp_pktio_stats(odp_pktio_t pktio, odp_pktio_stats_t *stats); > What about resetting the stats? > I think that reset is not supported on many platforms. You can only relay on diff between 2 times. It's hardware counters and apps have no access to update or clear them. Maxim.
diff --git a/include/odp/api/packet_io_stats.h b/include/odp/api/packet_io_stats.h new file mode 100644 index 0000000..731a96f --- /dev/null +++ b/include/odp/api/packet_io_stats.h @@ -0,0 +1,77 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP Packet IO + */ + +#ifndef ODP_API_PACKET_IO_STATS_H_ +#define ODP_API_PACKET_IO_STATS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @defgroup odp_packet_io ODP PACKET IO + * @{ + */ + +/** + * Packet IO statistics + * + */ +typedef struct odp_pktio_stats_t { + uint64_t collisions; /**< number of collisions */ + uint64_t multicast; /**< multicast packets received */ + + uint64_t rx_bytes; /**< total bytes received */ + uint64_t rx_crc_errors; /**< received packets with crc error */ + uint64_t rx_dropped; /**< no space in buffers */ + uint64_t rx_errors; /**< bad packets received */ + uint64_t rx_fifo_errors; /**< recv'r fifo overrun */ + uint64_t rx_frame_errors; /**< recv'd frame alignment error */ + uint64_t rx_length_errors; /**< bad packets length */ + uint64_t rx_missed_errors; /**< receiver missed packet */ + uint64_t rx_over_errors; /**< receiver ring buff overflow */ + uint64_t rx_packets; /**< total packets received */ + + uint64_t tx_aborted_errors; /**< packets aborted during + transmission by a network device (e.g: + because of a medium collision) */ + uint64_t tx_bytes; /**< total bytes transmitted */ + uint64_t tx_carrier_errors; /**< not transmitted packets because of + carrier errors (e.g: physical link down) */ + uint64_t tx_dropped; /**< no resources to transmit packet*/ + uint64_t tx_errors; /**< packets transmit problems */ + uint64_t tx_fifo_errors; /**< packets transmit FIFO errors */ + uint64_t tx_heartbeat_errors; /**< packets transmitted that have been + reported as heartbeat errors */ + uint64_t tx_packets; /**< total packets transmitted */ + uint64_t tx_window_errors; /**< number of packets not successfully + transmitted due to a window collision.*/ +} odp_pktio_stats_t; + +/** + * Get statistics for pktio handle + * + * @param pktio Packet IO handle + * @param[out] *stats Output buffer + * @retval 0 on success + * @retval <0 on failure + */ +int odp_pktio_stats(odp_pktio_t pktio, odp_pktio_stats_t *stats); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp/packet_io.h b/platform/linux-generic/include/odp/packet_io.h index 1d690f5..18f8e78 100644 --- a/platform/linux-generic/include/odp/packet_io.h +++ b/platform/linux-generic/include/odp/packet_io.h @@ -33,6 +33,7 @@ extern "C" { */ #include <odp/api/packet_io.h> +#include <odp/api/packet_io_stats.h> #ifdef __cplusplus }
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- include/odp/api/packet_io_stats.h | 77 ++++++++++++++++++++++++++ platform/linux-generic/include/odp/packet_io.h | 1 + 2 files changed, 78 insertions(+) create mode 100644 include/odp/api/packet_io_stats.h