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 D38104547D; Mon, 17 Jun 2024 08:28:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E022940A7A; Mon, 17 Jun 2024 08:27:49 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2097.outbound.protection.outlook.com [40.107.220.97]) by mails.dpdk.org (Postfix) with ESMTP id A505E40697 for ; Mon, 17 Jun 2024 08:27:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CS91gRnQUifUWqJVrPerqLXonkMBcHCw4xwedd+n8oVjgsRsNhamfda1UMSClHAlCMB5liz4z8DWthkz+K3DmVKnMonPWc8dhtDyoUCez9QAyKMmcLQIn5fetlUk1DwJG5X9vztwby+mscIuLNloKku5qNu8MZWzB7DRLH9AmWH7n7Qp3RF6Gmy/rAwgi1rkASF7SSy/jJlk5HCiP91g6C9yCx+QPKw+dpLMgRtfcKpZQ6BXFefj+5mren4sNU5iuaLN2UTd8uyc762OxBBNRTK78IHSZUvrTVL0wqf0FFChsN+/wHMjZsq5r4+jvyPVGMG9R+9Oleb5q2+rSaOoNA== 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=UIEpqR/8qg8vF/YSUfr6zTrpNGD6XV6GS/nTPsl4P2E=; b=gaY4harxgAbLnQHpFoPzfq3PShIRn/yVXVogipkoYC5RgvfHJcgAJWZi11xFA31g8DXrDqoGWcU1NJVTF2tmR+pwrO2VGRBewh+7x9ZmZboQXj7tS/3OztMYtlYiKC8bReX2wiopoXEofftChKuY7ztsa41b0pvt56cy9Bp+9pfEXdYTVTri9c+pSFxnqOzfIKnHt0zUL81fSIZbR7bszPS/QaAAErGzId1Cue8WmobKQzL7sVPFOzEAeSaXRJ4hWUTDMncMb8fsLU1kw5oJ3o49N4y0tef+J5go7FVgIKpsDd7xgkpDPNUmFJerUXR+YcxKFvfpKeAG2QKeYsgDWA== 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=UIEpqR/8qg8vF/YSUfr6zTrpNGD6XV6GS/nTPsl4P2E=; b=EhfrvzYRrfA2KdyDfcEajtgqv0b5KWOH0bFc6oBA6NqC5pmGBY5yC8v+ksXX2X4Ad9YAblCJlsgr2TSRhQkSHDbrnSDFWaVrYhm6hhGEqXKN67g69G6vPXXTtqK8ax+jVqMCyz82oCmGT0bh1Jny74OMWqo7OAAkjt63quL/dt0= 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 MW3PR13MB4106.namprd13.prod.outlook.com (2603:10b6:303:56::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 06:27:47 +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; Mon, 17 Jun 2024 06:27:47 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Xinying Yu , Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH v3 04/11] vdpa/nfp: refactor the logic of datapath update Date: Mon, 17 Jun 2024 14:27:01 +0800 Message-Id: <20240617062708.2932037-5-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240617062708.2932037-1-chaoyong.he@corigine.com> References: <20240614070120.2663160-1-chaoyong.he@corigine.com> <20240617062708.2932037-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR04CA0175.apcprd04.prod.outlook.com (2603:1096:4:14::13) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW3PR13MB4106:EE_ X-MS-Office365-Filtering-Correlation-Id: 6fc0916c-9bbf-4514-4d46-08dc8e969a8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|376011|1800799021|52116011|366013|38350700011; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?upkSkv1arkm/cMS8MWMpQWPDJJKOQnuM4VpPv2CpjRAQEOdcHbWXNNqMz7DA?= =?us-ascii?Q?g39vUdZ5r9P/YB1p1KhWGW0B9M1ZKVa/zFoaUtwJgKj94XSlP/7PY9TM9JKw?= =?us-ascii?Q?fkEBhC4vg9xoRVNuMIi5dtEP1rvIzoSQCzPcytOnqF3Ge9lsCtCNeJY1NM48?= =?us-ascii?Q?l01HtOzTmD96VdNkb1mupLCB7PvrFI1vQYAwDg3bJbjIS70RdgjAvZBbKXbz?= =?us-ascii?Q?cdRkC9hpq2Go4x8xYGPAEzwNT4hX1yGGb+P1R9ob29J2Dm+cHYTo+dI++SsE?= =?us-ascii?Q?iHF7vsMLB44JjagUsTHsfkBh5tHESWMcuBrTtNiDj+dsWAFCArT50nclOBFo?= =?us-ascii?Q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6ely9c49AUagej?= =?us-ascii?Q?49Bx3+X0U7e1SjDB3iywmIsfZEYFEDYgMK7Ny2zKnFRG6Zsi52BSC4hWLjTT?= =?us-ascii?Q?1IxhS9m2JUuPnWBY/7pxwJFkSubUbhH1Iy6lGWiHlRQKZM+RMLN6N9wQmhkI?= =?us-ascii?Q?D05nOqY=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)(376011)(1800799021)(52116011)(366013)(38350700011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ICIFFxs8gffH2LTGJT6y15PBk4T40Kp9KoIU4qKonEv6tboFqDoSCFUhWips?= =?us-ascii?Q?tZl2ZT6IPQTXUigAjJYd4RBN/tXfh3yIib0TU1SuFIqiocqjf/s3o5shpy8A?= =?us-ascii?Q?Jv4BzzzK0Vwoqxm3B/KLB4lRXyjTPXhdg6h8k6BO5+1PuYnCgnXoIQAjZNfg?= =?us-ascii?Q?zqYN7ZQDZivrOiqAsDJ7yB5cfK3wxUradz4NH2CwKvDXmA3YM7qP3zM29SXl?= =?us-ascii?Q?8P/OjnhZLxwOYb8985fjU+CzIOi+bVPJUNPI1FWfMO6zicoEnvkS231iGf8b?= =?us-ascii?Q?FX+reYQZg4WJqzh+9WDlZzL4BuvtVFjMh0/V4KSfNXA/+6iiTXmCwvC8fdBX?= =?us-ascii?Q?GbH1MlRzQKBEblKJXAoWf0vj0qWkOdIO2+9bomVLaWYAjI5NIMYVoGWrmpPa?= =?us-ascii?Q?5RkDOueoJBBnOyupYRAPN0tRGzIPVfOdvjsHa0srPSpC/aO+aOV6MztkvBgP?= =?us-ascii?Q?nwNA2v87cZVdMlWaUvQgC7PH47sMl73vTADpnBcoHGYh44m+oqb31M6gmqBk?= =?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kckmWp89dxJ3bSBbDT2vr2?= =?us-ascii?Q?fZQFxzkKUFfZ7NRlLRoG9nZ1AA5fjfTlSV7jkTWKrllsyGHto0YHvGNXmohS?= =?us-ascii?Q?s0MfxXMy5w/uR9xOW92+CPyt6kjzz28oFxKFTEysshXzB9fgNgJNDxujyUTi?= =?us-ascii?Q?j4F+WMoSbHQb4MjBhjF3WSA85EUl3h4gtc4qt6bo6KLfkyRHAzBKofAiUdxU?= =?us-ascii?Q?pA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6fc0916c-9bbf-4514-4d46-08dc8e969a8b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 06:27:47.0534 (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: c5UqjoMg8MEEh09bCMCF3mNw/lh+cvL4PCQ/zA6JZmZljz7pxzbryAV5Wkiw2yoCd66vX8lpFY/rBapnmR+vPw/aecNjnnP2j/nBlFyognQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR13MB4106 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 In order to add the new configuration logic of software live migration, split the datapath update logic into two parts, queue configuration and VF configuration. Signed-off-by: Xinying Yu Reviewed-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/vdpa/nfp/nfp_vdpa_core.c | 54 +++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/drivers/vdpa/nfp/nfp_vdpa_core.c b/drivers/vdpa/nfp/nfp_vdpa_core.c index 6d07356581..79ecd2b4fc 100644 --- a/drivers/vdpa/nfp/nfp_vdpa_core.c +++ b/drivers/vdpa/nfp/nfp_vdpa_core.c @@ -105,8 +105,8 @@ nfp_vdpa_check_offloads(void) NFP_NET_CFG_CTRL_IN_ORDER; } -int -nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw, +static int +nfp_vdpa_vf_config(struct nfp_hw *hw, int vid) { int ret; @@ -114,24 +114,8 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw, uint32_t new_ctrl; uint32_t new_ext_ctrl; struct timespec wait_tst; - struct nfp_hw *hw = &vdpa_hw->super; uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; - nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(0), vdpa_hw->vring[1].desc); - nn_cfg_writeb(hw, NFP_NET_CFG_TXR_SZ(0), rte_log2_u32(vdpa_hw->vring[1].size)); - nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(1), vdpa_hw->vring[1].avail); - nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(2), vdpa_hw->vring[1].used); - - nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(0), vdpa_hw->vring[0].desc); - nn_cfg_writeb(hw, NFP_NET_CFG_RXR_SZ(0), rte_log2_u32(vdpa_hw->vring[0].size)); - nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(1), vdpa_hw->vring[0].avail); - nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(2), vdpa_hw->vring[0].used); - - rte_wmb(); - - nfp_disable_queues(hw); - nfp_enable_queues(hw, NFP_VDPA_MAX_QUEUES, NFP_VDPA_MAX_QUEUES); - nn_cfg_writel(hw, NFP_NET_CFG_MTU, 9216); nn_cfg_writel(hw, NFP_NET_CFG_FLBUFSZ, 10240); @@ -177,6 +161,40 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw, return 0; } +static void +nfp_vdpa_queue_config(struct nfp_vdpa_hw *vdpa_hw) +{ + struct nfp_hw *hw = &vdpa_hw->super; + + nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(0), vdpa_hw->vring[1].desc); + nn_cfg_writeb(hw, NFP_NET_CFG_TXR_SZ(0), + rte_log2_u32(vdpa_hw->vring[1].size)); + nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(1), vdpa_hw->vring[1].avail); + nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(2), vdpa_hw->vring[1].used); + + nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(0), vdpa_hw->vring[0].desc); + nn_cfg_writeb(hw, NFP_NET_CFG_RXR_SZ(0), + rte_log2_u32(vdpa_hw->vring[0].size)); + nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(1), vdpa_hw->vring[0].avail); + nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(2), vdpa_hw->vring[0].used); + + rte_wmb(); +} + +int +nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw, + int vid) +{ + struct nfp_hw *hw = &vdpa_hw->super; + + nfp_vdpa_queue_config(vdpa_hw); + + nfp_disable_queues(hw); + nfp_enable_queues(hw, NFP_VDPA_MAX_QUEUES, NFP_VDPA_MAX_QUEUES); + + return nfp_vdpa_vf_config(hw, vid); +} + void nfp_vdpa_hw_stop(struct nfp_vdpa_hw *vdpa_hw) { -- 2.39.1