Signed-off-by: Christophe Milard <christophe.mil...@linaro.org> --- platform/linux-generic/include/odp_nic_internal.h | 5 ++++ platform/linux-generic/pktio/nic.c | 31 +++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/platform/linux-generic/include/odp_nic_internal.h b/platform/linux-generic/include/odp_nic_internal.h index 4f0f137..5ced7e8 100644 --- a/platform/linux-generic/include/odp_nic_internal.h +++ b/platform/linux-generic/include/odp_nic_internal.h @@ -48,6 +48,11 @@ int driver_probe(odp_pktio_t pktio, const char *pci_address, odp_pool_t pool); */ void driver_unprobe(pktio_entry_t *pktio_entry); +static inline odp_nic_dev_t *nic_dev_from_pktio(odp_pktio_t pktio) +{ + return _odp_nic_pktio_tbl[_odp_typeval(pktio)].nic_dev; +} + /** * @} */ diff --git a/platform/linux-generic/pktio/nic.c b/platform/linux-generic/pktio/nic.c index 1df93e1..1c25c90 100644 --- a/platform/linux-generic/pktio/nic.c +++ b/platform/linux-generic/pktio/nic.c @@ -46,6 +46,33 @@ static int nic_close(pktio_entry_t *entry) return 0; } +static int nic_recv(pktio_entry_t *pktio_entry, + odp_packet_t pkt_table[], unsigned len) +{ + int nbrx; + odp_nic_dev_t *nic_dev; + + nic_dev = nic_dev_from_pktio(pktio_entry->s.handle); + + nbrx = nic_dev->rx_pkt_burst(nic_dev->data->rx_queues[0], + (odp_nic_sgmt_t *)pkt_table, + len); + return nbrx; +} + +static int nic_send(pktio_entry_t *pktio_entry, + odp_packet_t pkt_table[], unsigned len) +{ + int nbtx; + odp_nic_dev_t *nic_dev; + + nic_dev = nic_dev_from_pktio(pktio_entry->s.handle); + nbtx = nic_dev->tx_pkt_burst(nic_dev->data->tx_queues[0], + (odp_nic_sgmt_t *)pkt_table, + len); + return nbtx; +} + const pktio_if_ops_t nic_pktio_ops = { .name = "Nic", .init = NULL, @@ -54,8 +81,8 @@ const pktio_if_ops_t nic_pktio_ops = { .close = nic_close, .start = NULL, .stop = NULL, - .recv = NULL, - .send = NULL, + .recv = nic_recv, + .send = nic_send, .mtu_get = NULL, .promisc_mode_set = NULL, .promisc_mode_get = NULL, -- 2.1.4 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp