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 21F02A00C2; Wed, 4 Jan 2023 12:46:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12E6B40697; Wed, 4 Jan 2023 12:46:14 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2068.outbound.protection.outlook.com [40.107.243.68]) by mails.dpdk.org (Postfix) with ESMTP id 3FAB74067B for ; Wed, 4 Jan 2023 12:46:12 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cmv+MzmcLBX1DqLtX6GKRWDxX6SPxfZmZEjq3S2UJ0UmgEl1Ucg5hsvxNBWIZadBmTt/4TNHQ54WxichPDr0E0s8FqrD4v+jTxHH4MyxMwbBZZE2iShKyx8BxwUtWrEERFi1lCRnS6Fsr60FSN1LnoLQH3HzvfHLo4WOACRDCb+PffDInN/VcEEsLNVKFMfR2+eW5Lq0Hvn78LffDp8XQ3bWypwc1tfJRLXoiGzZOtCHzzwvtCmcHPrgEwEGzHm/D+Mo2HxUpC/+jaslvi4Ce8izPsVa8XmEWp1lo5VoZLir1Jo414JIBuPryKWZ7rdMhwrYnPcQLwowzLnB+xlh7w== 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=pgMmPT+yfysi566bLvuMRGx1v/w//fr7uv1NVvnwaYs=; b=UwBvWWTTAvAetFND8vcZ2Df0Bp1HVO43JyCnjClNfSXg/880AVnuYnFEdr9+ED2tNMOZeqxAIXSWcR2ATzEWOI07P+UuIqB+hyO94tgK7OcGPbVqpU7JL2rpsR//rG+TivUNImL0/8bKjwauD6skENC+mvlVFcRF8L5rLP4bQADwzDl3uF2mtEBVPQx6D/+hL+Jl3emKCIrQTf7K5Q3uvEHZhI4OuoJ01z0fzU/9rB+O3pfU9dS0TL+tHE+RToeDgznUDyzXTeOYOSk7va4o5/XzvYHgFIL1gRzdMG63pKbXdu3VkG15QUXjS3yqbw0coZ1flM3MzLvzbYugckAK8g== 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=pgMmPT+yfysi566bLvuMRGx1v/w//fr7uv1NVvnwaYs=; b=GUxiAiHdouz0Rf3YA8DKQ22j+4aIdH0sTLiuSyBDFpfCY7rFlYxS1CFfQdKS9MMXdEYZH/JfsOLQxd483cEJNSfVlpDjpqVNZzKB/FGxLpK5v20wJzTPFQIwziP/afzI/dlPwso7WJTS+ijPYieOitCSCp1zJjEOW4k6nqljIHI= Received: from MW4PR03CA0093.namprd03.prod.outlook.com (2603:10b6:303:b7::8) by PH7PR12MB5807.namprd12.prod.outlook.com (2603:10b6:510:1d3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Wed, 4 Jan 2023 11:46:10 +0000 Received: from CO1NAM11FT077.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::da) by MW4PR03CA0093.outlook.office365.com (2603:10b6:303:b7::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.14 via Frontend Transport; Wed, 4 Jan 2023 11:46:10 +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 CO1NAM11FT077.mail.protection.outlook.com (10.13.175.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.16 via Frontend Transport; Wed, 4 Jan 2023 11:46:09 +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; Wed, 4 Jan 2023 05:46:04 -0600 From: Jesna K E To: CC: , , Jesna K E Subject: [PATCH v2] net/axgbe: add multi-process support Date: Wed, 4 Jan 2023 17:15:22 +0530 Message-ID: <20230104114522.34622-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: CO1NAM11FT077:EE_|PH7PR12MB5807:EE_ X-MS-Office365-Filtering-Correlation-Id: 539021b3-2688-4b18-d2ae-08daee494600 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hcbWCnBH+NNqnlPYMvKPnvED0L2GqewE4nK/PwthohoAFNzCy+Ugg0ewwWo30ePRKSf6B4TJKPriHEyVTbIDIHr7nd4/qx93kc+A4+6jrYJ6vm2DhYyqdAe5LL/Yp0FVLM24H//EtMLswDckhlckeAzStTgTvAwtoTNqscs1n0JRJVoqhRsu+w57Q9xB9HVospx2EwGeMmXpFUYLw8ZYwzcVlC6RTtZqyP6LkUi9zXfoRakrnS8Fwjx3rYl5LCBUiTlT9Pmar+iGsOtjFgxMydiRtFAUgH8IYjtAtUQWOAucjrbje21rOF+HFjLsEvIMFFHHqa3/IpL1lLnYpdzAbZHVqTMEHEDfWj3iq6cUtrozg785qAVe0Gu0m4Iaiu0hLlHzsPkU2XNk5niOwIyWhIwB0cW0lanCLf8Kx+LVTNybwAntSFuMQmOkIGqAAOwKbOdiTH3VimABmEQI1uwSiE+KPr7DNZkSh4nrqtta0LuxKOhV7JPKEzH2PXQdG59SXuxl1Y2jf/jdykoEcVuj+OTqTn4VrUsqB39jNuB/XnTnepQElAoIa29AmrqcPzge/kS08N584uyncgCdLxI50Mwj2ayYay1gVMZ1yePZqutLT4Kb4ckluImsEbRETU8KzMzuOyzKvlYAV3qPKFUdmSLNCgc47qo5OTYuWoz0Xs3K5BVZ4ZiceCZbPB+XZLMZHl04RoojtkoOUQJbvFQOW0b6IRl9ZlcFi5iJNrwS5fg= 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)(39860400002)(396003)(376002)(136003)(346002)(451199015)(36840700001)(46966006)(40470700004)(8936002)(4326008)(41300700001)(70586007)(70206006)(8676002)(5660300002)(54906003)(478600001)(6916009)(316002)(2906002)(7696005)(6666004)(1076003)(47076005)(426003)(336012)(86362001)(40480700001)(26005)(186003)(16526019)(83380400001)(2616005)(36756003)(36860700001)(82740400003)(81166007)(356005)(40460700003)(103116003)(82310400005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 11:46:09.9266 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 539021b3-2688-4b18-d2ae-08daee494600 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: CO1NAM11FT077.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5807 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 --- .mailmap | 1 + doc/guides/nics/features/axgbe.ini | 1 + doc/guides/rel_notes/release_23_03.rst | 2 + drivers/net/axgbe/axgbe_ethdev.c | 62 ++++++++++++++++++++------ drivers/net/axgbe/axgbe_rxtx.c | 11 ----- drivers/net/axgbe/axgbe_rxtx.h | 5 +++ 6 files changed, 57 insertions(+), 25 deletions(-) diff --git a/.mailmap b/.mailmap index 75884b6fe2..a153c9ab93 100644 --- a/.mailmap +++ b/.mailmap @@ -581,6 +581,7 @@ Jerome Jutteau Jerry Hao OS Jerry Lilijun Jerry Zhang +Jesna K E Jesper Wramberg Jesse Brandeburg Jesse Bruni 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/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst index b8c5b68d6c..92ec1e4b88 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -55,6 +55,8 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added multi-process support for axgbe PMD.** + Removed Items ------------- diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index b071e4e460..48714eebe6 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,45 @@ get_pci_rc_devid(void) return (uint16_t)device_id; } +/* 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; + + if (pdata->multi_segs_tx) + dev->tx_pkt_burst = &axgbe_xmit_pkts_seg; +#ifdef RTE_ARCH_X86 + struct axgbe_tx_queue *txq = dev->data->tx_queues[0]; + 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. */ @@ -2163,12 +2191,18 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) 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; 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..1dceb76606 100644 --- a/drivers/net/axgbe/axgbe_rxtx.h +++ b/drivers/net/axgbe/axgbe_rxtx.h @@ -158,6 +158,11 @@ struct axgbe_tx_queue { * RX/TX function prototypes */ +/* 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, -- 2.25.1