From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60079.outbound.protection.outlook.com [40.107.6.79]) by dpdk.org (Postfix) with ESMTP id DABB8326C for ; Thu, 6 Sep 2018 07:51:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IPW6UIGSDp2wqSXxdFn7/81s8s5LRNQ211tOGiCdr2M=; b=Mbb1g8iTadZxuBnKqlXv8nyxMnSchKv3YIdLKnZHgYPivVRaePiH6ctopbK/FGOFOWQ4wBETglKHCjftZqlDlaGX+M4F2Kd/p7BZhpPAuo6wYGBS1jywSVAISxjJ4cFHfk6n91Trlj/G96nAbkbibDANjb/MD2TZedVu2rEo0rI= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4138.eurprd05.prod.outlook.com (52.134.107.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.15; Thu, 6 Sep 2018 05:51:39 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::c8e7:d9c1:5054:693b]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::c8e7:d9c1:5054:693b%6]) with mapi id 15.20.1101.019; Thu, 6 Sep 2018 05:51:39 +0000 From: Shahaf Shuler To: Stephen Hemminger , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [RFC] ethdev: add min/max MTU to device info Thread-Index: AQHURTdj7vK/04ezYkalUUsWZC7t4aTiwMYA Date: Thu, 6 Sep 2018 05:51:39 +0000 Message-ID: References: <20180905164157.844-1-stephen@networkplumber.org> In-Reply-To: <20180905164157.844-1-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4138; 6:W5wp8jcmo2OmN92TY75phkv6hIgy2g8/Op9TUdqDfjM86fqnX0DuUXKbBwqW0ZbAZpNAZlNeV8iIXuq8UGJ59emz+6ts2Njml3szdysmXIXzH5PAsTIGsJFaK778+DBwEb1KTrvB2HsqVbJJHhMaxSpVAOVg/3cWu3MTo4s8a+E64Y7XuAaaVqYHJoNSIHmQ8uMoTp7TEh9XvxciuWWvqIFsZitI7Ckk7R5XxHB3VfW1ik6Gj4QrS8JHMh2OJWsgAmI1dlMh3LEyw08iO322T/VGTBhuHSZ7lkJTiKspCSNXRDC4JWMO4Ry1DdJw8QdcwBwIcGY0sNGqSIn6FkIwkz+o0G8pD/pr2rdnSclwgz2Vwitx9F/vW3c2x812IPnFPLe2HOaTxB2HG2BVsKJrBUbK7eJ0ka1iHIfg1qEby3pRHQvNRhh/yuYk1l5fx7PdXAVFTfqQgySABzn2hEBuKg==; 5:D7hJrgKFmWlbzV+m59aUtjWFUZSe+qwUw/z/YzB4z3/DKXKiuoQCMf/YPht2V2UtzxnuwifKYSNilUTjPaJAzcnt96phnfPFR42dW2OQhntQvKOi2SWXHKLW/Zj6MmFnqoCr2RnWN+xCfD8QS6tudWiie/FD5Ahm8vAslu+O6V4=; 7:n/l4hzzbFCmesrh6fbvGPgpFVB+8nc1uST78QfxnWIPR+oDWxtT+7w4oD6W5Uegeu4HKqj1jCjHGexamxLZ1kw1zIWys+XH4mPWAYpcciRe/XSygnBBZNLnxr6r+nrqt/ol9m0eNcwBjC6xWhcNjznNPiv68rjOtETyAOBlTUEXwl6MYd2FRTfsazYhGsD3HHVlZGMQxt+im61HhcCKgWLsUNNSptfFYAoxoRaATQWYqrK5c+DHhW6ymf8SNAgR1 x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 78ee85d4-2a51-4919-6437-08d613bcd0b8 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4138; x-ms-traffictypediagnostic: DB7PR05MB4138: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016); SRVR:DB7PR05MB4138; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4138; x-forefront-prvs: 0787459938 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(39860400002)(136003)(346002)(376002)(189003)(199004)(110136005)(55016002)(53936002)(9686003)(5660300001)(25786009)(5250100002)(2501003)(2906002)(256004)(7696005)(76176011)(97736004)(6246003)(2900100001)(33656002)(3846002)(476003)(486006)(74316002)(68736007)(446003)(105586002)(106356001)(575784001)(6506007)(102836004)(66066001)(305945005)(81166006)(11346002)(86362001)(81156014)(8936002)(7736002)(478600001)(99286004)(14454004)(316002)(6116002)(6436002)(26005)(186003)(8676002)(229853002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4138; H:DB7PR05MB4426.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: opAZ/Jb6arK8lOGCmLravG412CpxdWf76VnVVAfYGRQaFN3dBAFKcV27HJtrmnzUOYJfUpkFzEJzetCksQlV6tdc/EwUcvIMw0WJ8AVZYI+kok9OgndeO7agHsqyurIapbjFfXhZeFWs10u9vug9JUek7ZbnKTwypBkhEC1dLZQRvpphVaN7t7Vzsx51GnSH+eD51KCP1h46Acy7ehqTT7tahCbWsUxg+a20Ued4GSuVzLUsFYNKBCG271D+Bzyl9T/FnKYUYePaNKX8RCZ1rlfdJTOZzPmdXVbTrAtWbDkCsX9LysYgzxCbp+JxMmO9v1ZXe4wYPQw8S9sSJI5ly8g6DOMtATYPIlXKF4nEpL8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78ee85d4-2a51-4919-6437-08d613bcd0b8 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2018 05:51:39.4707 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4138 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 05:51:41 -0000 Wednesday, September 5, 2018 7:42 PM, Stephen Hemminger: > Subject: [dpdk-dev] [RFC] ethdev: add min/max MTU to device info >=20 > 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 s= ave > space, it fits in a hole in existing structure. >=20 > The initial version sets max mtu to normal Ethernet, it is up to PMD to s= et > larger value if it supports Jumbo frames. >=20 > Fixing the drivers to use this is trivial and can be done by 18.11. > Already have some of the patches done. >=20 > Signed-off-by: Stephen Hemminger Makes sense. Acked-by: Shahaf Shuler > --- > lib/librte_ethdev/rte_ethdev.c | 7 +++++++ lib/librte_ethdev/rte_ethdev= .h > | 2 ++ > 2 files changed, 9 insertions(+) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.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 =3D lim; > dev_info->tx_desc_lim =3D lim; > dev_info->device =3D dev->device; > + dev_info->min_mtu =3D ETHER_MIN_MTU; > + dev_info->max_mtu =3D ETHER_MTU; >=20 > 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; >=20 > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > dev =3D &rte_eth_devices[port_id]; > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, - > ENOTSUP); >=20 > + rte_eth_dev_info_get(port_id, &dev_info); > + if (mtu < dev_info.min_mtu || mtu > dev_info.max_mtu) > + return -EINVAL; > + > ret =3D (*dev->dev_ops->mtu_set)(dev, mtu); > if (!ret) > dev->data->mtu =3D mtu; > diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethde= v.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. */ > -- > 2.17.1