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 794A243153 for ; Fri, 13 Oct 2023 09:47:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E5E6402ED; Fri, 13 Oct 2023 09:47:21 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2121.outbound.protection.outlook.com [40.107.243.121]) by mails.dpdk.org (Postfix) with ESMTP id 9ACFD4028C; Fri, 13 Oct 2023 09:47:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EVGaqBgXU6SEHUlVDq/DiOhKepUH4W3VEL8X41wS9Iv0x2cpdIixF+qvkrNsHQE0Dcd7W3vfw0r5yBnhPKZhJhBDTVfEowJWoemIFPcpesFThSk5d8S2x44JonVhankRP/2Itpe89OTs+E2cLz43O0lCwiVBCt4d+SMSh4nyGpM/5wNIAI78hF28cbCDWN1AVisWikDCvxMMYUqhqMG4Y4nh7cZ/5sEhnZcVyXoG6t3o1rwwW15HJk66F08zUaOAI6JrdQOuuwZeDErneL8aeEf++hPED+WrLJgPpGt+oJtoS3MitBrOuNHnHJzvBXdQDiF0tBRuZFLQQfNej2m07g== 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=tg6B++rJ1MhJY1LPDpV5y6yKW4DFxkwNN32efA6Y35w=; b=X1i+d1lUi1bD7H5ZeC55KyiLTBDlVwJYCAyMyr0/XJIYct9HV+LwnYI3aFUC7NnF9iIqX5KZesY5F9U0Zvply7IAcdd63hp/t3tb+C76WgzjukS1vDLKQp0cyi1ZP5qk7DOm2ll+VKvY0yeNc29dtQzPY2VB/BgO0tP7dWfimmFB3/KxflwmdiFbbOONL0AuJy+mBio7jZlN6qAsdG8xjTeWxIHLKJzheRw2QejbF8DDBaxu7il6XGC+Jomc4eHzDzrgwP66/WrXuYhggheH0AUucUcdNCBbntYzxtp2fziYo8Ce8BdARQc4hMQ/d6h4Aa2z1hUbWC9fw9WGxX2G4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tg6B++rJ1MhJY1LPDpV5y6yKW4DFxkwNN32efA6Y35w=; b=vdpYsvm/2gVyQ3tsK6lzihBtN969PLbGeke9B9TKoNnhDDRUxvJWr3POHJoDhI8dQC9Xb2GOp5/llod/gDSC8yuLwZHcp/7SmOIGWvhKbSbGYA9KymmKxth1RHRHCo75U7tt/g4OFD4Ge0UHJ2TTW9tXccrnOKKgiFsl8EGfm8g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by BY5PR13MB4519.namprd13.prod.outlook.com (2603:10b6:a03:1d5::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.46; Fri, 13 Oct 2023 07:47:15 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::2d5:f7d6:ecde:c93a]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::2d5:f7d6:ecde:c93a%4]) with mapi id 15.20.6863.032; Fri, 13 Oct 2023 07:47:15 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Zerun Fu , shihong.wang@corigine.com, stable@dpdk.org, Long Wu , Peng Zhang , Chaoyong He Subject: [PATCH] net/nfp: fix the Tx performance issue Date: Fri, 13 Oct 2023 15:46:53 +0800 Message-Id: <20231013074653.3429-1-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ2PR07CA0006.namprd07.prod.outlook.com (2603:10b6:a03:505::18) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BY5PR13MB4519:EE_ X-MS-Office365-Filtering-Correlation-Id: 5bdb2219-2b66-413b-e847-08dbcbc09e24 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: epLu/p0GII6o7CxdwAQptkD2WwfHLuZnRDRLeEZ6fmgev1O+yfL4oLOZAb9h0binI6CYrQqzbX/rE+xWzgLcbTv/qJr6HWY+vT/lCrCSk69U/O9nj07hiQQ/rgzH5lieWC4Ng18t9zbd5NTOr4aUKIaFe8ynN/tzURnYO++j07lTK+nJnhWflEl0PKGx16zlMOAmNNE0LGr4z557qvUc3wHEma+aRSfC4Rvt0EA2cYKTEBoLKAdTkaZj3SouiujRR4zTuHEHZocaPiAeQWebJ2AW2cHTtlnOj7DhjBFqnHC2B4Ih9R3EgOzFBN2/fuC/UQBjbMv337L9VrgKL49omQBFhIBd0TMf6HnTKymIYvOsPhMI7POaPpH0yLFmFSARrUbCNSCDtrRYkKP+6mHoE3hNo+iqcMc+U1AtucCh8MIRi89Psk3611fXO1YOGtOX1yhFHTCNXC4DBCujZ5IiIYbYdGp9TbPh9tktWPrqVhnpsFsucFRPUVxQ6PIKcXtDpte/pQbDHvngDvNsAdLgLlx+vtKxUyqgL+/ooCSQIyunMdgBA775fbP7pvVoWH8M+xCi8W/0XYffXE0m74z5cXGmKVpXhXcvmmo+tm067G9mUeLQcVMT48sOrj7TqEIXAEU/+4HTCQ+ueUZ0GfHp8yfsV6C3vz5PLb18aZhQ6kw= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39830400003)(136003)(346002)(376002)(366004)(396003)(230922051799003)(451199024)(1800799009)(64100799003)(186009)(36756003)(41300700001)(44832011)(4326008)(8676002)(8936002)(450100002)(5660300002)(6916009)(54906003)(66476007)(66556008)(66946007)(316002)(2906002)(86362001)(83380400001)(6506007)(6512007)(6666004)(2616005)(52116002)(107886003)(26005)(38100700002)(1076003)(38350700002)(478600001)(6486002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?dNWbFrlA5arKAzF47S0mGmEGdNUTSyMwwFG3ZUrIOgsyhjh2ucIlb+JG7QsZ?= =?us-ascii?Q?0HKIYeb1lLgilEsSojQ3RZRwiUyHMpN1aBl5hE6b88WmD1XGeueX6MAWfK23?= =?us-ascii?Q?hoqixlm9RQTw1a/u0Y0hXYJviK4y9Grzc5OrrHGa35eTBO74PI9ezLoT0gvB?= =?us-ascii?Q?YyX8n9UwprGCl34x4tAoj86jBQE2vKRToX6VJagXaoCy/GCeu1FT9ewkWZ6o?= =?us-ascii?Q?Zlyo8ialYKFY9n6yYsNA37onmDxojdxIYq/v3Re9dMRYzFGzennVoKOdPYO4?= =?us-ascii?Q?HkSSnZZZQIbjQHQNGMxre+rh9Mo7hJgdgVxOKvSC8Yn2Gw8yGjvnGuPbG7R9?= =?us-ascii?Q?Dg0ptvks8LPuYJPLpDtSRjXDSactvGLxPWO/HL44IZChvJ5T0WltWL8DUwIX?= =?us-ascii?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xyQeZhaK6nN3adB7ipA+JrMyfWmBN?= =?us-ascii?Q?LaaGJCmVMOkvCFP4VlHI+sAclDKMLlH0VqbL89TuwFHvtlsdJ0op9LNG4Eut?= =?us-ascii?Q?UAq0/pBbKLkD6xJ7K8IybN/0QP77rv6clgBbnOf6na3sbgES0qnOq6+QpTEI?= =?us-ascii?Q?MrU6VaS53K1uhw+dR1vVRjs4iAa/Yvj9TTiQ2IhgGrC6PbgAA3S9RfZCzNYF?= =?us-ascii?Q?ick8wpQBqKv1Lmq/NzXbtomhzY9A9Z/cd6UFS9j0OYPipaLEwjmLR6zIIt2h?= =?us-ascii?Q?79B3BOrM8TYH+S0Nq6D7V4Y4bvyxdeHRpAEcmOt/Jyp6T8Tf5mY6dYtzNIJm?= =?us-ascii?Q?LA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5bdb2219-2b66-413b-e847-08dbcbc09e24 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 07:47:15.3446 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IvN5FPAh4IoCrde+cv0Sx0bpfIo62uQp5KCJ0qH+laRXuechvLdp2KInoaNgwQVmTc8hbuhAi9kCGsFgOGwY4TNAs03Ue4e+6WkY85wzeiE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR13MB4519 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Zerun Fu The former commit imports a register read operation into the data path logic, which will severely degrade performance. Fix this bug by moving the register read logic out of the data path. Read 'cap_extend' only once in the initialisation logic and store it in the data structure. And all other logics that need this value should get it from the data structure. Fixes: 310a1780581e ("net/nfp: support IPsec Rx and Tx offload") Cc: shihong.wang@corigine.com Cc: stable@dpdk.org Signed-off-by: Zerun Fu Reviewed-by: Long Wu Reviewed-by: Peng Zhang Reviewed-by: Chaoyong He --- drivers/net/nfp/nfd3/nfp_nfd3_dp.c | 2 +- drivers/net/nfp/nfdk/nfp_nfdk_dp.c | 2 +- drivers/net/nfp/nfp_common.c | 3 ++- drivers/net/nfp/nfp_common.h | 1 + drivers/net/nfp/nfp_ethdev.c | 2 +- drivers/net/nfp/nfp_ipsec.c | 4 ++-- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c index 64928254d8..8e3199e9b6 100644 --- a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c +++ b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c @@ -153,7 +153,7 @@ nfp_net_nfd3_set_meta_data(struct nfp_net_meta_raw *meta_data, uint8_t ipsec_layer = 0; hw = txq->hw; - cap_extend = nn_cfg_readl(hw, NFP_NET_CFG_CAP_WORD1); + cap_extend = hw->cap_ext; if ((pkt->ol_flags & RTE_MBUF_F_TX_VLAN) != 0 && (hw->ctrl & NFP_NET_CFG_CTRL_TXVLAN_V2) != 0) { diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c index d4bd5edb0a..80b48a3f16 100644 --- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c +++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c @@ -186,7 +186,7 @@ nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt, memset(&meta_data, 0, sizeof(meta_data)); hw = txq->hw; - cap_extend = nn_cfg_readl(hw, NFP_NET_CFG_CAP_WORD1); + cap_extend = hw->cap_ext; if ((pkt->ol_flags & RTE_MBUF_F_TX_VLAN) != 0 && (hw->ctrl & NFP_NET_CFG_CTRL_TXVLAN_V2) != 0) { diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index 5683afc40a..59da28a182 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -1257,7 +1257,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) if (hw->cap & NFP_NET_CFG_CTRL_GATHER) dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_MULTI_SEGS; - cap_extend = nn_cfg_readl(hw, NFP_NET_CFG_CAP_WORD1); + cap_extend = hw->cap_ext; if ((cap_extend & NFP_NET_CFG_CTRL_IPSEC) != 0) { dev_info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_SECURITY; dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_SECURITY; @@ -1348,6 +1348,7 @@ nfp_net_common_init(struct rte_pci_device *pci_dev, /* Get some of the read-only fields from the config BAR */ hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); + hw->cap_ext = nn_cfg_readl(hw, NFP_NET_CFG_CAP_WORD1); hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); hw->flbufsz = DEFAULT_FLBUF_SIZE; diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h index bc3a948231..3c89519195 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -120,6 +120,7 @@ struct nfp_net_hw { struct rte_eth_dev *eth_dev; /* Info from the firmware */ + uint32_t cap_ext; struct nfp_net_fw_ver ver; uint32_t cap; uint32_t max_mtu; diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index ebc5538291..85fcb08bd9 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -137,7 +137,7 @@ nfp_net_start(struct rte_eth_dev *dev) return -EIO; /* Enable packet type offload by extend ctrl word1. */ - cap_extend = nn_cfg_readl(hw, NFP_NET_CFG_CAP_WORD1); + cap_extend = hw->cap_ext; if ((cap_extend & NFP_NET_CFG_CTRL_PKT_TYPE) != 0) ctrl_extend = NFP_NET_CFG_CTRL_PKT_TYPE; diff --git a/drivers/net/nfp/nfp_ipsec.c b/drivers/net/nfp/nfp_ipsec.c index 9edb096a58..a76ba2a91d 100644 --- a/drivers/net/nfp/nfp_ipsec.c +++ b/drivers/net/nfp/nfp_ipsec.c @@ -1382,7 +1382,7 @@ nfp_ipsec_init(struct rte_eth_dev *dev) hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); - cap_extend = nn_cfg_readl(hw, NFP_NET_CFG_CAP_WORD1); + cap_extend = hw->cap_ext; if ((cap_extend & NFP_NET_CFG_CTRL_IPSEC) == 0) { PMD_INIT_LOG(INFO, "Unsupported IPsec extend capability"); return 0; @@ -1429,7 +1429,7 @@ nfp_ipsec_uninit(struct rte_eth_dev *dev) hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); - cap_extend = nn_cfg_readl(hw, NFP_NET_CFG_CAP_WORD1); + cap_extend = hw->cap_ext; if ((cap_extend & NFP_NET_CFG_CTRL_IPSEC) == 0) { PMD_INIT_LOG(INFO, "Unsupported IPsec extend capability"); return; -- 2.39.1