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 6F2B441CE5 for ; Mon, 20 Feb 2023 10:03:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A5A042FBA; Mon, 20 Feb 2023 10:03:17 +0100 (CET) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2090.outbound.protection.outlook.com [40.107.95.90]) by mails.dpdk.org (Postfix) with ESMTP id 7F39A40395; Mon, 20 Feb 2023 10:03:15 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P4FVGz4Ox0Ct4xjdVqnJLUQ+qXVm9I1gdJnrTq3BRr+eSOc/gK0L4d4cz2pbjYXRJYYJSsFLfCkRjZSpECo4B6oym/RFcZYYAWyb7WFLjaaClFt4C4pyMdTwQsodi7nl589//5OW7Y1HAOb6wQlR/kNLUT7upKTpHvpRJjxZgsHrL3aIMeV0t6219Ekx8DnuesxJB/dHUfyOfYpX/u23AKJMr1h+B2IMYes+ZjOfL3rntdX2RRSp0KWpyOhimx6pJ0SOGDExPqzkoURPtudjMxWylQDk9/sPxSquXUsaIZcqiEVUez6L70mmLqIa3l9GI1OI/lsxFqJcbbkOSkiVtw== 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=c0l1d/5GQVkXiGY7tuS6jLRlyUZ7L7AWIXRVUO0qlRY=; b=dt6P8kZGZJbff5bdChrRDaaewE8cq6p256H1MJd7qrpOMepyV0DoyTkp61R7n5LE7ZWM+ukCDabN9WCJP4nx+rxQIXPXTGNR7k7O8KQ+h2Q0Z6KrEqPr1rPe4Ir8YYM1/2OBBYW4fc7xjdhs2jtQEt5SV6kscsm9FuDHKGUHsjDR1uIGpAFoZGr/wklnDXg38lE1BfGZvlnAIRLxNb8QfTIHLrIXDZ7toxZSjhiJLDo18bTsPLYB9b+I+03xFTueIP0gbIfeC/3kuQ3h1vduCflXVdQCObsDjNuRVGCGjOdLjdV6eYdYTiLbgQApbdJH2rWuO47h0I4Mquzz+jFzlQ== 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=c0l1d/5GQVkXiGY7tuS6jLRlyUZ7L7AWIXRVUO0qlRY=; b=A1qVZb6SPL77AUpWqc1+byQ9BOw4EZAbTIy+W6yc0lzg2gaWc/MZz0Zt3T8DjYU1j8X4bWb66omzL4b7gN0aUExOUs4nX7hSaI1URDk+xh2dLTJxqyKAKZ2EmBz0dmtPBOIH66JXIS1GzpSfzUKtSnwLl7xwaKjBohPaF9T3vgY= 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 SJ0PR13MB6051.namprd13.prod.outlook.com (2603:10b6:a03:4e6::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.20; Mon, 20 Feb 2023 09:03:13 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d%5]) with mapi id 15.20.6111.018; Mon, 20 Feb 2023 09:03:13 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Peng Zhang , jin.liu@corigine.com, stable@dpdk.org, Chaoyong He Subject: [PATCH v2] net/nfp: fix 48-bit DMA address support for NFDk Date: Mon, 20 Feb 2023 17:02:54 +0800 Message-Id: <20230220090254.10641-1-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20230208091544.22122-1-chaoyong.he@corigine.com> References: <20230208091544.22122-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SGXP274CA0019.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::31) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SJ0PR13MB6051:EE_ X-MS-Office365-Filtering-Correlation-Id: dbd9b7ca-9440-4eb6-4a35-08db13214be3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vhteE18CtdfJ/cJo84KEqOGoRq+CFXWs3Bw1TA0DmEFQwL16fGzQBbJHlPF3ITluFWteJkjfyRgr0u9VwhT1++Gg7YivVYKj6ySctFSi1lT8VXwrBcSvahYirigIPH481T3uUBC4HtTyX+St+01BgeVGpGuSizDG2u/xaumK/JJuToFddSS+yeo3Tnyqz2YRHE0QIh6/WcQiaiKLpLvJDQ8UZemFOL/njJikT12NMCQ1wVIrl5ZGPn3leZkDqcrO0Oy5+4sm8ApgIMwmGeU8yZrkEflfvxOiCokWByAeqczdYbYBlDxNE9cqHUdh6oCiOm7bIJqEzw3oupBxkI+Sgy4lPEeVsyQaUVhoQFp7dxQnrKyZqDXQmOA69KPYYT221+TbbAS8UEE/lIymUylOryIREDK/G8xIZgIq7grnek+gYmKi8bqMlclxuxCq4oXznLlKWjmotO4InOvWWx1Vsrb9JQvTtevxrbDmVQJPtQkqnFre7ELXtP9MJX97xIa49S3JlGi9JHDu1IJDCORWYv3ZtVCS4mbWpDF9Z6lNDKAqX0d+DjALrH921nC60a8Jnar9jD2gkFPRfXnHluGeaPxLC6b5iFYRb8v6NvSJOaZXO6UYSP0VkMDc70ROerPDr9QJFqBDhQXdUG1dKVXVRXlJArfsJXJr+aRLmWQ401ffY5e01m2RK6q0JdgDH4O7 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:(13230025)(4636009)(376002)(366004)(346002)(396003)(136003)(39840400004)(451199018)(2906002)(186003)(26005)(107886003)(44832011)(5660300002)(6666004)(1076003)(66574015)(6512007)(6506007)(86362001)(450100002)(66476007)(66556008)(8676002)(6916009)(4326008)(66946007)(41300700001)(54906003)(38350700002)(38100700002)(2616005)(316002)(6486002)(83380400001)(478600001)(8936002)(52116002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UmM3aTdRNVF0dHhnTlZsaDRwNm01QjFOSWpSdWZkSHluc1haUmkwa3JCczZn?= =?utf-8?B?ZXNQN3hPcy9xdjFDUEJSeUhRMWk3ak01MEs2NkJOTzFvekMyM240eWhadlNV?= =?utf-8?B?YVdjU1VuN1F5U3NPOGQyUEdORWcwdk9vNTFMd2FDeU4wdE5udzNtZVpGMTZr?= =?utf-8?B?RG5iWE95cFk5ZGpoc2w0bCtpQkpVV3h4TnUwRVgyZldtL3VhUzc3MmxQdEpa?= =?utf-8?B?bjhLQW1DSFMwNnBZVFcrZVNLUTJuTUVITVB5ZVMxRHFhc29ScDgwSkVmb0lq?= =?utf-8?B?T2llWVNRSVZ5ZENSbFhMdEF2V0YvSklYazNIdVo0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WDFqWVBlK1N6akVVYW1OZ1NCRTkyKytU?= =?utf-8?B?UUE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbd9b7ca-9440-4eb6-4a35-08db13214be3 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2023 09:03:13.3904 (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: o5WMwZooXYex2riKgh7XJdymcRL5j2/QN4hoEJu4UeNob7KTrAMee4R396joOvJVkijopvAgyVnW8VpqVI9rNoQXy+ZgoKUpxV+sVhsDLFA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR13MB6051 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: Peng Zhang Initializing of the NFP PMD fails when a NFDk device is used in a PCIe slot that supports 48-bit DMA address. The failure is due to an incorrect check by the PMD that limits the support to 40-bit DMA address. While this check is correct for NFD3 devices, it is incorrect for NFDk that can support 48-bit DMA address. Fix this by correcting the DMA mask check at initialization to allow for different DMA address masks for NFD3 and NFDk. The RX free list descriptor code is also updated to allow for 48-bit DMA address. While this code is shared by the NFD3 and NFDk code paths, this is not an issue as for 40-bit address the top bits are always 0. Fixes: c73dced48c8c ("net/nfp: add NFDk Tx") Cc: jin.liu@corigine.com Cc: stable@dpdk.org Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Niklas Söderlund --- v2: * Rewrite the commit message. --- drivers/net/nfp/flower/nfp_flower.c | 12 ++++-------- drivers/net/nfp/flower/nfp_flower_ctrl.c | 2 +- drivers/net/nfp/nfp_common.c | 18 ++++++++++++++++++ drivers/net/nfp/nfp_common.h | 1 + drivers/net/nfp/nfp_ethdev.c | 11 +++-------- drivers/net/nfp/nfp_ethdev_vf.c | 11 +++-------- drivers/net/nfp/nfp_rxtx.c | 4 ++-- drivers/net/nfp/nfp_rxtx.h | 4 ++-- 8 files changed, 34 insertions(+), 29 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index f1424a010d..11bf277f42 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -452,7 +452,7 @@ nfp_flower_pf_recv_pkts(void *rx_queue, rxds->vals[1] = 0; dma_addr = rte_cpu_to_le_64(RTE_MBUF_DMA_ADDR_DEFAULT(new_mb)); rxds->fld.dd = 0; - rxds->fld.dma_addr_hi = (dma_addr >> 32) & 0xff; + rxds->fld.dma_addr_hi = (dma_addr >> 32) & 0xffff; rxds->fld.dma_addr_lo = dma_addr & 0xffffffff; nb_hold++; @@ -629,13 +629,6 @@ nfp_flower_init_vnic_common(struct nfp_net_hw *hw, const char *vnic_type) pf_dev = hw->pf_dev; pci_dev = hw->pf_dev->pci_dev; - /* NFP can not handle DMA addresses requiring more than 40 bits */ - if (rte_mem_check_dma_mask(40)) { - PMD_INIT_LOG(ERR, "Device %s can not be used: restricted dma mask to 40 bits!\n", - pci_dev->device.name); - return -ENODEV; - }; - hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id; hw->subsystem_device_id = pci_dev->id.subsystem_device_id; @@ -664,6 +657,9 @@ nfp_flower_init_vnic_common(struct nfp_net_hw *hw, const char *vnic_type) hw->mtu = hw->max_mtu; hw->flbufsz = DEFAULT_FLBUF_SIZE; + if (nfp_net_check_dma_mask(hw, pci_dev->name) != 0) + return -ENODEV; + /* read the Rx offset configured from firmware */ if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 2) hw->rx_offset = NFP_NET_RX_OFFSET; diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c index 03a2e2e622..b134a74bd8 100644 --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c @@ -122,7 +122,7 @@ nfp_flower_ctrl_vnic_recv(void *rx_queue, rxds->vals[1] = 0; dma_addr = rte_cpu_to_le_64(RTE_MBUF_DMA_ADDR_DEFAULT(new_mb)); rxds->fld.dd = 0; - rxds->fld.dma_addr_hi = (dma_addr >> 32) & 0xff; + rxds->fld.dma_addr_hi = (dma_addr >> 32) & 0xffff; rxds->fld.dma_addr_lo = dma_addr & 0xffffffff; nb_hold++; diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index 5d6e1a742d..4d36adc377 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -1566,6 +1566,24 @@ nfp_net_set_vxlan_port(struct nfp_net_hw *hw, return ret; } +/* + * The firmware with NFD3 can not handle DMA address requiring more + * than 40 bits + */ +int +nfp_net_check_dma_mask(struct nfp_net_hw *hw, char *name) +{ + if (NFD_CFG_CLASS_VER_of(hw->ver) == NFP_NET_CFG_VERSION_DP_NFD3 && + rte_mem_check_dma_mask(40) != 0) { + PMD_DRV_LOG(ERR, + "The device %s can't be used: restricted dma mask to 40 bits!", + name); + return -ENODEV; + } + + return 0; +} + RTE_LOG_REGISTER_SUFFIX(nfp_logtype_init, init, NOTICE); RTE_LOG_REGISTER_SUFFIX(nfp_logtype_driver, driver, NOTICE); RTE_LOG_REGISTER_SUFFIX(nfp_logtype_cpp, cpp, NOTICE); diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h index 56b7edc951..980f3cad89 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -454,6 +454,7 @@ int nfp_net_rx_desc_limits(struct nfp_net_hw *hw, int nfp_net_tx_desc_limits(struct nfp_net_hw *hw, uint16_t *min_tx_desc, uint16_t *max_tx_desc); +int nfp_net_check_dma_mask(struct nfp_net_hw *hw, char *name); #define NFP_NET_DEV_PRIVATE_TO_HW(adapter)\ (&((struct nfp_net_adapter *)adapter)->hw) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 290e2fcb41..fed7b1ab13 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -519,14 +519,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev) /* Use backpointer to the CoreNIC app struct */ app_fw_nic = NFP_PRIV_TO_APP_FW_NIC(pf_dev->app_fw_priv); - /* NFP can not handle DMA addresses requiring more than 40 bits */ - if (rte_mem_check_dma_mask(40)) { - RTE_LOG(ERR, PMD, - "device %s can not be used: restricted dma mask to 40 bits!\n", - pci_dev->device.name); - return -ENODEV; - } - port = ((struct nfp_net_hw *)eth_dev->data->dev_private)->idx; if (port < 0 || port > 7) { PMD_DRV_LOG(ERR, "Port value is wrong"); @@ -574,6 +566,9 @@ nfp_net_init(struct rte_eth_dev *eth_dev) hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION); + if (nfp_net_check_dma_mask(hw, pci_dev->name) != 0) + return -ENODEV; + if (nfp_net_ethdev_ops_mount(hw, eth_dev)) return -EINVAL; diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index 07a2e17ef8..c1f8a0fa0f 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -291,14 +291,6 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); - /* NFP can not handle DMA addresses requiring more than 40 bits */ - if (rte_mem_check_dma_mask(40)) { - RTE_LOG(ERR, PMD, - "device %s can not be used: restricted dma mask to 40 bits!\n", - pci_dev->device.name); - return -ENODEV; - } - hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0].addr; @@ -312,6 +304,9 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION); + if (nfp_net_check_dma_mask(hw, pci_dev->name) != 0) + return -ENODEV; + if (nfp_netvf_ethdev_ops_mount(hw, eth_dev)) return -EINVAL; diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index cfc1a784b1..12ca8381e4 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -48,7 +48,7 @@ nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq) rxd = &rxq->rxds[i]; rxd->fld.dd = 0; - rxd->fld.dma_addr_hi = (dma_addr >> 32) & 0xff; + rxd->fld.dma_addr_hi = (dma_addr >> 32) & 0xffff; rxd->fld.dma_addr_lo = dma_addr & 0xffffffff; rxe[i].mbuf = mbuf; PMD_RX_LOG(DEBUG, "[%d]: %" PRIx64, i, dma_addr); @@ -454,7 +454,7 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rxds->vals[1] = 0; dma_addr = rte_cpu_to_le_64(RTE_MBUF_DMA_ADDR_DEFAULT(new_mb)); rxds->fld.dd = 0; - rxds->fld.dma_addr_hi = (dma_addr >> 32) & 0xff; + rxds->fld.dma_addr_hi = (dma_addr >> 32) & 0xffff; rxds->fld.dma_addr_lo = dma_addr & 0xffffffff; nb_hold++; diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h index cb67657014..5e651518ed 100644 --- a/drivers/net/nfp/nfp_rxtx.h +++ b/drivers/net/nfp/nfp_rxtx.h @@ -288,8 +288,8 @@ struct nfp_net_rx_desc { union { /* Freelist descriptor */ struct { - uint8_t dma_addr_hi; - __le16 spare; + __le16 dma_addr_hi; + uint8_t spare; uint8_t dd; __le32 dma_addr_lo; -- 2.29.3