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 77B91A0581; Thu, 20 Oct 2022 12:39:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4309F42D3B; Thu, 20 Oct 2022 12:38:51 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id A703442D19 for ; Thu, 20 Oct 2022 12:38:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666262326; x=1697798326; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=301zoO50jmbJkPfMjybLjSdiwDO6q14jbHYUVKxunCI=; b=CPJOHEGhX2Gm67uw7GpOweZ5ebVdPQQV+k8oXS4lF/HFxH2p2R8lEz1N /dhhkHHUejDDaivS3CdOiVpOknmlRTmxseLVighS0N2yGKD6iqtyGzmmt zB2z8H9BlUhkvYULihREn4Nqe2nZ/mzr1zbTYIF9JeeRpkK3GHXWky4IS VOxNZoHIua+wFaaXU3XFCcEjSrbmFa04cRvymBZMPsIKVxxX8U2ZPnFX8 jmCEOZVjD/f9K1GECJaUBV6ohD2mZNtePM79ah64EPouGivFktIwbkovc d8PNFZQmXaRLBf9iforZonTKHILVHHuoziofZv/lRFyf7AXVJuyBlXXJE A==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="308354915" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="308354915" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 03:38:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="698582896" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="698582896" Received: from dpdk-jf-ntb-one.sh.intel.com ([10.67.111.104]) by fmsmga004.fm.intel.com with ESMTP; 20 Oct 2022 03:38:43 -0700 From: Junfeng Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, ferruh.yigit@xilinx.com, beilei.xing@intel.com Cc: dev@dpdk.org, xiaoyun.li@intel.com, awogbemila@google.com, bruce.richardson@intel.com, hemant.agrawal@nxp.com, stephen@networkplumber.org, chenbo.xia@intel.com, helin.zhang@intel.com, Junfeng Guo Subject: [PATCH v6 5/8] net/gve: add support for MTU setting Date: Thu, 20 Oct 2022 18:36:53 +0800 Message-Id: <20221020103656.1068036-6-junfeng.guo@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221020103656.1068036-1-junfeng.guo@intel.com> References: <20221010101757.878317-2-junfeng.guo@intel.com> <20221020103656.1068036-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 Support dev_ops mtu_set. Signed-off-by: Xiaoyun Li Signed-off-by: Junfeng Guo --- doc/guides/nics/features/gve.ini | 1 + drivers/net/gve/gve_ethdev.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/doc/guides/nics/features/gve.ini b/doc/guides/nics/features/gve.ini index ae466ad677..d1703d8dab 100644 --- a/doc/guides/nics/features/gve.ini +++ b/doc/guides/nics/features/gve.ini @@ -5,6 +5,7 @@ ; [Features] Link status = Y +MTU update = Y Linux = Y x86-32 = Y x86-64 = Y diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c index ca4a467140..1968f38eb6 100644 --- a/drivers/net/gve/gve_ethdev.c +++ b/drivers/net/gve/gve_ethdev.c @@ -94,12 +94,39 @@ gve_dev_close(struct rte_eth_dev *dev) return err; } +static int +gve_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) +{ + struct gve_priv *priv = dev->data->dev_private; + int err; + + if (mtu < RTE_ETHER_MIN_MTU || mtu > priv->max_mtu) { + PMD_DRV_LOG(ERR, "MIN MTU is %u MAX MTU is %u", RTE_ETHER_MIN_MTU, priv->max_mtu); + return -EINVAL; + } + + /* 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; + } + + err = gve_adminq_set_mtu(priv, mtu); + if (err) { + PMD_DRV_LOG(ERR, "Failed to set mtu as %u err = %d", mtu, err); + return err; + } + + return 0; +} + static const struct eth_dev_ops gve_eth_dev_ops = { .dev_configure = gve_dev_configure, .dev_start = gve_dev_start, .dev_stop = gve_dev_stop, .dev_close = gve_dev_close, .link_update = gve_link_update, + .mtu_set = gve_dev_mtu_set, }; static void -- 2.34.1