From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150077.outbound.protection.outlook.com [40.107.15.77]) by dpdk.org (Postfix) with ESMTP id 6F8BF1B43F for ; Wed, 3 Apr 2019 17:03:22 +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=a5Cdi7ynp2Ognpe844L+E1jnpKzINOpPEqAOs4HtNJs=; b=wrGlq7w1i1hnXyVX7VHQqCftjnxznF/1NuuUzURm0NCjCmgw3qWYrSwQ6K4qW5Lajlntbaau8t493RRGQrZd4odS17aKInRalMTEKwTLwNA3niX1NzmLrKL7OlHfoLyS1b5S93bC67uPIJKcuV+y5C3nsptcQ8Yw8nN7s990cpw= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3217.eurprd05.prod.outlook.com (10.171.186.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.17; Wed, 3 Apr 2019 15:03:21 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::11b0:de86:8d93:8b02]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::11b0:de86:8d93:8b02%3]) with mapi id 15.20.1750.021; Wed, 3 Apr 2019 15:03:21 +0000 From: Slava Ovsiienko To: Thomas Monjalon , "gaetan.rivet@6wind.com" , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 1/4] ethdev: simplify port state comparisons Thread-Index: AQHU6DJ7Us6jyevnmUaEdkDiZF6Bv6YqjBwg Date: Wed, 3 Apr 2019 15:03:21 +0000 Message-ID: References: <20181130002716.27325-1-thomas@monjalon.net> <20190401022700.1570-1-thomas@monjalon.net> <20190401022700.1570-2-thomas@monjalon.net> In-Reply-To: <20190401022700.1570-2-thomas@monjalon.net> 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=viacheslavo@mellanox.com; x-originating-ip: [95.67.35.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7cdafc6a-5fc2-45fe-d9e0-08d6b845833a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:AM4PR05MB3217; x-ms-traffictypediagnostic: AM4PR05MB3217: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-forefront-prvs: 0996D1900D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(366004)(346002)(136003)(39860400002)(396003)(199004)(189003)(13464003)(316002)(66066001)(186003)(5660300002)(6506007)(76176011)(256004)(97736004)(7696005)(53546011)(305945005)(476003)(33656002)(5024004)(14454004)(8676002)(71200400001)(446003)(11346002)(99286004)(52536014)(6116002)(71190400001)(53936002)(6436002)(68736007)(81156014)(486006)(8936002)(106356001)(26005)(110136005)(478600001)(102836004)(81166006)(105586002)(86362001)(25786009)(2906002)(7736002)(2501003)(74316002)(3846002)(229853002)(55016002)(9686003)(4326008)(6246003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3217; H:AM4PR05MB3265.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: 21YNZcRj/a3G3QwDypJ5UYQW6DpQihXhVl/JOhLqDjRF5BvGs+0I0F4rGtASZFLsa3YRe8ETndx0Fqb9Je8ZQrSLCTclCB2Am9euC1kSCsSoIKyFQUWOWHQm8irl066z5CKv2nlQU2Cuf1zG1LsRr6XI9xRyujHr8U9puLpHwLSjEN4NIKJBnfXRDnaA+MWEXiEM8Ov2zsvYtmS0EjWdZDGy4L/D0o+YBkUwg7Ija2SIi0/rm6GmfNVjQXuqAlg8I6js/7lLuYmVeEN+ZuG/yI5UlRegrvzD6i+7CvSHjzlSxM4blT+mF3ddbqS88/H0jetTQMUHdq2mrjY0zn7tMHFc4O+EptKCa2z88Wmlz7jlqpTIVnQJuvIp22mgN/MDBh3QsaUf3ERfce34BjEVKydpbSEC2J/t2Ye4lZ+z5Rs= 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: 7cdafc6a-5fc2-45fe-d9e0-08d6b845833a X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Apr 2019 15:03:21.2489 (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-Transport-CrossTenantHeadersStamped: AM4PR05MB3217 Subject: Re: [dpdk-dev] [PATCH v3 1/4] ethdev: simplify port state comparisons 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, 03 Apr 2019 15:03:22 -0000 > -----Original Message----- > From: dev On Behalf Of Thomas Monjalon > Sent: Monday, April 1, 2019 5:27 > To: gaetan.rivet@6wind.com; Ferruh Yigit ; Andrew > Rybchenko > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3 1/4] ethdev: simplify port state comparison= s >=20 > There are three states for an ethdev port. > Checking that the port is unused looks simpler than checking it is neithe= r > attached nor removed. >=20 > Signed-off-by: Thomas Monjalon > Reviewed-by: Andrew Rybchenko Tested-by: Viacheslav Ovsiienko > --- > lib/librte_ethdev/rte_ethdev.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index 10bdfb37e..33cffc498 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -330,8 +330,7 @@ uint16_t > rte_eth_find_next(uint16_t port_id) > { > while (port_id < RTE_MAX_ETHPORTS && > - rte_eth_devices[port_id].state !=3D RTE_ETH_DEV_ATTACHED && > - rte_eth_devices[port_id].state !=3D RTE_ETH_DEV_REMOVED) > + rte_eth_devices[port_id].state =3D=3D > RTE_ETH_DEV_UNUSED) > port_id++; >=20 > if (port_id >=3D RTE_MAX_ETHPORTS) > @@ -567,8 +566,7 @@ uint64_t > rte_eth_find_next_owned_by(uint16_t port_id, const uint64_t owner_id) { > while (port_id < RTE_MAX_ETHPORTS && > - ((rte_eth_devices[port_id].state !=3D RTE_ETH_DEV_ATTACHED && > - rte_eth_devices[port_id].state !=3D RTE_ETH_DEV_REMOVED) || > + (rte_eth_devices[port_id].state =3D=3D RTE_ETH_DEV_UNUSED || > rte_eth_devices[port_id].data->owner.id !=3D owner_id)) > port_id++; >=20 > -- > 2.21.0 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 57C88A0679 for ; Wed, 3 Apr 2019 17:03:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 997EB1B44E; Wed, 3 Apr 2019 17:03:23 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150077.outbound.protection.outlook.com [40.107.15.77]) by dpdk.org (Postfix) with ESMTP id 6F8BF1B43F for ; Wed, 3 Apr 2019 17:03:22 +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=a5Cdi7ynp2Ognpe844L+E1jnpKzINOpPEqAOs4HtNJs=; b=wrGlq7w1i1hnXyVX7VHQqCftjnxznF/1NuuUzURm0NCjCmgw3qWYrSwQ6K4qW5Lajlntbaau8t493RRGQrZd4odS17aKInRalMTEKwTLwNA3niX1NzmLrKL7OlHfoLyS1b5S93bC67uPIJKcuV+y5C3nsptcQ8Yw8nN7s990cpw= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3217.eurprd05.prod.outlook.com (10.171.186.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.17; Wed, 3 Apr 2019 15:03:21 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::11b0:de86:8d93:8b02]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::11b0:de86:8d93:8b02%3]) with mapi id 15.20.1750.021; Wed, 3 Apr 2019 15:03:21 +0000 From: Slava Ovsiienko To: Thomas Monjalon , "gaetan.rivet@6wind.com" , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 1/4] ethdev: simplify port state comparisons Thread-Index: AQHU6DJ7Us6jyevnmUaEdkDiZF6Bv6YqjBwg Date: Wed, 3 Apr 2019 15:03:21 +0000 Message-ID: References: <20181130002716.27325-1-thomas@monjalon.net> <20190401022700.1570-1-thomas@monjalon.net> <20190401022700.1570-2-thomas@monjalon.net> In-Reply-To: <20190401022700.1570-2-thomas@monjalon.net> 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=viacheslavo@mellanox.com; x-originating-ip: [95.67.35.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7cdafc6a-5fc2-45fe-d9e0-08d6b845833a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:AM4PR05MB3217; x-ms-traffictypediagnostic: AM4PR05MB3217: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-forefront-prvs: 0996D1900D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(366004)(346002)(136003)(39860400002)(396003)(199004)(189003)(13464003)(316002)(66066001)(186003)(5660300002)(6506007)(76176011)(256004)(97736004)(7696005)(53546011)(305945005)(476003)(33656002)(5024004)(14454004)(8676002)(71200400001)(446003)(11346002)(99286004)(52536014)(6116002)(71190400001)(53936002)(6436002)(68736007)(81156014)(486006)(8936002)(106356001)(26005)(110136005)(478600001)(102836004)(81166006)(105586002)(86362001)(25786009)(2906002)(7736002)(2501003)(74316002)(3846002)(229853002)(55016002)(9686003)(4326008)(6246003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3217; H:AM4PR05MB3265.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: 21YNZcRj/a3G3QwDypJ5UYQW6DpQihXhVl/JOhLqDjRF5BvGs+0I0F4rGtASZFLsa3YRe8ETndx0Fqb9Je8ZQrSLCTclCB2Am9euC1kSCsSoIKyFQUWOWHQm8irl066z5CKv2nlQU2Cuf1zG1LsRr6XI9xRyujHr8U9puLpHwLSjEN4NIKJBnfXRDnaA+MWEXiEM8Ov2zsvYtmS0EjWdZDGy4L/D0o+YBkUwg7Ija2SIi0/rm6GmfNVjQXuqAlg8I6js/7lLuYmVeEN+ZuG/yI5UlRegrvzD6i+7CvSHjzlSxM4blT+mF3ddbqS88/H0jetTQMUHdq2mrjY0zn7tMHFc4O+EptKCa2z88Wmlz7jlqpTIVnQJuvIp22mgN/MDBh3QsaUf3ERfce34BjEVKydpbSEC2J/t2Ye4lZ+z5Rs= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7cdafc6a-5fc2-45fe-d9e0-08d6b845833a X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Apr 2019 15:03:21.2489 (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-Transport-CrossTenantHeadersStamped: AM4PR05MB3217 Subject: Re: [dpdk-dev] [PATCH v3 1/4] ethdev: simplify port state comparisons 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: <20190403150321.8LwkD8MWVFQgz8M3FBd-fu1zCwV35jDRp6jIqjqAVs4@z> > -----Original Message----- > From: dev On Behalf Of Thomas Monjalon > Sent: Monday, April 1, 2019 5:27 > To: gaetan.rivet@6wind.com; Ferruh Yigit ; Andrew > Rybchenko > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3 1/4] ethdev: simplify port state comparison= s >=20 > There are three states for an ethdev port. > Checking that the port is unused looks simpler than checking it is neithe= r > attached nor removed. >=20 > Signed-off-by: Thomas Monjalon > Reviewed-by: Andrew Rybchenko Tested-by: Viacheslav Ovsiienko > --- > lib/librte_ethdev/rte_ethdev.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index 10bdfb37e..33cffc498 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -330,8 +330,7 @@ uint16_t > rte_eth_find_next(uint16_t port_id) > { > while (port_id < RTE_MAX_ETHPORTS && > - rte_eth_devices[port_id].state !=3D RTE_ETH_DEV_ATTACHED && > - rte_eth_devices[port_id].state !=3D RTE_ETH_DEV_REMOVED) > + rte_eth_devices[port_id].state =3D=3D > RTE_ETH_DEV_UNUSED) > port_id++; >=20 > if (port_id >=3D RTE_MAX_ETHPORTS) > @@ -567,8 +566,7 @@ uint64_t > rte_eth_find_next_owned_by(uint16_t port_id, const uint64_t owner_id) { > while (port_id < RTE_MAX_ETHPORTS && > - ((rte_eth_devices[port_id].state !=3D RTE_ETH_DEV_ATTACHED && > - rte_eth_devices[port_id].state !=3D RTE_ETH_DEV_REMOVED) || > + (rte_eth_devices[port_id].state =3D=3D RTE_ETH_DEV_UNUSED || > rte_eth_devices[port_id].data->owner.id !=3D owner_id)) > port_id++; >=20 > -- > 2.21.0