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 740B0A0C45; Thu, 28 Oct 2021 09:57:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 84FC841140; Thu, 28 Oct 2021 09:57:09 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2083.outbound.protection.outlook.com [40.107.243.83]) by mails.dpdk.org (Postfix) with ESMTP id 8FBC141140 for ; Thu, 28 Oct 2021 09:57:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UiomU5orNqqCdmjd4D2+qfMbDWBQeJjFFpUOsdudwPBSdf1CSumfeAPIeZtNjdEG7KBVyFiNURXmbaEpgC4BCXQ23gbgvIQrqjmh7Z1X6mwqDmhE+UFpmsjKZDkuAXj5HTcKcRakpnddxnaJeOnaM7xpYbZ63wJ4BTdIIQXqYxqgjP+J9GD+AuKewTAWsevmL5qRoBEWxm2JsMY+D72/jrwEBuHHU8/ifPOYAtqBOpddec03UhbbNPRLidAq42UCVvgaYpMc6xw5nKB1XkQ6lFjoTXxgfnlgfd0ILWrxMQRsHdUtxOIkAafAOLOwFcJxATlNSlx0J4JD8RSCYfsrfg== 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=EzTW43/BOV7NOCMK1xaLXfEaDOrBbd0V5WiV01vb9gk=; b=G8nxD1iD9rXlkrRH2oiZ6FI4Y+xDrcrQ/EfeCWCtksI9iLxDkemNVgqesTOOGNVxZI+PKsjXSL1UohFuUHU01u5+cbsqoge+2YkI/EV1ulaerowvcnUTPPkyj3t3Mjn9mhVJ76zR29SVRTjT07oJzcXQ8hHSscYDqOnkU0P4UETHZr82RrVE4yP8UG7p8WJUmQsIF3Pw/9AlEiPhvibbB33bUrfNwjWJGTm8ioaSIVj8gyKtKzde4nD3f8YzQjPKt06sonePEyoEMlzSOOMZVpC4R9yc/atX8HS/JDKDVE9Wj3mMdj0dKSZ5O1hjo2OE9GzKUvZKah6CnL0bDmv4lg== 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=EzTW43/BOV7NOCMK1xaLXfEaDOrBbd0V5WiV01vb9gk=; b=ig0dqfIJPvqnBZB2Vahtgn9nha0lAnqARomxl4QOw3/KVVVFtZvpmeAiJjO6WddzNa7RgueLdZ8/UtT6y8EMUUMeV9uUQVi2AFlasi8g4ltFq0ln7zl2M1Kg8IIs9p1rVBa0kQB9lyhIcUJbp6mRsCazxRCEbEqi6fRRaMGFYhI= Received: from BN6PR22CA0065.namprd22.prod.outlook.com (2603:10b6:404:ca::27) by BYAPR02MB5095.namprd02.prod.outlook.com (2603:10b6:a03:70::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Thu, 28 Oct 2021 07:57:03 +0000 Received: from BN1NAM02FT047.eop-nam02.prod.protection.outlook.com (2603:10b6:404:ca:cafe::42) by BN6PR22CA0065.outlook.office365.com (2603:10b6:404:ca::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15 via Frontend Transport; Thu, 28 Oct 2021 07:57:03 +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 BN1NAM02FT047.mail.protection.outlook.com (10.13.3.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4649.14 via Frontend Transport; Thu, 28 Oct 2021 07:57:02 +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.14; Thu, 28 Oct 2021 00:57:01 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Thu, 28 Oct 2021 00:57:01 -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=35870 helo=xndengvm004108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mg0HV-0005p5-34; Thu, 28 Oct 2021 00:57:01 -0700 From: Vijay Srivastava To: CC: , , , Vijay Kumar Srivastava Date: Thu, 28 Oct 2021 13:24:51 +0530 Message-ID: <20211028075452.11804-10-vsrivast@xilinx.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20211028075452.11804-1-vsrivast@xilinx.com> References: <20210706164418.32615-1-vsrivast@xilinx.com> <20211028075452.11804-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: b47f38ef-499a-4fba-c6a8-08d999e8873b X-MS-TrafficTypeDiagnostic: BYAPR02MB5095: 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: M/24hR65yYLrW7xAp+NLQdWUPJFkFTFrXoYIjc5HS+kBHaiztsHNUJz5cmqpaSTkatmkl8RKWBPBjliBxJNRgiW4XKQsSvn+jefi7SbSWWNs4NK/meFuXvBrSPGpVFWfbSfm2ZWfS3/V5QqKCcPDCyea9Hx5wgwDhXL1Sgk9PLXOFIA0B83oHWOxQ2jHh6cprD+mIAdaPovMdwIHoqbs3Fhs5GhhSP2XSHpm7LH5LIVgOW03j3puRx577K2ISOYhxjXZnyWT11PQPF0789/BH6/QeiziYe4uxVlKidsL6CCyA6tkemepIz2JoOLRCnGHlV9SoT7rdXAzGwg1sXs8jURdbFH214Utd+LoS1I14RnnTWvowSkDFbgjHYKDARQiC1hyUio4+tm8r215YWnKom6/Q5aONDFRxpaxHC93OGnVchLN8gQddGB48IMA9Q9S7Rl91Nm/3yXxPpnfyoef988Dv1ME99afEy7CDhtEuExpIGkUT0VTmorMlggh7KAq8QKcKBI98/1Gbre/MIQy/uO46zgP5btdcM1AJ/82jnDX0QiTn6v7DevJzlGfy/ecf1OAhOG6BHptZ7mdiZOG6ZoNHiqban5kiYNnh5R111F4KM8XLP5Z9FIQJPYRoTJs4lqTsXWNlWAmD+0kJviwScyVqK2JtL1ur3q4HhxUY3LuckLHc/VG4P+rGalMorQzlGUzk/4Zd+0EMuhJoN8BcDt6um2ZfphXd4KkkJsR3io= 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:(36840700001)(46966006)(6666004)(2616005)(5660300002)(316002)(7696005)(508600001)(6916009)(82310400003)(36906005)(54906003)(36860700001)(336012)(83380400001)(8936002)(8676002)(426003)(4326008)(186003)(9786002)(107886003)(47076005)(36756003)(356005)(7636003)(70206006)(1076003)(2906002)(44832011)(26005)(70586007)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2021 07:57:02.8610 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b47f38ef-499a-4fba-c6a8-08d999e8873b 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: BN1NAM02FT047.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5095 Subject: [dpdk-dev] [PATCH v2 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 8551b65..3430643 100644 --- a/drivers/vdpa/sfc/sfc_vdpa_ops.c +++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c @@ -719,11 +719,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