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 F07A8A00C4; Sat, 29 Oct 2022 05:58:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C8EB94280E; Sat, 29 Oct 2022 05:57:55 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 0DEEE427EC for ; Sat, 29 Oct 2022 05:57:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667015866; x=1698551866; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oMQRVc+ustbPDp3T1l0Vo8SltdOE8k7HBV1G87h4uKM=; b=OKshGSSgKtzSzgqRFdrBgYTFxHJ2N/Pke67/DOlMPQRf75mDgLgxTuH1 JrUscJaRrQ/PRVQ0IaN5ObCpz2c0V0H/XGhDOQdY+/G4vzBfCuxaGs1Sf 5uD4RBnovM94mfx5AlBPzWRrK3lzOlswWZWozI/xXEIruPVSbUPGQ0EgH Cdz6xe33S4nBImDxI8gMYiI3glN5TZNBdQV8OJKVVbcKR66pMRtUh+tXo c9MxlojCzWAHJ4jPlt6/sokMzzBAp8anV96gnE09zaI90atR7AsFyq7g6 9JDz8Xx8dStrlSo+y+Q3cIwOJhid1s9Pmy0d6ZVZMrYa5YiC3VHRmtuQR w==; X-IronPort-AV: E=McAfee;i="6500,9779,10514"; a="296043731" X-IronPort-AV: E=Sophos;i="5.95,222,1661842800"; d="scan'208";a="296043731" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Oct 2022 20:57:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10514"; a="635523871" X-IronPort-AV: E=Sophos;i="5.95,222,1661842800"; d="scan'208";a="635523871" Received: from dpdk-beileix-3.sh.intel.com ([10.67.110.253]) by fmsmga007.fm.intel.com with ESMTP; 28 Oct 2022 20:57:43 -0700 From: beilei.xing@intel.com To: andrew.rybchenko@oktetlabs.ru, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, Junfeng Guo , Xiaoyun Li Subject: [PATCH v15 05/18] net/idpf: add support for device start and stop Date: Sat, 29 Oct 2022 03:27:16 +0000 Message-Id: <20221029032729.22772-6-beilei.xing@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20221029032729.22772-1-beilei.xing@intel.com> References: <20221027074729.1494529-1-junfeng.guo@intel.com> <20221029032729.22772-1-beilei.xing@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 From: Junfeng Guo Add dev ops dev_start, dev_stop and link_update. Signed-off-by: Beilei Xing Signed-off-by: Xiaoyun Li Signed-off-by: Junfeng Guo --- drivers/net/idpf/idpf_ethdev.c | 55 ++++++++++++++++++++++++++++++++++ drivers/net/idpf/idpf_rxtx.c | 20 +++++++++++++ 2 files changed, 75 insertions(+) diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index fb5cd1b111..621bf9aad5 100644 --- a/drivers/net/idpf/idpf_ethdev.c +++ b/drivers/net/idpf/idpf_ethdev.c @@ -29,6 +29,22 @@ static const char * const idpf_valid_args[] = { NULL }; +static int +idpf_dev_link_update(struct rte_eth_dev *dev, + __rte_unused int wait_to_complete) +{ + struct rte_eth_link new_link; + + memset(&new_link, 0, sizeof(new_link)); + + new_link.link_speed = RTE_ETH_SPEED_NUM_NONE; + new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; + new_link.link_autoneg = !(dev->data->dev_conf.link_speeds & + RTE_ETH_LINK_SPEED_FIXED); + + return rte_eth_linkstatus_set(dev, &new_link); +} + static int idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -267,6 +283,42 @@ idpf_dev_configure(struct rte_eth_dev *dev) return 0; } +static int +idpf_dev_start(struct rte_eth_dev *dev) +{ + struct idpf_vport *vport = dev->data->dev_private; + int ret; + + if (dev->data->mtu > vport->max_mtu) { + PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu); + return -EINVAL; + } + + vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD; + + /* TODO: start queues */ + + ret = idpf_vc_ena_dis_vport(vport, true); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed to enable vport"); + return ret; + } + + return 0; +} + +static int +idpf_dev_stop(struct rte_eth_dev *dev) +{ + struct idpf_vport *vport = dev->data->dev_private; + + idpf_vc_ena_dis_vport(vport, false); + + /* TODO: stop queues */ + + return 0; +} + static int idpf_dev_close(struct rte_eth_dev *dev) { @@ -656,6 +708,9 @@ static const struct eth_dev_ops idpf_eth_dev_ops = { .rx_queue_setup = idpf_rx_queue_setup, .tx_queue_setup = idpf_tx_queue_setup, .dev_infos_get = idpf_dev_info_get, + .dev_start = idpf_dev_start, + .dev_stop = idpf_dev_stop, + .link_update = idpf_dev_link_update, }; static uint16_t diff --git a/drivers/net/idpf/idpf_rxtx.c b/drivers/net/idpf/idpf_rxtx.c index 25dd5d85d5..3528d2f2c7 100644 --- a/drivers/net/idpf/idpf_rxtx.c +++ b/drivers/net/idpf/idpf_rxtx.c @@ -334,6 +334,11 @@ idpf_rx_split_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, if (check_rx_thresh(nb_desc, rx_free_thresh) != 0) return -EINVAL; + if (rx_conf->rx_deferred_start) { + PMD_INIT_LOG(ERR, "Queue start is not supported currently."); + return -EINVAL; + } + /* Setup Rx description queue */ rxq = rte_zmalloc_socket("idpf rxq", sizeof(struct idpf_rx_queue), @@ -465,6 +470,11 @@ idpf_rx_single_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, if (check_rx_thresh(nb_desc, rx_free_thresh) != 0) return -EINVAL; + if (rx_conf->rx_deferred_start) { + PMD_INIT_LOG(ERR, "Queue start is not supported currently."); + return -EINVAL; + } + /* Setup Rx description queue */ rxq = rte_zmalloc_socket("idpf rxq", sizeof(struct idpf_rx_queue), @@ -569,6 +579,11 @@ idpf_tx_split_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, if (check_tx_thresh(nb_desc, tx_rs_thresh, tx_free_thresh) != 0) return -EINVAL; + if (tx_conf->tx_deferred_start) { + PMD_INIT_LOG(ERR, "Queue start is not supported currently."); + return -EINVAL; + } + /* Allocate the TX queue data structure. */ txq = rte_zmalloc_socket("idpf split txq", sizeof(struct idpf_tx_queue), @@ -691,6 +706,11 @@ idpf_tx_single_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, if (check_tx_thresh(nb_desc, tx_rs_thresh, tx_free_thresh) != 0) return -EINVAL; + if (tx_conf->tx_deferred_start) { + PMD_INIT_LOG(ERR, "Queue start is not supported currently."); + return -EINVAL; + } + /* Allocate the TX queue data structure. */ txq = rte_zmalloc_socket("idpf txq", sizeof(struct idpf_tx_queue), -- 2.26.2