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 3499FA0545; Wed, 21 Dec 2022 03:52:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C6EE40698; Wed, 21 Dec 2022 03:52:24 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2057.outbound.protection.outlook.com [40.107.94.57]) by mails.dpdk.org (Postfix) with ESMTP id 762B740684 for ; Wed, 21 Dec 2022 03:52:22 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fpsKIezJRAT+/F7RBE7xASzj+K51EXTTmQc1gJjnoKZq5rZDOl7c5W3NWyTsiQyosBeCWVVgAJqkRmISC3UemVpLvGdDx/qAU6YyK1d9jyh53qC1I+6F2kHvsur08Q2eBUVxXzavfqGXL0uOXg7B1L5ZUmCje8p87ieI4ZgfAOV9Q4VSEYoGcXSn3wd0uEHvcIc35oIhDdTILkHq+kgALpFK/WQWCUtXWr8w2kcHMl0atl4xTn8Unk/RqwqFBv0qDJX2FeHl1c0AIr+p6KvdybzwVIwJZmQyQi5uh4U/P5K6liJUEMzUsgAbRGvTRkwux285uPfR2Hj/iztN5+fR5g== 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=UlONidqNyxvsN2dXXK9vAd4+sZG48TAnAe4CY0NUPAhA83LkFE6g87EubmS/vkNOio9tz0qZ8jd7LktcKRGId1otKREcmdugHkoxZf14X+V3M+1KkGcPzVlQ1LKMwJXxgPLMN8U5h0dzoqoghJ8prKXqba0LjeMLJTVUFwb19IMDI2KPW/jLH2Fbk2mDgg0W+ytyTl+EYkq8E2jcbuOlvQLOYFeKHLiWOZBPK3uPqYqglsk1ftt8nsgmX4M/qlX1cCQuCNFcjgE52XKzmF3NLiSZZniktDwQzhmS1uwRrsZckeUfYKlwr3AtUTCOHtJ/5Zt1aL8Iv9mzICi2UF5iMA== 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=CYqlzu/Cmpta2rJfFa0Si9g4OQvhaGOsbyB079noguuoNWnMU3fLtm46dQgw8cFPXxsnG7uUpcaO0JHOgPpRKJVXckwLzcXoJ8D82URXPNeNkZ797NXCLHtn63EDcpI9Ab8pQAq3RyM+8wYtxbWFZPqQB0ej/pGAJHZ3/do2q9A= Received: from DM6PR05CA0040.namprd05.prod.outlook.com (2603:10b6:5:335::9) by MN2PR12MB4343.namprd12.prod.outlook.com (2603:10b6:208:26f::9) 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:52:20 +0000 Received: from DM6NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:5:335:cafe::bf) by DM6PR05CA0040.outlook.office365.com (2603:10b6:5:335::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.5 via Frontend Transport; Wed, 21 Dec 2022 02:52:19 +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 DM6NAM11FT037.mail.protection.outlook.com (10.13.172.122) 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:52:19 +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:52:17 -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:22:01 +0530 Message-ID: <20221221025202.31733-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: DM6NAM11FT037:EE_|MN2PR12MB4343:EE_ X-MS-Office365-Filtering-Correlation-Id: 56385877-a74f-443a-727c-08dae2fe60a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JExV3oryTXOAgSv8IgxgqhLybP0h7h5pIajTomlXNVia/YXdD+QTIQofUwJMN8H1A8eFArjsNmb+cbcOvRyT7w9OY5EzC0jY0/bdra+xpYajoiaXoVV62X27ef0TJiaWw61c1HcCHBztEFAOSOpjvR0BCQq0HU33p/KbVHwGZGvQfsVJV0M2DoGgNX86wrAdAaIwT7KBAkqAAdXgehj3ulN3UzFDo0uN26vpCIwR7C/FJztB3msTNhc/huZ9LTrgJdTqLf4scl028tkmNE/+1jNr+d/ROt6z7a0pIHtqgWvhDZhkCauG/H6MhaYE7bdW3A1+g09dPh4JYBfB5scVU8NJBhxmxY1xbLZRlgjEHF64FFCMjNfKmtntVdoLYNs8jthxl0oxwxh7p3JsDSs0541o9RVpAbh4Yr8xlMgxKztFA84SPKdqroUmsOR/yF34Ix2aSy42kpW+Q9iRHpy9T0zQCfYzXdb1twqwO1asHf6eCpx+K6KJkC/iMwJlGx6DTUluFFGXsvAKR1Ulx5Mjy8yZiDS3V00ifboCTjNlo21/psSAkHj3rqoUyAmvJhnPqbhAjYWNMtXhh/5nJTG8NbGQ+fUk97WjpWYeWOy5pZfldUEeimMyNxTNtJ7NKZbAHDNrJUx5FR5KWbbt8JPcGaNFU5KZe6wvbem8mg3kxkpygkVpPdIl6c7uHn9kdwuQ6qYRDhvZVGmjfoqOVcZ4bl2snEQNSNY3XKFiVSrbvOU= 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)(346002)(39860400002)(396003)(376002)(136003)(451199015)(46966006)(36840700001)(40470700004)(6666004)(82310400005)(356005)(186003)(7696005)(81166007)(26005)(82740400003)(478600001)(4326008)(336012)(41300700001)(54906003)(36860700001)(103116003)(6916009)(2616005)(8676002)(316002)(40480700001)(16526019)(70586007)(1076003)(70206006)(2906002)(83380400001)(36756003)(8936002)(426003)(40460700003)(47076005)(86362001)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 02:52:19.6329 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 56385877-a74f-443a-727c-08dae2fe60a1 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: DM6NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4343 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