* [dpdk-dev] [pbhagavatula@caviumnetworks.com: Re: [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter]
@ 2018-07-16 11:33 Pavan Nikhilesh
2018-07-16 14:17 ` Rao, Nikhil
0 siblings, 1 reply; 6+ messages in thread
From: Pavan Nikhilesh @ 2018-07-16 11:33 UTC (permalink / raw)
To: nikhil.rao, jkollanukkaran, olivier.matz; +Cc: dev
Hi Nikhil,
On Mon, Jul 16, 2018 at 11:25:45AM +0530, Rao, Nikhil wrote:
> On 7/10/2018 4:26 PM, Pavan Nikhilesh wrote:
> > +int __rte_experimental
> > +rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint32_t *caps)
> > +{
> > The caps get API needs to be similar to rx adapter caps get i.e. it needs to
> > have the eth_port_id as a parameter so that the underlying event dev driver can
> > expose INTERNAL PORT capability as not all ethdev drivers have the capability
> > to interact with the eventdevs internal port.
> >
> > rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id,
> > uint32_t *caps);
> Hi Pavan,
>
> Is querying the INTERNAL PORT on a per ethdev basis useful to the
> application ?
If an application chooses to use 2 ports one with INTERNAL PORT capability and
one _without_ it then it would be useful to have per ethdev based
classification similar to Rx adapter. The application can classify events based
on event type RTE_EVENT_TYPE_ETHDEV & RTE_EVENT_TYPE_ETH_RX_ADAPTER to
segregate between INTERNAL & NON-INTERNAL port at ingress side and enqueue it
to either rte_event_eth_tx_adapter_enqueue or to the SINGLE link queue
respectively.
Also, I dont think eventdev should iterate over all probed ethdevs and give
the overall caps as an application might want only a specific ethdev to be
connected to the event tx adapter.
>
> For e.g., the txa_init() function in the adapter implementation can only
> decide to use the internal port if it is supported for all ethdevs,
> hence I left that upto the eventdev PMD to decide - i.e., it could
> iterate across txa->dev_count eth devices to make that determination.
> For caps in general, I agree it makes sense to pass in the ethdev, but
> the INTERNAL PORT didn't seem useful on a per ethdev basis.
>
> We could also replace caps_get with something like a
> rte_event_eth_tx_adapter_internal_port_check(dev_id) and add a per
> ethdev caps if needed later.
>
> Thanks,
> Nikhil
Thanks,
Pavan.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [pbhagavatula@caviumnetworks.com: Re: [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter]
2018-07-16 11:33 [dpdk-dev] [pbhagavatula@caviumnetworks.com: Re: [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter] Pavan Nikhilesh
@ 2018-07-16 14:17 ` Rao, Nikhil
2018-07-16 14:27 ` [dpdk-dev] [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter Pavan Nikhilesh
0 siblings, 1 reply; 6+ messages in thread
From: Rao, Nikhil @ 2018-07-16 14:17 UTC (permalink / raw)
To: Pavan Nikhilesh, jkollanukkaran, olivier.matz; +Cc: dev
> -----Original Message-----
> From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com]
> Sent: Monday, July 16, 2018 5:03 PM
> To: Rao, Nikhil <nikhil.rao@intel.com>;
> jkollanukkaran@caviumnetworks.com; olivier.matz@6wind.com
> Cc: dev@dpdk.org
> Subject: [pbhagavatula@caviumnetworks.com: Re: [dpdk-dev] [PATCH 2/4]
> eventdev: add caps API and PMD callbacks for eth Tx adapter]
>
> Hi Nikhil,
>
> On Mon, Jul 16, 2018 at 11:25:45AM +0530, Rao, Nikhil wrote:
> > On 7/10/2018 4:26 PM, Pavan Nikhilesh wrote:
> > > +int __rte_experimental
> > > +rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint32_t *caps) {
> > > The caps get API needs to be similar to rx adapter caps get i.e. it
> > > needs to have the eth_port_id as a parameter so that the underlying
> > > event dev driver can expose INTERNAL PORT capability as not all
> > > ethdev drivers have the capability to interact with the eventdevs
> internal port.
> > >
> > > rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint16_t
> eth_port_id,
> > > uint32_t *caps);
> > Hi Pavan,
> >
> > Is querying the INTERNAL PORT on a per ethdev basis useful to the
> > application ?
>
> If an application chooses to use 2 ports one with INTERNAL PORT capability
> and one _without_ it then it would be useful to have per ethdev based
> classification similar to Rx adapter. The application can classify events based
> on event type RTE_EVENT_TYPE_ETHDEV &
> RTE_EVENT_TYPE_ETH_RX_ADAPTER to segregate between INTERNAL &
> NON-INTERNAL port at ingress side and enqueue it to either
> rte_event_eth_tx_adapter_enqueue or to the SINGLE link queue
> respectively.
>
The current tx adapter is very similar to how the eventdev pipeline app decides between using the generic_tx v/s worker_tx, I guess what you are suggesting is using the 2 concurrently. I am fine with this,
Would you always assume INTERNAL PORT on the Rx side to deduce INTERNAL PORT on the tx side ? Just curious if that was just an example, in the general case, you could have packets ingressing from an INTERNAL port and egressing on a port that is !INTERNAL ?
> Also, I dont think eventdev should iterate over all probed ethdevs and give
> the overall caps as an application might want only a specific ethdev to be
> connected to the event tx adapter.
>
Agreed. The current adapter only supports either the generic_tx or the worker_tx models and selects either at the earliest point it is feasible to,
I will update the patch series for caps_get()
Thanks,
Nikhil
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter
2018-07-16 14:17 ` Rao, Nikhil
@ 2018-07-16 14:27 ` Pavan Nikhilesh
0 siblings, 0 replies; 6+ messages in thread
From: Pavan Nikhilesh @ 2018-07-16 14:27 UTC (permalink / raw)
To: Rao, Nikhil, jkollanukkaran, olivier.matz; +Cc: dev
On Mon, Jul 16, 2018 at 02:17:40PM +0000, Rao, Nikhil wrote:
>
> > -----Original Message-----
> > From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com]
> > Sent: Monday, July 16, 2018 5:03 PM
> > To: Rao, Nikhil <nikhil.rao@intel.com>;
> > jkollanukkaran@caviumnetworks.com; olivier.matz@6wind.com
> > Cc: dev@dpdk.org
> > Subject: [pbhagavatula@caviumnetworks.com: Re: [dpdk-dev] [PATCH 2/4]
> > eventdev: add caps API and PMD callbacks for eth Tx adapter]
> >
> > Hi Nikhil,
> >
> > On Mon, Jul 16, 2018 at 11:25:45AM +0530, Rao, Nikhil wrote:
> > > On 7/10/2018 4:26 PM, Pavan Nikhilesh wrote:
> > > > +int __rte_experimental
> > > > +rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint32_t *caps) {
> > > > The caps get API needs to be similar to rx adapter caps get i.e. it
> > > > needs to have the eth_port_id as a parameter so that the underlying
> > > > event dev driver can expose INTERNAL PORT capability as not all
> > > > ethdev drivers have the capability to interact with the eventdevs
> > internal port.
> > > >
> > > > rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint16_t
> > eth_port_id,
> > > > uint32_t *caps);
> > > Hi Pavan,
> > >
> > > Is querying the INTERNAL PORT on a per ethdev basis useful to the
> > > application ?
> >
> > If an application chooses to use 2 ports one with INTERNAL PORT capability
> > and one _without_ it then it would be useful to have per ethdev based
> > classification similar to Rx adapter. The application can classify events based
> > on event type RTE_EVENT_TYPE_ETHDEV &
> > RTE_EVENT_TYPE_ETH_RX_ADAPTER to segregate between INTERNAL &
> > NON-INTERNAL port at ingress side and enqueue it to either
> > rte_event_eth_tx_adapter_enqueue or to the SINGLE link queue
> > respectively.
> >
> The current tx adapter is very similar to how the eventdev pipeline app decides between using the generic_tx v/s worker_tx, I guess what you are suggesting is using the 2 concurrently. I am fine with this,
> Would you always assume INTERNAL PORT on the Rx side to deduce INTERNAL PORT on the tx side ? Just curious if that was just an example, in the general case, you could have packets ingressing from an INTERNAL port and egressing on a port that is !INTERNAL ?
I was just giving an example :). The application would be free to model the
pipeline accordingly based on event type and caps.
>
> > Also, I dont think eventdev should iterate over all probed ethdevs and give
> > the overall caps as an application might want only a specific ethdev to be
> > connected to the event tx adapter.
> >
> Agreed. The current adapter only supports either the generic_tx or the worker_tx models and selects either at the earliest point it is feasible to,
>
> I will update the patch series for caps_get()
>
> Thanks,
> Nikhil
Thanks,
Pavan
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 1/4] eventdev: add eth Tx adapter APIs
@ 2018-07-06 6:42 Nikhil Rao
2018-07-06 6:42 ` [dpdk-dev] [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter Nikhil Rao
0 siblings, 1 reply; 6+ messages in thread
From: Nikhil Rao @ 2018-07-06 6:42 UTC (permalink / raw)
To: jerin.jacob, olivier.matz; +Cc: nikhil.rao, dev
The ethernet Tx adapter abstracts the transmit stage of an
event driven packet processing application. The transmit
stage may be implemented with eventdev PMD support or use a
rte_service function implemented in the adapter. These APIs
provide a common configuration and control interface and
an transmit API for the eventdev PMD implementation.
The transmit port is specified using mbuf::port. The transmit
queue is specified using the rte_event_eth_tx_adapter_txq_set()
function. The mbuf will specify a queue ID in the future
(http://mails.dpdk.org/archives/dev/2018-February/090651.html)
at which point this function will be replaced with a macro.
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---
This patch series adds the event ethernet Tx adapter which is
based on a previous RFC
* RFCv1 - http://mails.dpdk.org/archives/dev/2018-May/102936.html
* RFCv2 - http://mails.dpdk.org/archives/dev/2018-June/104075.html
RFC -> V1:
=========
* Move port and tx queue id to mbuf from mbuf private area. (Jerin Jacob)
* Support for PMD transmit function. (Jerin Jacob)
* mbuf change has been replaced with rte_event_eth_tx_adapter_txq_set().
The goal is to align with the mbuf change for a qid field.
(http://mails.dpdk.org/archives/dev/2018-February/090651.html). Once the mbuf
change is available, the function can be replaced with a macro with no impact
to applications.
* Various cleanups (Jerin Jacob)
lib/librte_eventdev/rte_event_eth_tx_adapter.h | 497 +++++++++++++++++++++++++
lib/librte_mbuf/rte_mbuf.h | 4 +-
MAINTAINERS | 5 +
3 files changed, 505 insertions(+), 1 deletion(-)
create mode 100644 lib/librte_eventdev/rte_event_eth_tx_adapter.h
diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
new file mode 100644
index 0000000..b85ca70
--- /dev/null
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h
@@ -0,0 +1,497 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation.
+ */
+
+#ifndef _RTE_EVENT_ETH_TX_ADAPTER_
+#define _RTE_EVENT_ETH_TX_ADAPTER_
+
+/**
+ * @file
+ *
+ * RTE Event Ethernet Tx Adapter
+ *
+ * The event ethernet Tx adapter provides configuration and data path APIs
+ * for the ethernet transmit stage of an event driven packet processing
+ * application. These APIs abstract the implementation of the transmit stage
+ * and allow the the application to use eventdev PMD support or a common
+ * implementation.
+ *
+ * In the common implementation, the application enqueues mbufs to the adapter
+ * which runs as a rte_service function. The service function dequeues events
+ * from its event port and transmits the mbufs referenced by these events.
+ *
+ * The ethernet Tx event adapter APIs are:
+ *
+ * - rte_event_eth_tx_adapter_create()
+ * - rte_event_eth_tx_adapter_create_ext()
+ * - rte_event_eth_tx_adapter_free()
+ * - rte_event_eth_tx_adapter_start()
+ * - rte_event_eth_tx_adapter_stop()
+ * - rte_event_eth_tx_adapter_queue_add()
+ * - rte_event_eth_tx_adapter_queue_del()
+ * - rte_event_eth_tx_adapter_stats_get()
+ * - rte_event_eth_tx_adapter_stats_reset()
+ * - rte_event_eth_tx_adapter_enqueue()
+ * - rte_event_eth_tx_adapter_event_port_get()
+ * - rte_event_eth_tx_adapter_service_id_get()
+ *
+ * The application creates the adapter using
+ * rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_ext().
+ *
+ * The adapter will use the common implementation when the eventdev PMD
+ * does not have the RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT capability.
+ * The common implementation uses an event port that is created using the port
+ * configuration parameter passed to rte_event_eth_tx_adapter_create(). The
+ * application can get the port identifier using
+ * rte_event_eth_tx_adapter_event_port_get() and must link an event queue to
+ * this port.
+ *
+ * If the eventdev PMD has the RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT
+ * flags set, Tx adapter events should be enqueued using the
+ * rte_event_eth_tx_adapter_enqueue() function, else the application should
+ * use rte_event_enqueue_burst().
+ *
+ * Transmit queues can be added and deleted from the adapter using
+ * rte_event_eth_tx_adapter_queue_add()/del() APIs respectively.
+ *
+ * The application can start and stop the adapter using the
+ * rte_event_eth_tx_adapter_start/stop() calls.
+ *
+ * The common adapter implementation uses an EAL service function as described
+ * before and its execution is controlled using the rte_service APIs. The
+ * rte_event_eth_tx_adapter_service_id_get()
+ * function can be used to retrieve the adapter's service function ID.
+ *
+ * The ethernet port and transmit queue index to transmit the mbuf on are
+ * specified in the mbuf using rte_event_eth_tx_adapter_txq_set().
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#include "rte_eventdev.h"
+
+#define RTE_EVENT_ETH_TX_ADAPTER_SERVICE_NAME_LEN 32
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Adapter configuration structure
+ *
+ * @see rte_event_eth_tx_adapter_create_ext
+ * @see rte_event_eth_tx_adapter_conf_cb
+ */
+struct rte_event_eth_tx_adapter_conf {
+ uint8_t event_port_id;
+ /**< Event port identifier, the adapter service function dequeues mbuf
+ * events from this port.
+ * @see RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT
+ */
+ uint32_t max_nb_tx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_tx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_tx mbufs.
+ */
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Function type used for adapter configuration callback. The callback is
+ * used to fill in members of the struct rte_event_eth_tx_adapter_conf, this
+ * callback is invoked when creating a RTE service function based
+ * adapter implementation.
+ *
+ * @param id
+ * Adapter identifier.
+ * @param dev_id
+ * Event device identifier.
+ * @param [out] conf
+ * Structure that needs to be populated by this callback.
+ * @param arg
+ * Argument to the callback. This is the same as the conf_arg passed to the
+ * rte_event_eth_tx_adapter_create_ext().
+ *
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+typedef int (*rte_event_eth_tx_adapter_conf_cb) (uint8_t id, uint8_t dev_id,
+ struct rte_event_eth_tx_adapter_conf *conf,
+ void *arg);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * A structure used to retrieve statistics for an eth tx adapter instance.
+ */
+struct rte_event_eth_tx_adapter_stats {
+ uint64_t tx_retry;
+ /**< Number of transmit retries */
+ uint64_t tx_packets;
+ /**< Number of packets transmitted */
+ uint64_t tx_dropped;
+ /**< Number of packets dropped */
+};
+
+/** Event Eth Tx Adapter Structure */
+struct rte_event_eth_tx_adapter {
+ uint8_t id;
+ /**< Adapter Identifier */
+ uint8_t eventdev_id;
+ /**< Max mbufs processed in any service function invocation */
+ uint32_t max_nb_tx;
+ /**< The adapter can return early if it has processed at least
+ * max_nb_tx mbufs. This isn't treated as a requirement; batching may
+ * cause the adapter to process more than max_nb_tx mbufs.
+ */
+ uint32_t nb_queues;
+ /**< Number of Tx queues in adapter */
+ int socket_id;
+ /**< socket id */
+ rte_spinlock_t tx_lock;
+ /**< Synchronization with data path */
+ void *dev_private;
+ /**< PMD private data */
+ char mem_name[RTE_EVENT_ETH_TX_ADAPTER_SERVICE_NAME_LEN];
+ /**< Memory allocation name */
+ rte_event_eth_tx_adapter_conf_cb conf_cb;
+ /** Configuration callback */
+ void *conf_arg;
+ /**< Configuration callback argument */
+ uint16_t dev_count;
+ /**< Highest port id supported + 1 */
+ struct rte_event_eth_tx_adapter_ethdev *txa_ethdev;
+ /**< Per ethernet device structure */
+ struct rte_event_eth_tx_adapter_stats stats;
+} __rte_cache_aligned;
+
+struct rte_event_eth_tx_adapters {
+ struct rte_event_eth_tx_adapter **data;
+};
+
+/* Per eth device structure */
+struct rte_event_eth_tx_adapter_ethdev {
+ /* Pointer to ethernet device */
+ struct rte_eth_dev *dev;
+ /* Number of queues added */
+ uint16_t nb_queues;
+ /* PMD specific queue data */
+ void *queues;
+};
+
+extern struct rte_event_eth_tx_adapters rte_event_eth_tx_adapters;
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Create a new event ethernet Tx adapter with the specified identifier.
+ *
+ * @param id
+ * The identifier of the event ethernet Tx adapter.
+ * @param dev_id
+ * The event device identifier.
+ * @param port_config
+ * Event port configuration, the adapter uses this configuration to
+ * create an event port if needed.
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+int __rte_experimental
+rte_event_eth_tx_adapter_create(uint8_t id, uint8_t dev_id,
+ struct rte_event_port_conf *port_config);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Create a new event ethernet Tx adapter with the specified identifier.
+ *
+ * @param id
+ * The identifier of the event ethernet Tx adapter.
+ * @param dev_id
+ * The event device identifier.
+ * @param conf_cb
+ * Callback function that initalizes members of the
+ * struct rte_event_eth_tx_adapter_conf struct passed into
+ * it.
+ * @param conf_arg
+ * Argument that is passed to the conf_cb function.
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure
+ */
+int __rte_experimental
+rte_event_eth_tx_adapter_create_ext(uint8_t id, uint8_t dev_id,
+ rte_event_eth_tx_adapter_conf_cb conf_cb,
+ void *conf_arg);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Free an event adapter
+ *
+ * @param id
+ * Adapter identifier.
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure, If the adapter still has Tx queues
+ * added to it, the function returns -EBUSY.
+ */
+int __rte_experimental
+rte_event_eth_tx_adapter_free(uint8_t id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Start ethernet Tx event adapter
+ *
+ * @param id
+ * Adapter identifier.
+ * @return
+ * - 0: Success, Adapter started correctly.
+ * - <0: Error code on failure.
+ */
+int __rte_experimental
+rte_event_eth_tx_adapter_start(uint8_t id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Stop ethernet Tx event adapter
+ *
+ * @param id
+ * Adapter identifier.
+ * @return
+ * - 0: Success.
+ * - <0: Error code on failure.
+ */
+int __rte_experimental
+rte_event_eth_tx_adapter_stop(uint8_t id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Add a Tx queue to the adapter.
+ * A queue value of -1 is used to indicate all
+ * queues within the device.
+ *
+ * @param id
+ * Adapter identifier.
+ * @param eth_dev_id
+ * Ethernet Port Identifier.
+ * @param queue
+ * Tx queue index.
+ * @return
+ * - 0: Success, Queues added succcessfully.
+ * - <0: Error code on failure.
+ */
+int __rte_experimental
+rte_event_eth_tx_adapter_queue_add(uint8_t id,
+ uint16_t eth_dev_id,
+ int32_t queue);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Delete a Tx queue from the adapter.
+ * A queue value of -1 is used to indicate all
+ * queues within the device, that have been added to this
+ * adapter.
+ *
+ * @param id
+ * Adapter identifier.
+ * @param eth_dev_id
+ * Ethernet Port Identifier.
+ * @param queue
+ * Tx queue index.
+ * @return
+ * - 0: Success, Queues deleted successfully.
+ * - <0: Error code on failure.
+ */
+int __rte_experimental
+rte_event_eth_tx_adapter_queue_del(uint8_t id,
+ uint16_t eth_dev_id,
+ int32_t queue);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Set Tx queue in the mbuf.
+ *
+ * @param pkt
+ * Pointer to the mbuf.
+ * @param queue
+ * Tx queue index.
+ */
+void __rte_experimental
+rte_event_eth_tx_adapter_txq_set(struct rte_mbuf *pkt, uint16_t queue);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Retrieve the adapter event port. The adapter creates an event port if
+ * the RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT is not set in the
+ * eth Tx capabilities of the event device.
+ *
+ * @param id
+ * Adapter Identifier.
+ * @param[out] event_port_id
+ * Event port pointer.
+ * @return
+ * - 0: Success.
+ * - <0: Error code on failure.
+ */
+int __rte_experimental
+rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id);
+
+static __rte_always_inline uint16_t __rte_experimental
+__rte_event_eth_tx_adapter_enqueue(uint8_t id, uint8_t dev_id, uint8_t port_id,
+ struct rte_event ev[],
+ uint16_t nb_events,
+ const event_tx_adapter_enqueue fn)
+{
+ const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
+ struct rte_event_eth_tx_adapter *txa =
+ rte_event_eth_tx_adapters.data[id];
+
+#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
+ if (id >= RTE_EVENT_ETH_TX_ADAPTER_MAX_INSTANCE ||
+ dev_id >= RTE_EVENT_MAX_DEVS ||
+ !rte_eventdevs[dev_id].attached) {
+ rte_errno = -EINVAL;
+ return 0;
+ }
+
+ if (port_id >= dev->data->nb_ports) {
+ rte_errno = -EINVAL;
+ return 0;
+ }
+#endif
+ return fn((void *)txa, dev, dev->data->ports[port_id], ev, nb_events);
+}
+
+/**
+ * Enqueue a burst of events objects or an event object supplied in *rte_event*
+ * structure on an event device designated by its *dev_id* through the event
+ * port specified by *port_id*. This function is supported if the eventdev PMD
+ * has the RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT capability flag set.
+ *
+ * The *nb_events* parameter is the number of event objects to enqueue which are
+ * supplied in the *ev* array of *rte_event* structure.
+ *
+ * The rte_event_eth_tx_adapter_enqueue() function returns the number of
+ * events objects it actually enqueued. A return value equal to *nb_events*
+ * means that all event objects have been enqueued.
+ *
+ * @param id
+ * The identifier of the tx adapter.
+ * @param dev_id
+ * The identifier of the device.
+ * @param port_id
+ * The identifier of the event port.
+ * @param ev
+ * Points to an array of *nb_events* objects of type *rte_event* structure
+ * which contain the event object enqueue operations to be processed.
+ * @param nb_events
+ * The number of event objects to enqueue, typically number of
+ * rte_event_port_enqueue_depth() available for this port.
+ *
+ * @return
+ * The number of event objects actually enqueued on the event device. The
+ * return value can be less than the value of the *nb_events* parameter when
+ * the event devices queue is full or if invalid parameters are specified in a
+ * *rte_event*. If the return value is less than *nb_events*, the remaining
+ * events at the end of ev[] are not consumed and the caller has to take care
+ * of them, and rte_errno is set accordingly. Possible errno values include:
+ * - -EINVAL The port ID is invalid, device ID is invalid, an event's queue
+ * ID is invalid, or an event's sched type doesn't match the
+ * capabilities of the destination queue.
+ * - -ENOSPC The event port was backpressured and unable to enqueue
+ * one or more events. This error code is only applicable to
+ * closed systems.
+ */
+static inline uint16_t __rte_experimental
+rte_event_eth_tx_adapter_enqueue(uint8_t id, uint8_t dev_id,
+ uint8_t port_id,
+ struct rte_event ev[],
+ uint16_t nb_events)
+{
+ const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
+
+ return __rte_event_eth_tx_adapter_enqueue(id, dev_id, port_id, ev,
+ nb_events,
+ dev->txa_enqueue);
+}
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Retrieve statistics for an adapter
+ *
+ * @param id
+ * Adapter identifier.
+ * @param [out] stats
+ * A pointer to structure used to retrieve statistics for an adapter.
+ * @return
+ * - 0: Success, statistics retrieved successfully.
+ * - <0: Error code on failure.
+ */
+int __rte_experimental
+rte_event_eth_tx_adapter_stats_get(uint8_t id,
+ struct rte_event_eth_tx_adapter_stats *stats);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Reset statistics for an adapter.
+ *
+ * @param id
+ * Adapter identifier.
+ * @return
+ * - 0: Success, statistics reset successfully.
+ * - <0: Error code on failure.
+ */
+int __rte_experimental
+rte_event_eth_tx_adapter_stats_reset(uint8_t id);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * Retrieve the service ID of an adapter. If the adapter doesn't use
+ * a rte_service function, this function returns -ESRCH.
+ *
+ * @param id
+ * Adapter identifier.
+ * @param [out] service_id
+ * A pointer to a uint32_t, to be filled in with the service id.
+ * @return
+ * - 0: Success
+ * - <0: Error code on failure, if the adapter doesn't use a rte_service
+ * function, this function returns -ESRCH.
+ */
+int __rte_experimental
+rte_event_eth_tx_adapter_service_id_get(uint8_t id, uint32_t *service_id);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _RTE_EVENT_ETH_TX_ADAPTER_ */
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 8e6b4d2..216212c 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -464,7 +464,9 @@ struct rte_mbuf {
};
uint16_t nb_segs; /**< Number of segments. */
- /** Input port (16 bits to support more than 256 virtual ports). */
+ /** Input port (16 bits to support more than 256 virtual ports).
+ * The event eth Tx adapter uses this field to specify the output port.
+ */
uint16_t port;
uint64_t ol_flags; /**< Offload features. */
diff --git a/MAINTAINERS b/MAINTAINERS
index dabb12d..ab23503 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -388,6 +388,11 @@ F: lib/librte_eventdev/*crypto_adapter*
F: test/test/test_event_crypto_adapter.c
F: doc/guides/prog_guide/event_crypto_adapter.rst
+Eventdev Ethdev Tx Adapter API - EXPERIMENTAL
+M: Nikhil Rao <nikhil.rao@intel.com>
+T: git://dpdk.org/next/dpdk-next-eventdev
+F: lib/librte_eventdev/*eth_tx_adapter*
+
Raw device API - EXPERIMENTAL
M: Shreyansh Jain <shreyansh.jain@nxp.com>
M: Hemant Agrawal <hemant.agrawal@nxp.com>
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter
2018-07-06 6:42 [dpdk-dev] [PATCH 1/4] eventdev: add eth Tx adapter APIs Nikhil Rao
@ 2018-07-06 6:42 ` Nikhil Rao
2018-07-10 10:56 ` Pavan Nikhilesh
0 siblings, 1 reply; 6+ messages in thread
From: Nikhil Rao @ 2018-07-06 6:42 UTC (permalink / raw)
To: jerin.jacob, olivier.matz; +Cc: nikhil.rao, dev
The caps API allows the application to query if the transmit
stage is implemented in the eventdev PMD or uses the common
rte_service function. The PMD callbacks support the
eventdev PMD implementation of the adapter.
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---
lib/librte_eventdev/rte_eventdev.h | 30 ++++-
lib/librte_eventdev/rte_eventdev_pmd.h | 193 +++++++++++++++++++++++++++++++++
lib/librte_eventdev/rte_eventdev.c | 19 ++++
3 files changed, 241 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index b6fd6ee..e8df526 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -1186,6 +1186,28 @@ struct rte_event {
rte_event_crypto_adapter_caps_get(uint8_t dev_id, uint8_t cdev_id,
uint32_t *caps);
+/* Ethdev Tx adapter capability bitmap flags */
+#define RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT 0x1
+/**< This flag is sent when the PMD supports a packet transmit callback
+ */
+
+/**
+ * Retrieve the event device's eth Tx adapter capabilities
+ *
+ * @param dev_id
+ * The identifier of the device.
+ *
+ * @param[out] caps
+ * A pointer to memory filled with eth Tx adapter capabilities.
+ *
+ * @return
+ * - 0: Success, driver provides eth Tx adapter capabilities.
+ * - <0: Error code returned by the driver function.
+ *
+ */
+int __rte_experimental
+rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint32_t *caps);
+
struct rte_eventdev_ops;
struct rte_eventdev;
@@ -1204,6 +1226,11 @@ typedef uint16_t (*event_dequeue_burst_t)(void *port, struct rte_event ev[],
uint16_t nb_events, uint64_t timeout_ticks);
/**< @internal Dequeue burst of events from port of a device */
+typedef uint16_t (*event_tx_adapter_enqueue)(void *adapter,
+ const struct rte_eventdev *dev, void *port,
+ struct rte_event ev[], uint16_t nb_events);
+/**< @internal Enqueue burst of events on port of a device */
+
#define RTE_EVENTDEV_NAME_MAX_LEN (64)
/**< @internal Max length of name of event PMD */
@@ -1266,7 +1293,8 @@ struct rte_eventdev {
/**< Pointer to PMD dequeue function. */
event_dequeue_burst_t dequeue_burst;
/**< Pointer to PMD dequeue burst function. */
-
+ event_tx_adapter_enqueue txa_enqueue;
+ /**< Pointer to PMD eth Tx adapter enqueue function. */
struct rte_eventdev_data *data;
/**< Pointer to device data */
struct rte_eventdev_ops *dev_ops;
diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h
index 3fbb4d2..ccf07a8 100644
--- a/lib/librte_eventdev/rte_eventdev_pmd.h
+++ b/lib/librte_eventdev/rte_eventdev_pmd.h
@@ -789,6 +789,178 @@ typedef int (*eventdev_crypto_adapter_stats_reset)
(const struct rte_eventdev *dev,
const struct rte_cryptodev *cdev);
+/**
+ * Retrieve the event device's eth Tx adapter capabilities.
+ *
+ * @param dev
+ * Event device pointer
+ *
+ * @param[out] caps
+ * A pointer to memory filled with eth Tx adapter capabilities.
+ *
+ * @return
+ * - 0: Success, driver provides eth Tx adapter capabilities
+ * - <0: Error code returned by the driver function.
+ *
+ */
+typedef int (*eventdev_eth_tx_adapter_caps_get_t)
+ (const struct rte_eventdev *dev,
+ uint32_t *caps);
+
+struct rte_event_eth_tx_adapter;
+
+/**
+ * Retrieve the adapter event port. The adapter creates an event port if
+ * the RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT is not set in the
+ * eth Tx capabilities of the event device.
+ *
+ * @param txa
+ * Adapter pointer
+ *
+ * @param[out] event_port_id
+ * Event port pointer
+ *
+ * @return
+ * - 0: Success.
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_tx_adapter_event_port_get)
+ (struct rte_event_eth_tx_adapter *txa,
+ uint8_t *port);
+
+/**
+ * Initialize adapter PMD resources. This callback is invoked when
+ * adding the first Tx queue to the adapter.
+ *
+ * @param txa
+ * Adapter pointer
+ *
+ * @return
+ * - 0: Success.
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_tx_adapter_init_t)(
+ struct rte_event_eth_tx_adapter *txa);
+
+/**
+ * Free adapter PMD resources. This callback is invoked after the last queue
+ * has been deleted from the adapter.
+ *
+ * @param txa
+ * Adapter pointer
+ *
+ * @return
+ * - 0: Success.
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_tx_adapter_free_t)(
+ struct rte_event_eth_tx_adapter *txa);
+
+/**
+ * Add a Tx queue to the adapter.
+ * A queue value of -1 is used to indicate all
+ * queues within the device.
+ *
+ * @param txa
+ * Adapter pointer
+ *
+ * @param eth_dev
+ * Pointer to ethernet device
+ *
+ * @param tx_queue_id
+ * Transmt queue index
+ *
+ * @return
+ * - 0: Success.
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_tx_adapter_queue_add_t)(
+ struct rte_event_eth_tx_adapter *txa,
+ const struct rte_eth_dev *eth_dev,
+ int32_t tx_queue_id);
+
+/**
+ * Delete a Tx queue from the adapter.
+ * A queue value of -1 is used to indicate all
+ * queues within the device, that have been added to this
+ * adapter.
+ *
+ * @param txa
+ * Adapter pointer
+ *
+ * @param eth_dev_id
+ * Ethernet Port Identifier
+ *
+ * @param queue
+ * Tx queue index
+ *
+ * @return
+ * - 0: Success, Queues deleted successfully.
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_tx_adapter_queue_del_t)(
+ struct rte_event_eth_tx_adapter *txa,
+ const struct rte_eth_dev *eth_dev,
+ int32_t tx_queue_id);
+
+/**
+ * Start the adapter.
+ *
+ * @param txa
+ * Adapter pointer
+ *
+ * @return
+ * - 0: Success, Adapter started correctly.
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_tx_adapter_start_t)(
+ struct rte_event_eth_tx_adapter *txa);
+
+/**
+ * Stop the adapter.
+ *
+ * @param txa
+ * Adapter pointer
+ *
+ * @return
+ * - 0: Success.
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_tx_adapter_stop_t)(
+ struct rte_event_eth_tx_adapter *txa);
+
+struct rte_event_eth_tx_adapter_stats;
+
+/**
+ * Retrieve statistics for an adapter
+ *
+ * @param txa
+ * Adapter Pointer
+ *
+ * @param [out] stats
+ * A pointer to structure used to retrieve statistics for an adapter
+ *
+ * @return
+ * - 0: Success, statistics retrieved successfully.
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_tx_adapter_stats_get_t)(
+ struct rte_event_eth_tx_adapter *txa,
+ struct rte_event_eth_tx_adapter_stats *stats);
+
+/**
+ * Reset statistics for an adapter
+ *
+ * @param txa
+ * Adapter Pointer
+ *
+ * @return
+ * - 0: Success, statistics retrieved successfully.
+ * - <0: Error code on failure.
+ */
+typedef int (*eventdev_eth_tx_adapter_stats_reset_t)(
+ struct rte_event_eth_tx_adapter *txa);
+
/** Event device operations function pointer table */
struct rte_eventdev_ops {
eventdev_info_get_t dev_infos_get; /**< Get device info. */
@@ -862,6 +1034,27 @@ struct rte_eventdev_ops {
eventdev_crypto_adapter_stats_reset crypto_adapter_stats_reset;
/**< Reset crypto stats */
+ eventdev_eth_tx_adapter_caps_get_t eth_tx_adapter_caps_get;
+ /**< Get ethernet Tx adapter capabilities */
+ eventdev_eth_tx_adapter_event_port_get eth_tx_adapter_event_port_get;
+ /**< Get event port */
+ eventdev_eth_tx_adapter_init_t eth_tx_adapter_init;
+ /**< Initialize eth Tx adapter */
+ eventdev_eth_tx_adapter_free_t eth_tx_adapter_free;
+ /**< Free ethernet Tx adapter resources */
+ eventdev_eth_tx_adapter_queue_add_t eth_tx_adapter_queue_add;
+ /**< Add Tx queues to the eth Tx adapter */
+ eventdev_eth_tx_adapter_queue_del_t eth_tx_adapter_queue_del;
+ /**< Delete Tx queues from the eth Tx adapter */
+ eventdev_eth_tx_adapter_start_t eth_tx_adapter_start;
+ /**< Start eth Tx adapter */
+ eventdev_eth_tx_adapter_stop_t eth_tx_adapter_stop;
+ /**< Stop eth Tx adapter */
+ eventdev_eth_tx_adapter_stats_get_t eth_tx_adapter_stats_get;
+ /**< Get eth Tx adapter statistics */
+ eventdev_eth_tx_adapter_stats_reset_t eth_tx_adapter_stats_reset;
+ /**< Reset eth Tx adapter statistics */
+
eventdev_selftest dev_selftest;
/**< Start eventdev Selftest */
diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index 801810e..a29fae1 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -175,6 +175,25 @@
(dev, cdev, caps) : -ENOTSUP;
}
+int __rte_experimental
+rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint32_t *caps)
+{
+ struct rte_eventdev *dev;
+
+ RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+
+ dev = &rte_eventdevs[dev_id];
+
+ if (caps == NULL)
+ return -EINVAL;
+ *caps = 0;
+
+ return dev->dev_ops->eth_tx_adapter_caps_get ?
+ (*dev->dev_ops->eth_tx_adapter_caps_get)(dev,
+ caps)
+ : 0;
+}
+
static inline int
rte_event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
{
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter
2018-07-06 6:42 ` [dpdk-dev] [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter Nikhil Rao
@ 2018-07-10 10:56 ` Pavan Nikhilesh
2018-07-16 5:55 ` Rao, Nikhil
0 siblings, 1 reply; 6+ messages in thread
From: Pavan Nikhilesh @ 2018-07-10 10:56 UTC (permalink / raw)
To: Nikhil Rao, jerin.jacob, olivier.matz; +Cc: dev
Hi Nikhil,
On Fri, Jul 06, 2018 at 12:12:07PM +0530, Nikhil Rao wrote:
> The caps API allows the application to query if the transmit
> stage is implemented in the eventdev PMD or uses the common
> rte_service function. The PMD callbacks support the
> eventdev PMD implementation of the adapter.
>
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> ---
> lib/librte_eventdev/rte_eventdev.h | 30 ++++-
> lib/librte_eventdev/rte_eventdev_pmd.h | 193 +++++++++++++++++++++++++++++++++
> lib/librte_eventdev/rte_eventdev.c | 19 ++++
> 3 files changed, 241 insertions(+), 1 deletion(-)
>
<...>
>
> diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
> index 801810e..a29fae1 100644
> --- a/lib/librte_eventdev/rte_eventdev.c
> +++ b/lib/librte_eventdev/rte_eventdev.c
> @@ -175,6 +175,25 @@
> (dev, cdev, caps) : -ENOTSUP;
> }
>
> +int __rte_experimental
> +rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint32_t *caps)
> +{
The caps get API needs to be similar to rx adapter caps get i.e. it needs to
have the eth_port_id as a parameter so that the underlying event dev driver can
expose INTERNAL PORT capability as not all ethdev drivers have the capability
to interact with the eventdevs internal port.
rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id,
uint32_t *caps);
> + struct rte_eventdev *dev;
> +
> + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
> +
> + dev = &rte_eventdevs[dev_id];
> +
> + if (caps == NULL)
> + return -EINVAL;
> + *caps = 0;
> +
> + return dev->dev_ops->eth_tx_adapter_caps_get ?
> + (*dev->dev_ops->eth_tx_adapter_caps_get)(dev,
> + caps)
> + : 0;
> +}
> +
> static inline int
> rte_event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
> {
> --
> 1.8.3.1
>
Thanks,
Pavan.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter
2018-07-10 10:56 ` Pavan Nikhilesh
@ 2018-07-16 5:55 ` Rao, Nikhil
0 siblings, 0 replies; 6+ messages in thread
From: Rao, Nikhil @ 2018-07-16 5:55 UTC (permalink / raw)
To: Pavan Nikhilesh, jerin.jacob, olivier.matz; +Cc: dev
On 7/10/2018 4:26 PM, Pavan Nikhilesh wrote:
> +int __rte_experimental
> +rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint32_t *caps)
> +{
> The caps get API needs to be similar to rx adapter caps get i.e. it needs to
> have the eth_port_id as a parameter so that the underlying event dev driver can
> expose INTERNAL PORT capability as not all ethdev drivers have the capability
> to interact with the eventdevs internal port.
>
> rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id,
> uint32_t *caps);
Hi Pavan,
Is querying the INTERNAL PORT on a per ethdev basis useful to the
application ?
For e.g., the txa_init() function in the adapter implementation can only
decide to use the internal port if it is supported for all ethdevs,
hence I left that upto the eventdev PMD to decide - i.e., it could
iterate across txa->dev_count eth devices to make that determination.
For caps in general, I agree it makes sense to pass in the ethdev, but
the INTERNAL PORT didn't seem useful on a per ethdev basis.
We could also replace caps_get with something like a
rte_event_eth_tx_adapter_internal_port_check(dev_id) and add a per
ethdev caps if needed later.
Thanks,
Nikhil
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-07-16 14:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16 11:33 [dpdk-dev] [pbhagavatula@caviumnetworks.com: Re: [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter] Pavan Nikhilesh
2018-07-16 14:17 ` Rao, Nikhil
2018-07-16 14:27 ` [dpdk-dev] [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter Pavan Nikhilesh
-- strict thread matches above, loose matches on Subject: below --
2018-07-06 6:42 [dpdk-dev] [PATCH 1/4] eventdev: add eth Tx adapter APIs Nikhil Rao
2018-07-06 6:42 ` [dpdk-dev] [PATCH 2/4] eventdev: add caps API and PMD callbacks for eth Tx adapter Nikhil Rao
2018-07-10 10:56 ` Pavan Nikhilesh
2018-07-16 5:55 ` Rao, Nikhil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).