From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 07EA7A0C4C; Mon, 20 Sep 2021 08:30:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75E2740DF7; Mon, 20 Sep 2021 08:30:43 +0200 (CEST) Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) by mails.dpdk.org (Postfix) with ESMTP id AA72440DF5 for ; Mon, 20 Sep 2021 08:30:42 +0200 (CEST) Received: by mail-il1-f181.google.com with SMTP id i13so17451409ilm.4 for ; Sun, 19 Sep 2021 23:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OtChxnXSU/FV3+IM37NRjhTD/wwdeyAGsDj76eTry4w=; b=UL6uOY+Lc/IJrgSffaW7Pdepridqs79s5tolwbUVlGlSTHClj+Cq5DbPKcuQ5vUNGV /0Qz4TqHn+iVDYq+dSL2ptfT9XGwb6CSYWz2YR0sIzC4kbwqWuQlSkKhAui7ndS/0CXG go2vNdaWEsQ/pNOEnXbBhmBpg3bIRlphuddtwEknr5/rcu2H0ONtPI9s96lPAF3iJgo4 jWDHzZ5XM/idWPHtatTaiGfPPtDJzfu2ITe8q26r+Qu7p9p+8nABUpF0gllVNHnDMpKk FvO60MO0+Inn8ktCXfTyE1Eu8VrXCY4CLI/SyicIsF9GxRHkIAZsormHiCNDQqUlJQTq wx2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OtChxnXSU/FV3+IM37NRjhTD/wwdeyAGsDj76eTry4w=; b=wordEscbHsYUtOPW4JebynWUGfkrlrsNPjN7k+zmYUNywgj9tMEYaY6N40AkPDFOBK 4J/VuQSP09vR260MV8IraH8knK5okAL2GI2FQKe1z6X/RKjEftZDEoOdedqGfAXIZJHQ RNnWZDvP8+nVdpDUuZCLhGFEQx0bz+qdlRMyTuAeCJm2XCEMI/AwE2HUFjarXXQ1RDOt ECd5XQEL43TawHgLc7iaVjpYD4Gq1IVOs7gHEohqR8wxwSMTDx43GEYPCzvbAuMuu+uC mk9w+GnwAsMloZr0jRBINgxqadjLXlJcDQJLOuHDkQ1hQayHrIZDGBB2r0MVFhg7Bz0B mflQ== X-Gm-Message-State: AOAM532FjDFi2LBmGNNAdB7zrIHBB5vXv7pViZokW2jQkazP4UFStVvk jmNOHhEipbN+dx7ol1j/pkOUYrRCherh/HiZHhRK7sL8ok8qKg== X-Google-Smtp-Source: ABdhPJwgeaQDQoo0HPe8UvRPXpEyFDMrdnXy3AHmU0V2GejdOWlyQhaUyrs2i91JdupVmI6rdOsVcElPLS9PUClMQR8= X-Received: by 2002:a05:6e02:ef4:: with SMTP id j20mr16903956ilk.294.1632119440804; Sun, 19 Sep 2021 23:30:40 -0700 (PDT) MIME-Version: 1.0 References: <20210912155858.1397453-1-ganapati.kundapura@intel.com> <20210916125107.2024111-1-ganapati.kundapura@intel.com> In-Reply-To: <20210916125107.2024111-1-ganapati.kundapura@intel.com> From: Jerin Jacob Date: Mon, 20 Sep 2021 12:00:14 +0530 Message-ID: To: Ganapati Kundapura Cc: "Jayatheerthan, Jay" , dpdk-dev , Ferruh Yigit Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v5 1/2] eventdev: add rx queue conf get api X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Sep 16, 2021 at 6:21 PM Ganapati Kundapura wrote: > > Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx queue > information - event queue identifier, flags for handling received packets, > scheduler type, event priority, polling frequency of the receive queue > and flow identifier in rte_event_eth_rx_adapter_queue_conf structure > > Signed-off-by: Ganapati Kundapura > > --- > v5: > * Filled queue_conf after memzone lookup > * PMD callback if not NULL, invoked to override queue_conf struct > * Added memzone lookup for stats_get(), stats_reset(), service_id_get() > api's called by secondary applications. > > v4: > * squashed 1/3 and 3/3 > * reused rte_event_eth_rx_adapter_queue_conf structure in place of > rte_event_eth_rx_adapter_queue_info > * renamed to rte_event_eth_rx_adapter_queue_info_get() to > rte_event_eth_rx_adapter_queue_conf_get to align with > rte_event_eth_rx_adapter_queue_conf structure > > v3: > * Split single patch into implementaion, test and document updation > patches separately > > v2: > * Fixed build issue due to missing entry in version.map > > v1: > * Initial patch with implementaion, test and doc together > --- > --- > .../prog_guide/event_ethernet_rx_adapter.rst | 8 ++ > lib/eventdev/eventdev_pmd.h | 28 +++++++ > lib/eventdev/rte_event_eth_rx_adapter.c | 91 +++++++++++++++++++++- > lib/eventdev/rte_event_eth_rx_adapter.h | 27 +++++++ > lib/eventdev/version.map | 1 + > 5 files changed, 154 insertions(+), 1 deletion(-) > > diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst > index 0780b6f..ce23d8a 100644 > --- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst > +++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst > @@ -146,6 +146,14 @@ if the callback is supported, and the counts maintained by the service function, > if one exists. The service function also maintains a count of cycles for which > it was not able to enqueue to the event device. > > +Getting Adapter queue config > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > + > +The ``rte_event_eth_rx_adapter_queue_conf_get()`` function reports > +flags for handling received packets, event queue identifier, scheduler type, > +event priority, polling frequency of the receive queue and flow identifier > +in struct ``rte_event_eth_rx_adapter_queue_conf``. > + > Interrupt Based Rx Queues > ~~~~~~~~~~~~~~~~~~~~~~~~~~ > > diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h > index 63b3bc4..e69644b 100644 > --- a/lib/eventdev/eventdev_pmd.h > +++ b/lib/eventdev/eventdev_pmd.h > @@ -562,6 +562,32 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t) > int32_t rx_queue_id); > > /** > + * Retrieve Rx adapter queue config information for the specified > + * rx queue ID. > + * > + * @param dev > + * Event device pointer > + * > + * @param eth_dev > + * Ethernet device pointer > + * > + * @param rx_queue_id > + * Ethernet device receive queue index. > + * > + * @param[out] queue_conf > + * Pointer to rte_event_eth_rx_adapter_queue_conf structure > + * > + * @return > + * - 0: Success > + * - <0: Error code on failure. > + */ > +typedef int (*eventdev_eth_rx_adapter_queue_conf_get_t) > + (const struct rte_eventdev *dev, > + const struct rte_eth_dev *eth_dev, > + uint16_t rx_queue_id, > + struct rte_event_eth_rx_adapter_queue_conf *queue_conf); > + > +/** > * Start ethernet Rx adapter. This callback is invoked if > * the caps returned from eventdev_eth_rx_adapter_caps_get(.., eth_port_id) > * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set and Rx queues > @@ -1081,6 +1107,8 @@ struct rte_eventdev_ops { > /**< Add Rx queues to ethernet Rx adapter */ > eventdev_eth_rx_adapter_queue_del_t eth_rx_adapter_queue_del; > /**< Delete Rx queues from ethernet Rx adapter */ > + eventdev_eth_rx_adapter_queue_conf_get_t eth_rx_adapter_queue_conf_get; > + /**< Get Rx adapter queue info */ > eventdev_eth_rx_adapter_start_t eth_rx_adapter_start; > /**< Start ethernet Rx adapter */ > eventdev_eth_rx_adapter_stop_t eth_rx_adapter_stop; > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c > index f2dc695..6cc4210 100644 > --- a/lib/eventdev/rte_event_eth_rx_adapter.c > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c > @@ -40,6 +40,8 @@ > /* Sentinel value to detect initialized file handle */ > #define INIT_FD -1 > > +#define RXA_ADAPTER_ARRAY "rte_event_eth_rx_adapter_array" > + > /* > * Used to store port and queue ID of interrupting Rx queue > */ > @@ -1347,7 +1349,7 @@ rxa_service_func(void *args) > static int > rte_event_eth_rx_adapter_init(void) > { > - const char *name = "rte_event_eth_rx_adapter_array"; > + const char *name = RXA_ADAPTER_ARRAY; > const struct rte_memzone *mz; > unsigned int sz; > > @@ -1370,6 +1372,21 @@ rte_event_eth_rx_adapter_init(void) > return 0; > } > > +static int > +rxa_memzone_lookup(void) > +{ > + const struct rte_memzone *mz; > + > + if (event_eth_rx_adapter == NULL) { > + mz = rte_memzone_lookup(RXA_ADAPTER_ARRAY); Should this be global? There can be different config based on id and dev_id. Right? If so, we need to store memzone per unique space by appending additional items in this base string via sprintf or so. > + if (mz == NULL) > + return -ENOMEM; > + event_eth_rx_adapter = mz->addr; > + } > + > + return 0; > +} > + > static inline struct rte_event_eth_rx_adapter * > rxa_id_to_adapter(uint8_t id) > { > @@ -2631,6 +2648,9 @@ rte_event_eth_rx_adapter_stats_get(uint8_t id, > uint32_t i; > int ret; > > + if (rxa_memzone_lookup()) > + return -ENOMEM; > + > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); > > rx_adapter = rxa_id_to_adapter(id); > @@ -2669,6 +2689,9 @@ rte_event_eth_rx_adapter_stats_reset(uint8_t id) > struct eth_device_info *dev_info; > uint32_t i; > > + if (rxa_memzone_lookup()) > + return -ENOMEM; > + > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); > > rx_adapter = rxa_id_to_adapter(id); > @@ -2694,6 +2717,9 @@ rte_event_eth_rx_adapter_service_id_get(uint8_t id, uint32_t *service_id) > { > struct rte_event_eth_rx_adapter *rx_adapter; > > + if (rxa_memzone_lookup()) > + return -ENOMEM; > + > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); > > rx_adapter = rxa_id_to_adapter(id); > @@ -2750,3 +2776,66 @@ rte_event_eth_rx_adapter_cb_register(uint8_t id, > > return 0; > } > + > +int > +rte_event_eth_rx_adapter_queue_conf_get(uint8_t id, > + uint16_t eth_dev_id, > + uint16_t rx_queue_id, > + struct rte_event_eth_rx_adapter_queue_conf *queue_conf) > +{ > + struct rte_eventdev *dev; > + struct rte_event_eth_rx_adapter *rx_adapter; > + struct eth_device_info *dev_info; > + struct eth_rx_queue_info *queue_info; > + struct rte_event *qi_ev; > + int ret; > + > + if (rxa_memzone_lookup()) > + return -ENOMEM; > + > + RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); > + RTE_ETH_VALID_PORTID_OR_ERR_RET(eth_dev_id, -EINVAL); > + > + if (rx_queue_id >= rte_eth_devices[eth_dev_id].data->nb_rx_queues) { > + RTE_EDEV_LOG_ERR("Invalid rx queue_id %u", rx_queue_id); > + return -EINVAL; > + } > + > + if (queue_conf == NULL) { > + RTE_EDEV_LOG_ERR("Rx queue conf struct cannot be NULL"); > + return -EINVAL; > + } > + > + rx_adapter = rxa_id_to_adapter(id); > + if (rx_adapter == NULL) > + return -EINVAL; > + > + dev_info = &rx_adapter->eth_devices[eth_dev_id]; > + queue_info = &dev_info->rx_queue[rx_queue_id]; > + if (!queue_info->queue_enabled) { > + RTE_EDEV_LOG_ERR("Rx queue %u not added", rx_queue_id); > + return -EINVAL; > + } > + > + qi_ev = (struct rte_event *)&queue_info->event; > + > + memset(queue_conf, 0, sizeof(*queue_conf)); > + queue_conf->rx_queue_flags = 0; > + if (queue_info->flow_id_mask != 0) > + queue_conf->rx_queue_flags |= > + RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID; > + queue_conf->servicing_weight = queue_info->wt; > + > + memcpy(&queue_conf->ev, qi_ev, sizeof(*qi_ev)); > + > + dev = &rte_eventdevs[rx_adapter->eventdev_id]; > + if (dev->dev_ops->eth_rx_adapter_queue_conf_get != NULL) { > + ret = (*dev->dev_ops->eth_rx_adapter_queue_conf_get)(dev, > + &rte_eth_devices[eth_dev_id], > + rx_queue_id, > + queue_conf); > + return ret; > + } > + > + return 0; > +} > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h > index 3f8b362..470543e 100644 > --- a/lib/eventdev/rte_event_eth_rx_adapter.h > +++ b/lib/eventdev/rte_event_eth_rx_adapter.h > @@ -33,6 +33,7 @@ > * - rte_event_eth_rx_adapter_stop() > * - rte_event_eth_rx_adapter_stats_get() > * - rte_event_eth_rx_adapter_stats_reset() > + * - rte_event_eth_rx_adapter_queue_conf_get() > * > * The application creates an ethernet to event adapter using > * rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create() > @@ -545,6 +546,32 @@ int rte_event_eth_rx_adapter_vector_limits_get( > uint8_t dev_id, uint16_t eth_port_id, > struct rte_event_eth_rx_adapter_vector_limits *limits); > > +/** > + * Retrieve Rx queue config information. > + * > + * @param id > + * Adapter identifier. > + > + * @param eth_dev_id > + * Port identifier of Ethernet device. > + > + * @param rx_queue_id > + * Ethernet device receive queue index. > + > + * @param[out] queue_conf > + * Pointer to struct rte_event_eth_rx_adapter_queue_conf > + > + * @return > + * - 0: Success, Receive queue added correctly. > + * - <0: Error code on failure. > + */ > +__rte_experimental > +int rte_event_eth_rx_adapter_queue_conf_get(uint8_t id, > + uint16_t eth_dev_id, > + uint16_t rx_queue_id, > + struct rte_event_eth_rx_adapter_queue_conf *queue_conf); > + > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map > index cd86d2d..9f28016 100644 > --- a/lib/eventdev/version.map > +++ b/lib/eventdev/version.map > @@ -143,6 +143,7 @@ EXPERIMENTAL { > rte_event_vector_pool_create; > rte_event_eth_rx_adapter_vector_limits_get; > __rte_eventdev_trace_crypto_adapter_enqueue; > + rte_event_eth_rx_adapter_queue_conf_get; > }; > > INTERNAL { > -- > 2.6.4 >