diff mbox

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

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

Commit Message

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

Patch

diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c
index 794c82e..920c365 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 = 1;
+	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,