From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9492AC433EF for ; Mon, 11 Oct 2021 12:38:35 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 315A560C49 for ; Mon, 11 Oct 2021 12:38:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 315A560C49 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9BB88410E1; Mon, 11 Oct 2021 14:38:34 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2068.outbound.protection.outlook.com [40.107.237.68]) by mails.dpdk.org (Postfix) with ESMTP id 49F60410E1 for ; Mon, 11 Oct 2021 14:38:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fvfYj1pccWlXDHdhCNdLGB40bzMRZBwxp9PBZ79k7ngQcyZ1AnZ6vB+XV2ikFKngY0ctpEAn3o3W3ygC9i4cREB4HFqjk9UqMbRRd6KWaQaewiXo3DfWuiITRBnAjMxEW8UVUBqK/EAUY+LwFHu7sjCrx6el/F1fTc4ExLu/0KbusWF0NChj27gwdZQ5QEO5fZkpzkrdRy+kB831lCbUhIu/lNSwQ/fOnvKMOK3Eul4QgjzhGhg+4guVlATRAYfIaWZYtjOKT36aJwH/1pYlpII9yZUfxQHm9EU65AUNcwiz1mvTGx64EFbkMQ7mv5U4N7+pt75Kl5alaItjgjqjiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bvWfbTADmqYZRIl6Pbj7YNYwa9Rpps76lIYdhCRal/s=; b=jIx75WKIKn9s9Z4pvcNOij1iS/jZMa6rJ6TlNpuDML1MBJj24DhhfE+5lhmFPpu4UWMkqM9ed5sZzLTrpzTxXwFwBQ/fzZopS8mXewJ9JiyU8zOIQkrLA/C+ytliIezvC3n2lR2qjMRS+ygj8ycdY/kaJReIoXbMA7ZJo6XoYudCFbRJb8uTlYrxtnrSewCaTun4p6C3+KAW0E4If38yt4NtqSbSw8S2PtP1uuHbxBn9ZDyY0Ne2AAKGiuI71YXzq1ZGCvOPyznn8AacnCfN7OE0Toy+9RaVTNXG0rvx+OQbV0vEm4K1IDvdsyNwVuSlU0L4K/+92jGQLbq/ReU8nA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=temperror (sender ip is 216.228.112.34) smtp.rcpttodomain=oktetlabs.ru smtp.mailfrom=nvidia.com; dmarc=temperror action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bvWfbTADmqYZRIl6Pbj7YNYwa9Rpps76lIYdhCRal/s=; b=NuWtF/B7hyUaD+y+7PgBCJcEGzpIG1dWxM3VjkL9mLh78xoIEd400cAwBiq+KVPtMplbuWmzB6J78M+ddWxTWyX6Yuor6UIZUyOtKzQ470/zS2RcYm7JcTvlZpnly8GfOr4aW1G8kI74jbkaikrhiDX/HuOchzmE1W9kZhQeyPihkl6Scbgx67fRNHllQ2uNxnT8M/Xd3k60GAf4CoUURDWjZKV+slZdakTdMtVRP6AfBi+kMLdtzdfx6E8pW8EXDU+ICPI/Q1L3mM17WxQgJmbzRtfKquC+fls3pthdYvC3AKmenKejG0Wha9CNnSfbIEzlEXMW+5vGoY4bx8xZeA== Received: from DM3PR12CA0134.namprd12.prod.outlook.com (2603:10b6:0:51::30) by DM6PR12MB4265.namprd12.prod.outlook.com (2603:10b6:5:211::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.20; Mon, 11 Oct 2021 12:38:30 +0000 Received: from DM6NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:0:51:cafe::9f) by DM3PR12CA0134.outlook.office365.com (2603:10b6:0:51::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Mon, 11 Oct 2021 12:38:30 +0000 X-MS-Exchange-Authentication-Results: spf=temperror (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; oktetlabs.ru; dkim=none (message not signed) header.d=none;oktetlabs.ru; dmarc=temperror action=none header.from=nvidia.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of nvidia.com: DNS Timeout) Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT052.mail.protection.outlook.com (10.13.172.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4587.18 via Frontend Transport; Mon, 11 Oct 2021 12:38:29 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 11 Oct 2021 12:38:26 +0000 From: Xueming Li To: CC: , Jerin Jacob , Ferruh Yigit , Andrew Rybchenko , Viacheslav Ovsiienko , Thomas Monjalon , Lior Margalit , "Ananyev Konstantin" Date: Mon, 11 Oct 2021 20:37:28 +0800 Message-ID: <20211011123733.961222-2-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211011123733.961222-1-xuemingl@nvidia.com> References: <20210727034204.20649-1-xuemingl@nvidia.com> <20211011123733.961222-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 011ee322-33d7-46e7-6ccb-08d98cb4076a X-MS-TrafficTypeDiagnostic: DM6PR12MB4265: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lXcGr5BRQgYebj4gPCQBnCHUrhenVs0PbKlNSzLSEIb4unGjpXtI8nnkVA5Jhe5PyqqbaGT8agp9XHZVDq+dWOixwIQVOgp/ke/oZmY08FPwZQUGpsFSMZU9Vp1Ne/gjc2MSB3twyDr9yfJaO2Qseb3oeOou2RXoZ+NlsgEmM8fchIQlh9SV6Xzzcgu3rTeWw8lGd9q44JqvdFkhAEwMQ4CuorT7ajETFBf2Ayyiq2sdsHzeHBkJcLvRcN+CH6kAhbl+0aE64PUhhIP9lPpNzz7csl+Yv2+zRLfkCthM4munXgkDAkO+YxArbzwxxJZ9dJk6uiDr/LN7p4zZcOFZIdM7e+28bu0fRb0lZy6nuajMXP4KyWcmZSrlrchGIprIo2ILFMMIzkGou+ptvEicHmgoIlCQ32jsl9uwQTsmfuljCpzO38LoT3nPy0t0xF5g5s33mkAG7aOop+ibotNhheNW6mIlVugcB3bTbwjrirnb8Kdj6Jpkjog+SMOUeLNMsaPhnGCS0vpqX+5C2EeiJ2ubqG7GIgpey6303BKocY8+pWJlh5fVjo9f7/eN9VB951jafgk+C+R+X9N4hwZTQgWpuTfS7cW8J9QDw3x0DJoFCFqUfnnBkAEy9+5dL8mgIkbWwh4t3B6GZNanY37jL0jM/ItoZuoOrGnZn/Ag+zZ3fssqEMVW4sO9dHS+MjyB1R8DjgJ/RFuXXZrJryGrq7H3yrxaKMzKMh/VzFbFHV6Jdci3DWUnDfb3Rz88kLlHRSYnhQLmkL2eBTFzxgMk/0bFU6vG4FW6nt7qXhH1wGuPEkycmXJCZL7vm57OTR7PeTa+VXJNHlgnFY7/BeV2+w== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(86362001)(2616005)(7636003)(63350400001)(7696005)(356005)(4326008)(8936002)(63370400001)(6916009)(1076003)(82310400003)(83380400001)(55016002)(70586007)(316002)(70206006)(508600001)(966005)(36756003)(2906002)(16526019)(336012)(47076005)(6286002)(36860700001)(8676002)(54906003)(5660300002)(26005)(426003)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2021 12:38:29.4964 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 011ee322-33d7-46e7-6ccb-08d98cb4076a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT052.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4265 Subject: [dpdk-dev] [PATCH v5 1/5] ethdev: introduce shared Rx queue 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 current DPDK framework, each Rx queue is pre-loaded with mbufs for incoming packets. For some PMDs, when number of representors scale out in a switch domain, the memory consumption became significant. Polling all ports also leads to high cache miss, high latency and low throughput. This patch introduce shared Rx queue. Ports with same configuration in a switch domain could share Rx queue set by specifying sharing group. Polling any queue using same shared Rx queue receives packets from all member ports. Source port is identified by mbuf->port. Port queue number in a shared group should be identical. Queue index is 1:1 mapped in shared group. Share Rx queue must be polled on single thread or core. Multiple groups are supported by group ID. Example grouping and polling model to reflect service priority: Group0, 2 shared Rx queues per port: PF, rep0, rep1 Group1, 1 shared Rx queue per port: rep2, rep3, ... rep127 Core0: poll PF queue0 Core1: poll PF queue1 Core2: poll rep2 queue0 Signed-off-by: Xueming Li Cc: Jerin Jacob --- Rx queue object could be used as shared Rx queue object, it's important to clear all queue control callback api that using queue object: https://mails.dpdk.org/archives/dev/2021-July/215574.html --- doc/guides/nics/features.rst | 11 +++++++++++ doc/guides/nics/features/default.ini | 1 + doc/guides/prog_guide/switch_representation.rst | 10 ++++++++++ doc/guides/rel_notes/release_21_11.rst | 4 ++++ lib/ethdev/rte_ethdev.c | 1 + lib/ethdev/rte_ethdev.h | 7 +++++++ 6 files changed, 34 insertions(+) diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index 4fce8cd1c97..69bc1d5719c 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -626,6 +626,17 @@ Supports inner packet L4 checksum. ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_OUTER_UDP_CKSUM``. +.. _nic_features_shared_rx_queue: + +Shared Rx queue +--------------- + +Supports shared Rx queue for ports in same switch domain. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_SHARED_RXQ``. +* **[provides] mbuf**: ``mbuf.port``. + + .. _nic_features_packet_type_parsing: Packet type parsing diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini index 754184ddd4d..ebeb4c18512 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -19,6 +19,7 @@ Free Tx mbuf on demand = Queue start/stop = Runtime Rx queue setup = Runtime Tx queue setup = +Shared Rx queue = Burst mode info = Power mgmt address monitor = MTU update = diff --git a/doc/guides/prog_guide/switch_representation.rst b/doc/guides/prog_guide/switch_representation.rst index ff6aa91c806..47205f5f1cc 100644 --- a/doc/guides/prog_guide/switch_representation.rst +++ b/doc/guides/prog_guide/switch_representation.rst @@ -123,6 +123,16 @@ thought as a software "patch panel" front-end for applications. .. [1] `Ethernet switch device driver model (switchdev) `_ +- For some PMDs, memory usage of representors is huge when number of + representor grows, mbufs are allocated for each descriptor of Rx queue. + Polling large number of ports brings more CPU load, cache miss and + latency. Shared Rx queue can be used to share Rx queue between PF and + representors among same switch. ``RTE_ETH_RX_OFFLOAD_SHARED_RXQ`` is + present in Rx offloading capability of device info. Setting the + offloading flag in device Rx mode or Rx queue configuration to enable + shared Rx queue. Polling any member port of the shared Rx queue can return + packets of all ports in the group, port ID is saved in ``mbuf.port``. + Basic SR-IOV ------------ diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index c0a7f755189..aa6b5e2e9c5 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -134,6 +134,10 @@ New Features * Added tests to validate packets hard expiry. * Added tests to verify tunnel header verification in IPsec inbound. +* **Added ethdev shared Rx queue support. ** + + * Added new Rx queue offloading capability flag. + * Added share group to Rx queue configuration. Removed Items ------------- diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index fb69f6ea8d1..d78b50e1fa7 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -127,6 +127,7 @@ static const struct { RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM), RTE_RX_OFFLOAD_BIT2STR(RSS_HASH), RTE_ETH_RX_OFFLOAD_BIT2STR(BUFFER_SPLIT), + RTE_ETH_RX_OFFLOAD_BIT2STR(SHARED_RXQ), }; #undef RTE_RX_OFFLOAD_BIT2STR diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 39d2cd612cb..b94f7ba5a3f 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1077,6 +1077,7 @@ struct rte_eth_rxconf { uint8_t rx_drop_en; /**< Drop packets if no descriptors are available. */ uint8_t rx_deferred_start; /**< Do not start queue with rte_eth_dev_start(). */ uint16_t rx_nseg; /**< Number of descriptions in rx_seg array. */ + uint32_t shared_group; /**< Shared port group index in switch domain. */ /** * Per-queue Rx offloads to be set using DEV_RX_OFFLOAD_* flags. * Only offloads set on rx_queue_offload_capa or rx_offload_capa @@ -1403,6 +1404,12 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_OUTER_UDP_CKSUM 0x00040000 #define DEV_RX_OFFLOAD_RSS_HASH 0x00080000 #define RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT 0x00100000 +/** + * Rx queue is shared among ports in same switch domain to save memory, + * avoid polling each port. Any port in the group can be used to receive + * packets. Real source port number saved in mbuf->port field. + */ +#define RTE_ETH_RX_OFFLOAD_SHARED_RXQ 0x00200000 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \ -- 2.33.0