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 6A035A0552; Fri, 21 Oct 2022 07:21:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D8F942BF0; Fri, 21 Oct 2022 07:20:17 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id F2BBC42BE5 for ; Fri, 21 Oct 2022 07:20:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666329613; x=1697865613; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pS16UMCO+mQqL3FaOqqBhs3C1G0XhlnDcwaPZzXeqfY=; b=bEKHLayGNNvKVTcK3ryjL4uRkZB2mtpAqLMkLicgdrTrmDWAFuA25bxC UZxCtUKJSQssLaS8Vv/iX5ufOKRNoWE2jtXaM/5EwBQyPTu52Jih+UUvS 1zGWu+Sg1qLq7oRGKI44JBR1d8t4e4qqRwm1BDdlfn9uY4BxJxmnxrLNe HYYhNqE9jT1XKYVloydPmjRe+/94aveQ9WAsgYBL6T+R0nf2S5WyhZyz3 rkaQv9JSS+AH+AIm8CCnDlP/xnOgSPTlcJDjmbOdnYE3bfXrb6NW3nu8g LjJlqwEUaHreQ24TQID901hNFbLkdTRWiecL34j21SFx058GzCduVp1jF A==; X-IronPort-AV: E=McAfee;i="6500,9779,10506"; a="371128611" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="371128611" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 22:20:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10506"; a="772826449" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="772826449" Received: from dpdk-jf-ntb-one.sh.intel.com ([10.67.111.104]) by fmsmga001.fm.intel.com with ESMTP; 20 Oct 2022 22:20:10 -0700 From: Junfeng Guo To: andrew.rybchenko@oktetlabs.ru, qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, Junfeng Guo Subject: [PATCH v9 11/14] net/idpf: add support for MTU configuration Date: Fri, 21 Oct 2022 13:18:18 +0800 Message-Id: <20221021051821.2164939-12-junfeng.guo@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221021051821.2164939-1-junfeng.guo@intel.com> References: <20221020062951.645121-2-junfeng.guo@intel.com> <20221021051821.2164939-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 --- doc/guides/nics/features/idpf.ini | 1 + drivers/net/idpf/idpf_ethdev.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/doc/guides/nics/features/idpf.ini b/doc/guides/nics/features/idpf.ini index 36dec39b9f..ee3f6e7c6f 100644 --- a/doc/guides/nics/features/idpf.ini +++ b/doc/guides/nics/features/idpf.ini @@ -10,6 +10,7 @@ Queue start/stop = Y Runtime Rx queue setup = Y Runtime Tx queue setup = Y +MTU update = Y TSO = P L3 checksum offload = P L4 checksum offload = P diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index cc1cfe402b..803c0d7e12 100644 --- a/drivers/net/idpf/idpf_ethdev.c +++ b/drivers/net/idpf/idpf_ethdev.c @@ -32,6 +32,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); static void idpf_adapter_rel(struct idpf_adapter *adapter); int @@ -70,6 +71,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 @@ -83,6 +85,9 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->min_rx_bufsize = IDPF_MIN_BUF_SIZE; dev_info->max_rx_pktlen = IDPF_MAX_FRAME_SIZE; + dev_info->max_mtu = dev_info->max_rx_pktlen - IDPF_ETH_OVERHEAD; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; + dev_info->flow_type_rss_offloads = IDPF_RSS_OFFLOAD_ALL; dev_info->max_mac_addrs = IDPF_NUM_MACADDR_MAX; dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | @@ -131,6 +136,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) { @@ -429,6 +446,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.34.1