[dpdk-dev] [PATCH v5 6/7] eventdev: add eth Rx adapter implementation

Pavan Nikhilesh Bhagavatula pbhagavatula at caviumnetworks.com
Fri Oct 6 16:34:23 CEST 2017


Hi Nikhil,

I have verified the series with octeontx hw and found few issues mentioned
below, I will send the hw driver in a while.

On Sat, Oct 07, 2017 at 02:40:00AM +0530, Nikhil Rao wrote:
> The adapter implementation uses eventdev PMDs to configure the packet
> transfer if HW support is available and if not, it uses an EAL service
> function that reads packets from ethernet Rx queues and injects these
> as events into the event device.
>
> Signed-off-by: Gage Eads <gage.eads at intel.com>
> Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar at intel.com>
> Signed-off-by: Nikhil Rao <nikhil.rao at intel.com>
> ---
>  lib/librte_eventdev/rte_event_eth_rx_adapter.c | 1237 ++++++++++++++++++++++++
>  lib/Makefile                                   |    2 +-
>  lib/librte_eventdev/Makefile                   |    1 +
>  lib/librte_eventdev/rte_eventdev_version.map   |    9 +
>  4 files changed, 1248 insertions(+), 1 deletion(-)
>  create mode 100644 lib/librte_eventdev/rte_event_eth_rx_adapter.c
>
> diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> new file mode 100644
> index 000000000..0823aee16
> --- /dev/null
> +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> @@ -0,0 +1,1237 @@
> +#include <rte_cycles.h>
> +#include <rte_common.h>
> +#include <rte_dev.h>
> +#include <rte_errno.h>
> +#include <rte_ethdev.h>
> +#include <rte_log.h>
> +#include <rte_malloc.h>
> +#include <rte_service_component.h>
> +#include <rte_thash.h>
> +
> +#include "rte_eventdev.h"
> +#include "rte_eventdev_pmd.h"
> +#include "rte_event_eth_rx_adapter.h"
> +
> +#define BATCH_SIZE		32
> +#define BLOCK_CNT_THRESHOLD	10
> +#define ETH_EVENT_BUFFER_SIZE	(4*BATCH_SIZE)
> +
> +#define ETH_RX_ADAPTER_SERVICE_NAME_LEN	32
> +#define ETH_RX_ADAPTER_MEM_NAME_LEN	32
> +
> +/*
> + * There is an instance of this struct per polled Rx queue added to the
> + * adapter
> + */
> +struct eth_rx_poll_entry {
> +	/* Eth port to poll */
> +	uint8_t eth_dev_id;
> +	/* Eth rx queue to poll */
> +	uint16_t eth_rx_qid;
> +};
> +
> +/* Instance per adapter */
> +struct rte_eth_event_enqueue_buffer {
> +	/* Count of events in this buffer */
> +	uint16_t count;
> +	/* Array of events in this buffer */
> +	struct rte_event events[ETH_EVENT_BUFFER_SIZE];
> +};
> +
> +struct rte_event_eth_rx_adapter {
> +	/* RSS key */
> +	uint8_t rss_key_be[40];

Use #define or compile time config parameter instead of hardcoding to 40

> +	/* Event device identifier */
> +	uint8_t eventdev_id;
> +	/* Per ethernet device structure */
> +	struct eth_device_info *eth_devices;
> +	/* Event port identifier */
> +	uint8_t event_port_id;
> +	/* Lock to serialize config updates with service function */
> +	rte_spinlock_t rx_lock;
> +	/* Max mbufs processed in any service function invocation */
> +	uint32_t max_nb_rx;
> +	/* Receive queues that need to be polled */
> +	struct eth_rx_poll_entry *eth_rx_poll;
> +

<snip>

> +static int add_rx_queue(struct rte_event_eth_rx_adapter *rx_adapter,
> +		uint8_t eth_dev_id,
> +		int rx_queue_id,
> +		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
> +{
> +	struct eth_device_info *dev_info = &rx_adapter->eth_devices[eth_dev_id];
> +	uint32_t i;
> +	int ret;
> +
> +	if (queue_conf->servicing_weight == 0) {
> +		struct rte_event_eth_rx_adapter_queue_conf temp_conf;

temp_conf should be declared outside if condition, It goes out of scope and the
assignment queue_conf = &temp_conf; would become undefined.

> +
> +		struct rte_eth_dev_data *data = dev_info->dev->data;
> +		if (data->dev_conf.intr_conf.rxq) {
> +			RTE_EDEV_LOG_ERR("Interrupt driven queues"
> +					" not supported");
> +			return -ENOTSUP;
> +		}
> +		temp_conf = *queue_conf;
> +		temp_conf.servicing_weight = 1;
> +		/* If Rx interrupts are disabled set wt = 1 */
> +		queue_conf = &temp_conf;
> +	}
> +
> +	if (dev_info->rx_queue == NULL) {
<snip>

Thanks,
Pavan


More information about the dev mailing list