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 93CFCA00C5; Wed, 3 Aug 2022 13:32:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B9DC42BDC; Wed, 3 Aug 2022 13:31:39 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id D4F9142BC3 for ; Wed, 3 Aug 2022 13:31:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659526297; x=1691062297; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=USc/cCysHUCoxmqE2v7gZltYP/UltIzVZ5ZmhoiCpQs=; b=l7dqi1sSSCw/CeczDY5u0KLcwdS/+5zmqD4gmX32/jUq11oQ+n6Xk7JG apYVE5lI9xogPchn28YMLGQIs8LTiU44e7zKyk0LCM/H7NhIh57MIoH8f 5LGC3ifHVwV/5CkMZPDUzRbqTSPC4sxG+qMH4AM3Ijqh/3vC2Ig3fN3Qs uatwPxvCL3Rw1MjPAEWeBBgtVCZuSF1RdXGICz8iHrwsoxbYWaot2mHAE NSnhgdYqv2yMX9DP/AHcXYh/Swz8brgPbmVcnTgQEvbdOIq8Ww3soq8Fr v6P4WrOcvkRQ7f73J18UvqW8IUVF0EwsvLdndr7zHJIYNRu7wAHBzmpJD w==; X-IronPort-AV: E=McAfee;i="6400,9594,10427"; a="375948533" X-IronPort-AV: E=Sophos;i="5.93,214,1654585200"; d="scan'208";a="375948533" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2022 04:31:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,214,1654585200"; d="scan'208";a="692211106" Received: from dpdk-jf-ntb-v2.sh.intel.com ([10.67.118.246]) by FMSMGA003.fm.intel.com with ESMTP; 03 Aug 2022 04:31:35 -0700 From: Junfeng Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, junfeng.guo@intel.com Subject: [PATCH 10/13] net/idpf: add mtu configuration Date: Wed, 3 Aug 2022 19:31:01 +0800 Message-Id: <20220803113104.1184059-11-junfeng.guo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220803113104.1184059-1-junfeng.guo@intel.com> References: <20220803113104.1184059-1-junfeng.guo@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 mtu_set. Signed-off-by: Beilei Xing Signed-off-by: Junfeng Guo --- drivers/net/idpf/idpf_ethdev.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index 0b03ec860a..4b8e3c4d5b 100644 --- a/drivers/net/idpf/idpf_ethdev.c +++ b/drivers/net/idpf/idpf_ethdev.c @@ -34,6 +34,7 @@ static int idpf_dev_stop(struct rte_eth_dev *dev); static int idpf_dev_close(struct rte_eth_dev *dev); static int idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); +static int idpf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); int idpf_dev_link_update(struct rte_eth_dev *dev, @@ -72,6 +73,7 @@ static const struct eth_dev_ops idpf_eth_dev_ops = { .tx_queue_release = idpf_dev_tx_queue_release, .dev_infos_get = idpf_dev_info_get, .link_update = idpf_dev_link_update, + .mtu_set = idpf_dev_mtu_set, }; static int @@ -143,6 +145,18 @@ idpf_dev_info_get(__rte_unused struct rte_eth_dev *dev, struct rte_eth_dev_info return 0; } +static int +idpf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu __rte_unused) +{ + /* mtu setting is forbidden if port is start */ + if (dev->data->dev_started) { + PMD_DRV_LOG(ERR, "port must be stopped before configuration"); + return -EBUSY; + } + + return 0; +} + static int idpf_init_vport_req_info(__rte_unused struct rte_eth_dev *dev) { @@ -465,6 +479,13 @@ idpf_dev_start(struct rte_eth_dev *dev) vport->stopped = 0; + if (dev->data->mtu > vport->max_mtu) { + PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu); + goto err_mtu; + } + + vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD; + if (idpf_start_queues(dev)) { PMD_DRV_LOG(ERR, "Failed to start queues"); goto err_mtu; -- 2.25.1