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 8E2E3A054F; Mon, 5 Sep 2022 12:59:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 38FCF42B8C; Mon, 5 Sep 2022 12:59:00 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 63A6D4114A for ; Mon, 5 Sep 2022 12:58:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662375538; x=1693911538; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ev5IREo4kkx/scWFdNdcqEWrCQkf++QLkp5Vajl1C/c=; b=Gtti6O6Uc8PldIhwdwuMe9z8zGZ6bYpPZ6n8r0ocKSdTHz/V47Rsukd9 K/GbxIUah2E2t5HKt9w9EU3L30IVNtIAUvPmbgmvg8ox/w+rwBipAQf5j DOBibf56IvwXrgKzjenhCp0gUcQg9mpL/m6UxSBDo/PqZH3O8JerxTijS kDP4Ek62dHVB7gk4RfkXdx1RJM+Av6tsh8yYk9mb6sVIPQqYgDBjmT4EH 1ofKTSI8wt7uJnbmyTTQ2WF6p3ABBFBtatbPaYDirqEeRat6uQ4tNLdzC 6MEoBzbB06lG9TZQBCpTC/jgvP/7myNhj1E1apidHsG3j/WaeySZQNnlY Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10460"; a="297676335" X-IronPort-AV: E=Sophos;i="5.93,291,1654585200"; d="scan'208";a="297676335" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2022 03:58:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,291,1654585200"; d="scan'208";a="682023921" Received: from dpdk-jf-ntb-v2.sh.intel.com ([10.67.118.246]) by fmsmga004.fm.intel.com with ESMTP; 05 Sep 2022 03:58:56 -0700 From: Junfeng Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, xiao.w.wang@intel.com, junfeng.guo@intel.com Subject: [PATCH v2 10/14] net/idpf: add support for mtu configuration Date: Mon, 5 Sep 2022 18:58:24 +0800 Message-Id: <20220905105828.3190335-11-junfeng.guo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905105828.3190335-1-junfeng.guo@intel.com> References: <20220803113104.1184059-1-junfeng.guo@intel.com> <20220905105828.3190335-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 b1e2ca21ca..6b3e7eff89 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, @@ -71,6 +72,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 @@ -151,6 +153,18 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *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(struct rte_eth_dev *dev) { @@ -474,6 +488,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