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 45148A0C46; Fri, 17 Sep 2021 10:02:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E977410E3; Fri, 17 Sep 2021 10:02:22 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2040.outbound.protection.outlook.com [40.107.93.40]) by mails.dpdk.org (Postfix) with ESMTP id D38BB40689 for ; Fri, 17 Sep 2021 10:02:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y1ZoxHWbfXPGAxZOj4nXJXuEmceRSDVC5niJlioit70I3EhhaP5nYdufi003Wh0o2vNyomyP6Plo3BLf5koDJGlFa16FocXT8jhowKVO8rYD3jWOyFt3vkL9MYDxWFUhHzlFRISx+lHrgEner2tWrAMS7wikZzR2eMWcJvDAUtSlFcULbqFyfbTLT3yXQ/wM7FA4aVxud0wWJF9cFli2HHgoTZT0F6iU4VV0t79tgovoE5kzLaxHmUiZ4oCUMCOBXeeetZ7BKDKSZLLBrz3Rb6712EsOkXUNRBptpH1phOMYP7uQvM7yRWqcNi5lPI/IFhYTYKOqDOmNFrMfQ10qBQ== 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; bh=ujYISd6LMaPdHaABRFLGx7XBnrsrKjZYRFWztMn3K+s=; b=IN9uWJN0qSK+VCgQSKnFC/3C8q8lIIdh/nawPIM3KsYE+UwTqe2vLMMuzKURxgcYkTW79ZBt7G/kok8NU5s+gyX7C6Xa6b13GeMjXY9cjf+bAK1f7nP0Oi6s0DfyDvYjJivqDXHNPwJWng4mM4Uub/PQTW8o/cyMjsh5lPJzWC4JSW4sF/Sxz8Si8b0sgHFY4IWfS765ia6g/v7qeA+mQICgZbRfA2Sxq89UAu7uB+YmSZIdmris7aoLnHbMim6g16lDljD/W9dq9ANae63uHe3Jyd3Dy85sELXKSoLX4KdLayYn+VCaiSH0AktT3uWuXE9xm72VWYO9LSvrTEZajg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) smtp.rcpttodomain=intel.com 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=ujYISd6LMaPdHaABRFLGx7XBnrsrKjZYRFWztMn3K+s=; b=E5jeZKp+O6YbzLzq++sGh4PzE+Sh3gE5SGCAwWDNBxbmFxTDARzEtI1W6RTveKSLs/EgClkLKNHElEmcGINiYpVpU4WTd3767trTO3wXSHTYTxhDP7Fyd5Ddkuf4uqFj6swDyaLX/jnaDrHhLxJZS22tG/0Im469EAnpEmRWNe1JgAwLYVBwrONK7XcBhgoqUbeH/LZB5RyXJSOOfM8GK26IFHtpXFIgDvUqC7mG+Xg/mkriKxn0HdYxmzwmF2ODJlipQuWuST7JN/PkiKAo04eTU4kM8+HMc+/FaPBDjH6vxOoTMTE5/jUW464qqmO4PVBgGfGBo4kD3VW/X8Q9xw== Received: from DM5PR2001CA0014.namprd20.prod.outlook.com (2603:10b6:4:16::24) by BN6PR1201MB2465.namprd12.prod.outlook.com (2603:10b6:404:a6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Fri, 17 Sep 2021 08:02:19 +0000 Received: from DM6NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:4:16:cafe::9b) by DM5PR2001CA0014.outlook.office365.com (2603:10b6:4:16::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Fri, 17 Sep 2021 08:02:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.36) by DM6NAM11FT031.mail.protection.outlook.com (10.13.172.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4523.14 via Frontend Transport; Fri, 17 Sep 2021 08:02:19 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 17 Sep 2021 08:02:18 +0000 Received: from nvidia.com (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 17 Sep 2021 08:02:16 +0000 From: Xueming Li To: CC: , Jerin Jacob , Ferruh Yigit , Andrew Rybchenko , Viacheslav Ovsiienko , Thomas Monjalon , Lior Margalit Date: Fri, 17 Sep 2021 16:01:14 +0800 Message-ID: <20210917080121.329373-2-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210917080121.329373-1-xuemingl@nvidia.com> References: <20210727034204.20649-1-xuemingl@nvidia.com> <20210917080121.329373-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: HQMAIL101.nvidia.com (172.20.187.10) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3a5f0ffb-b20d-47a1-56e2-08d979b178bb X-MS-TrafficTypeDiagnostic: BN6PR1201MB2465: 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: UMZWGZz11wqSYkgRnkubHj1F3Z4dhmm6UnJLD2Ca5vZHbiZ5votJqB9RwfW/xFrkTCFsL8gdj1VHUq+KPL5mtHcp6v8Lk4UFFieeyK7MX0TqJqV0pPwuTCjo13+Br2IqeuzwthfqTrHTvTeLTAhlg7Rwou5AQRH7H4z+j8+FoI/oKM41qvMy85LDM/RvILclJ7KDK+BnNwhRBR+zmDwQicwOoYLah2MXdXPZ1p/Mw+rh0D25Ayn6kCaBXFd1zpQuiYHFH/mZwZCWQbW0xm9/uqDGnMQlwzN3eFlkPDxtAIRqyn6friW4LTwl6mruakCxVyPexEP+eOR/GRfAbeXgEIrOu0e/tVM0cF3H2b/SVYxBSiPKT5h1VxhxwDMLXViIG9NKnNlU37wur2UxwgeOjmVDI6lgAbUgcj3NA3hfZe26g0RuXgEPYQOV6l2D7XVPMNCQymZRa20l2pBIfZm9udHjIOVoQWpl8knUZ7eSd4PC+9CqXAmIGGhT0Ran1BBdVizPGTMkVgluCDw86G61qv3uGAcdIbno/KryZklWJgbZjq4eRbZG18roL9a2pWKqaONO20U6zv/KwslMczvP+YEfMqSJWMPt37Bsf87L+XH64JIHsWrw1igA+jWERe4zz+6BWsqtqupR4cKSXVk0as/LUGwdza+2jkI6WGZcHKNYcYoDGaX+AO4DyU9Mvu7tp228fpZsoSyECbKNpMNkQ7ZcPsSW+PE/UlV1vAz8LjkQAh9pqlsN7tZzzX9iRLDMCSFYcV+3XmZqLfBRigBeejdPmhVU76qWYI2sGb09Wx+JvJV4XUw2+esNb0k5o2jk2RoufGdztnoU5SkBj96nzQ== X-Forefront-Antispam-Report: CIP:216.228.112.36; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid05.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(376002)(346002)(39860400002)(136003)(46966006)(36840700001)(316002)(83380400001)(54906003)(6286002)(82310400003)(2906002)(4326008)(36906005)(7696005)(186003)(5660300002)(7636003)(82740400003)(70586007)(16526019)(336012)(6916009)(86362001)(1076003)(107886003)(2616005)(36860700001)(8936002)(36756003)(55016002)(8676002)(426003)(47076005)(966005)(478600001)(70206006)(356005)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2021 08:02:19.0092 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a5f0ffb-b20d-47a1-56e2-08d979b178bb 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.36]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB2465 Subject: [dpdk-dev] [PATCH v3 1/8] 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 a7c090ce79..b3a58d5e65 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.33.0