From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 79366326C for ; Thu, 6 Sep 2018 08:30:07 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 610789C0069; Thu, 6 Sep 2018 06:30:06 +0000 (UTC) Received: from [192.168.38.17] (91.220.146.112) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 6 Sep 2018 07:30:02 +0100 To: Stephen Hemminger , References: <20180905164157.844-1-stephen@networkplumber.org> From: Andrew Rybchenko Message-ID: Date: Thu, 6 Sep 2018 09:29:32 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180905164157.844-1-stephen@networkplumber.org> Content-Language: en-US X-Originating-IP: [91.220.146.112] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24076.002 X-TM-AS-Result: No-16.063800-8.000000-10 X-TMASE-MatchedRID: 1GZI+iG+MtcOwH4pD14DsPHkpkyUphL9BdebOqawiLt+YesuCgkiXFDc zN/SMpBYasQ1trdDkyzRQzXF0KHRftzH3tllVlwyt1AhvyEKdj6Zf5btvM85ASz+5QCTrE/sR47 F23WRhl7VPGtJpQStsCWjHpTVFePU7PLTo+w6geoG7bNEJKsuNmlYsa84w2hT+3n3Z6rbGhPDcD W4tUEEBiVdfkXtEyU13LRB48mwljY25XOhnouJ5SI9MxSOQ6CSXgqwd9ijktCjC1E/zCEIrwrxO vLvFPZPEeHflL4ZdKr9Vaa04yzrEd5ZokMflaoNZjQijgrFvzoN5rzymY/8/jssXelfet1UuPFr kRUFXWri8zVgXoAltkWL4rBlm20vt7DW3B48kkGyO81X3yak871qMoOtJ8uUTYjwRrtNJgyxNpE LZ9Zk068ZU+GJfZtcaC3K36TeU+dK6KVh64ntvrzLTW+RZWe24kb5nr5BaVC//aiedJ0Owg== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--16.063800-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24076.002 X-MDID: 1536215407-HRU5jtpvsSd8 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [RFC] ethdev: add min/max MTU to device info 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: Thu, 06 Sep 2018 06:30:07 -0000 On 09/05/2018 07:41 PM, Stephen Hemminger wrote: > This addresses the usability issue raised by OVS at DPDK Userspace > summit. It adds general min/max mtu into device info. For compatiablity, > and to save space, it fits in a hole in existing structure. It is true for amd64, but it looks like it is false on 32-bit. So, ABI breakage. > The initial version sets max mtu to normal Ethernet, it is up to > PMD to set larger value if it supports Jumbo frames. > > Fixing the drivers to use this is trivial and can be done by 18.11. > Already have some of the patches done. > > Signed-off-by: Stephen Hemminger > --- > lib/librte_ethdev/rte_ethdev.c | 7 +++++++ > lib/librte_ethdev/rte_ethdev.h | 2 ++ > 2 files changed, 9 insertions(+) > > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c > index 4c320250589a..df0c7536a7c4 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -2408,6 +2408,8 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) > dev_info->rx_desc_lim = lim; > dev_info->tx_desc_lim = lim; > dev_info->device = dev->device; > + dev_info->min_mtu = ETHER_MIN_MTU; > + dev_info->max_mtu = ETHER_MTU; > > RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); > (*dev->dev_ops->dev_infos_get)(dev, dev_info); > @@ -2471,12 +2473,17 @@ int > rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu) > { > int ret; > + struct rte_eth_dev_info dev_info; > struct rte_eth_dev *dev; > > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > dev = &rte_eth_devices[port_id]; > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP); > > + rte_eth_dev_info_get(port_id, &dev_info); > + if (mtu < dev_info.min_mtu || mtu > dev_info.max_mtu) > + return -EINVAL; > + The check breaks set MTU to value larger than ETHER_MTU for not updated drivers. So, IMHO, it should be pushed only with appropriate updates in all drivers which support bigger MTU. > ret = (*dev->dev_ops->mtu_set)(dev, mtu); > if (!ret) > dev->data->mtu = mtu; > diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h > index 7070e9ab408f..5171a9083288 100644 > --- a/lib/librte_ethdev/rte_ethdev.h > +++ b/lib/librte_ethdev/rte_ethdev.h > @@ -1015,6 +1015,8 @@ struct rte_eth_dev_info { > const char *driver_name; /**< Device Driver name. */ > unsigned int if_index; /**< Index to bound host interface, or 0 if none. > Use if_indextoname() to translate into an interface name. */ > + uint16_t min_mtu; /**< Minimum MTU allowed */ > + uint16_t max_mtu; /**< Maximum MTU allowed */ > const uint32_t *dev_flags; /**< Device flags */ > uint32_t min_rx_bufsize; /**< Minimum size of RX buffer. */ > uint32_t max_rx_pktlen; /**< Maximum configurable length of RX pkt. */