From patchwork Mon Aug 5 02:12:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaoyong He X-Patchwork-Id: 142890 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 758F74573B; Mon, 5 Aug 2024 04:14:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5925D4064E; Mon, 5 Aug 2024 04:13:27 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2108.outbound.protection.outlook.com [40.107.243.108]) by mails.dpdk.org (Postfix) with ESMTP id 99CB04060F for ; Mon, 5 Aug 2024 04:13:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SY73fwyK6o/KuBmaT+2iuSwvSvIviWRd2ffUxOjNjcu3p0nvPM3cH/W+uYvksrGi2SS/656F7TbMjKet9fc413v/M0AlbBF+nbROj8UkNF7cWH9C85rOL0EzYgAus7vHN24WzcLGfz+90lIWHZTqzs8Be5BQDzUJ/VKqO/g7I6qGQYEOqz9CDY+DoIROubkPBwF+iHQ9qnjiuSAz603awYzSAe0nuOQqWwfM4kU6S1UjMun6sx7cg9YJpM5c8yv7d85BAR7l4iQH3aPdvwYyk/XlxAP8pT1DiAwzuQXsywcemQTblj8UFwmd0q/qDz2nNIpZYtFnUA8jA/8bF2w99A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Sr3gV9pmN8ewEOSAflAp5gC0k0EI05Y91pYXFwRbu/4=; b=cb8T1b9QbY2gOInDNW0XG5p0v5ZCRw8chxozy/eFbJX/VPaSttFsTzmJA5bUhH6ZjUdbE+WiyDlGfaEQ3VQiL46xccb9S1GCfQ28lw4eRDiJvPeBAHmE+fKQuo+2qpLR6Blvn/pYZfh9uU8nREKNN1ua6359UrBVfs6Hb32/B/1w/OnSYvUa64yxsPWa3OXEAUyC1zyrJ57AszbYJQGoCONQeh4N/E+l99vqjobp82q7c1EqYq7mJ59J7/Pc52lsjGoBiQ5A5ZDkra4qUa05U81ZrmtE2IJAN2UTi5vhkUJmCwIkMIod2kuR4TJdC4EXoho9760U/VBOj0wtDSLi6g== 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=Sr3gV9pmN8ewEOSAflAp5gC0k0EI05Y91pYXFwRbu/4=; b=Scls4iCqjqnB5UfrLfJrEhlgSgo/QmTGTmxRPLzlDvod59cFDecAAYjAplHNmGiSqwx7Y8s5Inb/EiTWn6jkQxlKE6Wic+AcARvq9hJXMZf3wYNFxCW+Q9GldmEdJt70+QKsXvZfCb8fWNU4f6FuGmZ99RbDJF0oUTXjrozbwiI= 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 SJ0PR13MB5896.namprd13.prod.outlook.com (2603:10b6:a03:43a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.25; Mon, 5 Aug 2024 02:13:24 +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.7828.023; Mon, 5 Aug 2024 02:13:24 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Xinying Yu , Chaoyong He , Long Wu , Peng Zhang , Maxime Coquelin Subject: [PATCH v4 08/11] vdpa/nfp: recover the ring index on new host Date: Mon, 5 Aug 2024 10:12:45 +0800 Message-Id: <20240805021248.1051198-9-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240805021248.1051198-1-chaoyong.he@corigine.com> References: <20240617062708.2932037-1-chaoyong.he@corigine.com> <20240805021248.1051198-1-chaoyong.he@corigine.com> X-ClientProxiedBy: BYAPR01CA0050.prod.exchangelabs.com (2603:10b6:a03:94::27) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SJ0PR13MB5896:EE_ X-MS-Office365-Filtering-Correlation-Id: f5453148-2575-4794-d00f-08dcb4f42f67 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: my9H9xy9Gx4EbM776W8YdqH0jSb/ODjM+26iiQ67IZFFfMDXUuATvsTogVBGblWwraH9FDAmefCfJeupyjbKJUFVgOaSVAB0/qQzVN+mNvk4ZiiETKOvZBjAfHm4sZ+T9yxRWD6H30iBJKpcl9kxWcyrRCa0LD4NHOalZ49GeHwLhEmVLfc2RJhuMjSgM7R+ATaue8K8qneYNsyqMdUp7YSdGVmnefbkutMkJChjJwmwxgyPiNuk0WbrVeRjrxm1dmiKztTAW2FhCImskF4LX5j8UOflm67rAeOxGp8l+TIZkp829rXklMgdN4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BMRy9Ulmm7T+Gnmja8aBinSdu8g7mVtQ== 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:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0ApRC4kQYHGSuxs9TpOiPa6l/tMBhJZUhlrvolDGuYioOfi1MGOx7d/MBSlvLUNJ25mg/L8NxrPbPhJklPCfQCBHYsbx4JEzRf/F+XvLRRZbCEeCmVzkj5c8L6tD88PAjLfjz/hKUmJH1FFFHUl2f5018upZJKG0Zo9W0nCVIXnxFo4/u0KM8CT/oP0E+VeoIKAqnX6xUqCwxaKM2/tNiQSdPCL9DA5STxpVJxO0WRVcM5nrnCxLXIrHPbTW0P4mcGi4rCEgJs9ZdWsx0puibMVDs6By6jdosOtDPl8m6J1Rt65nRkUK6ytSDAQk0CQ2IIMNZGrcB8HTAAkdOCAYQWBB/6d2U48rD/NQbltGeHiPn+3zM/3Qw/eQYxeV1rBzFcf+xquI4mi1Ua9ML/gg1Pw+Ih2cAzv7DpL9TFlLMABHo4KL7ytyfSlHZBfPFSh/v8maFc3X33Y0krssTV0cwqxwBvlHa/UzgRWdi3UzI0LwUSglWXsXgcfd18rXMVk7nDhaD0o8wFvPnm179mLn1F4h3H/rguCZ7U28yVO4iq5ms2JFororvZsghFLkQC9/Dy70PAGskygqId4UqTaOd6hjw0AHkG6pZBkneT6rA1StdjukD5LzMU8Gg9BYFpclhtEsasNVHqoR1r/4Ftd5F25XdEY7WeX3NrZRHOVPth7OALLXCCH5aS8TNCRh3sHyk3YLu5KiroMgokCQxv/XrSk78yF/V72ReposmYI9v+Rp2PSrsH7WwjTqL2X5OZjKIGg1wr8RRM3ipfQ/Rglr7a9mgVau7NpckeeYvbDxx/oW0fcZKNi//YNtlZMd1mPxtyirRpQVnntaBiu3mSkOoVf4KmEv1Pw4oy5LDX+syc5Q5i4iHx6+dF8FZPJ7OwKLwCEqFDvEu8WEhG30xThnobTLYOeDWaBohWgrOjNG4iOaMR4ljMRZlMW3rBtgSjrjU/fjIbElgskmyu9Y4gu8jtlx8y0fcGRNBKMuHNXIsEnRaKsAk0MKg3J6IQ1bWi9z4oVWJVOa68j0owOxu6gyd8Gn3YZvn243lGDNze78L78adSsrox0O32aWpXMWPsd3Rh0DK+88QmTjvUr6RwOkPCl5k97xl3IFQNKmzJbUg9v+S/ivi80keDBW8x+KnGs+wPS2kZIr5dIW7LzXjY4ec/V0ow1St4BbjUJIoDQJdjzObCP36TIud45nQH7R4U/vTaicY3RlP5zfUJgtfveCsV0aiJ8xu/xHuJMPoA547lVW1i5HzE9lb7HP4sqYvMGv44jTvC3GNHnLS/nCTmiALhvbqfIfruH0D6k0GWUVSUCgJ3pJPwoWStInp2KKdW7CKyop5qTUAGO1qRo0IKhVeUefd3C5qVKB7+GHUb3/pvRRUdC9yDNikqm2/WET1zUprGsPBK59BapkywtK43EYrk4VxgWdSumrdOrWfuPNyL2CeFXTlZEje5yyxUptCyyEgQee8DqLrbfAOhsGC16wonB0t3VMZBhucUaDExUBg4C8EuvagFwArk/e5w1LWX75AJz0akaZCGdnZUUy948pX3ddFFNJLMQK6mUNeljaCaMzogqTMEpvNqbsBz4szbG719tP1MMGp1m2bS+c7jX2fw== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5453148-2575-4794-d00f-08dcb4f42f67 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2024 02:13:24.2739 (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: eNl58pEKvCz1ZRWN8Q+lrSAxrCIVNQ5xDZUWHK8qReKjO55tsQiG4/OlOKpew8TnsppMveQ+8K9NthcVM5VdmlisL2CeeAUuFJBRDqROd5A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR13MB5896 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: Xinying Yu After migrating to new host, the vring information is recovered by the value in offset 'NFP_NET_CFG_TX_USED_INDEX' and 'NFP_NET_CFG_RX_USED_INDEX'. Signed-off-by: Xinying Yu Reviewed-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang Reviewed-by: Maxime Coquelin --- drivers/common/nfp/nfp_common_ctrl.h | 7 +++++-- drivers/vdpa/nfp/nfp_vdpa_core.c | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h index 8a760ddb4b..b64bb1dd2d 100644 --- a/drivers/common/nfp/nfp_common_ctrl.h +++ b/drivers/common/nfp/nfp_common_ctrl.h @@ -214,8 +214,11 @@ struct nfp_net_fw_ver { #define NFP_NET_CFG_CAP_WORD1 0x00a4 -/* 16B reserved for future use (0x00b0 - 0x00c0). */ -#define NFP_NET_CFG_RESERVED 0x00b0 +#define NFP_NET_CFG_TX_USED_INDEX 0x00b0 +#define NFP_NET_CFG_RX_USED_INDEX 0x00b4 + +/* 16B reserved for future use (0x00b8 - 0x0010). */ +#define NFP_NET_CFG_RESERVED 0x00b8 #define NFP_NET_CFG_RESERVED_SZ 0x0010 /* diff --git a/drivers/vdpa/nfp/nfp_vdpa_core.c b/drivers/vdpa/nfp/nfp_vdpa_core.c index 2b609dddc2..d7c48e2490 100644 --- a/drivers/vdpa/nfp/nfp_vdpa_core.c +++ b/drivers/vdpa/nfp/nfp_vdpa_core.c @@ -100,6 +100,16 @@ nfp_vdpa_hw_init(struct nfp_vdpa_hw *vdpa_hw, return 0; } +static void +nfp_vdpa_hw_queue_init(struct nfp_vdpa_hw *vdpa_hw) +{ + /* Distribute ring information to firmware */ + nn_cfg_writel(&vdpa_hw->super, NFP_NET_CFG_TX_USED_INDEX, + vdpa_hw->vring[1].last_used_idx); + nn_cfg_writel(&vdpa_hw->super, NFP_NET_CFG_RX_USED_INDEX, + vdpa_hw->vring[0].last_used_idx); +} + static uint32_t nfp_vdpa_check_offloads(void) { @@ -198,6 +208,9 @@ nfp_vdpa_queue_config(struct nfp_vdpa_hw *vdpa_hw, nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(2), vdpa_hw->vring[0].used); + if (!relay) + nfp_vdpa_hw_queue_init(vdpa_hw); + rte_wmb(); }