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 92AF1A00E6 for ; Wed, 17 Apr 2019 11:38:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 08D801B5EA; Wed, 17 Apr 2019 11:38:52 +0200 (CEST) Received: from mail-ua1-f66.google.com (mail-ua1-f66.google.com [209.85.222.66]) by dpdk.org (Postfix) with ESMTP id 1CC7E1B5E9 for ; Wed, 17 Apr 2019 11:38:50 +0200 (CEST) Received: by mail-ua1-f66.google.com with SMTP id h4so7688761uaj.9 for ; Wed, 17 Apr 2019 02:38:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gYykulzEwhx2Me5//oHNlNV8rf5ILH6/luz70aR85dY=; b=FlYSi5DAeNvDhNPb/Qh7uT9FqSUfQXRIoa+0yEltCPGMebkA95VmPw2uASnQGxErdj 3f+yEKZcoWUJdAln5GWNfLdrL7WbkiOiHutMFHHRF+Jz3Bj/HYUdf/Zol6VLAW3+V3tB 0WLr8S0VGM7sdl1yvHHfRC2eoDATHkHYDnMaW2zf+zfJyxCyaC8qxi+Jmq9Eiu/ie+Fn bvt+iJXetZg0Lsp1Kn86fEkaG169oemAyC7oDPi7E9TM6wB2KEJIH0iu4CMp95cq8iVT Z2nuS6EMHS0TJ3nFEhEq5xsQ/N9rvwUh2Qw+2P251/WPt4y9mnRjTVNs5VyIM23ct0Bf 0VnQ== X-Gm-Message-State: APjAAAX7t2ZS/yJR3/qdo5TSuroyZA15afWkMfS2ODWnx0Aqmo1hzq4B Pe8r2H671/+hh4t8JaLt0llwjRWZhAIcI475HYMQgQ== X-Google-Smtp-Source: APXvYqyA2KB/8U6xG/cz303DtMl3mEPZo7TqoRW8BWtNEMe4ijqkR5rDL6dp5JPgjuLpbmSEhTeyqM+fuyobvgU/SuY= X-Received: by 2002:ab0:b05:: with SMTP id b5mr9641863uak.73.1555493929405; Wed, 17 Apr 2019 02:38:49 -0700 (PDT) MIME-Version: 1.0 References: <20190417085653.110559-1-xiaolong.ye@intel.com> <20190417085653.110559-3-xiaolong.ye@intel.com> In-Reply-To: <20190417085653.110559-3-xiaolong.ye@intel.com> From: David Marchand Date: Wed, 17 Apr 2019 11:38:38 +0200 Message-ID: To: Xiaolong Ye Cc: dev , Ferruh Yigit , Qi Zhang , Karlsson Magnus , Topel Bjorn Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 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: <20190417093838.yOXZKb_Xmfn5NXWee5vK1c2iC23CJ0I1g0bSHWIXxM0@z> 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. 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. Thanks. -- David Marchand