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 60897A0093; Fri, 23 Dec 2022 03:52:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DFC4542D1D; Fri, 23 Dec 2022 03:51:54 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 381E042D19 for ; Fri, 23 Dec 2022 03:51:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671763911; x=1703299911; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G8KHlsrHESA9p4/lG+ZzOxQQFTdQGmkilrI9wLTgk4M=; b=BF/rgW42jwUhjJpfFQUxo81unjSkR2uApFjD0vnujU/itCgfVm0Iij2E 90iZX9IfUUJMe3HBTs+tpydPs9Fdtx5ndufI5Iwl9TJulF4i7NN5GJv+F T4+V/0N61e7AOtgGGMXuN4kSTsKZ8zD4jm0xkXoCw0SAEEoNP7tRa4DP9 rCOLUnk8AiaYqdYO5/pNXeV9mh2JDh18leisZ8O4wr9iAf1N62igFhclz 8DXl/Rl4mWhDkBS7e3inJLlEfLe3bA5n88iku2Q/j8CLGv8TuOCoxCL0p ELOE5A/fNSCQRvA6kYZ2Vqyhq+6BijYsUfllXr8WD6/SuGAovNdTYmaFR g==; X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="321467094" X-IronPort-AV: E=Sophos;i="5.96,267,1665471600"; d="scan'208";a="321467094" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2022 18:51:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="629707152" X-IronPort-AV: E=Sophos;i="5.96,267,1665471600"; d="scan'208";a="629707152" Received: from dpdk-mingxial-01.sh.intel.com ([10.67.119.112]) by orsmga006.jf.intel.com with ESMTP; 22 Dec 2022 18:51:49 -0800 From: Mingxia Liu To: dev@dpdk.org Cc: jingjing.wu@intel.com, beilei.xing@intel.com, qi.z.zhang@intel.com, Mingxia Liu Subject: [PATCH 04/21] net/cpfl: support device start and stop Date: Fri, 23 Dec 2022 01:55:41 +0000 Message-Id: <20221223015558.3143279-5-mingxia.liu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221223015558.3143279-1-mingxia.liu@intel.com> References: <20221223015558.3143279-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 | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c index 6d1992dd6e..4c259f24e8 100644 --- a/drivers/net/cpfl/cpfl_ethdev.c +++ b/drivers/net/cpfl/cpfl_ethdev.c @@ -184,12 +184,55 @@ 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; + + vport->stopped = 0; + + if (dev->data->mtu > vport->max_mtu) { + PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu); + ret = -EINVAL; + goto err_mtu; + } + + vport->max_pkt_len = dev->data->mtu + CPFL_ETH_OVERHEAD; + + ret = idpf_vc_ena_dis_vport(vport, true); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed to enable vport"); + return ret; + } + + return 0; +err_mtu: + return ret; +} + +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); @@ -538,6 +581,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