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

Message ID 1448370648-18974-5-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

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

Patch

diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c
index 20a144d..1986ba2 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -162,6 +162,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);
@@ -342,6 +348,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,