diff mbox

[API-NEXT,PATCHv2,4/5] linux-generic: pktio netmap: implement statistics counters

Message ID 1447839268-20423-5-git-send-email-maxim.uvarov@linaro.org
State Superseded
Headers show

Commit Message

Maxim Uvarov Nov. 18, 2015, 9:34 a.m. UTC
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 platform/linux-generic/pktio/netmap.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Maxim Uvarov Nov. 18, 2015, 9:39 a.m. UTC | #1
On 11/18/2015 12:34, Maxim Uvarov wrote:
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> ---
>   platform/linux-generic/pktio/netmap.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c
> index 794c82e..f9359ba 100644
> --- a/platform/linux-generic/pktio/netmap.c
> +++ b/platform/linux-generic/pktio/netmap.c
> @@ -168,6 +168,12 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry,
>   	if (err)
>   		goto error;
>   
> +	/* netmap uses only ethtool to get statistics counters */
> +	pktio_entry->s.use_ethtool;
ops, it has to be = 1.

Will resend.
> +	err = sock_stats_reset(pktio_entry);
> +	if (err != 0)
> +		goto error;
> +
>   	/* Wait for the link to come up */
>   	for (i = 0; i < NM_OPEN_RETRIES; i++) {
>   		err = netmap_do_ioctl(pktio_entry, SIOCETHTOOL, ETHTOOL_GLINK);
> @@ -313,6 +319,8 @@ const pktio_if_ops_t netmap_pktio_ops = {
>   	.close = netmap_close,
>   	.start = NULL,
>   	.stop = NULL,
> +	.stats = sock_stats,
> +	.stats_reset = sock_stats_reset,
>   	.recv = netmap_recv,
>   	.send = netmap_send,
>   	.mtu_get = netmap_mtu_get,
diff mbox

Patch

diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c
index 794c82e..f9359ba 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -168,6 +168,12 @@  static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry,
 	if (err)
 		goto error;
 
+	/* netmap uses only ethtool to get statistics counters */
+	pktio_entry->s.use_ethtool;
+	err = sock_stats_reset(pktio_entry);
+	if (err != 0)
+		goto error;
+
 	/* Wait for the link to come up */
 	for (i = 0; i < NM_OPEN_RETRIES; i++) {
 		err = netmap_do_ioctl(pktio_entry, SIOCETHTOOL, ETHTOOL_GLINK);
@@ -313,6 +319,8 @@  const pktio_if_ops_t netmap_pktio_ops = {
 	.close = netmap_close,
 	.start = NULL,
 	.stop = NULL,
+	.stats = sock_stats,
+	.stats_reset = sock_stats_reset,
 	.recv = netmap_recv,
 	.send = netmap_send,
 	.mtu_get = netmap_mtu_get,