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 14329A0C47; Wed, 11 Aug 2021 16:04:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9AAB740C35; Wed, 11 Aug 2021 16:04:51 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2051.outbound.protection.outlook.com [40.107.243.51]) by mails.dpdk.org (Postfix) with ESMTP id 9B15E40042 for ; Wed, 11 Aug 2021 16:04:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aOdaq5vFgGW+5LP5MjLW9FtPqotd3zdYG50ELolpPgzlUfwlRNuYCnDWz8Z95o5BQQzImy+qa0U6jLGO2HslyAZ/Ct3m92Xg2wSNBjdbZNLBGiESXpqkSTHS447Zs+QsbAv6lNRzV45EgN8RaldTi+vLVe7IGIaIutxBfHLJxsVaAGzmHfvamGN3Q77ZMCE4ZvZ+7EnkmgDrbsCq1XwyetrCuSbYUivoJHkOXXqSh8FAJstYN028fjL+LRMQRmbfm6D5Y8A/h1wBLJDVE2JipdXpVzht0dtcXvklstA7Q3BT/9VQXWj13K2DflSPRLnizrffHYnPFVeJUdFyq8+6gg== 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-SenderADCheck; bh=PkQYlx+vtUnNZgrMujHY5rwqL4uPEeMrmSoHy5Ok0jk=; b=KuDx2ThZOsKMymgVJVTW7c53sjHY7kB0UzQ+O+EI2Bh4yXAYxj3//vM0bFsu5UZ9ZMCuN9r0PUMSDGft5PE6gH6SCJ0GzZK2wIy9TpJrMaijjj+jYG3JV35Wx2Klc1rWnSJcDmPLuutWhiLUdr2Z8zKhcqedgtbHT+TpdhcwjASrHNtRi3MnHACjm+gYYIjaGD3jjQ5mOvH3tQSU9JeZSVllrAt73+86eemN8tkh9JrNusF0UV2XgKyUZGr4N0QVBhoFd78zyYPodiDUHg+owIbeSAHyDQBTuEv1dwOmVbH29hUvR5oeOpa3CoOaGItuqZ7rx2wPl1/dhOqgKdxiIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) 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=PkQYlx+vtUnNZgrMujHY5rwqL4uPEeMrmSoHy5Ok0jk=; b=LJd9QWAx2WTwF/LpXyViJ7LOEt9C66KV9/MVlfH7EvjphqO2v3s/IvBAbcYQGuoFHkuiRy9dfQgB/K9XtUK6t6iCGnizVHU9j3Rir8ABr3VuQZJgTHY48QIOu9dQbnHyfyeeX6j7lkQulpzLNsJ+zfY0U9jW3gvvK1M8SccESQJT3xr9kS/Ph3xD4Up72fx85TlbCpLfeI+QBsx3c4FT/b4UXuXTBMPxpjrDVmfEyBPEERCp+N/+DoB3Ir31hqMVOyr22U/0VWUBIG2lV6VNb/Asg/x4V8sKpNt3ADFBD0ZN+WCjGguMOZC2ddhtnBtWMBgxhDzHVPmrtAU/vs8khw== Received: from DM5PR07CA0139.namprd07.prod.outlook.com (2603:10b6:3:13e::29) by MN2PR12MB4048.namprd12.prod.outlook.com (2603:10b6:208:1d5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.21; Wed, 11 Aug 2021 14:04:47 +0000 Received: from DM6NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:3:13e:cafe::24) by DM5PR07CA0139.outlook.office365.com (2603:10b6:3:13e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.13 via Frontend Transport; Wed, 11 Aug 2021 14:04:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT015.mail.protection.outlook.com (10.13.172.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4415.16 via Frontend Transport; Wed, 11 Aug 2021 14:04:47 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 11 Aug 2021 14:04:45 +0000 From: Xueming Li To: CC: , , Jerin Jacob , Ferruh Yigit , "Thomas Monjalon" , Andrew Rybchenko Date: Wed, 11 Aug 2021 17:04:03 +0300 Message-ID: <20210811140418.393264-1-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210727034204.20649-1-xuemingl@nvidia.com> References: <20210727034204.20649-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23d88f49-da04-43a8-06e2-08d95cd0fa65 X-MS-TrafficTypeDiagnostic: MN2PR12MB4048: 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: dp/AOPqgFFAs40/OrsJ+9WIpyaSihAIbt2+4y2plpb3ZsLkGsu9EBM0DMQBcdU0GCoRiiyc+J5NwjRCAK6fVkqEMvYKAf8QaR/nqhPBrpfWS7tvH7LKp7bmc6j85ulMfKYpTmvXVWFC9dolkxH9ylhXXz44soKWlfnx83VuR4fIOGwwTu4UMAx2fUXxp0PId5MuJ9/rWyWtWu3MVYof1uR+YZdJ7QUCLCNfyVGgBGkUM7ciLtcCnX90XEaU9JM5YWEYZLBgFGnlIaseHbIg7asYZ7iyaPvKKWciB3FVq2tz5vOgHVyINXgwe/osd5+IJ0L0KwE6QveJybNQVxdX7qFYHM+gLoH3E0nwASaOBLweeWul5NtggQTyvrHYrRX16EDVslh7AP8L+wADwaBA+wTfx3U7xBDKlwpUVu6bGtbYtAFCej7Fkk96hemSJDCXs4/3r8UVfH9k9LMPP+NiCQIAgfdGhlCyZVhlvkW8JOKw3kbJMRynPKKoINFrcqHyi7DdLNzvbncbdUisauxSgm0ImNTk/jh7D7MRHatussSdHDn3USUwYTbHS8+Ek+ZSp6VFwSt0NTXaC3zPRsacpZLNLv3boNF2ZqbTxVyRNgV475WcwBq/OiG1QAOv4yoPqlMxvy4xcAPDodl6n1XnB6gstykF2+YTetyjSkZMsnwyJCYt7VJx8MwC0YEl1dVFOqvRhRE2ji++NJ4JqapqS5ySFMhWyHZSByWfnITUp+EsVhv1uFr8FsYCSEx37oZelq7vwQpsOvzo/Cpm3YkGOvdvDDwu8mMAae9yIvj50gT29A9Y/G2Thj8YxEQPrfiFtzB95amfo6WoFgScsh8rBJg== 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)(136003)(396003)(39860400002)(346002)(376002)(36840700001)(46966006)(83380400001)(2906002)(336012)(36906005)(82310400003)(7696005)(36756003)(316002)(6286002)(47076005)(26005)(2616005)(966005)(1076003)(55016002)(5660300002)(478600001)(6666004)(7636003)(70206006)(8676002)(4326008)(426003)(82740400003)(356005)(186003)(16526019)(54906003)(70586007)(36860700001)(109986005)(86362001)(8936002)(266003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2021 14:04:47.1534 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23d88f49-da04-43a8-06e2-08d95cd0fa65 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: DM6NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4048 Subject: [dpdk-dev] [PATCH v2 01/15] 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. When number of representors scale out in a switch domain, the memory consumption became significant. Most important, polling all ports leads to high cache miss, high latency and low throughput. This patch introduces 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 is supported by group ID. 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 ++++++++++ lib/ethdev/rte_ethdev.c | 1 + lib/ethdev/rte_ethdev.h | 7 +++++++ 5 files changed, 30 insertions(+) diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index a96e12d155..2e2a9b1554 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -624,6 +624,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 754184ddd4..ebeb4c1851 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 ff6aa91c80..45bf5a3a10 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) `_ +- Memory usage of representors is huge when number of representor grows, + because PMD always allocate mbuf for each descriptor of Rx queue. + Polling the 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 in same switch domain. ``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 shared Rx queue can return + packets of all ports in group, port ID is saved in ``mbuf.port``. + Basic SR-IOV ------------ diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 193f0d8295..058f5c88d9 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 d2b27c351f..a578c9db9d 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1047,6 +1047,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 @@ -1373,6 +1374,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 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.25.1