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 14E2FA00C2; Wed, 4 Jan 2023 08:43:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 05F0A40A82; Wed, 4 Jan 2023 08:43:07 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id 17B9940697 for ; Wed, 4 Jan 2023 08:43:05 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EY9+Lw/aiIl0vUs4C96LZied3RXmuXa+fvg2Z7eLGi2AcvowE+pCw5WKkZJti5viDaTDG6OgXPCU5C0VkKtwZVyVrpL1mnBifWwWqxdmB9MwkbFM4bLBdjqw8gFOECWCgfQJJBo2iQQsikDcuurn0cj6T1BNOKPzzDiy6FqrMe5JfiKbINzK0l5fmTtrLqp4o35FUJ/zr4mZgXYgv4EVSLa58wMx9XgJ9OEjk3MgFM1znY5mfjDC6KprKwG68i6sn2K+rAmM6DtDQHewNG/kn0Wka9+j8PxZk+/EVzEvTA2aUYF30jsHWV04CKTdOEfe4uLRBu4xuCuK5dexEOUE5w== 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=RAMS31OkFKsclAsb9OUOh1dEb6s0Y/f75ayOAxcfP70=; b=WNWo71/V5nSEM3gIo4QK0ajzFtw+VY2cg7YMlpjyS9fvyW1OhkHSkbZTvqc9fg2SRQujWbAXvhtOLNpH5pwQLL26Uc1qUsT2+BPAoDmAie/fs5Z5HnQl9/vClvl0nl8w8LsvsPzbfUaWg0P2ls0pEnPPUA8nKRZi1EmO0aHae3g0I15YyeyQ8r/PnUPOnxxzIKLZHG7Q74J2YZDCsAXZSoSlMS9rA/T3BCa+/h+7zGXwaguRAHtH9+BH1olJMoLE1Vqbs+RfvbFRHBaioI72Y9C+1vmGMFOJLIeZTtcLPSaPDtW6X/ENQFEsyegWhSeRzXVDWjibfQNgXTAHaITEFw== 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=RAMS31OkFKsclAsb9OUOh1dEb6s0Y/f75ayOAxcfP70=; b=XGbou0+rINaLDj1OR0EGkjzEUy89+BmV7wdmW6GPT6Qvx7T2uq8AO0qpQhOUTT95ZUdTvPFLwin1HjzbLdkopChSIoVMGkT4CZsR68RQ3/EgMR7VWnx29P/lHC5JeQRJMuObG3pVdZTJm1jGccA8WmT04ytJeg1HRSlEhDIfq34= Received: from DM6PR04CA0017.namprd04.prod.outlook.com (2603:10b6:5:334::22) by SN7PR12MB6864.namprd12.prod.outlook.com (2603:10b6:806:263::10) 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 07:43:03 +0000 Received: from DM6NAM11FT069.eop-nam11.prod.protection.outlook.com (2603:10b6:5:334:cafe::40) by DM6PR04CA0017.outlook.office365.com (2603:10b6:5:334::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Wed, 4 Jan 2023 07:43:03 +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 DM6NAM11FT069.mail.protection.outlook.com (10.13.173.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5966.17 via Frontend Transport; Wed, 4 Jan 2023 07:43:02 +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 01:42:58 -0600 From: Jesna K E To: CC: , , Jesna K E Subject: [PATCH v1 1/2] net/axgbe: add multi-process support Date: Wed, 4 Jan 2023 13:12:40 +0530 Message-ID: <20230104074241.33445-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: DM6NAM11FT069:EE_|SN7PR12MB6864:EE_ X-MS-Office365-Filtering-Correlation-Id: c297f9b6-f4cd-438c-a9a9-08daee274f71 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /uFyotU0juvW+WcinrFLb7nNw+JViDfmHJBsBZ7j5zuq+PQTib8UEMO9JwNyFapiVqYkiGnBOw4p9X7yNcsmrJ61H4hIMQeMEsT/eEVIktVEZJdS78riDz1vKm7clEIXj+byWQRrE7XK44dI5KRcxBe68+p0BX0bracVkgWZS8z+B75lvSI09Q6hH3mNgRV0zCarWUh/AAsApd0ZzYm5VGqRtDN25CiI+HUJcbCOdloRUuiw3cFDAYqB2lLcqoJKftCFPy1nc/br18oo6vv/sbk1Z0YQkfPP6L+22lr97ccD0ZFG9pCeIZl/HSqul+dT7QHA+K9OOQaw/IfFR0w/TlVwYlvyApxktONvXmI1qy48+3ePW9hT+BUs/PIl/J+lNRtap0VnJV2+yvyGCMpplS5UqEKMvb5R2xX6V2RCsOtfg5jc8Zi+hzXWoDttqOnvJUn7EaFb13VhknNj5FmzfvsaE33SygdPxle+LKcgZJP92v9PqUrCLj/rlOSd/W/ErVAWyXl4HW8+9PuBP1fiWO2k932B1nXjeeY91aLhR+++J6z6UO6HrNwqOoP8Z0yN8EfJldGPgRwyupz3JPNiLoL2niQAPudZVqNpyJ5VKjvTHnQ7yWBsu0jre4IvLoGwuc4+S3Py5eLeJcSg1qqyuz6V+oGLKtEVyQNChFyHMb7l2RqjkUmIoN78yQC6Oed4w7ZDnABdv68h1zkpNqVKUJ69g9ge7qeFta9e3OEzAYQ= 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)(376002)(346002)(39860400002)(451199015)(46966006)(40470700004)(36840700001)(6666004)(36756003)(478600001)(36860700001)(82310400005)(336012)(86362001)(40480700001)(82740400003)(356005)(81166007)(40460700003)(426003)(16526019)(47076005)(26005)(1076003)(186003)(2616005)(103116003)(7696005)(83380400001)(5660300002)(70586007)(4326008)(8676002)(70206006)(8936002)(41300700001)(316002)(54906003)(2906002)(6916009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2023 07:43:02.9393 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c297f9b6-f4cd-438c-a9a9-08daee274f71 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: DM6NAM11FT069.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6864 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 | 8 ++++ drivers/net/axgbe/axgbe_ethdev.c | 65 +++++++++++++++++++------- drivers/net/axgbe/axgbe_rxtx.c | 11 ----- drivers/net/axgbe/axgbe_rxtx.h | 6 +++ 6 files changed, 65 insertions(+), 27 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..17e5862c04 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -55,6 +55,14 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **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 + + Added new API functions ``axgbe_set_rx_function()``, + and ``axgbe_set_tx_function()`` to support multi-process. Removed Items ------------- diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index b071e4e460..57dead3adc 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; + + 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. */ @@ -2159,19 +2188,23 @@ 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; /* initial state */ rte_bit_relaxed_set32(AXGBE_DOWN, &pdata->dev_state); 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..a904939de3 100644 --- a/drivers/net/axgbe/axgbe_rxtx.h +++ b/drivers/net/axgbe/axgbe_rxtx.h @@ -158,6 +158,12 @@ struct axgbe_tx_queue { * RX/TX function prototypes */ +/* Takes an 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); +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