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 15ACFA00C2; Mon, 31 Oct 2022 10:04:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2DACE40F16; Mon, 31 Oct 2022 10:04:25 +0100 (CET) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 3D4A740151 for ; Mon, 31 Oct 2022 10:04:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667207058; x=1698743058; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oMQRVc+ustbPDp3T1l0Vo8SltdOE8k7HBV1G87h4uKM=; b=SDZY/WdzEl4SpQUzWu9mxWz45tBHnxQ/LbWy9Xhuj1cL+kjHs1+/GPJP QwQ1gi10sDzsRX/7+5u+gCuNdHgEh+B9R5nP0qLbtUn1IIfcvnzf97h1N 5NjPYko6PT0G5XE1yY4lXMmH/YlIS8ya7rmOPuathg67m6J0PPWymJDU5 a88X8rBweKIvAaPohgGNTHZmQLc5e13IRMiXwxLCWxgvsKm1Y4Yswx29Y kLox5MAPIVEhcLtrpc7C1+5UIjlHXulQQVeGn3Eq/5nm1TRDbNw0jZByG zPd2mdzz6m8uF1gqjduEo9RX2EEFx3N+hqB2t1nheBDNv68R9VSgH7NxG w==; X-IronPort-AV: E=McAfee;i="6500,9779,10516"; a="370926291" X-IronPort-AV: E=Sophos;i="5.95,227,1661842800"; d="scan'208";a="370926291" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2022 02:04:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10516"; a="878664809" X-IronPort-AV: E=Sophos;i="5.95,227,1661842800"; d="scan'208";a="878664809" Received: from dpdk-beileix-3.sh.intel.com ([10.67.110.253]) by fmsmga006.fm.intel.com with ESMTP; 31 Oct 2022 02:04:06 -0700 From: beilei.xing@intel.com To: jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, Junfeng Guo , Xiaoyun Li Subject: [PATCH v18 05/18] net/idpf: add support for device start and stop Date: Mon, 31 Oct 2022 08:33:33 +0000 Message-Id: <20221031083346.16558-6-beilei.xing@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20221031083346.16558-1-beilei.xing@intel.com> References: <20221031051556.98549-1-beilei.xing@intel.com> <20221031083346.16558-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