On 7/6/2017 7:48 PM, Jerin Jacob wrote:
-----Original Message-----
Date: Fri, 7 Jul 2017 03:22:31 +0530
From: Nikhil Rao <nikhil....@intel.com>
To: jerin.ja...@caviumnetworks.com
CC: gage.e...@intel.com, dev@dpdk.org, tho...@monjalon.net,
  bruce.richard...@intel.com, harry.van.haa...@intel.com,
  hemant.agra...@nxp.com, nipun.gu...@nxp.com, narender.vang...@intel.com,
  Nikhil Rao <nikhil....@intel.com>, Abhinandan Gujjar
  <abhinandan.guj...@intel.com>
Subject: [PATCH 1/2] eventdev: add event adapter for ethernet Rx queues
X-Mailer: git-send-email 2.7.4

Signed-off-by: Abhinandan Gujjar <abhinandan.guj...@intel.com>
---
<sniped>

Thanks Nikhil for the patch.

Looks like you missed this email?
http://dpdk.org/ml/archives/dev/2017-June/068142.html

Can we make it as function pointer based approach(keeping all adapter functions
function prototype required for SW PMD) so that each PMD
can register the ops for adapter_create etc so that same API can be used
for software and hardware PMDs(the scheme like rte_flow() or rte_tm()
approach)

Can discuss more on that to finalize the approach?
Yes, I did miss that email :-( (I am including the relevant extract below)

>
> /* adapter has inbuilt port, no need to create producer port */
> #define RTE_EVENT_ETHDEV_CAP_INBUILT_PORT  (1ULL << 0)
> /* adapter does not need service function */
> #define RTE_EVENT_ETHDEV_CAP_NO_SERVICE_FUNC (1ULL << 1)
>
> struct rte_event_eth_rx_adap_info {
>    char name[32];
>          uint32_t adapter_cap;
>          /**< Ethdev RX adapter capabilities(RTE_EVENT_ETHDEV_CAP_)*/
> }
>
>
> struct rte_event_eth_rx_adap_cfg {
>    uint8_t rx_event_port_id;
> /**< Event port identifier, the adapter enqueues mbuf events to this
>          * port, Ignored when RTE_EVENT_ETHDEV_CAP_INBUILT_PORT
>          */
>
> }
>
> struct rte_eth_rx_event_adapter_queue_config {
>         uint32_t rx_queue_flags;
>          /**< Flags for handling received packets */
>         uint16_t servicing_weight;
> /**< Relative polling frequency of ethernet receive queue, if this
>          * is set to zero, the Rx queue is interrupt driven
>          * Ignored if RTE_EVENT_ETHDEV_CAP_NO_SERVICE_FUNC set
>          */
>         struct rte_event ev;
>         /**<
>          *  The values from the following event fields will be used when
>          *  enqueuing mbuf events:
> * - event_queue_id: Targeted event queue ID for received packets. > * - event_priority: Event priority of packets from this Rx queue in
>          *                     the event queue relative to other events.
> * - sched_type: Scheduling type for packets from this Rx queue. > * - flow_id: If the RTE_ETH_RX_EVENT_ADAPTER_QUEUE_FLOW_ID_VALID bit > * is set in rx_queue_flags, this flow_id is used for all > * packets received from this queue. Otherwise the flow ID
>          *               is set to the RSS hash.
>          */
> };
>
> int rte_event_eth_rx_adapter_create(uint8_t id, uint8_t dev_id, uint8_t eth_port_id);

> int rte_event_eth_rx_adapter_get_info(uint8_t id, struct rte_event_eth_rx_adap_info *info); > int rte_event_eth_rx_adapter_configure(uint8_t id, struct rte_event_eth_rx_adap_config *cfg); > int rte_event_eth_rx_adapter_queue_add(uint8_t id, int32_t rx_queue_id, const struct rte_eth_rx_event_adapter_queue_config *config);
> int rte_event_eth_rx_adapter_queue_del(uint8_t id, int32_t rx_queue_id)
> int rte_event_eth_rx_adapter_run();
> int rte_event_eth_rx_adapter_free(uint8_t id);
>

If I understood your idea, the function pointer struct would look something like this.

struct rte_eventdev_rx_adapter_ops {
        rx_adapter_create_t     create,
        rx_adapter_get_info_t   info,
        rx_adapter_configure_t  configure,
        rx_adapter_queue_add_t  queue_add,
        rx_adapter_queue_del_t  queue_del,
        rx_adapter_queue_free_t queue_free,
        rx_adapter_free_t       free
};

struct rte_eventdev {
       ..
       const struct rte_eventdev_rx_adapter_ops *rx_adapter_ops;
       ..
};

int rte_event_eth_rx_adapter_create(uint8_t id, uint8_t dev_id, uint8_t eth_port_id) {
        eventdev_ops = ... /* access through dev_id */
        void *priv;
        uint64_t cap;

        if (eventdev_ops->rx_adapter_ops) {
                rc =    
                eventdev_ops->rx_adapter_ops->rx_adapter_create(dev,
                                        &priv, eth_port_id, &caps))
        }

        if (!rc) {
                /* eventdev adapter for eth_port_id -> dev_id */
                rx_adapter[id].info.adapter_cap =               
                         RTE_EVENT_ETHDEV_CAP_NO_SERVICE_FUNC | caps ;
        } else  {
                /* create SW adapter for eth_port_id->dev_id */
                rx_adapter[id].info.adapter_cap = 0;
        }
}

According to the code above rx_adapter_get_info should be able to fill in RTE_EVENT_ETHDEV_CAP_INBUILT_PORT after rx_adapter_create, so that info() can retrieve it.

But from previous emails (see struct rte_event_dev_producer_conf below), it appears that the rx queue id and event information would be needed to create the adapter that enqueues from the ethdev queue id to the event pmd, however that information is available only at queue add time - thoughts ?

+struct rte_event_dev_producer_conf {
+       uint32_t event_type:4;
+       /**< Event type to classify the event source.
+        * @see RTE_EVENT_TYPE_ETHDEV, (RTE_EVENT_TYPE_*)
+        */
+       uint8_t sched_type:2;
+       /**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
+        * associated with flow id on a given event queue for the enqueue
+        * operation.
+        */
+       uint8_t priority;
+       /**< Event priority relative to other events in the
+        * event queue. The requested priority should in the
+        * range of  [RTE_EVENT_DEV_PRIORITY_HIGHEST,
+        * RTE_EVENT_DEV_PRIORITY_LOWEST].
+        * The implementation shall normalize the requested
+        * priority to supported priority value.
+        * Valid when the device has
+        * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
+        */
+       union {
+               struct rte_event_ethdev_producer {
+                       uint16_t ethdev_port;
+                       /**< The port identifier of the Ethernet device */
+                       int32_t rx_queue_id;
+                       /**< The index of the receive queue from which to
+                        * retrieve the input packets and inject to eventdev.
+                        * The value -1 denotes all the Rx queues configured
+                        * for the given ethdev_port are selected for retrieving
+                        * the input packets and then injecting the
+                        * events/packets to eventdev.
+                        * The rte_eth_rx_burst() result is undefined
+                        * if application invokes on bounded ethdev_port and
+                        * rx_queue_id.
+                        */
+               } ethdev; /* RTE_EVENT_TYPE_ETHDEV */
+               /**< Valid when event_type == RTE_EVENT_TYPE_ETHDEV.
+                * Implementation may use mbuff's rss->hash value as
+                * flow_id for the enqueue operation.
+                */
+       };
+};

Reply via email to