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 44A1F45495; Wed, 19 Jun 2024 12:01:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 016C442E67; Wed, 19 Jun 2024 11:59:25 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2118.outbound.protection.outlook.com [40.107.243.118]) by mails.dpdk.org (Postfix) with ESMTP id 25E4D42E5D for ; Wed, 19 Jun 2024 11:59:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AujNIdlD65Yew7Z6WBRdbzxBiKujUUheruPKBkAbhHbWU1nFADbUWo4wdTI33xeVySq4RoTY6w9VHvdXdV3l3Hp0UNXWZbF3F2a69SGvyBgYvgIuk5pc9ofw0wD80mF7+pXishOnSKdZllOJL3XjryCVE+j5rC7izWtp28EeyQS5gEUHGedYAVJeazF4OOiennqJ1+N501Eeg2f+X6u0qAkqklAB7uYenXuxFJi0H2NJD0wFAX+xm27dhcNJCFdB53HvqmhgdufpBpbwEA6KyXiXMnLBICrLY8RZq/GlgCKNQZWN40X7RJgbUsk6+jToeFumCnKnD5q/ApTvfZEI+A== 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=VthzKr8crwDUs11LOmeQj96bVgqCD9tx8vjyS8+l1rE=; b=d71SdS3cYwZr3Eec96tY/5iONA0Ul93apIWh+6RXQvCH4oyJlq/f36UAhN4McUApTa3gbrur0gNxIB8sy9P3vhRosHf6eJMCMsnp3hGWuN/YbCtV6mz18dNxqcfazELdlhyfFYOp3tnd7OhKmhpnZCRyti4uY3j4sC2+TqIKc3rtNmG4caGh2HmFSGctVEscwECGH8xYhBvDooE1S99Lmdl/llnfhEyGbMwle2sBecpggx3DBWI8bMW+0Zvgcr3GmrH1KsUVdBwYxgeVcLWjcAU7sE04z/d+TGnI97oFWc/zf6vV9i5yCpP8BC/IQw+SHP1un2Yto3vkmTY52cIfRw== 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=VthzKr8crwDUs11LOmeQj96bVgqCD9tx8vjyS8+l1rE=; b=i0+5Mdpy48DM5ELNvNjlgUZqh3I6WygZzTG/XTPaTomxfzGygPdNQ2cQe+aT1zIbNEm8lI5+j7E6GgxAP/A5/GVBSdJaXS/EvUoSIuG66SG0xVcVlDwBzuVmp0RI1TO1Di9y+r98PWKmykrqgciOVW9WPLkkODeQ40a0wBvwe60= 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 MN2PR13MB3912.namprd13.prod.outlook.com (2603:10b6:208:263::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Wed, 19 Jun 2024 09:59:20 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%4]) with mapi id 15.20.7677.030; Wed, 19 Jun 2024 09:59:20 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , Chaoyong He , Long Wu Subject: [PATCH 16/23] net/nfp: support configuration of VF numbers Date: Wed, 19 Jun 2024 17:58:23 +0800 Message-Id: <20240619095830.3479757-17-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240619095830.3479757-1-chaoyong.he@corigine.com> References: <20240619095830.3479757-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR13CA0057.namprd13.prod.outlook.com (2603:10b6:a03:2c2::32) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MN2PR13MB3912:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e4aaad4-7ba9-45b0-3fd2-08dc90467d0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|366013|376011|52116011|1800799021|38350700011; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?mjMcoPGbdEghfPK0mrwRmcnxa4WtohJ/Ah+I6j9gWnMu5W1TeQANQnqVsKwl?= =?us-ascii?Q?sc98MWIFVO2KwRholnAvAp4YGaTRLciu9+kQ6pbxzF0oGz6CHIrGw0egKC5u?= =?us-ascii?Q?4jt6IclZBmZ2fwT05/zAB6DF79K7duHUmI7t2TbA9MkKhSQ+Q3vnXitNv+UT?= =?us-ascii?Q?LFRxNX/RTJopjgy4wdC9/VyGOIFptW20h1h18LmAXPJMWU4uqEKEtnuDfCth?= =?us-ascii?Q?q4CSRGWjGLK5mNbEuGWoWet9IgeFR9Ml2W8OzhoNErJ+IyGqJ9QQAKQPADmv?= =?us-ascii?Q?fYWa/G/75uw3D5PRPQSi9L8lnjowRvwaR+JnRCfVY1y5XPbiC//hG401FAgw?= =?us-ascii?Q?q8UMXrlfLSSfqe7pOgEhzElJpVP0KH7PVrJIpmzyFFUg+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Yz5QlHZhpOd1WvTAPz37iPjH0Ut2fNdax2Yh+VL5DeYSSQaYOfdSk8?= =?us-ascii?Q?2+s/i02GfAd5tNrzlvbH9JyWSN6vgTwpYOFFHQ7gXKPWQVadApXLsLWW1+yR?= =?us-ascii?Q?q4EtqNw=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(366013)(376011)(52116011)(1800799021)(38350700011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?d9zKnWkSkte6vy4DyRtG7A/kPWXV9MW9GuCNUIcmCm95oxYQdA4Mq0tv9UEO?= =?us-ascii?Q?3ye6qvBIExHkTyHOdTIU+l4mVLXZ7qNfvWnteI/89aX2cbb1Z4IqDAS6aMwA?= =?us-ascii?Q?Mllgo8YmsynxaOwp+iwlLkO62GIDOE+9qsouueGaCY2lyxRkXaMJzVjRaJ8I?= =?us-ascii?Q?n3p4DXQv2MbyJuUZ00RqtcnJydfhATYL8GPSAAd9eTOwP0ifiFvXyt9c6fel?= =?us-ascii?Q?QPLVZmuB3kndNczr5uOt4fGsYlBmu1s0vhTiKTBQXJBbPp0N6MKA5r16rbbN?= =?us-ascii?Q?kaCJkZpPJZ99mnpo66udVZeYfF3DvRFeLirRLsCa4/E7nPYsOk9oc0ulae/V?= =?us-ascii?Q?kYbBjGmZ1/WBislFrmuZmedP5nRcPPhfkqzTH2tYrtsr69vEYzHxiSKAdw4h?= =?us-ascii?Q?IHNCQ0suSNQR/FstaAQ1nFSbK5IKHDUmO9zCVpjZ4WnO6pVg80hG+9biPjnd?= =?us-ascii?Q?kQUjL6Wr9r3E3x6YrdZDitXUX+DH2MoqGxJfO8IFaAOTTPGdTuVexjHdx8Hb?= =?us-ascii?Q?UqczGngm59akJWgbQ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gjrZT?= =?us-ascii?Q?y96p6SuUTSWpBeJFUmhRS7xG+sm2KKHAELKPo/92swwJCJT7KamX+Rtvw4Ec?= =?us-ascii?Q?UBlWxElfCTRwRYjpmAebtuZF91B6Yjff28V+YFIaLkNugzg+2R0rzvMuEIC+?= =?us-ascii?Q?o4NLzvBkML2iL4kEhSlo0381TbMGgx75B/9RWLcAqDbEOsmfyURDLaxYyEgd?= =?us-ascii?Q?Xw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e4aaad4-7ba9-45b0-3fd2-08dc90467d0e X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 09:59:20.2683 (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: wy2NbnLn/8XN9Irpq/HVDESTGalUhO5jwGdYIPX395DZ6wAIssRD54tKzRY7auVFlQpKBG2/WACqYIikU8iUzPCy+MuvE2ynK1EQNbqKh18= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3912 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 From: Peng Zhang The firmware uses the VF split capacity to identify the feature of PF can has different number of VFs. Add the logic to write the VF count and the first VF ID into firmware, so that the firmware can initialize and allocate relevant resource accordingly. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- drivers/common/nfp/nfp_common_ctrl.h | 11 +++ drivers/net/nfp/flower/nfp_flower.c | 6 ++ drivers/net/nfp/nfp_ethdev.c | 8 ++ drivers/net/nfp/nfp_net_common.c | 125 +++++++++++++++++++++++++++ drivers/net/nfp/nfp_net_common.h | 2 + 5 files changed, 152 insertions(+) diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h index e108720ff6..a52c33508e 100644 --- a/drivers/common/nfp/nfp_common_ctrl.h +++ b/drivers/common/nfp/nfp_common_ctrl.h @@ -21,6 +21,16 @@ #define NFP_NET_VF_CFG_SZ 16 #define NFP_NET_VF_CFG_MB_SZ 16 +/* VF config mailbox */ +#define NFP_NET_VF_CFG_MB 0x0 +#define NFP_NET_VF_CFG_MB_CAP 0x0 +#define NFP_NET_VF_CFG_MB_CAP_SPLIT (0x1 << 8) +#define NFP_NET_VF_CFG_MB_RET 0x2 +#define NFP_NET_VF_CFG_MB_UPD 0x4 +#define NFP_NET_VF_CFG_MB_UPD_SPLIT (0x1 << 8) +#define NFP_NET_VF_CFG_MB_VF_CNT 0x6 +#define NFP_NET_VF_CFG_MB_VF_NUM 0x7 + /* * @NFP_NET_TXR_MAX: Maximum number of TX rings * @NFP_NET_TXR_MASK: Mask for TX rings @@ -89,6 +99,7 @@ #define NFP_NET_CFG_UPDATE_VXLAN (0x1 << 9) /* VXLAN port change */ #define NFP_NET_CFG_UPDATE_MACADDR (0x1 << 11) /* MAC address change */ #define NFP_NET_CFG_UPDATE_MBOX (0x1 << 12) /* Mailbox update */ +#define NFP_NET_CFG_UPDATE_VF (0x1 << 13) /* VF settings change */ #define NFP_NET_CFG_UPDATE_ERR (0x1U << 31) /* A error occurred */ #define NFP_NET_CFG_TXRS_ENABLE 0x0008 #define NFP_NET_CFG_RXRS_ENABLE 0x0010 diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 602f45d1dd..fa272790bc 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -724,6 +724,12 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv) goto pf_cpp_area_cleanup; } + ret = nfp_net_vf_config_app_init(pf_hw, pf_dev); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Failed to init sriov module"); + goto pf_cpp_area_cleanup; + } + nfp_flower_nfd_func_register(app_fw_flower); /* The ctrl vNIC struct comes directly after the PF one */ diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index dc3890ef53..f9f0884c88 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -1030,6 +1030,14 @@ nfp_net_init(struct rte_eth_dev *eth_dev, /* Initializing spinlock for reconfigs */ rte_spinlock_init(&hw->reconfig_lock); + if ((port == 0 || pf_dev->multi_pf.enabled)) { + err = nfp_net_vf_config_app_init(net_hw, pf_dev); + if (err != 0) { + PMD_INIT_LOG(ERR, "Failed to init sriov module"); + goto xstats_free; + } + } + /* Allocating memory for mac addr */ eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 0bfe7a514c..e1cae983b2 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -196,6 +196,54 @@ nfp_net_notify_port_speed(struct nfp_net_hw *hw, /* The length of firmware version string */ #define FW_VER_LEN 32 +/** + * Reconfigure the firmware of VF configure + * + * @param net_hw + * Device to reconfigure + * @param pf_dev + * Get the Device info + * @param update + * The value for the mailbox VF command + * @param value + * The value of update + * @param offset + * The offset in the VF configure table + * + * @return + * - (0) if OK to reconfigure vf configure. + * - (-EIO) if I/O err and fail to configure the vf configure + */ +static int +nfp_net_vf_reconfig(struct nfp_net_hw *net_hw, + struct nfp_pf_dev *pf_dev, + uint16_t update, + uint8_t value, + uint32_t offset) +{ + int ret; + struct nfp_hw *hw; + + hw = &net_hw->super; + rte_spinlock_lock(&hw->reconfig_lock); + + /* Write update info to mailbox in VF config symbol */ + nn_writeb(value, pf_dev->vf_cfg_tbl_bar + offset); + nn_writew(update, pf_dev->vf_cfg_tbl_bar + NFP_NET_VF_CFG_MB_UPD); + nn_cfg_writel(hw, NFP_NET_CFG_UPDATE, NFP_NET_CFG_UPDATE_VF); + + rte_wmb(); + + ret = nfp_reconfig_real(hw, NFP_NET_CFG_UPDATE_VF); + + rte_spinlock_unlock(&hw->reconfig_lock); + + if (ret != 0) + return -EIO; + + return nn_readw(pf_dev->vf_cfg_tbl_bar + NFP_NET_VF_CFG_MB_RET); +} + /** * Reconfigure the firmware via the mailbox * @@ -2574,3 +2622,80 @@ nfp_function_id_get(const struct nfp_pf_dev *pf_dev, return port_id; } + +static int +nfp_net_sriov_check(struct nfp_pf_dev *pf_dev, + uint16_t cap) +{ + uint16_t cap_vf; + + cap_vf = nn_readw(pf_dev->vf_cfg_tbl_bar + NFP_NET_VF_CFG_MB_CAP); + if ((cap_vf & cap) != cap) + return -ENOTSUP; + + return 0; +} + +static int +nfp_net_sriov_update(struct nfp_net_hw *net_hw, + struct nfp_pf_dev *pf_dev, + uint16_t update) +{ + int ret; + + /* Reuse NFP_NET_VF_CFG_MB_VF_NUM to pass vf_base_id to FW. */ + ret = nfp_net_vf_reconfig(net_hw, pf_dev, update, pf_dev->vf_base_id, + NFP_NET_VF_CFG_MB_VF_NUM); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Error nfp VF reconfig"); + return ret; + } + + return 0; +} + +static int +nfp_net_sriov_init(struct nfp_net_hw *net_hw, + struct nfp_pf_dev *pf_dev) +{ + int ret; + + ret = nfp_net_sriov_check(pf_dev, NFP_NET_VF_CFG_MB_CAP_SPLIT); + if (ret != 0) { + if (ret == -ENOTSUP) { + PMD_INIT_LOG(WARNING, "Set VF split not supported"); + return 0; + } + + PMD_INIT_LOG(ERR, "Set VF split failed"); + return ret; + } + + nn_writeb(pf_dev->sriov_vf, pf_dev->vf_cfg_tbl_bar + NFP_NET_VF_CFG_MB_VF_CNT); + + ret = nfp_net_sriov_update(net_hw, pf_dev, NFP_NET_VF_CFG_MB_UPD_SPLIT); + if (ret != 0) { + PMD_INIT_LOG(ERR, "The nfp sriov update spilt failed"); + return ret; + } + + return 0; +} + +int +nfp_net_vf_config_app_init(struct nfp_net_hw *net_hw, + struct nfp_pf_dev *pf_dev) +{ + int ret; + + if (pf_dev->sriov_vf == 0) + return 0; + + ret = nfp_net_sriov_init(net_hw, pf_dev); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Failed to init sriov module"); + return ret; + } + + return 0; +} diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index c4d469599f..4b5029f3f4 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -347,6 +347,8 @@ uint32_t nfp_net_get_port_num(struct nfp_pf_dev *pf_dev, struct nfp_eth_table *nfp_eth_table); uint8_t nfp_function_id_get(const struct nfp_pf_dev *pf_dev, uint8_t port_id); +int nfp_net_vf_config_app_init(struct nfp_net_hw *net_hw, + struct nfp_pf_dev *pf_dev); #define NFP_PRIV_TO_APP_FW_NIC(app_fw_priv)\ ((struct nfp_app_fw_nic *)app_fw_priv) -- 2.39.1