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 8FCF5A0543; Sat, 27 Aug 2022 14:14:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 35583410D1; Sat, 27 Aug 2022 14:14:38 +0200 (CEST) Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) by mails.dpdk.org (Postfix) with ESMTP id B250940DF7 for ; Sat, 27 Aug 2022 14:14:36 +0200 (CEST) Received: by mail-qk1-f172.google.com with SMTP id f14so3053091qkm.0 for ; Sat, 27 Aug 2022 05:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=+aoW4JXmRzYAHnUsgrpDuTWj0Cwa6l+UDet2ju+6mjc=; b=WMTlC2FFV/Hkcxfa5+MJKeC2TiWIp4AVAceVA/iO20geZP0alSLN6Vy/P6U4VhyaS6 hd5fQrrRl9zAFGKZBHJZbywq8/dAGleFomvLocfgB68Op5/6dcCw/kmydpzQnqcQICaU 2xsQNeTmvRuUIvZvHNRtMTju4Xlj/nsbb+DkxOXAZRnTKtmEG5I0HZnPyfM0pmhIyoGh weGIh1+gMa/fH9WO0k7LrXj84qjeqL514NOjU8rm5andZhdnpQAd/rXwStgJ4+bYlMDu bJHUFoHt7hktJEYP58IFhGzWLj+PU5kHjvD603e26n/6LfUzIIaO3ioD3jyXV1J2bY0z DDzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=+aoW4JXmRzYAHnUsgrpDuTWj0Cwa6l+UDet2ju+6mjc=; b=clD0O+Q+gF7W+zJfqoSQnenqlrizDLoXC6A1cJDiyd7Ajx4m1vvsnHj0kE6rz5aVYj miR6qIUxSRX30e/w9qsPzNhPsGKW/WBjPIWQGRQGUM+xeOUaU3FKDQvdCDkLFi+VKw8P 822qWEl2YEOdr4XCu6zUwiNi3z2VIqRXj0bliz1LJosHxogKM9CtvU5wMjvqAH95BSgE P4u79I9QuLj7b/1kjcpyAxK8oE9Bey9uz6tG5EVXa447SsHWcEBozXwAJ2NvbueTvX3q 0k1B0EQg8NgsMFdVFMe8raBWB4l4Mp5c6ba3BTzOg6SPWdR7eW2EsB1tglvO3xU/V60p MOyA== X-Gm-Message-State: ACgBeo2rTJ2nYcnrtcAo0jdCCJk4DMI3XgktdqBLAvZWZCcBMvPHCXbe DqOFsoXoEXUI3SakFKrdFg+1ruuSoQ5cxjEEyIA= X-Google-Smtp-Source: AA6agR5CH/JQ1NR0FQndu4JnVXjFwWk5JLtZkDV/Cgxlam0X3wnVvTE5tcuPsoHoCbqS8/E9jZEUNEBzF+LzP+CJqIM= X-Received: by 2002:a05:620a:424c:b0:6aa:cdf8:f6f3 with SMTP id w12-20020a05620a424c00b006aacdf8f6f3mr2736741qko.26.1661602476020; Sat, 27 Aug 2022 05:14:36 -0700 (PDT) MIME-Version: 1.0 References: <20220623093036.708448-1-ganapati.kundapura@intel.com> <20220719082538.274845-1-ganapati.kundapura@intel.com> In-Reply-To: From: Jerin Jacob Date: Sat, 27 Aug 2022 17:44:10 +0530 Message-ID: Subject: Re: [PATCH v11 1/7] eventdev/eth_rx: add adapter instance get API To: "Kundapura, Ganapati" Cc: "jerinj@marvell.com" , "Jayatheerthan, Jay" , "Naga Harish K, S V" , "dev@dpdk.org" Content-Type: text/plain; charset="UTF-8" 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 On Thu, Aug 11, 2022 at 6:58 PM Kundapura, Ganapati wrote: > > Hi Jerin, > Could you please review this? Series looks good to me. Some minor comments below. We can merge the next version(v12). 1) Squash 1/7 and 6/7 2) Squash 4/7 and 7/7 3) Please update doc/guides/rel_notes/release_21_11.rst for new the APIs. > > Thanks, > Ganapati > > > -----Original Message----- > > From: Ganapati Kundapura > > Sent: 19 July 2022 13:56 > > To: jerinj@marvell.com; Jayatheerthan, Jay ; > > Naga Harish K, S V ; dev@dpdk.org > > Subject: [PATCH v11 1/7] eventdev/eth_rx: add adapter instance get API > > > > Added rte_event_eth_rx_adapter_instance_get() to get adapter instance id > > for specified ethernet device id and rx queue index. > > > > Signed-off-by: Ganapati Kundapura > > > > Reviewed-by: Naga Harish K S V > > Acked-by: Jay Jayatheerthan > > --- > > v11: > > * added instance_get under 22.11 in version.map > > > > v10: > > * Add Review and Ack to series > > > > v9: > > * Corrected rte_event_eth_tx_adapter_instanceget to > > * rte_event_eth_tx_adapter_instance_get in > > event_ethernet_tx_adapter.rst > > > > v8: > > * Removed limits.h inclusion > > > > v7: > > * Remove allocation of instance array and storage of instnace id > > * in instance array > > * Use Rx adapter instance data to query instance id for specified > > * eth_dev_id and rx_queue_id > > > > v6: > > * rx adapter changes removed from patch4 and moved to patch1 > > > > v5: > > * patch is split into saperate patches > > > > v4: > > * Moved instance array allocation and instance id storage > > before adapter's nb_queue updation for handling the > > error case properly > > > > v3: > > * Fixed checkpatch error > > > > v2: > > * Fixed build issues > > * Added telemetry support for rte_event_eth_rx_adapter_instance_get > > * arranged functions in alphabetical order in version.map > > > > diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h > > index 6940266..c58ba05 100644 > > --- a/lib/eventdev/eventdev_pmd.h > > +++ b/lib/eventdev/eventdev_pmd.h > > @@ -888,6 +888,26 @@ typedef int > > (*eventdev_eth_rx_adapter_vector_limits_get_t)( > > const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev, > > struct rte_event_eth_rx_adapter_vector_limits *limits); > > > > +/** > > + * Get Rx adapter instance id for Rx queue > > + * > > + * @param eth_dev_id > > + * Port identifier of ethernet device > > + * > > + * @param rx_queue_id > > + * Ethernet device Rx queue index > > + * > > + * @param[out] rxa_inst_id > > + * Pointer to Rx adapter instance identifier. > > + * Contains valid Rx adapter instance id when return value is 0 > > + * > > + * @return > > + * - 0: Success > > + * - <0: Error code on failure > > + */ > > +typedef int (*eventdev_eth_rx_adapter_instance_get_t) > > + (uint16_t eth_dev_id, uint16_t rx_queue_id, uint8_t *rxa_inst_id); > > + > > typedef uint32_t rte_event_pmd_selftest_seqn_t; extern int > > rte_event_pmd_selftest_seqn_dynfield_offset; > > > > @@ -1321,6 +1341,8 @@ struct eventdev_ops { > > eventdev_eth_rx_adapter_vector_limits_get_t > > eth_rx_adapter_vector_limits_get; > > /**< Get event vector limits for the Rx adapter */ > > + eventdev_eth_rx_adapter_instance_get_t > > eth_rx_adapter_instance_get; > > + /**< Get Rx adapter instance id for Rx queue */ > > > > eventdev_timer_adapter_caps_get_t timer_adapter_caps_get; > > /**< Get timer adapter capabilities */ diff --git > > a/lib/eventdev/rte_event_eth_rx_adapter.c > > b/lib/eventdev/rte_event_eth_rx_adapter.c > > index bf8741d..ababe13 100644 > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c > > @@ -1415,15 +1415,13 @@ rxa_service_func(void *args) > > return 0; > > } > > > > -static int > > -rte_event_eth_rx_adapter_init(void) > > +static void * > > +rxa_memzone_array_get(const char *name, unsigned int elt_size, int > > +nb_elems) > > { > > - const char *name = RXA_ADAPTER_ARRAY; > > const struct rte_memzone *mz; > > unsigned int sz; > > > > - sz = sizeof(*event_eth_rx_adapter) * > > - RTE_EVENT_ETH_RX_ADAPTER_MAX_INSTANCE; > > + sz = elt_size * nb_elems; > > sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE); > > > > mz = rte_memzone_lookup(name); > > @@ -1431,13 +1429,34 @@ rte_event_eth_rx_adapter_init(void) > > mz = rte_memzone_reserve_aligned(name, sz, > > rte_socket_id(), 0, > > RTE_CACHE_LINE_SIZE); > > if (mz == NULL) { > > - RTE_EDEV_LOG_ERR("failed to reserve memzone err > > = %" > > - PRId32, rte_errno); > > - return -rte_errno; > > + RTE_EDEV_LOG_ERR("failed to reserve memzone" > > + " name = %s, err = %" > > + PRId32, name, rte_errno); > > + return NULL; > > } > > } > > > > - event_eth_rx_adapter = mz->addr; > > + return mz->addr; > > +} > > + > > +static int > > +rte_event_eth_rx_adapter_init(void) > > +{ > > + uint8_t i; > > + > > + if (event_eth_rx_adapter == NULL) { > > + event_eth_rx_adapter = > > + rxa_memzone_array_get(RXA_ADAPTER_ARRAY, > > + sizeof(*event_eth_rx_adapter), > > + > > RTE_EVENT_ETH_RX_ADAPTER_MAX_INSTANCE); > > + if (event_eth_rx_adapter == NULL) > > + return -ENOMEM; > > + > > + for (i = 0; i < > > RTE_EVENT_ETH_RX_ADAPTER_MAX_INSTANCE; i++) > > + event_eth_rx_adapter[i] = NULL; > > + > > + } > > + > > return 0; > > } > > > > @@ -1450,6 +1469,7 @@ rxa_memzone_lookup(void) > > mz = rte_memzone_lookup(RXA_ADAPTER_ARRAY); > > if (mz == NULL) > > return -ENOMEM; > > + > > event_eth_rx_adapter = mz->addr; > > } > > > > @@ -1951,7 +1971,6 @@ rxa_sw_del(struct event_eth_rx_adapter > > *rx_adapter, > > int intrq; > > int sintrq; > > > > - > > if (rx_adapter->nb_queues == 0) > > return; > > > > @@ -2524,6 +2543,9 @@ rte_event_eth_rx_adapter_free(uint8_t id) { > > struct 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); > > @@ -2561,6 +2583,9 @@ rte_event_eth_rx_adapter_queue_add(uint8_t id, > > struct eth_device_info *dev_info; > > struct rte_event_eth_rx_adapter_vector_limits limits; > > > > + 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); > > > > @@ -2726,6 +2751,9 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, > > uint16_t eth_dev_id, > > uint32_t *rx_wrr = NULL; > > int num_intr_vec; > > > > + 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); > > > > @@ -2832,6 +2860,7 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, > > uint16_t eth_dev_id, > > > > rte_eventdev_trace_eth_rx_adapter_queue_del(id, eth_dev_id, > > rx_queue_id, ret); > > + > > return ret; > > } > > > > @@ -3286,6 +3315,97 @@ > > rte_event_eth_rx_adapter_queue_conf_get(uint8_t id, > > return 0; > > } > > > > +static int > > +rxa_is_queue_added(struct event_eth_rx_adapter *rx_adapter, > > + uint16_t eth_dev_id, > > + uint16_t rx_queue_id) > > +{ > > + struct eth_device_info *dev_info; > > + struct eth_rx_queue_info *queue_info; > > + > > + if (!rx_adapter->eth_devices) > > + return 0; > > + > > + dev_info = &rx_adapter->eth_devices[eth_dev_id]; > > + if (!dev_info || !dev_info->rx_queue) > > + return 0; > > + > > + queue_info = &dev_info->rx_queue[rx_queue_id]; > > + > > + return queue_info && queue_info->queue_enabled; } > > + > > +#define rxa_evdev(rx_adapter) > > +(&rte_eventdevs[(rx_adapter)->eventdev_id]) > > + > > +#define rxa_dev_instance_get(rx_adapter) \ > > + rxa_evdev((rx_adapter))->dev_ops- > > >eth_rx_adapter_instance_get > > + > > +int > > +rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id, > > + uint16_t rx_queue_id, > > + uint8_t *rxa_inst_id) > > +{ > > + uint8_t id; > > + int ret = -EINVAL; > > + uint32_t caps; > > + struct event_eth_rx_adapter *rx_adapter; > > + > > + if (rxa_memzone_lookup()) > > + return -ENOMEM; > > + > > + if (eth_dev_id >= rte_eth_dev_count_avail()) { > > + RTE_EDEV_LOG_ERR("Invalid ethernet port id %u", > > eth_dev_id); > > + return -EINVAL; > > + } > > + > > + if (rx_queue_id >= rte_eth_devices[eth_dev_id].data- > > >nb_rx_queues) { > > + RTE_EDEV_LOG_ERR("Invalid Rx queue %u", rx_queue_id); > > + return -EINVAL; > > + } > > + > > + if (rxa_inst_id == NULL) { > > + RTE_EDEV_LOG_ERR("rxa_inst_id cannot be NULL"); > > + return -EINVAL; > > + } > > + > > + /* Iterate through all adapter instances */ > > + for (id = 0; id < RTE_EVENT_ETH_RX_ADAPTER_MAX_INSTANCE; > > id++) { > > + rx_adapter = rxa_id_to_adapter(id); > > + if (!rx_adapter) > > + continue; > > + > > + if (rxa_is_queue_added(rx_adapter, eth_dev_id, > > rx_queue_id)) { > > + *rxa_inst_id = rx_adapter->id; > > + ret = 0; > > + } > > + > > + /* Rx adapter internally mainatains queue information > > + * for both internal port and DPDK service port. > > + * Eventdev PMD callback is called for future proof only and > > + * overrides the above return value if defined. > > + */ > > + caps = 0; > > + if (!rte_event_eth_rx_adapter_caps_get(rx_adapter- > > >eventdev_id, > > + eth_dev_id, > > + &caps)) { > > + if (caps & > > RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) { > > + ret = rxa_dev_instance_get(rx_adapter) ? > > + > > rxa_dev_instance_get(rx_adapter) > > + (eth_dev_id, > > + rx_queue_id, > > + rxa_inst_id) > > + : -EINVAL; > > + } > > + } > > + > > + /* return if entry found */ > > + if (ret == 0) > > + return ret; > > + } > > + > > + return -EINVAL; > > +} > > + > > #define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_u64(d, #s, stats.s) > > > > static int > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h > > b/lib/eventdev/rte_event_eth_rx_adapter.h > > index 3608a7b..a3313c8 100644 > > --- a/lib/eventdev/rte_event_eth_rx_adapter.h > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.h > > @@ -38,6 +38,7 @@ > > * - rte_event_eth_rx_adapter_queue_stats_get() > > * - rte_event_eth_rx_adapter_queue_stats_reset() > > * - rte_event_eth_rx_adapter_event_port_get() > > + * - rte_event_eth_rx_adapter_instance_get() > > * > > * The application creates an ethernet to event adapter using > > * rte_event_eth_rx_adapter_create_ext() or > > rte_event_eth_rx_adapter_create() @@ -704,6 +705,29 @@ > > __rte_experimental int > > rte_event_eth_rx_adapter_event_port_get(uint8_t id, uint8_t > > *event_port_id); > > > > +/** > > + * Get RX adapter instance ID for a RX queue > > + * > > + * @param eth_dev_id > > + * Port identifier of Ethernet device. > > + * > > + * @param rx_queue_id > > + * Ethernet device receive queue index. > > + * > > + * @param[out] rxa_inst_id > > + * Pointer to store RX adapter instance identifier. > > + * Contains valid Rx adapter instance id when return value is 0 > > + * > > + * @return > > + * - 0: Success > > + * - <0: Error code on failure > > + */ > > +__rte_experimental > > +int > > +rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id, > > + uint16_t rx_queue_id, > > + uint8_t *rxa_inst_id); > > + > > #ifdef __cplusplus > > } > > #endif > > diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map index > > 886e2ec..da07a23 100644 > > --- a/lib/eventdev/version.map > > +++ b/lib/eventdev/version.map > > @@ -112,6 +112,9 @@ EXPERIMENTAL { > > # added in 22.07 > > rte_event_port_quiesce; > > rte_event_queue_attr_set; > > + > > + # added in 22.11 > > + rte_event_eth_rx_adapter_instance_get; > > }; > > > > INTERNAL { > > -- > > 2.6.4 >