net/mvneta: support Rx/Tx

Add part of PMD for actual reception/transmission.

Signed-off-by: Yelena Krivosheev <yelena@marvell.com>
Signed-off-by: Dmitri Epshtein <dima@marvell.com>
Signed-off-by: Zyta Szpak <zr@semihalf.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Zyta Szpak 2018-10-03 09:22:10 +02:00 committed by Ferruh Yigit
parent 4ccc8d770d
commit ce7ea76459
8 changed files with 1109 additions and 6 deletions

View File

@ -7,5 +7,8 @@
Speed capabilities = Y
Jumbo frame = Y
CRC offload = Y
L3 checksum offload = Y
L4 checksum offload = Y
Packet type parsing = Y
ARMv8 = Y
Usage doc = Y

View File

@ -27,9 +27,13 @@ Features of the MVNETA PMD are:
- Start/stop
- tx/rx_queue_setup
- tx/rx_burst
- Speed capabilities
- Jumbo frame
- CRC offload
- L3 checksum offload
- L4 checksum offload
- Packet type parsing
Limitations

View File

@ -37,6 +37,6 @@ LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_cfgfile
LDLIBS += -lrte_bus_vdev -lrte_common_mvep
# library source files
SRCS-$(CONFIG_RTE_LIBRTE_MVNETA_PMD) += mvneta_ethdev.c
SRCS-$(CONFIG_RTE_LIBRTE_MVNETA_PMD) += mvneta_ethdev.c mvneta_rxtx.c
include $(RTE_SDK)/mk/rte.lib.mk

View File

@ -21,7 +21,8 @@ else
endif
sources = files(
'mvneta_ethdev.c'
'mvneta_ethdev.c',
'mvneta_rxtx.c'
)
deps += ['cfgfile', 'common_mvep']

View File

@ -6,8 +6,6 @@
#include <rte_ethdev_driver.h>
#include <rte_kvargs.h>
#include <rte_log.h>
#include <rte_malloc.h>
#include <rte_bus_vdev.h>
#include <stdio.h>
@ -23,7 +21,7 @@
#include <rte_mvep_common.h>
#include "mvneta_ethdev.h"
#include "mvneta_rxtx.h"
#define MVNETA_IFACE_NAME_ARG "iface"
@ -305,6 +303,10 @@ mvneta_dev_start(struct rte_eth_dev *dev)
priv->uc_mc_flushed = 1;
}
ret = mvneta_alloc_rx_bufs(dev);
if (ret)
goto out;
ret = mvneta_dev_set_link_up(dev);
if (ret) {
MVNETA_LOG(ERR, "Failed to set link up");
@ -315,6 +317,8 @@ mvneta_dev_start(struct rte_eth_dev *dev)
for (i = 0; i < dev->data->nb_tx_queues; i++)
dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
mvneta_set_tx_function(dev);
return 0;
out:
@ -338,7 +342,7 @@ mvneta_dev_stop(struct rte_eth_dev *dev)
return;
mvneta_dev_set_link_down(dev);
mvneta_flush_queues(dev);
neta_ppio_deinit(priv->ppio);
priv->ppio = NULL;
@ -354,9 +358,20 @@ static void
mvneta_dev_close(struct rte_eth_dev *dev)
{
struct mvneta_priv *priv = dev->data->dev_private;
int i;
if (priv->ppio)
mvneta_dev_stop(dev);
for (i = 0; i < dev->data->nb_rx_queues; i++) {
mvneta_rx_queue_release(dev->data->rx_queues[i]);
dev->data->rx_queues[i] = NULL;
}
for (i = 0; i < dev->data->nb_tx_queues; i++) {
mvneta_tx_queue_release(dev->data->tx_queues[i]);
dev->data->tx_queues[i] = NULL;
}
}
/**
@ -395,6 +410,12 @@ static const struct eth_dev_ops mvneta_ops = {
.mac_addr_set = mvneta_mac_addr_set,
.dev_infos_get = mvneta_dev_infos_get,
.dev_supported_ptypes_get = mvneta_dev_supported_ptypes_get,
.rxq_info_get = mvneta_rxq_info_get,
.txq_info_get = mvneta_txq_info_get,
.rx_queue_setup = mvneta_rx_queue_setup,
.rx_queue_release = mvneta_rx_queue_release,
.tx_queue_setup = mvneta_tx_queue_setup,
.tx_queue_release = mvneta_tx_queue_release,
};
/**
@ -445,6 +466,8 @@ mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name)
eth_dev->data->kdrv = RTE_KDRV_NONE;
eth_dev->data->dev_private = priv;
eth_dev->device = &vdev->device;
eth_dev->rx_pkt_burst = mvneta_rx_pkt_burst;
mvneta_set_tx_function(eth_dev);
eth_dev->dev_ops = &mvneta_ops;
rte_eth_dev_probing_finish(eth_dev);

View File

@ -7,6 +7,10 @@
#ifndef _MVNETA_ETHDEV_H_
#define _MVNETA_ETHDEV_H_
#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_log.h>
/*
* container_of is defined by both DPDK and MUSDK,
* we'll declare only one version.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2018 Marvell International Ltd.
* Copyright(c) 2018 Semihalf.
* All rights reserved.
*/
#ifndef _MVNETA_RXTX_H_
#define _MVNETA_RXTX_H_
#include "mvneta_ethdev.h"
int mvneta_alloc_rx_bufs(struct rte_eth_dev *dev);
void mvneta_flush_queues(struct rte_eth_dev *dev);
void mvneta_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id,
struct rte_eth_rxq_info *qinfo);
void mvneta_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,
struct rte_eth_txq_info *qinfo);
void mvneta_set_tx_function(struct rte_eth_dev *dev);
uint16_t
mvneta_rx_pkt_burst(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
int
mvneta_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
unsigned int socket,
const struct rte_eth_rxconf *conf __rte_unused,
struct rte_mempool *mp);
int
mvneta_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
unsigned int socket, const struct rte_eth_txconf *conf);
void mvneta_rx_queue_release(void *rxq);
void mvneta_tx_queue_release(void *txq);
#endif /* _MVNETA_RXTX_H_ */