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 D7727A0545; Wed, 21 Dec 2022 03:36:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 79BF740698; Wed, 21 Dec 2022 03:36:13 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2073.outbound.protection.outlook.com [40.107.244.73]) by mails.dpdk.org (Postfix) with ESMTP id BCC7A40684 for ; Wed, 21 Dec 2022 03:36:11 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OfUaCn1+VFUuxZoQEti61s6qTwgcbfjL2bOt7DsAOFPDko7kglf3NdjMKOxbKhSitq9kTrFzjelnGfzpH6hJ6Rxmr0KEhVv1uwxWSIQ/EtHIwT+vkhhuksdUufL5BnocOYWMvqva77D5vOP9ap7rnHe+6ssIcjY6uRmeHkAZmyeNr6+vN8Le9TNhjD28I/01aFO+6AcTAmzBeyDtdbG22BjvhCyIcLJQQcEQkOabb9UcnFGyIyu70GprXbZLGHYlbrwpAn49jHAzeIGLT+VVCMSasMzRlZvtU0l7MKvH09bxuytD2Uzy7GEYK50HJU5WQe3iUjyobTjvgp7dPb40bA== 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=rCXxSjgdKQdWKuPuJDRFEi2bRwqAfFNTtonLp7iHhfY=; b=jVCG81Y44EcK7a0t+QPu3e5+4WySRJJrtMMw96f5U5swwRHax1+4E2oZSHBqSnX51XqREK5AcQH8eRw7UYLO9hkb2gPgitvcmzv8+I0Dt+sokg1o/j5I2Mlkt2quiyXMqwDwmuT3ZiS54gShLGweOQ57MqvGA4dNnlIOs/FPKBhD+Go9eD52TQbpOWeFPTAGcAXDE02AKhuhl1vPaCXEw1S9Kp/mw2U07pU5BzydXDDf9ESTf1O2qF1rnId8iEVofQy7zC8IPNZnRFhxtv7AN3DNVjeBFYxI2SoLR1Ed/hZRjuDJoLvxWwLERmc9M5DW0Tmc06Wi+MN7/RSIUumjuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rCXxSjgdKQdWKuPuJDRFEi2bRwqAfFNTtonLp7iHhfY=; b=PfGCVPElmEfKgD8XRNjsWTAOiRgmyNicPpxjubj5p+Yx0lUq7jSh6SckSKIVTJBJOlysbR2G+1ccAjuAzFjTIMWly9wCQ/WCruBDrhs/rQawcEykA7MqpHM/gT8STTqKDuYlCnYyB82acpNTGv77xT7Xve0oG/eb4KqHqihaprc= Received: from MN2PR02CA0030.namprd02.prod.outlook.com (2603:10b6:208:fc::43) by MN2PR12MB4319.namprd12.prod.outlook.com (2603:10b6:208:1dc::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 02:36:08 +0000 Received: from BL02EPF0000EE3C.namprd05.prod.outlook.com (2603:10b6:208:fc:cafe::29) by MN2PR02CA0030.outlook.office365.com (2603:10b6:208:fc::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Wed, 21 Dec 2022 02:36:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF0000EE3C.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.10 via Frontend Transport; Wed, 21 Dec 2022 02:36:07 +0000 Received: from cae-Bilby-RV1.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 20 Dec 2022 20:36:05 -0600 From: Jesna K E To: CC: , , Jesna K E Subject: [PATCH v1 1/2] net/axgbe: add multi-process support Date: Wed, 21 Dec 2022 08:05:34 +0530 Message-ID: <20221221023535.30547-1-jesna.k.e@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0000EE3C:EE_|MN2PR12MB4319:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e2d6727-6ada-4f1d-b478-08dae2fc1d67 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mCqwMbDEj2lH/zLY4ikBehMzE4qlx1i+19FIaFuaz/4GBTaAP7MpvmstMSIFtgzgjdLE2N+8rx4ezZyFaxS3S0d8jG9rW1ewFySAxpVbeqIZ8w+7CWcaXzavp/bny5DF+PU9jn1XiRhHWjfBH05ao8yPopkl5ncw4afTxiJwcbJLDSFjhNMZWx8EVKQuToZoxfFVmWzjlyOmvpIqmIk/1kXfqTYvFtw83/dHOvLybZV2ZvHEPHsAy4M+TpBbnDTBNNV393VJtUyJRfygrptT2hTn/2kZhk7DZwqTBsHByefzAb8G0KLq75AjcYGaENWyfZr3ZWGMZeO+dD7MFf1bfyExiyK/bPAnTbJD19Tu6kI0VWKAlcH+Fu/Ns841d6RbzEMI572p3TFzoI3vn7m+9svrwH4pwbeXasuSveBXBiKw/mXL0dGqOaAq0wn1Gge4XExYCzVMCV0cZzIMkudL5crRCS6MHvSUqQ9popzsQLvX+TJTaR/ZrTMlWKSJSMaTnC6Jb68k5hg2UkjPig1waHO6EGO0Hou1ux4vPZCZsdrG4T3ghXzYrISTKsqdbdebxIJDIhTldFsvxeGCOU2zrmWHAanx2PUpFhVpVERf0KaMPrpnXHI9lK+SOi5xtw1wcc/vG9FR43QVer1dT8TUU7Sn9XeDhLFAoy6OFRl9j/TdVnB+FeXNoy7iMNKlhF9DZfcolbe+yQ4TPdl1v23btc70hMnGaFJ55dLFAE2SGcc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(136003)(396003)(39860400002)(376002)(346002)(451199015)(36840700001)(46966006)(40470700004)(82740400003)(54906003)(40480700001)(478600001)(6916009)(81166007)(2906002)(5660300002)(316002)(8936002)(86362001)(36756003)(70206006)(40460700003)(4326008)(70586007)(8676002)(83380400001)(426003)(47076005)(26005)(336012)(36860700001)(356005)(41300700001)(2616005)(103116003)(186003)(7696005)(1076003)(16526019)(6666004)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 02:36:07.8849 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1e2d6727-6ada-4f1d-b478-08dae2fc1d67 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0000EE3C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4319 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 Added multi-process support for axgbe PMD To achieve multi-process support separate out TX and RX function inside the axgbe driver and call that from a secondary process when it is attaching to an already-configured NIC Signed-off-by: Jesna K E --- doc/guides/nics/features/axgbe.ini | 1 + drivers/net/axgbe/axgbe_ethdev.c | 65 ++++++++++++++++++++++-------- drivers/net/axgbe/axgbe_rxtx.c | 11 ----- drivers/net/axgbe/axgbe_rxtx.h | 7 +++- 4 files changed, 55 insertions(+), 29 deletions(-) diff --git a/doc/guides/nics/features/axgbe.ini b/doc/guides/nics/features/axgbe.ini index 821bb682d4..5e2d6498e5 100644 --- a/doc/guides/nics/features/axgbe.ini +++ b/doc/guides/nics/features/axgbe.ini @@ -18,6 +18,7 @@ L3 checksum offload = Y L4 checksum offload = Y Basic stats = Y FW version = Y +Multiprocess aware = Y Linux = Y x86-32 = Y x86-64 = Y diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index b071e4e460..4b3d655bd3 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -353,8 +353,6 @@ axgbe_dev_start(struct rte_eth_dev *dev) { struct axgbe_port *pdata = dev->data->dev_private; int ret; - struct rte_eth_dev_data *dev_data = dev->data; - uint16_t max_pkt_len; dev->dev_ops = &axgbe_eth_dev_ops; @@ -388,17 +386,8 @@ axgbe_dev_start(struct rte_eth_dev *dev) rte_bit_relaxed_clear32(AXGBE_STOPPED, &pdata->dev_state); rte_bit_relaxed_clear32(AXGBE_DOWN, &pdata->dev_state); - max_pkt_len = dev_data->mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; - if ((dev_data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_SCATTER) || - max_pkt_len > pdata->rx_buf_size) - dev_data->scattered_rx = 1; - - /* Scatter Rx handling */ - if (dev_data->scattered_rx) - dev->rx_pkt_burst = ð_axgbe_recv_scattered_pkts; - else - dev->rx_pkt_burst = &axgbe_recv_pkts; - + axgbe_set_rx_function(dev); + axgbe_set_tx_function(dev); return 0; } @@ -2145,6 +2134,46 @@ get_pci_rc_devid(void) return (uint16_t)device_id; } +/* Takes ethdev as parameter + * Used in dev_start by primary process and then + * in dev_init by secondary process when attaching to an existing ethdev. + */ +void +axgbe_set_tx_function(struct rte_eth_dev *dev) +{ + struct axgbe_port *pdata = dev->data->dev_private; + struct axgbe_tx_queue *txq = dev->data->tx_queues[0]; + + if (pdata->multi_segs_tx) + dev->tx_pkt_burst = &axgbe_xmit_pkts_seg; +#ifdef RTE_ARCH_X86 + if (!txq->vector_disable && + rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) + dev->tx_pkt_burst = &axgbe_xmit_pkts_vec; +#else + dev->tx_pkt_burst = &axgbe_xmit_pkts; +#endif +} + +void +axgbe_set_rx_function(struct rte_eth_dev *dev) +{ + struct rte_eth_dev_data *dev_data = dev->data; + uint16_t max_pkt_len; + struct axgbe_port *pdata; + + pdata = dev->data->dev_private; + max_pkt_len = dev_data->mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; + if ((dev_data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_SCATTER) || + max_pkt_len > pdata->rx_buf_size) + dev_data->scattered_rx = 1; + /* Scatter Rx handling */ + if (dev_data->scattered_rx) + dev->rx_pkt_burst = ð_axgbe_recv_scattered_pkts; + else + dev->rx_pkt_burst = &axgbe_recv_pkts; +} + /* * It returns 0 on success. */ @@ -2159,17 +2188,20 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) int ret; eth_dev->dev_ops = &axgbe_eth_dev_ops; - eth_dev->rx_descriptor_status = axgbe_dev_rx_descriptor_status; eth_dev->tx_descriptor_status = axgbe_dev_tx_descriptor_status; + eth_dev->tx_pkt_burst = &axgbe_xmit_pkts; + eth_dev->rx_pkt_burst = &axgbe_recv_pkts; /* * For secondary processes, we don't initialise any further as primary * has already done this work. */ - if (rte_eal_process_type() != RTE_PROC_PRIMARY) + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + axgbe_set_tx_function(eth_dev); + axgbe_set_rx_function(eth_dev); return 0; - + } eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; pdata = eth_dev->data->dev_private; @@ -2177,7 +2209,6 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) rte_bit_relaxed_set32(AXGBE_DOWN, &pdata->dev_state); rte_bit_relaxed_set32(AXGBE_STOPPED, &pdata->dev_state); pdata->eth_dev = eth_dev; - pci_dev = RTE_DEV_TO_PCI(eth_dev->device); pdata->pci_dev = pci_dev; diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c index 7cff79e030..9b283bd9d0 100644 --- a/drivers/net/axgbe/axgbe_rxtx.c +++ b/drivers/net/axgbe/axgbe_rxtx.c @@ -629,17 +629,6 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, RTE_ETH_TX_OFFLOAD_MULTI_SEGS)) pdata->multi_segs_tx = true; - if (pdata->multi_segs_tx) - dev->tx_pkt_burst = &axgbe_xmit_pkts_seg; - else if (txq->vector_disable || - rte_vect_get_max_simd_bitwidth() < RTE_VECT_SIMD_128) - dev->tx_pkt_burst = &axgbe_xmit_pkts; - else -#ifdef RTE_ARCH_X86 - dev->tx_pkt_burst = &axgbe_xmit_pkts_vec; -#else - dev->tx_pkt_burst = &axgbe_xmit_pkts; -#endif return 0; } diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h index eeef908ceb..d5660f5c4b 100644 --- a/drivers/net/axgbe/axgbe_rxtx.h +++ b/drivers/net/axgbe/axgbe_rxtx.h @@ -158,7 +158,12 @@ struct axgbe_tx_queue { * RX/TX function prototypes */ - +/* Takes an ethdev and sets up the tx function to be used based on + * the queue parameters. Used in dev_start by primary process and then + * in dev_init by secondary process when attaching to an existing ethdev. + */ +void axgbe_set_tx_function(struct rte_eth_dev *dev); +void axgbe_set_rx_function(struct rte_eth_dev *dev); void axgbe_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t queue_idx); int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, -- 2.25.1