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 9968FA0C4A; Wed, 7 Jul 2021 10:26:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D72D8414A4; Wed, 7 Jul 2021 10:25:38 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2041.outbound.protection.outlook.com [40.107.220.41]) by mails.dpdk.org (Postfix) with ESMTP id 3626A4120E for ; Tue, 6 Jul 2021 18:50:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FpFhN+TqWBIg7VfRja8ju+Npvzgsz4NLElXS3oY+psh3woPsSlbjQ7MqyWkn9oLwPdEH1qczC8vejK8Ov9WH9d5Y9H2I/ROY/C4uJ6s9Otv6DLvwUGJXt45skEnZ/YuY3wyWsgx0ayRlYacrTPnvRcLrqSO1XEPLPUEjBtmhhIXgoAOXhqjWwI4cb+77FEBjEnErPfiNOEgQ/rrZy2ArpsNwzzd2B49aHwK6pBkeUGitS6X9NwTbDcGJ5F1HSFDZ1zwCOdMdihLK9QCZ1UdWIwbOsCOvkP8bwCseWdt7R4v0gDZjHPdWcYTh4T15uIyVG4cygLpfvHKMXLz4BCMkzw== 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-SenderADCheck; bh=TE1IX3aHkjeeOZGvMCKvVlDV7CZr3bsC207SN/iwpzk=; b=ge33O4VjRmYoyx4YcVJDIOkQ5ITHQtxzxsn9k1rcniNL2Z6KHg7M8eHmWjeKMJ38ZjXaZ54LBDmVS97/bTfTMIHrUe2aBMFTsugXjOYNHaC1RabmeHZyh4IKX3071uLGnPJ2ERijPZBXOs1WcnTXM14qqzHG4ddc8ktav56hK63e2O74odK7C+JQyuFsBREdC5wRn485MXWbdt3cZTP/6HY/O3YSrhK11e8svCb1j0yCGlsyDdQ7GFiC9YFVvK0B684cjBNByugTkzsSn7uAoXXAepAQ6DgV4IJvuX0EpAdbd1ZrQxQjQR+A2nw0f/5nFJX9Wke0/4lQBIsYwAWqzQ== 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=TE1IX3aHkjeeOZGvMCKvVlDV7CZr3bsC207SN/iwpzk=; b=p2NOi+fIG5DzAxZzP6KDOWFsJk1ghA2Tj8fb9Ue94d7klApvZRFpkKszSG4CqnMzyNztoS55KbAqSBi7c4li4tKgz8blZ0wlDtt6vJh5nf2xvEzMxyBjyw5cF16OX9xbH7SXQLzKre4nvZVXYLEkKxlvq4hhQn30smE8lau35wI= Received: from BN9PR03CA0497.namprd03.prod.outlook.com (2603:10b6:408:130::22) by BYAPR02MB5320.namprd02.prod.outlook.com (2603:10b6:a03:61::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22; Tue, 6 Jul 2021 16:50:20 +0000 Received: from BN1NAM02FT029.eop-nam02.prod.protection.outlook.com (2603:10b6:408:130:cafe::56) by BN9PR03CA0497.outlook.office365.com (2603:10b6:408:130::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.19 via Frontend Transport; Tue, 6 Jul 2021 16:50:20 +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-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by BN1NAM02FT029.mail.protection.outlook.com (10.13.2.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4287.22 via Frontend Transport; Tue, 6 Jul 2021 16:50:19 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 6 Jul 2021 09:50:19 -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.2 via Frontend Transport; Tue, 6 Jul 2021 09:50:19 -0700 Envelope-to: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com, andrew.rybchenko@oktetlabs.ru Received: from [10.177.4.108] (port=54950 helo=xndengvm004108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1m0oH4-0000pF-Hr; Tue, 06 Jul 2021 09:50:19 -0700 From: Vijay Srivastava To: CC: , , , Vijay Kumar Srivastava Date: Tue, 6 Jul 2021 22:14:17 +0530 Message-ID: <20210706164418.32615-10-vsrivast@xilinx.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20210706164418.32615-1-vsrivast@xilinx.com> References: <20210706164418.32615-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: 5dfb4268-cc9e-4013-0594-08d9409e23d2 X-MS-TrafficTypeDiagnostic: BYAPR02MB5320: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:124; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KEIffY0PgnmVWquK1G+jfZlUzQSoP/fSf9CQ8+KEL95+rw7liY/riW5+LYSV0KGx86MI+44jjf6J/xAa/QYmzxVBrE+byz8yTNATFt8a6urDNKye/sfhsySPQjA3Ll5rq/owZqpBqKt12aUG1tlO+7OqR8Dz2fcjQpLxegnd5vtWHn7dhuVVy2xaBaGA2hk6pHvHc21MKIl5UQHENntqG5Yb5dScLdD+fzBkTb+Bf2AnpBLkNy/PIKwaoXIbKZEN/tzSUkC+G1cs0C+SRWPjVXCs2D0b262rStZ3Pzn97l0SRcx4wwJ5Osmnj3RwlS2/W9wyDkAI+Tnl6sBo/ae5RYN1CYnbkY2t+rve65F91pPJinYm0v+CbPk+o0+23DOBWqqXG1unrm0oeaZT7AuZDYtbO/EWhGLbzG2YJRzfU5i2eTSI0xLra7hvCUX3PpjZCSCcQdrr51VmuNbcVtiRu+PSdxedcNfsvd59LSRN6ycUhcvXlJlnWxd/l4ajEaGfv+T9j8Hby6CvYR/9gCklOQYlMkaPi8MgVzmysP2XtwvS/x1Ms7NofhWO4H9khgQIl79Iw3LqmhFIZi5VEGT7aqa729UA+QLDgliuDaOk7pWrdheh9RJc5zQ4mPm/Fvh5OpDg3by2qzQkXTCCArUKNpnoue6tq/0o25lw1DZ13kfIcrHMnPaAJ1vuUDPNGxibo8MkJsgg2byUyHJ0/v4+PKn+kJysBF7nfFO+I1rX2Vo= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(46966006)(36840700001)(426003)(336012)(36860700001)(44832011)(2616005)(70206006)(36756003)(8676002)(356005)(83380400001)(7636003)(36906005)(70586007)(82740400003)(9786002)(6916009)(54906003)(47076005)(5660300002)(82310400003)(8936002)(107886003)(478600001)(2906002)(7696005)(316002)(26005)(1076003)(4326008)(186003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2021 16:50:19.8203 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5dfb4268-cc9e-4013-0594-08d9409e23d2 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-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT029.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5320 X-Mailman-Approved-At: Wed, 07 Jul 2021 10:25:28 +0200 Subject: [dpdk-dev] [PATCH 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 --- 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 f14b385..5a3b766 100644 --- a/drivers/vdpa/sfc/sfc_vdpa_ops.c +++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c @@ -716,11 +716,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