From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3A7CCA00E6 for ; Tue, 6 Aug 2019 22:03:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 52AA91B502; Tue, 6 Aug 2019 22:03:26 +0200 (CEST) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40088.outbound.protection.outlook.com [40.107.4.88]) by dpdk.org (Postfix) with ESMTP id 1F06F1B4B6 for ; Tue, 6 Aug 2019 22:03:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j74HGeJI0Jnm+6uZA9MjauBptPWwgtCoj506+c7/3iWFw4/NlPLjhpRQWyUIligihjCUlElJErVKCRPoq2wiW1e9vZBc15Cjcb7nCPiEWNl/MBspjGjZczw+im0g8EdWRiaj4Ka/W6ZEh9A3Zb3MnBKzBpVEBGJ+MY5Tuxkd/YOXVjqgoVDQoaIVuh9AbwvaJV5ao7uC7RebyLM99Gc6aXCBOOeKyOLkp/BwIe4Zdpj3r9lFW+vR3k5/Uf4yNYinPzN6mVEb1I4okQ86sI+wki9t6PZ00i0jhnYbd5ScHw9PcKwh1yIV2zYriJyciTLjaNLUvoSmSlLXwDRgd/MlIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iJdjVx1m7vCtMyA9pUS3JvAdYyOt/bd1S6gdJX13gtM=; b=I1j2wPYPW1DiF7hYC/yOJmWGosunP2+ZKplKGalzXcwTLlyziEZhQNPttkvJmQDnZw0gcRr283aw1rNHrT4UngaEwVT98VInpTGTEMvJlXatnZi6RGQgb+wNhKTjyxH4Dt7ezFA5z6p0efUVcebTGx4+8k+VCx/PNfYprTAa0/agH5hGaNDWhvtVgjoETkM4E3llBC+NVv2KNCbHx4NCobrSGD4aNYDRvhp8yn2FeEelq32IV6WXz/b8XrDPIKZ3UEOM1FoMDot1BvhMClCPvZM3KN/XviwDEgGWiD0FjxA3KHg3j57QdTAjknUZkFA2Q/oF6hwE6sp+1CZh+wxFHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iJdjVx1m7vCtMyA9pUS3JvAdYyOt/bd1S6gdJX13gtM=; b=eKD7YQpQH/ZGGlD9GmcD2Ta+OlgFl6dFWGymJz0bqIaZ+0WV0rMYtVO/DZ+1fstnXS6zKfQHMLavo07AOD/pJP+cU4X6jTtpqNBpDx150GS0iRH99hDlhoyb9G/HcPLGE3gcJ7OUeDxqgunmtgFLsUzyyfWN8SB+pGxL0v7Z5tw= Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com (52.133.39.139) by AM0PR0502MB3700.eurprd05.prod.outlook.com (52.133.44.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2157.15; Tue, 6 Aug 2019 20:03:22 +0000 Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::ccc2:2dd4:ca86:7639]) by AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::ccc2:2dd4:ca86:7639%3]) with mapi id 15.20.2136.010; Tue, 6 Aug 2019 20:03:22 +0000 From: Matan Azrad To: Stephen Hemminger CC: "dev@dpdk.org" , Stephen Hemminger Thread-Topic: [dpdk-dev] [PATCH v5 1/4] examples/multi_process/client_server_mp: check port validity Thread-Index: AQHVSUphxp1Q426sqUeRhaSMjaIUiKbqqieggAIRMACAAQvgMIAAgJiAgABICsA= Date: Tue, 6 Aug 2019 20:03:22 +0000 Message-ID: References: <20190726165054.24078-1-stephen@networkplumber.org> <20190802025826.1174-1-stephen@networkplumber.org> <20190802025826.1174-2-stephen@networkplumber.org> <20190802085301.02ab5b55@hermes.lan> <20190805090054.1511b033@hermes.lan> <20190806083955.59124799@hermes.lan> In-Reply-To: <20190806083955.59124799@hermes.lan> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-originating-ip: [77.126.64.114] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b88bc967-5d02-4a0a-f049-08d71aa92295 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:AM0PR0502MB3700; x-ms-traffictypediagnostic: AM0PR0502MB3700: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0121F24F22 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(39860400002)(136003)(366004)(376002)(346002)(189003)(199004)(55016002)(9686003)(229853002)(486006)(6436002)(476003)(7696005)(6246003)(53936002)(2906002)(305945005)(7736002)(74316002)(71200400001)(71190400001)(33656002)(3846002)(6116002)(66066001)(64756008)(66556008)(76116006)(66946007)(76176011)(186003)(66446008)(25786009)(26005)(52536014)(256004)(14444005)(8676002)(86362001)(316002)(5660300002)(478600001)(99286004)(14454004)(54906003)(68736007)(6506007)(53546011)(446003)(11346002)(102836004)(66476007)(6916009)(4326008)(81156014)(81166006)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3700; H:AM0PR0502MB4019.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: h6W9tBhP1w/9y+6BVFytLfS8RjZ5+V6O/0owulr9PZ8SkblVOJbunxfuGeM5uVCXuu43/JjWgNGuGKJQa+UQayWuKcQhoc/4r67ChQ+6fBxIGUpmog7nnN8J0JhqTM+xGi845QKDvToXMt/zHtokwzp5/Hqz8ujvE81o45Ul+G9zRNiplvEjk0OBgk7MeIpqKjsyx1e8D0tI6loQnBnsQj8/vM9T8jmRmCF4O2KYxVT+1H/lLYhUa1OWZKhl4LSJbF6+BBoM3a3cgTxWBu8P9cF2q/j+vSiuC0rfm/DoyBA1Paqum//vPefXSiQrQ3shXqLqHmp2Btz0+euEG1BpSa2zna8J0TR3/k2MU1hSSeWbvtKGuk9P7Zu6PKJIb+mBxZC0VU33ps3JVpCGQOtcuEkmzuYK5j3B0Z69ZYnDS2s= x-ms-exchange-transport-forked: True 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: b88bc967-5d02-4a0a-f049-08d71aa92295 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Aug 2019 20:03:22.7042 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: matan@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3700 Subject: Re: [dpdk-dev] [PATCH v5 1/4] examples/multi_process/client_server_mp: check port validity 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" Hi From: Stephen Hemminger > Sent: Tuesday, August 6, 2019 6:40 PM > To: Matan Azrad > Cc: dev@dpdk.org; Stephen Hemminger > Subject: Re: [dpdk-dev] [PATCH v5 1/4] > examples/multi_process/client_server_mp: check port validity >=20 > On Tue, 6 Aug 2019 08:19:01 +0000 > Matan Azrad wrote: >=20 > > From: Stephen Hemminger > > > On Sun, 4 Aug 2019 08:31:54 +0000 > > > Matan Azrad wrote: > > > > > > > > > > /* convert parameter to a number and verify */ > > > > > > > pm =3D strtoul(portmask, &end, 16); > > > > > > > - if (end =3D=3D NULL || *end !=3D '\0' || pm =3D=3D 0) > > > > > > > + if (end =3D=3D NULL || *end !=3D '\0' || pm > UINT16_MAX ||= pm > > > =3D=3D 0) > > > > > > > > > > > > Why pm > UINT16_MAX ? should be something like > (1 << > > > > > RTE_MAX_ETHPORTS) - 1. > > > > > > And need to be sure pm type can hold RTE_MAX_ETHPORTS bits, > > > > > otherwise port 0 may unlikely be all the time visible in the loop= below. > > > > > > > > > > > > > > > > The DPDK assumes a lot of places that unsigned long will hold a > > > > > port > > > mask. > > > > > > > > So, all are bugs, no? > > > > > > I don't think 32 bit build is that well tested. But yes a mask needs > > > to hold 64 ports. > > > > What if someone changes RTE_MAX_ETHPORTS to be bigger than 64 in > config file? > > > > Assume the user changes RTE_MAX_ETHPORTS to 128, and there is a valid > port in range [64, 127]. > > Then, assume the failsafe sub device owns port ID 0. > > > > Because the mask bits are not enough to handle the above range, you wil= l > get port 0 as valid port - bug. > > > > I think you need one more check to the RTE_MAX_ETHPORTS > 64 case. >=20 > Not really needed. >=20 > The DPDK has lots of hard coded assumptions of all ports fitting in 64 bi= ts. > Examples include testpmd/parameters.c etc. Yes, I understand, but the user should know not to change the default value= of=20 RTE_MAX_ETHPORTS, at least it should be documented.=20 > The original concept of a small set of assigned values for portid is not = going to > scale. It really should have been more like ifindex; something that is no= t used > by common API's much larger range; and assigned purely sequentially. >=20 > The API's should all be using names, but the DPDK port naming is also a > mess... Port ID is OK, user can run port info, then to find the wanted port ID and = configure it by port id list\bitmap.