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 AF594A051C; Tue, 11 Feb 2020 09:29:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8ABFF2BFA; Tue, 11 Feb 2020 09:29:23 +0100 (CET) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50042.outbound.protection.outlook.com [40.107.5.42]) by dpdk.org (Postfix) with ESMTP id 96CF12BF4 for ; Tue, 11 Feb 2020 09:29:22 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g17C2aiEOmPXrLY/lYKJ/F2t9QA8D60MmiTzg3+8GW97ufg3ppG/6TpGOv/4QNKZm5whpjkpkoESCH0G6AJ4JteE22wtGjzgS/dBD5MnaT0xcLLFGUmKJYTg8vzR08ysHzqynXdbW3aOSei1e2sj8pKzaVGrmECb2XAMS+vKQ10L1Toyncv5HoSKtPODF0sKSyjN2jaDLTGyhqyfJAc7bokKg1SvJMBdqvtMDgYbaBmk/sOslR4ACo20SkHL5B40V9m7xROgq51iOiX3+I9rexQCnsZm33pcoYty85B5eLbjLHzzbfHDsaA2acY2K9dTVViPyb/gKCRW8Hc7SECs1Q== 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=PJiN9PZf5yAdL6NupJwqG/vwEVUWG27Rl4OJD8wbm70=; b=WGveOnBptA9m8lzGvVruKl0gXHB3UQXTSEpCHT4deGdZdLhhu0uicg8lLd6fVj9/pB7ee33xQ7qVkcEJKENibIDLoF9xcfa30jjlEKZtAaDtFP2RFIiP/VjWcIpu1HcB2R+Z0pBt9dcuqDbRrjSneaJ3xFlJHuoIllIE6t2xgFzeQhAmfk37R6+lftRJ1fDqj88w0tVX7bQB1RIGwtyFAX+CC3HU31bXES1UJm2O3LbPPhzeQiYhnguLIwiyMSgsFDrfgqQcH5wGHXexiISKxO/RELMBZGtC8HDhnK5mS15w6uxjhTMhMXp4e1udjtRiBNbofSm7xXOPDe+W1jwTqQ== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PJiN9PZf5yAdL6NupJwqG/vwEVUWG27Rl4OJD8wbm70=; b=V9IbCOVgQpPm2EHIBAbNsM4JBNeWNBoP56SwbFPthF79goeQV5dPaH76EHMSY8Ne5d4WMtivRTxBsSi3gZiGyAiFnDX9oL+gE3HxjPUKnnzAKYtFJo8mIZ4JuNwPn4YeA/YXyxxLbvPATLa6huNylCyCW3rGG7xzNyAEOSU8j6M= Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (10.186.174.145) by AM0PR05MB6817.eurprd05.prod.outlook.com (10.186.172.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2707.23; Tue, 11 Feb 2020 08:29:21 +0000 Received: from AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::adbd:45ca:54:bba9]) by AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::adbd:45ca:54:bba9%7]) with mapi id 15.20.2707.030; Tue, 11 Feb 2020 08:29:21 +0000 From: Raslan Darawsheh To: Thomas Monjalon , Matan Azrad , Shahaf Shuler , Slava Ovsiienko CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/mlx: replace hardcoded value with macro Thread-Index: AQHV345h8uu7as0DdE6MoOiGLxywEKgVq4iw Date: Tue, 11 Feb 2020 08:29:21 +0000 Message-ID: References: <20200209211725.197237-1-thomas@monjalon.net> In-Reply-To: <20200209211725.197237-1-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=rasland@mellanox.com; x-originating-ip: [212.29.221.74] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 99889afa-2bd9-4342-3ef6-08d7aecc7ea0 x-ms-traffictypediagnostic: AM0PR05MB6817:|AM0PR05MB6817: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:431; x-forefront-prvs: 0310C78181 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(136003)(346002)(396003)(39860400002)(189003)(199004)(6506007)(53546011)(52536014)(55016002)(9686003)(186003)(478600001)(5660300002)(26005)(7696005)(2906002)(33656002)(71200400001)(86362001)(4326008)(316002)(110136005)(64756008)(66946007)(66556008)(8936002)(8676002)(66476007)(81156014)(66446008)(81166006)(76116006)(6636002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB6817; H:AM0PR05MB6707.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: BCL:0; x-microsoft-antispam-message-info: AZnB5JSsjIJSFJzKPWwkwMrliBkia/LW8n9Sc/q4YMk/ys92Sm/MrNwboqFfru9biyjx+3gY4HhAkUsgljnlcLWzfr0SpqDXd8A4l7mT5Wo6yPKkTLWXvyj4MyDsHZ8v/fUcmn4jzPgDj5ds9mLhOlL03P3Fmg1XierRS2YvZffwvORmvKv4p9aAGQHp9JU14urysILGU/RiEoBn48/lG/VZ+FNNeBg7FLi1oDi5GAHdddytyciUsLTkOOLBHrrYfeMQUjGsC1MPxPKwP1E0RqL/mR2eVguElTdbQhld7TV08/AV5YBaGPp2BRffvNtqnzRnNVAatIrJfMOlQpp797S0STER1XKEz/Kwj93+xVD02NotcxhZHWUeggqifLECGwRFvYbpvnmB/NBs+ctaTQ/Ls1ciKQ3IpzPrl6zaPryfOK9MvnNG8lyZ4sxiwBQ0 x-ms-exchange-antispam-messagedata: BK1oszXL+4AL+4BIHr40W62+Mm2eltwXlmWXz2cILWq8pxgG3o1v50O5xRdNeHvogTcMI28CWNnbsQu3j0dMz7ci9dKB9hShp3/qbDQ6wM50v9B2SPz1nHGCGhLTK5msX3PbfsJZDaVC5B9x2x907g== 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: 99889afa-2bd9-4342-3ef6-08d7aecc7ea0 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2020 08:29:21.5852 (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: 7dmqEqO2EvD6uOTR7WyH1/dWBDgloybNe0R/LHKHTxJk2ikFmeEPFBVqs1+Uyw0X6F5AC3X3V1lWrq7dMHPBVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6817 Subject: Re: [dpdk-dev] [PATCH] net/mlx: replace hardcoded value with macro 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, > -----Original Message----- > From: dev On Behalf Of Thomas Monjalon > Sent: Sunday, February 9, 2020 11:17 PM > To: Matan Azrad ; Shahaf Shuler > ; Slava Ovsiienko > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] net/mlx: replace hardcoded value with macro >=20 > Replace checking against 65535 limit, > with a simpler form using RTE_MIN and UINT16_MAX macros. >=20 > Signed-off-by: Thomas Monjalon > --- > drivers/net/mlx4/mlx4_ethdev.c | 5 ++--- > drivers/net/mlx5/mlx5_ethdev.c | 5 ++--- > 2 files changed, 4 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/net/mlx4/mlx4_ethdev.c > b/drivers/net/mlx4/mlx4_ethdev.c > index e500ec422c..9ff05c6738 100644 > --- a/drivers/net/mlx4/mlx4_ethdev.c > +++ b/drivers/net/mlx4/mlx4_ethdev.c > @@ -645,9 +645,8 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, struct > rte_eth_dev_info *info) > */ > max =3D ((priv->device_attr.max_cq > priv->device_attr.max_qp) ? > priv->device_attr.max_qp : priv->device_attr.max_cq); > - /* If max >=3D 65535 then max =3D 0, max_rx_queues is uint16_t. */ > - if (max >=3D 65535) > - max =3D 65535; > + /* max_rx_queues is uint16_t. */ > + max =3D RTE_MIN(max, (unsigned int)UINT16_MAX); > info->max_rx_queues =3D max; > info->max_tx_queues =3D max; > info->max_mac_addrs =3D RTE_DIM(priv->mac); > diff --git a/drivers/net/mlx5/mlx5_ethdev.c > b/drivers/net/mlx5/mlx5_ethdev.c > index 86923aa7af..d7d3bc73ce 100644 > --- a/drivers/net/mlx5/mlx5_ethdev.c > +++ b/drivers/net/mlx5/mlx5_ethdev.c > @@ -619,9 +619,8 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct > rte_eth_dev_info *info) > */ > max =3D RTE_MIN(priv->sh->device_attr.orig_attr.max_cq, > priv->sh->device_attr.orig_attr.max_qp); > - /* If max >=3D 65535 then max =3D 0, max_rx_queues is uint16_t. */ > - if (max >=3D 65535) > - max =3D 65535; > + /* max_rx_queues is uint16_t. */ > + max =3D RTE_MIN(max, (unsigned int)UINT16_MAX); > info->max_rx_queues =3D max; > info->max_tx_queues =3D max; > info->max_mac_addrs =3D MLX5_MAX_UC_MAC_ADDRESSES; > -- > 2.25.0 Patch applied to next-net-mlx, Kindest regards, Raslan Darawsheh