Implemented odp_pktio_capability() function in netmap.
Signed-off-by: Matias Elo <[email protected]>
---
platform/linux-generic/include/odp_packet_netmap.h | 2 ++
platform/linux-generic/pktio/netmap.c | 11 ++++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/platform/linux-generic/include/odp_packet_netmap.h
b/platform/linux-generic/include/odp_packet_netmap.h
index 84bea65..a088d23 100644
--- a/platform/linux-generic/include/odp_packet_netmap.h
+++ b/platform/linux-generic/include/odp_packet_netmap.h
@@ -7,6 +7,7 @@
#ifndef ODP_PACKET_NETMAP_H
#define ODP_PACKET_NETMAP_H
+#include <odp/packet_io.h>
#include <odp/pool.h>
#include <linux/if_ether.h>
@@ -22,6 +23,7 @@ typedef struct {
int sockfd; /**< control socket */
unsigned char if_mac[ETH_ALEN]; /**< eth mac address */
char nm_name[IF_NAMESIZE + 7]; /**< netmap:<ifname> */
+ odp_pktio_capability_t capa; /**< interface capabilities */
} pkt_netmap_t;
#endif
diff --git a/platform/linux-generic/pktio/netmap.c
b/platform/linux-generic/pktio/netmap.c
index fa20c6e..313bcbe 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -127,6 +127,8 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED,
pktio_entry_t *pktio_entry,
ODP_ERR("nm_open(%s) failed\n", pkt_nm->nm_name);
goto error;
}
+ pkt_nm->capa.max_input_queues = desc->nifp->ni_rx_rings;
+ pkt_nm->capa.max_output_queues = desc->nifp->ni_tx_rings;
nm_close(desc);
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
@@ -341,6 +343,13 @@ static int netmap_promisc_mode_get(pktio_entry_t
*pktio_entry)
pktio_entry->s.name);
}
+static int netmap_capability(pktio_entry_t *pktio_entry,
+ odp_pktio_capability_t *capa)
+{
+ *capa = pktio_entry->s.pkt_nm.capa;
+ return 0;
+}
+
const pktio_if_ops_t netmap_pktio_ops = {
.name = "netmap",
.init = NULL,
@@ -355,7 +364,7 @@ const pktio_if_ops_t netmap_pktio_ops = {
.promisc_mode_set = netmap_promisc_mode_set,
.promisc_mode_get = netmap_promisc_mode_get,
.mac_get = netmap_mac_addr_get,
- .capability = NULL,
+ .capability = netmap_capability,
.input_queues_config = NULL,
.output_queues_config = NULL,
.in_queues = NULL,
--
1.9.1
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp