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 54D6EA0547; Fri, 29 Oct 2021 16:49:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 46E9C41238; Fri, 29 Oct 2021 16:49:25 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2041.outbound.protection.outlook.com [40.107.212.41]) by mails.dpdk.org (Postfix) with ESMTP id 2CEAB426D5 for ; Fri, 29 Oct 2021 16:49:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CUytpxHwCOlrJoRP5zZTzdyOPf5GFeTcZf2Vr8Yv0tVpFWNNvFe2CTwBdSiS9yUO5GYHRGZ1pDwPvkNCe3tSLifH16AplnSwzNwMOFJd7VV/+BQWqU9FEql0vecXuy6K7uPWkjSzcSqXdUy+IpJSO66BSLlS3H7jORjuPpwCMUmPYxUNB5/mFzW1PmCxsl4mp8HSqaadwBKy+x1zXYbg5M94XxQk3gnDti3G5X+B+vXc9OT0XWyR4+oahhxCBMh+7EXBXU22zD52omTSCvfnTNRLfQIUf0wphjm0ukJTIUcCMCCJcao/HpSv/xIyPPu9NL28SQis75mhqR12PvOM+w== 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=wUBE10ountwhKucK8xKGLfllPeot6fsSBegRcuO3miA=; b=VQdDf7Pb7QI5aR19kNdYqoFcYX8OuE6OFzNn6H5Pc/DTkbvINawbT8tmHpbUaL1ypiQO3irPRkILWUtoPvRPJ1KggWgkx4yy4GMrxf5L6PTtFeoR2+Q6gfsv1lzXzQecad8LHZl0cZmmTL9gs20laV6FjWpdWnYr18960FLX+x9NMnATdn1Wic288rAxIMzVsdSnfC9NJjOn1icYjN63H28hJ2v7U31K571Ezm5cHx0+Daut9wndblPxKJ4a2nmdFFTqkTwseeaICk2jGSZJNI9ipDW1ld1Fc+D7ukJnX0HAIfyBMxoVNAA1fJnwy+7f3D498uRlxVgFVkuVt7lncQ== 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=wUBE10ountwhKucK8xKGLfllPeot6fsSBegRcuO3miA=; b=hOU7FWGF2yMb70QkfGAnVacIxdmGfp8fuj5xgzZykX+QGWdArcYnEzAsUyvkPmJohsuNch4FHSKuaBcEbTljKMxoFmFseqy3NiearUNM5Umd3JlF1hfktsOEqk9KH1BxSAP3Yc+etI+KDd9Mu6JYJoGt7a6ETVh6nwzJ2i6kVoE= Received: from DM5PR2201CA0023.namprd22.prod.outlook.com (2603:10b6:4:14::33) by BYAPR02MB5559.namprd02.prod.outlook.com (2603:10b6:a03:a1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Fri, 29 Oct 2021 14:49:20 +0000 Received: from DM3NAM02FT022.eop-nam02.prod.protection.outlook.com (2603:10b6:4:14:cafe::4a) by DM5PR2201CA0023.outlook.office365.com (2603:10b6:4:14::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15 via Frontend Transport; Fri, 29 Oct 2021 14:49: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 DM3NAM02FT022.mail.protection.outlook.com (10.13.5.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4649.14 via Frontend Transport; Fri, 29 Oct 2021 14:49:20 +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; Fri, 29 Oct 2021 07:48:44 -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; Fri, 29 Oct 2021 07:48:44 -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=36706 helo=xndengvm004108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mgTBT-0008YO-MQ; Fri, 29 Oct 2021 07:48:44 -0700 From: Vijay Srivastava To: CC: , , , Vijay Kumar Srivastava Date: Fri, 29 Oct 2021 20:16:44 +0530 Message-ID: <20211029144645.30295-10-vsrivast@xilinx.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20211029144645.30295-1-vsrivast@xilinx.com> References: <20210706164418.32615-1-vsrivast@xilinx.com> <20211029144645.30295-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: ac9615e9-81e8-4a1c-e612-08d99aeb4a65 X-MS-TrafficTypeDiagnostic: BYAPR02MB5559: 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: 1oUGtcj5jMHr0tLzrAS7osq1I27D5eNg2jgx8HqMGkUtG/JocsdIIxgUOC2K0T8MX/XA11eFQitnwnp5tTQWrjdIVNDW2wOteIiysiNYbjl0NM23IJPYBseDznBvdwj3YD7OAA3fgGHnTk1H8RJb5BhlMlFPbTBW/Fcn+sWpYxDKI7fl3Ug8eU3w/0kAtLw2+xMOWHsoqaU/HytoRRwtBjcvthRR9oMi2RUXskwVR+0GiPHMtL0ikY8sDrdKCx31oxe8fpNp7XhhXnGbTRXsHGUkFB7Y8kTICm3tduwo/zDe/0D2qN7j9LjEhy/wj/vaPIWRnBJxbZVHreuW6szVXoyvVpFulxmyTvBgpOnjnQu9j4AfkouS47g1aGMffEmxH2F/EX9kxA5ivcUzWRycY2Vb19MSEg75IPMrOfpZ4sALRWFiVTwhT6m6hn+MUBv4XdYK5zhUMW4ySBBZtoi+0jkRF1on7GlgtadOK/flf0qKTZvZr+qfLhUIdCNIFhboJ/frGUGATGo+EyHdLcGHp2Steq/fvWtLdVwilEg+ZskMhNhDtCjsW3vNKCaknPAXBmHk7oJcGLTs6TOkiyZ/Q0kGsG6xyqFa6xSfM41MuVzxL4UeEGEV2ru9wCUbMefXJbr5ZUB/voVPRHKSasdFXMevf9BeOT5kY4Y4qolOmuVOiAuy33m7Y/uQNgZuJ+g6Te0Ms8B5zG+tZwSeQGv64l1iZJp2x60lfNQe41N9PkM= 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)(7636003)(356005)(82310400003)(4326008)(26005)(2906002)(36860700001)(6916009)(8676002)(36906005)(2616005)(508600001)(186003)(9786002)(107886003)(336012)(8936002)(7696005)(426003)(70586007)(36756003)(44832011)(70206006)(54906003)(1076003)(5660300002)(47076005)(316002)(83380400001)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2021 14:49:20.4920 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac9615e9-81e8-4a1c-e612-08d99aeb4a65 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: DM3NAM02FT022.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5559 Subject: [dpdk-dev] [PATCH v3 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 --- 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