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 4ACB7A0C53; Wed, 3 Nov 2021 15:02:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 45D8B42753; Wed, 3 Nov 2021 15:01:21 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2068.outbound.protection.outlook.com [40.107.237.68]) by mails.dpdk.org (Postfix) with ESMTP id DC55742736 for ; Wed, 3 Nov 2021 15:01:18 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=agEaQ4qzaUqJSC41Lv81p6e/ma/suNAvNhRsy56ZxFhEQJnDDHVgo+ZrHZLzYMX3Ius+h8js535BgIgCulxC0ag8OyRf1MSojvdd9fSYr1JpBQ1OgQRRpwcZrP/7SdUmU5nQF8WjYfpTqHCNhwwxWJONxRetEClIOtz/prWU+AkaTwHmxwMPERRRMMyvQvEvhfTPe7rUh/vsIyprpyaC671gWNCYZxcEj3EXnaF0QVlEDZYneoER4T0pxBw4w1rAcK9IUqIiCGKBfGOgv4wIkjEtPcYUysnZ8PAe++PH0ltAyCIvc224fNQBPXodmAB45HcxqxsSapvr8Ab3EKXJ4A== 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=qpe52jk3sY6Dp721p8uN88ZJYwPfry5FY8JwI0eSCoI=; b=aoE3PiQjBddhIsZGhvMbAKkFVkrD6pir+dwyAvgVTVtzEG2XYPmHXCH3ikWYRPZDDzycOaPR+PL7JpyoujMCCx5uoc3mwt5D1T/xctjKBqLygqmxTBVXrn1GH8KWzQtX11dbEidzDJIlmateLqb/Jm9O4iSZqwjVgUYbEQMAmpTOJvNxje3swz7Z1BI/Z1lX1RM+fvIJEq96lkm5JQiIRA0B3q41Sm+0P924bRzwxmgKbtPEm1RMOt0kyvtru/8OlI/K5ZIu+bCS1WaJNv8jAfQaEqFP9/7fhaTd0/2uEWtmlY1ALoF/4dGxJiC+2rWXA7goGX1em6oYNaZjWqSZpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=dpdk.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qpe52jk3sY6Dp721p8uN88ZJYwPfry5FY8JwI0eSCoI=; b=rpgx3vE+gpfrKKf002muHN+po2PKO9x76A/H5bVbE2HgSvW8F5eOcAlXSE1EScUq8DnnswlUaWiV9r/pY3Y3hBPUJEiQtXXhAHdC5Ou5ba5tyIW0QjmUTbaqhLhlq+jovIaei+54PwxZYO6ym3p9PT6OJKdXB3H8MVV8lPlikiI= Received: from SA9PR10CA0013.namprd10.prod.outlook.com (2603:10b6:806:a7::18) by SN6PR02MB5264.namprd02.prod.outlook.com (2603:10b6:805:71::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15; Wed, 3 Nov 2021 14:01:16 +0000 Received: from SN1NAM02FT0055.eop-nam02.prod.protection.outlook.com (2603:10b6:806:a7:cafe::9f) by SA9PR10CA0013.outlook.office365.com (2603:10b6:806:a7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Wed, 3 Nov 2021 14:01:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0055.mail.protection.outlook.com (10.97.5.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4669.10 via Frontend Transport; Wed, 3 Nov 2021 14:01:15 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 3 Nov 2021 07:00:53 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Wed, 3 Nov 2021 07:00:53 -0700 Envelope-to: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com, andrew.rybchenko@oktetlabs.ru Received: from [10.170.66.108] (port=38886 helo=xndengvm004108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1miGov-0003SS-3o; Wed, 03 Nov 2021 07:00:53 -0700 From: Vijay Srivastava To: CC: , , , Vijay Kumar Srivastava Date: Wed, 3 Nov 2021 19:27:53 +0530 Message-ID: <20211103135754.17411-10-vsrivast@xilinx.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20211103135754.17411-1-vsrivast@xilinx.com> References: <20210706164418.32615-1-vsrivast@xilinx.com> <20211103135754.17411-1-vsrivast@xilinx.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b2c5591-9bf0-40cf-0d72-08d99ed26723 X-MS-TrafficTypeDiagnostic: SN6PR02MB5264: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:124; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3kLargMvgfLJx9uQ/rRN7AftCCyH5J+MKJYOLYmpiPN9PfA8S0AoIlJBa/PG/PFnRw31FzoPy5ZKuqdLbu9MIxmUjuIeGNPyKinvdrrsHRjIbWZkkcrakzvMgwFdMduEbIZLuS04lNwokF5r9Y7oEnozOMIYNCXRBtufyqOfTLmNuCiMOGKujTOhPlnPxz3FxDEro8uxf0GEn9LORP3Le3sfUN/B19/BK0LlYrRiOO7tBkZt07Bd/1y2Qrc6OsT9JtCib6hVf4DoWN+c/g7LGP5Bravyizq7tYFP8PGRzCmgEjumovNeZtgQezphNcnSsqs4Tu/AQeH9nIhsE/TNTIorhjLuVERCThnr7EMeYg4KrbDDwaiMCY/rxc3X4QjAKoLwIJsLHO/16YvCOLqWDeBhndAWEDkitwewptiO2uA+umZ5Y095LO631FA0G7obqyVFOsTZGKDn/kSfwr+0VvxxnCUEvpBGvGp8+6XpQHm2gEV92g4DSE8ULIngzOZHg4lLdNhtIIXXY8DnL24Jc4nD6wzRuZskFgq9+bgfyXYGCB6uKDfjTCS831f0/opKXmGguMh32epOIh/H8TR55ogtv9h8stw5KMjS7POT0BTGW5U+IEAgadu+lW7bQE/e48/kvkPtjIrP49huGefTot9u06rZ1UZTCqD+K1FTgN9EQ6frbQ9c+tchcGNeJY8eJuqU7o/VY0gSU1+IvQNkXMK+QWLswnfM9cO9fFQbRDI= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(46966006)(36840700001)(2906002)(83380400001)(36860700001)(54906003)(316002)(426003)(5660300002)(2616005)(82310400003)(1076003)(186003)(8676002)(7636003)(70586007)(36906005)(26005)(356005)(70206006)(6916009)(47076005)(336012)(36756003)(8936002)(107886003)(508600001)(44832011)(7696005)(4326008)(9786002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2021 14:01:15.9517 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b2c5591-9bf0-40cf-0d72-08d99ed26723 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0055.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB5264 Subject: [dpdk-dev] [PATCH v4 09/10] vdpa/sfc: add support to set vring state 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 Sender: "dev" From: Vijay Kumar Srivastava Implements vDPA ops set_vring_state to configure vring state. Signed-off-by: Vijay Kumar Srivastava Acked-by: Andrew Rybchenko Reviewed-by: Maxime Coquelin Reviewed-by: Chenbo Xia --- drivers/vdpa/sfc/sfc_vdpa_ops.c | 54 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c index 9d4ed34..c5c97b8 100644 --- a/drivers/vdpa/sfc/sfc_vdpa_ops.c +++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c @@ -702,11 +702,57 @@ static int sfc_vdpa_set_vring_state(int vid, int vring, int state) { - RTE_SET_USED(vid); - RTE_SET_USED(vring); - RTE_SET_USED(state); + struct sfc_vdpa_ops_data *ops_data; + struct rte_vdpa_device *vdpa_dev; + efx_rc_t rc; + int vring_max; + void *dev; - return -1; + vdpa_dev = rte_vhost_get_vdpa_device(vid); + + ops_data = sfc_vdpa_get_data_by_dev(vdpa_dev); + if (ops_data == NULL) + return -1; + + dev = ops_data->dev_handle; + + sfc_vdpa_info(dev, + "vDPA ops set_vring_state: vid: %d, vring: %d, state:%d", + vid, vring, state); + + vring_max = (sfc_vdpa_adapter_by_dev_handle(dev)->max_queue_count * 2); + + if (vring < 0 || vring > vring_max) { + sfc_vdpa_err(dev, "received invalid vring id : %d to set state", + vring); + return -1; + } + + /* + * Skip if device is not yet started. virtqueues state can be + * changed once it is created and other configurations are done. + */ + if (ops_data->state != SFC_VDPA_STATE_STARTED) + return 0; + + if (ops_data->vq_cxt[vring].enable == state) + return 0; + + if (state == 0) { + rc = sfc_vdpa_virtq_stop(ops_data, vring); + if (rc != 0) { + sfc_vdpa_err(dev, "virtqueue stop failed: %s", + rte_strerror(rc)); + } + } else { + rc = sfc_vdpa_virtq_start(ops_data, vring); + if (rc != 0) { + sfc_vdpa_err(dev, "virtqueue start failed: %s", + rte_strerror(rc)); + } + } + + return rc; } static int -- 1.8.3.1