Message ID | 1445510711-12313-2-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | New |
Headers | show |
> -----Original Message----- > From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of EXT > Maxim Uvarov > Sent: Thursday, October 22, 2015 1:45 PM > To: lng-odp@lists.linaro.org > Subject: [lng-odp] [PATCHv5 1/2] api: define pktio statistics api > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > --- > include/odp/api/packet_io_stats.h | 133 > +++++++++++++++++++++++++ > platform/linux-generic/include/odp/packet_io.h | 1 + > 2 files changed, 134 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..1bff9ca > --- /dev/null > +++ b/include/odp/api/packet_io_stats.h > @@ -0,0 +1,133 @@ > +/* 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 This file does not define the group, but adds documentation into it @addtogroup odp_packet_io > + * @{ > + */ > + > +/** > + * Packet IO statistics > + * > + * Packet IO statictics counters follow RFCs for Management Information > Base > + * (MIB)for use with network management protocols in the Internet > community: > + * https://tools.ietf.org/html/rfc3635 > + * https://tools.ietf.org/html/rfc2863 > + * https://tools.ietf.org/html/rfc2819 > + */ > +typedef struct odp_pktio_stats_t { > + /** > + * The number of octets in valid MAC frames received on this > interface, > + * including the MAC header and FCS. See ifHCInOctets counter > + * description in RFC 3635 for details. > + */ > + uint64_t in_octets; Add empty lines between variables and documentation. Otherwise it's hard to see code from documentation. > + /** > + * The number of packets, delivered by this sub-layer to a higher > + * (sub-)layer, which were not addressed to a multicast or broadcast > + * address at this sub-layer. See InUcastPkts in RFC 2863. I think you can always point to 3635, which then points to 2863 (if needed). If previous variable refers to ifHCInOctets, then this should refers to ifHCInUcastPkts. > + */ > + uint64_t in_ucast_pkts; > + /** > + * The number of inbound packets which were chosen to be discarded > + * even though no errors had been detected to preven their being > + * deliverable to a higher-layer protocol. One possible reason for > + * discarding such a packet could be to free up buffer space. > + * See InDiscards in RFC 2863. > + */ > + uint64_t in_discards; > + /** > + * The sum for this interface of AlignmentErrors, FCSErrors, > FrameTooLongs, > + * InternalMacReceiveErrors. See InErrors in RFC 3635. > + */ > + uint64_t in_errors; > + /** > + * For packet-oriented interfaces, the number of packets received via > + * the interface which were discarded because of an unknown or > + * unsupported protocol. For character-oriented or fixed-length > + * interfaces that support protocol multiplexing the number of > + * transmission units received via the interface which were discarded > + * because of an unknown or unsupported protocol. For any interface > + * that does not support protocol multiplexing, this counter will > always > + * be 0. See InUnknownProtos in RFC 2863. > + */ > + uint64_t in_unknown_protos; > + /** > + * The number of octets transmitted in valid MAC frames on this > + * interface, including the MAC header and FCS. This does include > + * the number of octets in valid MAC Control frames transmitted on > + * this interface. See OutOctets in RFC 3635. > + */ > + uint64_t out_octets; > + /** > + * The total number of packets that higher-level protocols requested > + * be transmitted, and which were not addressed to a multicast or > + * broadcast address at this sub-layer, including those that were > + * discarded or not sent. does not include MAC Control frames. > + * See OutUcastPkts in RFC 2863, 3635. > + */ > + uint64_t out_ucast_pkts; > + /** > + * The number of outbound packets which were chosen to be discarded > + * even though no errors had been detected to prevent their being > + * transmitted. One possible reason for discarding such a packet > could > + * be to free up buffer space. See OutDiscards in RFC 2863. > + */ > + uint64_t out_discards; > + /** > + * The sum for this interface of SQETestErrors, LateCollisions, > + * ExcessiveCollisions, InternalMacTransmitErrors and > + * CarrierSenseErrors. See OutErrors in RFC 3635. > + */ > + uint64_t out_errors; > +} odp_pktio_stats_t; > + > +/** > + * Get statistics for pktio handle > + * > + * @param pktio Packet IO handle > + * @param[out] *stats Output buffer for counters Remove "*" from variable name. Didn't 'make doxygen-html' warn you about that? -Petri > + * @retval 0 on success > + * @retval <0 on failure > + * > + * @note: If counter is not supported by platform it has > + * to be set to 0. > + */ > +int odp_pktio_stats(odp_pktio_t pktio, > + odp_pktio_stats_t *stats); > + > +/** > + * Reset statistics for pktio handle > + * > + * Reset all pktio counters to 0. > + * @param pktio Packet IO handle > + * @retval 0 on success > + * @retval <0 on failure > + * > + */ > +int odp_pktio_stats_reset(odp_pktio_t pktio); > + > +/** > + * @} > + */ > + > +#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 > } > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp
diff --git a/include/odp/api/packet_io_stats.h b/include/odp/api/packet_io_stats.h new file mode 100644 index 0000000..1bff9ca --- /dev/null +++ b/include/odp/api/packet_io_stats.h @@ -0,0 +1,133 @@ +/* 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 + * + * Packet IO statictics counters follow RFCs for Management Information Base + * (MIB)for use with network management protocols in the Internet community: + * https://tools.ietf.org/html/rfc3635 + * https://tools.ietf.org/html/rfc2863 + * https://tools.ietf.org/html/rfc2819 + */ +typedef struct odp_pktio_stats_t { + /** + * The number of octets in valid MAC frames received on this interface, + * including the MAC header and FCS. See ifHCInOctets counter + * description in RFC 3635 for details. + */ + uint64_t in_octets; + /** + * The number of packets, delivered by this sub-layer to a higher + * (sub-)layer, which were not addressed to a multicast or broadcast + * address at this sub-layer. See InUcastPkts in RFC 2863. + */ + uint64_t in_ucast_pkts; + /** + * The number of inbound packets which were chosen to be discarded + * even though no errors had been detected to preven their being + * deliverable to a higher-layer protocol. One possible reason for + * discarding such a packet could be to free up buffer space. + * See InDiscards in RFC 2863. + */ + uint64_t in_discards; + /** + * The sum for this interface of AlignmentErrors, FCSErrors, FrameTooLongs, + * InternalMacReceiveErrors. See InErrors in RFC 3635. + */ + uint64_t in_errors; + /** + * For packet-oriented interfaces, the number of packets received via + * the interface which were discarded because of an unknown or + * unsupported protocol. For character-oriented or fixed-length + * interfaces that support protocol multiplexing the number of + * transmission units received via the interface which were discarded + * because of an unknown or unsupported protocol. For any interface + * that does not support protocol multiplexing, this counter will always + * be 0. See InUnknownProtos in RFC 2863. + */ + uint64_t in_unknown_protos; + /** + * The number of octets transmitted in valid MAC frames on this + * interface, including the MAC header and FCS. This does include + * the number of octets in valid MAC Control frames transmitted on + * this interface. See OutOctets in RFC 3635. + */ + uint64_t out_octets; + /** + * The total number of packets that higher-level protocols requested + * be transmitted, and which were not addressed to a multicast or + * broadcast address at this sub-layer, including those that were + * discarded or not sent. does not include MAC Control frames. + * See OutUcastPkts in RFC 2863, 3635. + */ + uint64_t out_ucast_pkts; + /** + * The number of outbound packets which were chosen to be discarded + * even though no errors had been detected to prevent their being + * transmitted. One possible reason for discarding such a packet could + * be to free up buffer space. See OutDiscards in RFC 2863. + */ + uint64_t out_discards; + /** + * The sum for this interface of SQETestErrors, LateCollisions, + * ExcessiveCollisions, InternalMacTransmitErrors and + * CarrierSenseErrors. See OutErrors in RFC 3635. + */ + uint64_t out_errors; +} odp_pktio_stats_t; + +/** + * Get statistics for pktio handle + * + * @param pktio Packet IO handle + * @param[out] *stats Output buffer for counters + * @retval 0 on success + * @retval <0 on failure + * + * @note: If counter is not supported by platform it has + * to be set to 0. + */ +int odp_pktio_stats(odp_pktio_t pktio, + odp_pktio_stats_t *stats); + +/** + * Reset statistics for pktio handle + * + * Reset all pktio counters to 0. + * @param pktio Packet IO handle + * @retval 0 on success + * @retval <0 on failure + * + */ +int odp_pktio_stats_reset(odp_pktio_t pktio); + +/** + * @} + */ + +#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 | 133 +++++++++++++++++++++++++ platform/linux-generic/include/odp/packet_io.h | 1 + 2 files changed, 134 insertions(+) create mode 100644 include/odp/api/packet_io_stats.h