diff mbox

[API-NEXT,PATCHv2] api: define pktio statistics api

Message ID 1440765663-17662-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Aug. 28, 2015, 12:41 p.m. UTC
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 v2: - add function to check supported cnts;
     - add optional functio to reset cnts;

 include/odp/api/packet_io_stats.h              | 101 +++++++++++++++++++++++++
 platform/linux-generic/include/odp/packet_io.h |   1 +
 2 files changed, 102 insertions(+)
 create mode 100644 include/odp/api/packet_io_stats.h

Comments

Maxim Uvarov Sept. 1, 2015, 7:56 a.m. UTC | #1
ping.


On 08/28/15 15:41, Maxim Uvarov wrote:
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> ---
>   v2: - add function to check supported cnts;
>       - add optional functio to reset cnts;
>
>   include/odp/api/packet_io_stats.h              | 101 +++++++++++++++++++++++++
>   platform/linux-generic/include/odp/packet_io.h |   1 +
>   2 files changed, 102 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..a72008b
> --- /dev/null
> +++ b/include/odp/api/packet_io_stats.h
> @@ -0,0 +1,101 @@
> +/* 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 supported counters for pktio handle
> + *
> + * @param	pktio	 Packet IO handle
> + * @param[out]	*stats	 Output buffer
> + *		For each stat field:
> + *		 0 - counter not supported.
> + *		!0 - counter is supported .
> + * @retval  0 on success
> + * @retval <0 on failure
> + */
> +int odp_config_pktio_stats(odp_pktio_t pktio, odp_pktio_stats_t *stat);
> +
> +/**
> + * 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);
> +
> +/**
> + * Reset statistics for pktio handle
> + *
> + * @param	pktio	 Packet IO handle
> + * @retval  0 on success
> + * @retval <0 on failure
> + *
> + * @note Optional.
> + */
> +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
>   }
Nicolas Morey-Chaisemartin Sept. 1, 2015, 1:15 p.m. UTC | #2
On 08/28/2015 02:41 PM, Maxim Uvarov wrote:
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Reviewed-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu>
> ---
>  v2: - add function to check supported cnts;
>      - add optional functio to reset cnts;
>
>  include/odp/api/packet_io_stats.h              | 101 +++++++++++++++++++++++++
>  platform/linux-generic/include/odp/packet_io.h |   1 +
>  2 files changed, 102 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..a72008b
> --- /dev/null
> +++ b/include/odp/api/packet_io_stats.h
> @@ -0,0 +1,101 @@
> +/* 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 supported counters for pktio handle
> + *
> + * @param	pktio	 Packet IO handle
> + * @param[out]	*stats	 Output buffer
> + *		For each stat field:
> + *		 0 - counter not supported.
> + *		!0 - counter is supported .
> + * @retval  0 on success
> + * @retval <0 on failure
> + */
> +int odp_config_pktio_stats(odp_pktio_t pktio, odp_pktio_stats_t *stat);
> +
> +/**
> + * 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);
> +
> +/**
> + * Reset statistics for pktio handle
> + *
> + * @param	pktio	 Packet IO handle
> + * @retval  0 on success
> + * @retval <0 on failure
> + *
> + * @note Optional.
> + */
> +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
>  }
Maxim Uvarov Sept. 1, 2015, 3:44 p.m. UTC | #3
Barry, did you talk about that counters?

https://tools.ietf.org/html/rfc1214

                             ifEntryId              GET,
                                ifIndex             GET,
                                ifDescr             GET,
                                ifType              GET,
                                ifMtu               GET,
                                ifSpeed             GET,
                                ifPhysAddress       GET,
                                ifAdminStatus       GET-REPLACE,
                                ifOperStatus        GET,
                                ifLastChange        GET,
                                ifInOctets          GET,
                                ifInUcastPkts       GET,
                                ifInNUcastPkts      GET,
                                ifInDiscards        GET,
                                ifInErrors          GET,
                                ifInUnknownProtos   GET,
                                ifOutOctets         GET,
                                ifOutUcastPkts      GET,
                                ifOutNUcastPkts     GET,
                                ifOutDiscards       GET,
                                ifOutErrors         GET,
                                ifOutQLen           GET,
                                ifSpecific          GET;


Thanks,
Maxim.


On 09/01/15 16:15, Nicolas Morey-Chaisemartin wrote:
>
> On 08/28/2015 02:41 PM, Maxim Uvarov wrote:
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> Reviewed-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu>
>> ---
>>   v2: - add function to check supported cnts;
>>       - add optional functio to reset cnts;
>>
>>   include/odp/api/packet_io_stats.h              | 101 +++++++++++++++++++++++++
>>   platform/linux-generic/include/odp/packet_io.h |   1 +
>>   2 files changed, 102 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..a72008b
>> --- /dev/null
>> +++ b/include/odp/api/packet_io_stats.h
>> @@ -0,0 +1,101 @@
>> +/* 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 supported counters for pktio handle
>> + *
>> + * @param	pktio	 Packet IO handle
>> + * @param[out]	*stats	 Output buffer
>> + *		For each stat field:
>> + *		 0 - counter not supported.
>> + *		!0 - counter is supported .
>> + * @retval  0 on success
>> + * @retval <0 on failure
>> + */
>> +int odp_config_pktio_stats(odp_pktio_t pktio, odp_pktio_stats_t *stat);
>> +
>> +/**
>> + * 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);
>> +
>> +/**
>> + * Reset statistics for pktio handle
>> + *
>> + * @param	pktio	 Packet IO handle
>> + * @retval  0 on success
>> + * @retval <0 on failure
>> + *
>> + * @note Optional.
>> + */
>> +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
>>   }
diff mbox

Patch

diff --git a/include/odp/api/packet_io_stats.h b/include/odp/api/packet_io_stats.h
new file mode 100644
index 0000000..a72008b
--- /dev/null
+++ b/include/odp/api/packet_io_stats.h
@@ -0,0 +1,101 @@ 
+/* 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 supported counters for pktio handle
+ *
+ * @param	pktio	 Packet IO handle
+ * @param[out]	*stats	 Output buffer
+ *		For each stat field:
+ *		 0 - counter not supported.
+ *		!0 - counter is supported .
+ * @retval  0 on success
+ * @retval <0 on failure
+ */
+int odp_config_pktio_stats(odp_pktio_t pktio, odp_pktio_stats_t *stat);
+
+/**
+ * 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);
+
+/**
+ * Reset statistics for pktio handle
+ *
+ * @param	pktio	 Packet IO handle
+ * @retval  0 on success
+ * @retval <0 on failure
+ *
+ * @note Optional.
+ */
+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
 }