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 97A02A0C41; Tue, 7 Sep 2021 10:12:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1D899410FC; Tue, 7 Sep 2021 10:12:43 +0200 (CEST) Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by mails.dpdk.org (Postfix) with ESMTP id E689C410ED for ; Tue, 7 Sep 2021 10:12:40 +0200 (CEST) Received: by mail-io1-f45.google.com with SMTP id g9so11605443ioq.11 for ; Tue, 07 Sep 2021 01:12:40 -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=VUcWh2yOxqiR3utuYy7Q7hHUaRRkiNTVv3zqTbThEjo=; b=n7YcGHm9RaCGXMZKw0IY89a+xWENg1CMJAF+Z5gJ6TJoIQYE9ccvIDtd2bAxvYFuFq qTD8B2xxewbKuONOERpZxctLTA2uFrBw9NxAB1/esVdqmZfBvfDPvfFQ26SydVic2NeO wCKN2oytQo1rwzu57yYqmMQzsbvCShmY9b/yCe+/noYDgEgX63CLJWhQJYRB/ayQRiIS qSuw6ZmnpLCpq91bilIGCHZddhkpr8IQc79MQ3jF2l2bnV4mQDn4uRzgYcqkLPdwdzld eKGVXw5eShcstDrylzN/u/0niIMb9iXw91nLWjR0REJitnnGa7cASRI6bh8qnVtZojMb noVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VUcWh2yOxqiR3utuYy7Q7hHUaRRkiNTVv3zqTbThEjo=; b=MQeReSIyO+jeBPaKXH4occlUcb8KLitcWqG9DrFh5AUnllRTGG+jOAhWTDlS6E0S5V BrkJMlh4RBoMjR4+nQXCTw8Z4p7qLEQFNIdhOeobj1yWYN2GS+HhzTkaMMOl37PRXETT CIGvDRmMGHMKfRUeO/tkvMk36s56xEfaQi4GnalDHf3GuIIFdIfflDf0GLEDxhva0lpk d4Cijhpc9R9+Wsxoab1Yf8YBa6/N8z7rqoCrrPMlzUiz25dMZhpogf3eA3AuqpwWVjsf giJpNJrZQKCpinXn9qfqFQD2rcDrpB8JgHT+3UikZU7wxVd14kommEXjtToFDvpze3e1 7++Q== X-Gm-Message-State: AOAM531lnrKYhy0g/EXv2duWTMW412u9ll1oqgITR9ju1x9LX95Si/Ls 8PjlGI79YRsyzhpjPlOJfe+/a2ALl8eMoH1o+zw= X-Google-Smtp-Source: ABdhPJyjzp2K9a2I5CDvFHli7X6Aqf71SY+TUg6nqWw2zrrn9ow03mtXmek218HNOubcWWR52krP+Gsh2wiHBmbo6ZU= X-Received: by 2002:a6b:3e84:: with SMTP id l126mr13457452ioa.151.1631002360155; Tue, 07 Sep 2021 01:12:40 -0700 (PDT) MIME-Version: 1.0 References: <20210907053642.4093569-1-ganapati.kundapura@intel.com> <20210907064518.376652-1-ganapati.kundapura@intel.com> In-Reply-To: <20210907064518.376652-1-ganapati.kundapura@intel.com> From: Jerin Jacob Date: Tue, 7 Sep 2021 13:42:13 +0530 Message-ID: To: Ganapati Kundapura Cc: "Jayatheerthan, Jay" , dpdk-dev , Pavan Nikhilesh Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v3 1/3] eventdev: add rx queue info 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" in On Tue, Sep 7, 2021 at 12:15 PM Ganapati Kundapura wrote: > > Added rte_event_eth_rx_adapter_queue_info_get() API to get rx queue > information - event queue identifier, flags for handling received packets, > schedular type, event priority, polling frequency of the receive queue > and flow identifier in rte_event_eth_rx_adapter_queue_info structure > > Signed-off-by: Ganapati Kundapura > > --- > v3: > * Split single patch into implementaion, test and document updation > patches separately Please squash 1/3 and 3/3. > > v2: > * Fixed build issue due to missing entry in version.map > > v1: > * Initial patch with implementaion, test and doc together > --- > lib/eventdev/eventdev_pmd.h | 31 ++++++++++++++ > lib/eventdev/rte_event_eth_rx_adapter.c | 76 +++++++++++++++++++++++++++++++++ > lib/eventdev/rte_event_eth_rx_adapter.h | 71 ++++++++++++++++++++++++++++++ > lib/eventdev/version.map | 1 + > 4 files changed, 179 insertions(+) > > diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h > index 0f724ac..20cc0a7 100644 > --- a/lib/eventdev/eventdev_pmd.h > +++ b/lib/eventdev/eventdev_pmd.h > @@ -561,6 +561,35 @@ typedef int (*eventdev_eth_rx_adapter_queue_del_t) > const struct rte_eth_dev *eth_dev, > int32_t rx_queue_id); > > +struct rte_event_eth_rx_adapter_queue_info; > + > +/** > + * Retrieve information about Rx queue. This callback is invoked if > + * the caps returned from the eventdev_eth_rx_adapter_caps_get(, eth_port_id) > + * has RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT set. It will useful for !RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT case too. > + * > + * @param dev > + * Event device pointer > + * > + * @param eth_dev > + * Ethernet device pointer > + * > + * @param rx_queue_id > + * Ethernet device receive queue index. > + * > + * @param[out] info > + * Pointer to rte_event_eth_rx_adapter_queue_info structure > + * > + * @return > + * - 0: Success > + * - <0: Error code on failure. > + */ > +typedef int (*eventdev_eth_rx_adapter_queue_info_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_info *info); > + > /** > * Start ethernet Rx adapter. This callback is invoked if > * the caps returned from eventdev_eth_rx_adapter_caps_get(.., eth_port_id) > @@ -1107,6 +1136,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_info_get_t eth_rx_adapter_queue_info_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 7c94c73..98184fb 100644 > --- a/lib/eventdev/rte_event_eth_rx_adapter.c > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c > @@ -2811,3 +2811,79 @@ rte_event_eth_rx_adapter_cb_register(uint8_t id, > > return 0; > } > + > +int > +rte_event_eth_rx_adapter_queue_info_get(uint8_t id, uint16_t eth_dev_id, > + uint16_t rx_queue_id, > + struct rte_event_eth_rx_adapter_queue_info *info) > +{ > + struct rte_eventdev *dev; > + struct eth_device_info *dev_info; > + struct rte_event_eth_rx_adapter *rx_adapter; > + struct eth_rx_queue_info *queue_info; > + struct rte_event *qi_ev; > + int ret; > + uint32_t cap; > + > + 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 (info == NULL) { > + RTE_EDEV_LOG_ERR("Rx queue info cannot be NULL"); > + return -EINVAL; > + } > + > + rx_adapter = rxa_id_to_adapter(id); > + if (rx_adapter == NULL) > + return -EINVAL; > + > + dev = &rte_eventdevs[rx_adapter->eventdev_id]; > + ret = rte_event_eth_rx_adapter_caps_get(rx_adapter->eventdev_id, > + eth_dev_id, > + &cap); > + if (ret) { > + RTE_EDEV_LOG_ERR("Failed to get adapter caps edev %" PRIu8 > + "eth port %" PRIu16, id, eth_dev_id); > + return ret; > + } > + > + if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) { > + RTE_FUNC_PTR_OR_ERR_RET( > + *dev->dev_ops->eth_rx_adapter_queue_info_get, > + -ENOTSUP); > + ret = (*dev->dev_ops->eth_rx_adapter_queue_info_get)(dev, > + &rte_eth_devices[eth_dev_id], > + rx_queue_id, > + info); > + return ret; > + } > + > + 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(info, 0, sizeof(*info)); > + info->servicing_weight = queue_info->wt; > + info->event_queue_id = qi_ev->queue_id; > + info->sched_type = qi_ev->sched_type; > + info->priority = qi_ev->priority; > + info->rx_queue_flags = 0; > + if (queue_info->flow_id_mask != 0) { > + info->rx_queue_flags |= > + RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID; > + info->flow_id = qi_ev->flow_id; > + } > + > + return 0; > +} > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h > index 182dd2e..75c0010 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_info_get() > * > * The application creates an ethernet to event adapter using > * rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create() > @@ -140,6 +141,56 @@ typedef int (*rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id, > void *arg); > > /** > + * Rx queue info > + */ > +struct rte_event_eth_rx_adapter_queue_info { Can we avoid the duplication of this structure and use rte_event_eth_rx_adapter_queue_conf instead. API can be rte_event_eth_rx_adapter_queue_conf_get() to align the structure. Also instead of every driver duplicating this code, How about - common code stores the config in rte_event_eth_rx_adapter_queue_add() - common code stores the config in rte_event_eth_rx_adapter_queue_conf_get() - Addtional PMD level API can be given incase, something needs to overridden by Adapter. > + uint32_t rx_queue_flags; > + /**< Flags for handling received packets > + * @see RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID > + */ > + uint16_t servicing_weight; > + /**< Relative polling frequency of ethernet receive queue when the > + * adapter uses a service core function for ethernet to event device > + * transfers. If it is set to zero, the Rx queue is interrupt driven > + * (unless rx queue interrupts are not enabled for the ethernet > + * device). > + */ > + > + uint8_t event_queue_id; > + /**< Targeted event queue identifier for the enqueue or > + * dequeue operation. > + * The value must be in the range of > + * [0, nb_event_queues - 1] which previously supplied to > + * rte_event_dev_configure(). > + */ > + > + uint8_t sched_type; > + /**< Scheduler synchronization type (RTE_SCHED_TYPE_*) > + * associated with flow id on a given event queue > + * for the enqueue and dequeue 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. > + */ > + > + uint32_t flow_id; > + /**< Targeted flow identifier for the enqueue and > + * dequeue operation. > + * The value must be in the range of > + * [0, nb_event_queue_flows - 1] which > + * previously supplied to rte_event_dev_configure(). > + */ > +}; > + > +/** > * Rx queue configuration structure > */ > struct rte_event_eth_rx_adapter_queue_conf { > @@ -575,6 +626,26 @@ int rte_event_eth_rx_adapter_queue_event_vector_config( > uint8_t id, uint16_t eth_dev_id, int32_t rx_queue_id, > struct rte_event_eth_rx_adapter_event_vector_config *config); > > +/** > + * Retrieve information about Rx queue. > + * > + * @param id > + * Adapter identifier. > + * @param eth_dev_id > + * Port identifier of Ethernet device. > + * @param rx_queue_id > + * Ethernet device receive queue index. > + * @param info > + * Pointer to struct rte_event_eth_rx_adapter_queue_info > + * @return > + * - 0: Success, Receive queue added correctly. > + * - <0: Error code on failure. > + */ > +int rte_event_eth_rx_adapter_queue_info_get(uint8_t id, > + uint16_t eth_dev_id, > + uint16_t rx_queue_id, > + struct rte_event_eth_rx_adapter_queue_info *info); > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map > index 8862562..258affd 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_event_eth_rx_adapter_queue_event_vector_config; > + rte_event_eth_rx_adapter_queue_info_get; > __rte_eventdev_trace_crypto_adapter_enqueue; > }; > > -- > 2.6.4 >