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 5728D423C1; Fri, 13 Jan 2023 10:15:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0D6C42DA5; Fri, 13 Jan 2023 10:15:20 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 2F461410D4 for ; Fri, 13 Jan 2023 10:15:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673601317; x=1705137317; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OXukDbJaE3rjW56tJpmvs+fCckN4ntmEUvEkKiGmrKI=; b=hrWGNkPmZI8xSuU3w4aMA7lQMosxcbNwyN42Dkr40mM6EH/d0zYIdwgY k+m1mLAWytJtyS7omrpUWtWD4rqJRVTc4Lp7l+ijPQupYaQvgY566iFpS Nb4bnrzC6O9T3HNvDuWLzeWoT9VIgbJkJpPBXWJdbubBOVmzan+NQTb5j Ak7AjdwNX2nKouoBTP2x6oZVEn84xRKzF1hKRVwx+PIkfb8BcOfRPHQUk A4ATKg8Co+y86SKYLOF8UyOetfJBQE89ExkCrIoxAi35F+QdGGxHrS/6C X4a6n0l3/+ApEPwGpklkDPvEyuBnRtR23JJJ0Tn0DJg+t93RrdkpgKF9/ w==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="304332472" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="304332472" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 01:14:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="903522569" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="903522569" Received: from dpdk-mingxial-01.sh.intel.com ([10.67.119.167]) by fmsmga006.fm.intel.com with ESMTP; 13 Jan 2023 01:14:57 -0800 From: Mingxia Liu To: dev@dpdk.org, qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: wenjun1.wu@intel.com, Mingxia Liu Subject: [PATCH v2 04/21] net/cpfl: support device start and stop Date: Fri, 13 Jan 2023 08:19:14 +0000 Message-Id: <20230113081931.221576-5-mingxia.liu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230113081931.221576-1-mingxia.liu@intel.com> References: <20221223015558.3143279-1-mingxia.liu@intel.com> <20230113081931.221576-1-mingxia.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Add dev ops dev_start, dev_stop and link_update. Signed-off-by: Mingxia Liu --- drivers/net/cpfl/cpfl_ethdev.c | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c index a113ed0de0..05c3ad1a9c 100644 --- a/drivers/net/cpfl/cpfl_ethdev.c +++ b/drivers/net/cpfl/cpfl_ethdev.c @@ -185,12 +185,45 @@ cpfl_dev_configure(struct rte_eth_dev *dev) return 0; } +static int +cpfl_dev_start(struct rte_eth_dev *dev) +{ + struct idpf_vport *vport = dev->data->dev_private; + int ret; + + ret = idpf_vc_ena_dis_vport(vport, true); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed to enable vport"); + return ret; + } + + vport->stopped = 0; + + return 0; +} + +static int +cpfl_dev_stop(struct rte_eth_dev *dev) +{ + struct idpf_vport *vport = dev->data->dev_private; + + if (vport->stopped == 1) + return 0; + + idpf_vc_ena_dis_vport(vport, false); + + vport->stopped = 1; + + return 0; +} + static int cpfl_dev_close(struct rte_eth_dev *dev) { struct idpf_vport *vport = dev->data->dev_private; struct cpfl_adapter_ext *adapter = CPFL_ADAPTER_TO_EXT(vport->adapter); + cpfl_dev_stop(dev); idpf_vport_deinit(vport); adapter->cur_vports &= ~RTE_BIT32(vport->devarg_id); @@ -539,6 +572,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = { .rx_queue_setup = cpfl_rx_queue_setup, .tx_queue_setup = cpfl_tx_queue_setup, .dev_infos_get = cpfl_dev_info_get, + .dev_start = cpfl_dev_start, + .dev_stop = cpfl_dev_stop, .link_update = cpfl_dev_link_update, .dev_supported_ptypes_get = cpfl_dev_supported_ptypes_get, }; -- 2.25.1