From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 9DEFB31FC for ; Wed, 17 Apr 2019 15:31:00 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2019 06:30:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,362,1549958400"; d="scan'208";a="338441353" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.206]) by fmsmga005.fm.intel.com with ESMTP; 17 Apr 2019 06:30:57 -0700 Date: Wed, 17 Apr 2019 21:25:13 +0800 From: Ye Xiaolong To: David Marchand Cc: dev , Ferruh Yigit , Qi Zhang , Karlsson Magnus , Topel Bjorn Message-ID: <20190417132513.GA111540@intel.com> References: <20190417085653.110559-1-xiaolong.ye@intel.com> <20190417085653.110559-3-xiaolong.ye@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v3 2/4] net/af_xdp: specify minimal and maximal MTU X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2019 13:31:01 -0000 On 04/17, David Marchand wrote: >On Wed, Apr 17, 2019 at 11:02 AM Xiaolong Ye wrote: > >> Since AF_XDP pmd doesn't support multi segment, we need to add a valid >> check in eth_dev_mtu_set. >> > >How about: >Properly report mtu capability in port device info. Sounds better. > > >Reported-by: David Marchand > >Signed-off-by: Xiaolong Ye >> --- >> drivers/net/af_xdp/rte_eth_af_xdp.c | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c >> b/drivers/net/af_xdp/rte_eth_af_xdp.c >> index 5cc643ce2..8430921af 100644 >> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c >> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c >> @@ -351,6 +351,9 @@ eth_dev_info(struct rte_eth_dev *dev, struct >> rte_eth_dev_info *dev_info) >> dev_info->max_rx_queues = 1; >> dev_info->max_tx_queues = 1; >> >> + dev_info->min_mtu = ETHER_MIN_MTU; >> + dev_info->max_mtu = ETH_AF_XDP_FRAME_SIZE - >> ETH_AF_XDP_DATA_HEADROOM; >> + >> > dev_info->default_rxportconf.nb_queues = 1; >> dev_info->default_txportconf.nb_queues = 1; >> dev_info->default_rxportconf.ring_size = ETH_AF_XDP_DFLT_NUM_DESCS; >> @@ -654,6 +657,15 @@ eth_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) >> int ret; >> int s; >> >> + if (mtu > ETH_AF_XDP_FRAME_SIZE - ETH_AF_XDP_DATA_HEADROOM || >> + mtu < ETHER_MIN_MTU) { >> + AF_XDP_LOG(ERR, "Unsupported MTU of %d. " >> + "max mtu: %d, min mtu: %d", mtu, >> + ETH_AF_XDP_FRAME_SIZE - ETH_AF_XDP_DATA_HEADROOM, >> + ETHER_MIN_MTU); >> + return -EINVAL; >> + } >> + >> > >Sorry, I suppose my previous mail was confusing. >If you provide min/max_mtu, ethdev will enforce those checks for you and >you don't need to care about it. > >See: >https://git.dpdk.org/dpdk/tree/lib/librte_ethdev/rte_ethdev.c?h=v19.05-rc1#n2630 > >With this block removed, you can add my review tag. Got it, will remove it in next version. Thanks, Xiaolong > >Thanks. > >-- >David Marchand From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 807C9A00E6 for ; Wed, 17 Apr 2019 15:31:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 150C91B60B; Wed, 17 Apr 2019 15:31:02 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 9DEFB31FC for ; Wed, 17 Apr 2019 15:31:00 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2019 06:30:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,362,1549958400"; d="scan'208";a="338441353" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.206]) by fmsmga005.fm.intel.com with ESMTP; 17 Apr 2019 06:30:57 -0700 Date: Wed, 17 Apr 2019 21:25:13 +0800 From: Ye Xiaolong To: David Marchand Cc: dev , Ferruh Yigit , Qi Zhang , Karlsson Magnus , Topel Bjorn Message-ID: <20190417132513.GA111540@intel.com> References: <20190417085653.110559-1-xiaolong.ye@intel.com> <20190417085653.110559-3-xiaolong.ye@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v3 2/4] net/af_xdp: specify minimal and maximal MTU X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190417132513.fRQHop6tdgmIRXEQ_KkQFUgaxgmcQEV3RF1GTGJh9U8@z> On 04/17, David Marchand wrote: >On Wed, Apr 17, 2019 at 11:02 AM Xiaolong Ye wrote: > >> Since AF_XDP pmd doesn't support multi segment, we need to add a valid >> check in eth_dev_mtu_set. >> > >How about: >Properly report mtu capability in port device info. Sounds better. > > >Reported-by: David Marchand > >Signed-off-by: Xiaolong Ye >> --- >> drivers/net/af_xdp/rte_eth_af_xdp.c | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c >> b/drivers/net/af_xdp/rte_eth_af_xdp.c >> index 5cc643ce2..8430921af 100644 >> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c >> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c >> @@ -351,6 +351,9 @@ eth_dev_info(struct rte_eth_dev *dev, struct >> rte_eth_dev_info *dev_info) >> dev_info->max_rx_queues = 1; >> dev_info->max_tx_queues = 1; >> >> + dev_info->min_mtu = ETHER_MIN_MTU; >> + dev_info->max_mtu = ETH_AF_XDP_FRAME_SIZE - >> ETH_AF_XDP_DATA_HEADROOM; >> + >> > dev_info->default_rxportconf.nb_queues = 1; >> dev_info->default_txportconf.nb_queues = 1; >> dev_info->default_rxportconf.ring_size = ETH_AF_XDP_DFLT_NUM_DESCS; >> @@ -654,6 +657,15 @@ eth_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) >> int ret; >> int s; >> >> + if (mtu > ETH_AF_XDP_FRAME_SIZE - ETH_AF_XDP_DATA_HEADROOM || >> + mtu < ETHER_MIN_MTU) { >> + AF_XDP_LOG(ERR, "Unsupported MTU of %d. " >> + "max mtu: %d, min mtu: %d", mtu, >> + ETH_AF_XDP_FRAME_SIZE - ETH_AF_XDP_DATA_HEADROOM, >> + ETHER_MIN_MTU); >> + return -EINVAL; >> + } >> + >> > >Sorry, I suppose my previous mail was confusing. >If you provide min/max_mtu, ethdev will enforce those checks for you and >you don't need to care about it. > >See: >https://git.dpdk.org/dpdk/tree/lib/librte_ethdev/rte_ethdev.c?h=v19.05-rc1#n2630 > >With this block removed, you can add my review tag. Got it, will remove it in next version. Thanks, Xiaolong > >Thanks. > >-- >David Marchand