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 79C25A0C41; Tue, 19 Oct 2021 17:29:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4EBE04123F; Tue, 19 Oct 2021 17:29:29 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2040.outbound.protection.outlook.com [40.107.100.40]) by mails.dpdk.org (Postfix) with ESMTP id D418A41261 for ; Tue, 19 Oct 2021 17:29:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RaMGVYlp7V4nMt05qbixiay4hkaL/RW9cX5+++fjho9cn/YqgGtD5wldxBQtEGpKy+qwltHORzrfR4bSSKrsYJfRC5+1+IMg7K5sGbbMcssWxsMBRCKY0Q8NPUpkhljCeKMc35upmaj9Z2BJKQNoBIiiwukhP4j7qRzMWoyrS2OtbHxaErZGg6y+db/v7DxaRaP08cW3qdSXf0JMZN8OGUpyC3IX9QQlS5yTL7MGEYC4igK/y6joh4ZnYl56Ndj0PMbMm9oC2D2usXbg5CoLkr9EAyAPYIuTN/HZRYjzb39Rils9EaM7L0daf7N6cKpNkCNsCqwDsumS2juKwchtZw== 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=qq/RawM1EzirQ5td16Dt9W5OgyysI3qdqLulDUsfJ5s=; b=OWnzoS6IDt8L5vXvwtZ9qWcyRP8n6pkeFbAW+4ku5koXxfo71th6BEt16LwF8ImVl2VEuLRV6cBrlZGXCELzPRUrZFKG5TUbZHRHtINtQl/hgll1B4BWCRb8AXkhGUZcWwdtt7yi7lKeVr/AjkL4Yt/sT6Lr/9lt9i1GS1keBUU42SJUsOE3J/2X2BJGraisSTpsVBAEjifvujL9lQxtykwcnyVIBSqmnW/n2MHJVit82a7zKo0sIdPl5eBLo/eq4dBzN+ld8pI0kq1o2UoDoOcbjtqiXQr5LKYXJtMQ9aeC1ZPEgT6j6miJ5Rw3LegeidPTD2siQ53AgqW9lEtYFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=qq/RawM1EzirQ5td16Dt9W5OgyysI3qdqLulDUsfJ5s=; b=n06q0d6XxHE24dJxD/9kf5gUwF5XqinM/0TM8BcTk0Nwkdn0uIHLVRkAd0DMN65H8j+OMF8AXnZMXwki7z5GVVl43gceRfdt8/JoEVhpwNPSTSLzF9AkLZZj+4/r6wMiFaq5ruTfefqkis5Q1adsTVYU/nPIHJAcYG9KUWACj96T0/U4TpK+ucTRqv6kAFAlYBbQ9B476dF/2Hi8U8KBBjzGSuffAmpKUea9h9Lgl6ZJjAwh5W+eLi1kqBKUKQiRcIrAjyEb9eujLJCM1octsPoL0b0E3f8xtVKyVQzcGzskIjbd396F/c18pqUMpOWPtMTWfNBS6Qtv08pK0SshbA== Received: from BN6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:404:65::25) by BY5PR12MB4115.namprd12.prod.outlook.com (2603:10b6:a03:20f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 15:29:26 +0000 Received: from BN8NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:404:65:cafe::22) by BN6PR17CA0015.outlook.office365.com (2603:10b6:404:65::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 15:29:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.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 BN8NAM11FT044.mail.protection.outlook.com (10.13.177.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 15:29:25 +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.18; Tue, 19 Oct 2021 15:29:20 +0000 From: Xueming Li To: , Zhang Yuying CC: , Jerin Jacob , Ferruh Yigit , Andrew Rybchenko , Viacheslav Ovsiienko , Thomas Monjalon , Lior Margalit , "Ananyev Konstantin" , Ajit Khaparde , Xiaoyun Li Date: Tue, 19 Oct 2021 23:28:08 +0800 Message-ID: <20211019152809.2278464-7-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211019152809.2278464-1-xuemingl@nvidia.com> References: <20210727034204.20649-1-xuemingl@nvidia.com> <20211019152809.2278464-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: 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: a37aba3e-edae-4e99-8de2-08d993153bea X-MS-TrafficTypeDiagnostic: BY5PR12MB4115: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: beA3NKtNWpf3XAcCYISZkS+BcaKJx9U+c1yMmoHAinSfIYNlrvPQ3/NJE/2RQ3MSt8S+6WLk89sxCyODtyzmX831xqug9sQMuZE+hNopS62rFx604N9m/rVzJTUox816t3Smd4+MwkNCDK1u16THEqHuRHlKEz5s3kJOmlOJFd4Lttmm2D3LNWuzpoGUO4abnc0H8GByCQVMpssjMwa4yohq+PFXgoBsp28gZ0/ouTomns47cVpoDeVIKNotZ1FM5QBnVWkydaP8yRlS/Xj5RpNaAg14K/7Um5fVZ5adVJEpytSRWEow7lHDCTrI2RsKgwWRkLUUOuFWLTtAdvfpjCR3hh8w+uRxnHpmznVYe31HDC0beD5/qDkwEDeoqGEBW/Gs9ZENkuO5jFqRreRK01r1JyXR1Gca3akTx1hq1xKzGYYAOY40eGxwhTVSlyrqmPej5GqehMFqYT3GCpZqVszpi3GPoel40BR68LkVscUNyqUpuBdMCqJpp1Xq3FAUeiKHiodQ7cIdJhQAxuu85xcZgHN6GUvF+Qp3EEcuqgSWmasxzT2xvLOdX2RIAattXWceAU5akl2ULObhhgKbXf5KH/QkOM3f/8vnr0mqJC+jZkDyPLvM7nNTqZE9JbR6Cfp4WGUan6piprLgO3kVHqBvBXGkMyXAbgx7QiXIFEU2e2KzTfcGhdfzEsLwp6X+K/ykd2p4zpMDjga++hLcpg== 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)(2906002)(83380400001)(426003)(356005)(186003)(6286002)(55016002)(47076005)(36756003)(5660300002)(4326008)(316002)(6666004)(70206006)(1076003)(508600001)(54906003)(70586007)(7636003)(82310400003)(86362001)(36860700001)(8936002)(7696005)(8676002)(36906005)(16526019)(2616005)(26005)(110136005)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 15:29:25.6760 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a37aba3e-edae-4e99-8de2-08d993153bea 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: BN8NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4115 Subject: [dpdk-dev] [PATCH v10 6/7] app/testpmd: force shared Rx queue polled on same core 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" Shared Rx queue must be polled on same core. This patch checks and stops forwarding if shared RxQ being scheduled on multiple cores. It's suggested to use same number of Rx queues and polling cores. Signed-off-by: Xueming Li --- app/test-pmd/config.c | 103 +++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.c | 4 +- app/test-pmd/testpmd.h | 2 + 3 files changed, 108 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index fa951a86704..1f1307178be 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2915,6 +2915,109 @@ port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key, } } +/* + * Check whether a shared rxq scheduled on other lcores. + */ +static bool +fwd_stream_on_other_lcores(uint16_t domain_id, lcoreid_t src_lc, + portid_t src_port, queueid_t src_rxq, + uint32_t share_group, queueid_t share_rxq) +{ + streamid_t sm_id; + streamid_t nb_fs_per_lcore; + lcoreid_t nb_fc; + lcoreid_t lc_id; + struct fwd_stream *fs; + struct rte_port *port; + struct rte_eth_dev_info *dev_info; + struct rte_eth_rxconf *rxq_conf; + + nb_fc = cur_fwd_config.nb_fwd_lcores; + /* Check remaining cores. */ + for (lc_id = src_lc + 1; lc_id < nb_fc; lc_id++) { + sm_id = fwd_lcores[lc_id]->stream_idx; + nb_fs_per_lcore = fwd_lcores[lc_id]->stream_nb; + for (; sm_id < fwd_lcores[lc_id]->stream_idx + nb_fs_per_lcore; + sm_id++) { + fs = fwd_streams[sm_id]; + port = &ports[fs->rx_port]; + dev_info = &port->dev_info; + rxq_conf = &port->rx_conf[fs->rx_queue]; + if ((dev_info->dev_capa & RTE_ETH_DEV_CAPA_RXQ_SHARE) + == 0) + /* Not shared rxq. */ + continue; + if (domain_id != port->dev_info.switch_info.domain_id) + continue; + if (rxq_conf->share_group != share_group) + continue; + if (rxq_conf->share_qid != share_rxq) + continue; + printf("Shared Rx queue group %u queue %hu can't be scheduled on different cores:\n", + share_group, share_rxq); + printf(" lcore %hhu Port %hu queue %hu\n", + src_lc, src_port, src_rxq); + printf(" lcore %hhu Port %hu queue %hu\n", + lc_id, fs->rx_port, fs->rx_queue); + printf("Please use --nb-cores=%hu to limit number of forwarding cores\n", + nb_rxq); + return true; + } + } + return false; +} + +/* + * Check shared rxq configuration. + * + * Shared group must not being scheduled on different core. + */ +bool +pkt_fwd_shared_rxq_check(void) +{ + streamid_t sm_id; + streamid_t nb_fs_per_lcore; + lcoreid_t nb_fc; + lcoreid_t lc_id; + struct fwd_stream *fs; + uint16_t domain_id; + struct rte_port *port; + struct rte_eth_dev_info *dev_info; + struct rte_eth_rxconf *rxq_conf; + + nb_fc = cur_fwd_config.nb_fwd_lcores; + /* + * Check streams on each core, make sure the same switch domain + + * group + queue doesn't get scheduled on other cores. + */ + for (lc_id = 0; lc_id < nb_fc; lc_id++) { + sm_id = fwd_lcores[lc_id]->stream_idx; + nb_fs_per_lcore = fwd_lcores[lc_id]->stream_nb; + for (; sm_id < fwd_lcores[lc_id]->stream_idx + nb_fs_per_lcore; + sm_id++) { + fs = fwd_streams[sm_id]; + /* Update lcore info stream being scheduled. */ + fs->lcore = fwd_lcores[lc_id]; + port = &ports[fs->rx_port]; + dev_info = &port->dev_info; + rxq_conf = &port->rx_conf[fs->rx_queue]; + if ((dev_info->dev_capa & RTE_ETH_DEV_CAPA_RXQ_SHARE) + == 0) + /* Not shared rxq. */ + continue; + /* Check shared rxq not scheduled on remaining cores. */ + domain_id = port->dev_info.switch_info.domain_id; + if (fwd_stream_on_other_lcores(domain_id, lc_id, + fs->rx_port, + fs->rx_queue, + rxq_conf->share_group, + rxq_conf->share_qid)) + return false; + } + } + return true; +} + /* * Setup forwarding configuration for each logical core. */ diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 123142ed110..f3f81ef561f 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2236,10 +2236,12 @@ start_packet_forwarding(int with_tx_first) fwd_config_setup(); + pkt_fwd_config_display(&cur_fwd_config); + if (!pkt_fwd_shared_rxq_check()) + return; if(!no_flush_rx) flush_fwd_rx_queues(); - pkt_fwd_config_display(&cur_fwd_config); rxtx_config_display(); fwd_stats_reset(); diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 3dfaaad94c0..f121a2da90c 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -144,6 +144,7 @@ struct fwd_stream { uint64_t core_cycles; /**< used for RX and TX processing */ struct pkt_burst_stats rx_burst_stats; struct pkt_burst_stats tx_burst_stats; + struct fwd_lcore *lcore; /**< Lcore being scheduled. */ }; /** @@ -795,6 +796,7 @@ void port_summary_header_display(void); void rx_queue_infos_display(portid_t port_idi, uint16_t queue_id); void tx_queue_infos_display(portid_t port_idi, uint16_t queue_id); void fwd_lcores_config_display(void); +bool pkt_fwd_shared_rxq_check(void); void pkt_fwd_config_display(struct fwd_config *cfg); void rxtx_config_display(void); void fwd_config_setup(void); -- 2.33.0