From patchwork Tue Mar 16 20:01:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 89264 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45E00A054F; Tue, 16 Mar 2021 21:02:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CBFF6242A0E; Tue, 16 Mar 2021 21:02:25 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 0EAB9242A07 for ; Tue, 16 Mar 2021 21:02:23 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12GK14M9001317; Tue, 16 Mar 2021 13:02:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=QUDnNKXGMTl16CvvRJdMye5DPBLf7PHBkhJMidz2670=; b=KbrvUfjPsUALJNLZfPfo9KTrpucn6tyY4M12X9vd5A4kRfD/CIC8IljTVf5L8jhNVLgh H/S3T4FoS6MbJYeBl+KamEVu4owANr63/rMcqdK9GKLKEl5gLWKxlGliPBvNSnt6QoVu i6U0jv54rOpVyyevzZZeGSuVDlDTA5eooVMpHJg8kjsfrbDzleOtiSLEDLvG8LtXYOyz qNXyPRWeFPITv9YsUWRItBdlpxvKzImwjJ/CBkKadM+cglXee+ORJv2rURPl19ygjLQ+ J/0ynLEYdHcZuzSpiEDCnptGsEb4Ohqnhsx0x5+Qq5hLIh4tCT+fSiY0bsGcZ+WtAU+/ /A== Received: from dc6wp-exch01.marvell.com ([4.21.29.232]) by mx0b-0016f401.pphosted.com with ESMTP id 378wsqsr5s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 16 Mar 2021 13:02:20 -0700 Received: from DC6WP-EXCH01.marvell.com (10.76.176.21) by DC6WP-EXCH01.marvell.com (10.76.176.21) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 16 Mar 2021 16:02:17 -0400 Received: from maili.marvell.com (10.76.176.51) by DC6WP-EXCH01.marvell.com (10.76.176.21) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 16 Mar 2021 16:02:17 -0400 Received: from BG-LT7430.marvell.com (BG-LT7430.marvell.com [10.28.177.176]) by maili.marvell.com (Postfix) with ESMTP id C37B53F703F; Tue, 16 Mar 2021 13:02:12 -0700 (PDT) From: To: , , , , , , , , , Ray Kinsella , Neil Horman CC: , Pavan Nikhilesh Date: Wed, 17 Mar 2021 01:31:49 +0530 Message-ID: <20210316200156.252-3-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210316200156.252-1-pbhagavatula@marvell.com> References: <20210316154846.1518-1-pbhagavatula@marvell.com> <20210316200156.252-1-pbhagavatula@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-16_07:2021-03-16, 2021-03-16 signatures=0 Subject: [dpdk-dev] [PATCH v3 2/8] eventdev: introduce event vector Rx capability 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" From: Pavan Nikhilesh Introduce event ethernet Rx adapter event vector capability. If an event eth Rx adapter has the capability of RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR then a given Rx queue can be configured to enable event vectorization by passing the flag RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR to rte_event_eth_rx_adapter_queue_conf::rx_queue_flags while configuring Rx adapter through rte_event_eth_rx_adapter_queue_add. The max vector size, vector timeout define the vector size and mempool used for allocating vector event are configured through rte_event_eth_rx_adapter_queue_add. The element size of the element in the vector pool should be equal to sizeof(struct rte_event_vector) + (vector_sz * sizeof(uintptr_t)) Application can use `rte_event_vector_pool_create` to create the vector mempool used for rte_event_eth_rx_adapter_queue_conf::vector_mp. The Rx adapter would be responsible for vectorizing the mbufs based on the flow, the vector limits configured by the application and add the vector event of mbufs to the event queue set via rte_event_eth_rx_adapter_queue_conf::ev::queue_id. It should also mark rte_event_vector::union_valid and fill rte_event_vector::port, rte_event_vector::queue. Signed-off-by: Pavan Nikhilesh --- .../prog_guide/event_ethernet_rx_adapter.rst | 38 ++++++++ .../rte_event_eth_rx_adapter.h | 95 +++++++++++++++++++ lib/librte_eventdev/rte_eventdev.h | 30 +++++- lib/librte_eventdev/version.map | 2 + 4 files changed, 163 insertions(+), 2 deletions(-) diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst index cb44ce0e4..5eefef355 100644 --- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst +++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst @@ -186,3 +186,41 @@ the event buffer fill level is low. The ``rte_event_eth_rx_adapter_cb_register()`` function allow the application to register a callback that selects which packets to enqueue to the event device. + +Rx event vectorization +~~~~~~~~~~~~~~~~~~~~~~ + +The event devices, ethernet device pairs which support the capability +``RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR`` can aggregate packets based on +flow characteristics and generate a ``rte_event`` containing ``rte_event_vector`` +whose event type is either ``RTE_EVENT_TYPE_ETHDEV_VECTOR`` or +``RTE_EVENT_TYPE_ETH_RX_ADAPTER_VECTOR``. +The aggregation size and timeout are configurable at a queue level and the +maximum, minimum vector sizes and timeouts vary based on the device capability +and can be queried using ``rte_event_eth_rx_adapter_vector_limits_get``. +The Rx adapter additionally might include useful data such as ethernet device +port and queue identifier in the ``rte_event_vector::port`` and +``rte_event_vector::queue`` and mark ``rte_event_vector::attr_valid`` as true. + +A loop processing ``rte_event_vector`` containing mbufs is shown below. + +.. code-block:: c + + event = rte_event_dequeue_burst(event_dev, event_port, &event, + 1, 0); + if (!event) + continue; + + switch (ev.event_type) { + case RTE_EVENT_TYPE_ETH_RX_ADAPTER_VECTOR: + case RTE_EVENT_TYPE_ETHDEV_VECTOR: + struct rte_mbufs **mbufs; + + mbufs = (struct rte_mbufs **)ev[i].vec->mbufs; + for (i = 0; i < ev.vec->nb_elem; i++) { + /* Process each mbuf. */ + } + break; + case ... + ... + } diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.h b/lib/librte_eventdev/rte_event_eth_rx_adapter.h index 21bb1e54c..dda846f57 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.h +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.h @@ -92,6 +92,10 @@ extern "C" { /**< This flag indicates the flow identifier is valid * @see rte_event_eth_rx_adapter_queue_conf::rx_queue_flags */ +#define RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR 0x2 +/**< This flag indicates that mbufs arriving on the queue need to be vectorized + * @see rte_event_eth_rx_adapter_queue_conf::rx_queue_flags + */ /** * Adapter configuration structure that the adapter configuration callback @@ -169,6 +173,36 @@ struct rte_event_eth_rx_adapter_queue_conf { */ }; +struct rte_event_eth_rx_adapter_event_vector_config { + uint16_t vector_sz; + /**< + * Indicates the maximum number for mbufs to combine and form a vector. + * Should be within + * @see rte_event_eth_rx_adapter_vector_limits::min_vector_sz + * @see rte_event_eth_rx_adapter_vector_limits::max_vector_sz + * Valid when RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR flag is set in + * @see rte_event_eth_rx_adapter_queue_conf::rx_queue_flags + */ + uint64_t vector_timeout_ns; + /**< + * Indicates the maximum number of nanoseconds to wait for receiving + * mbufs. Should be within vectorization limits of the + * adapter + * @see rte_event_eth_rx_adapter_vector_limits::min_vector_ns + * @see rte_event_eth_rx_adapter_vector_limits::max_vector_ns + * Valid when RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR flag is set in + * @see rte_event_eth_rx_adapter_queue_conf::rx_queue_flags + */ + struct rte_mempool *vector_mp; + /**< + * Indicates the mempool that should be used for allocating + * rte_event_vector container. + * Should be created by using `rte_event_vector_pool_create`. + * Valid when RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR flag is set in + * @see rte_event_eth_rx_adapter_queue_conf::rx_queue_flags. + */ +}; + /** * A structure used to retrieve statistics for an eth rx adapter instance. */ @@ -199,6 +233,22 @@ struct rte_event_eth_rx_adapter_stats { /**< Received packet count for interrupt mode Rx queues */ }; +/** + * A structure used to retrieve eth rx adapter vector limits. + */ +struct rte_event_eth_rx_adapter_vector_limits { + uint16_t min_sz; + /**< Minimum vector limit configurable. */ + uint16_t max_sz; + /**< Maximum vector limit configurable. */ + uint8_t log2_sz; + /**< The size configured should be in log2. */ + uint64_t min_timeout_ns; + /**< Minimum vector timeout configurable. */ + uint64_t max_timeout_ns; + /**< Maximum vector timeout configurable. */ +}; + /** * * Callback function invoked by the SW adapter before it continues @@ -467,6 +517,51 @@ int rte_event_eth_rx_adapter_cb_register(uint8_t id, uint16_t eth_dev_id, rte_event_eth_rx_adapter_cb_fn cb_fn, void *cb_arg); +/** + * Retrieve vector limits for a given event dev and eth dev pair. + * @see rte_event_eth_rx_adapter_vector_limits + * + * @param dev_id + * Event device identifier. + * @param eth_port_id + * Port identifier of the ethernet device. + * @param [out] limits + * A pointer to rte_event_eth_rx_adapter_vector_limits structure that has to + * be filled. + * + * @return + * - 0: Success. + * - <0: Error code on failure. + */ +__rte_experimental +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); + +/** + * Configure event vectorization for a given ethernet device queue, that has + * been added to a event eth Rx adapter. + * + * @param id + * The identifier of the ethernet Rx event adapter. + * + * @param eth_dev_id + * The identifier of the ethernet device. + * + * @param rx_queue_id + * Ethernet device receive queue index. + * If rx_queue_id is -1, then all Rx queues configured for the ethernet device + * are configured with event vectorization. + * + * @return + * - 0: Success, Receive queue configured correctly. + * - <0: Error code on failure. + */ +__rte_experimental +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); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index c0d01c873..e62825e49 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -919,9 +919,27 @@ rte_event_dev_close(uint8_t dev_id); * Event vector structure. */ struct rte_event_vector { - uint64_t nb_elem : 16; + uint16_t nb_elem; /**< Number of elements in this event vector. */ - uint64_t rsvd : 48; + uint16_t rsvd : 15; + uint16_t attr_valid : 1; + /**< Indicates that the below union attributes have valid information. + */ + union { + /* Used by Rx adapter. + * Indicats that all the elements in this vector belong to same + * port and queue pair when originating from Rx adapter, valid + * only when event type is ETHDEV_VECTOR or + * ETH_RX_ADAPTER_VECTOR. + */ + struct { + uint16_t port; + /* Ethernet device port id. */ + uint16_t queue; + /* Ethernet device queue id. */ + }; + }; + /**< Union to hold common attributes of the vector array. */ uint64_t impl_opaque; union { struct rte_mbuf *mbufs[0]; @@ -1019,8 +1037,14 @@ struct rte_event_vector { * // Classify and handle event. * } */ +#define RTE_EVENT_TYPE_ETHDEV_VECTOR \ + (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_ETHDEV) +/**< The event vector generated from ethdev subsystem */ #define RTE_EVENT_TYPE_CPU_VECTOR (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_CPU) /**< The event vector generated from cpu for pipelining. */ +#define RTE_EVENT_TYPE_ETH_RX_ADAPTER_VECTOR \ + (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_ETH_RX_ADAPTER) +/**< The event vector generated from eth Rx adapter. */ #define RTE_EVENT_TYPE_MAX 0x10 /**< Maximum number of event types */ @@ -1163,6 +1187,8 @@ struct rte_event { * @see struct rte_event_eth_rx_adapter_queue_conf::ev * @see struct rte_event_eth_rx_adapter_queue_conf::rx_queue_flags */ +#define RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR 0x8 +/**< Adapter supports event vectorization per ethdev. */ /** * Retrieve the event device's ethdev Rx adapter capabilities for the diff --git a/lib/librte_eventdev/version.map b/lib/librte_eventdev/version.map index a070ef56e..902df0ae3 100644 --- a/lib/librte_eventdev/version.map +++ b/lib/librte_eventdev/version.map @@ -141,6 +141,8 @@ EXPERIMENTAL { #added in 21.05 rte_event_vector_pool_create; + rte_event_eth_rx_adapter_vector_limits_get; + rte_event_eth_rx_adapter_queue_event_vector_config; }; INTERNAL {