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 01E76A0531; Mon, 10 Feb 2020 07:32:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CCC8B1BE94; Mon, 10 Feb 2020 07:32:21 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) by dpdk.org (Postfix) with ESMTP id D04BC100C for ; Mon, 10 Feb 2020 07:32:20 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aUMg48NQw86tEWan5qG4wBgCo7LHV05Y4uqWXnhGfL4Hq8bDpSPRB7L+qZLqcTw+ukg3vvmQKFvL2eYGUYpFzhpeelZzsXTqesiriJPI14unbm60AmJVeL90W0peoPv6Qbi3DCbz2nk60vqYBVjSsgZ4XejEz93ZNWqn9ondix5wGPBTXUTl4IIwioHO/yNdw6bFaepYTYWPoeugUDj9KwvPzpHO7BETn4idBeaLLuAx7i+UiYMDa7Kzjo2VrE5ViJle5fHkWgr7NwXDBiS1OlVgzeBFA0S8VdP34SOBVMTBFRU6egbJ5nVpECQ8zdDzHUTRlnVGjdRd1jVqDhGLiw== 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=eqX1Hw2nD2guFmg9UZhj+6UoyEiFHqz2FvEHRaPqkpo=; b=AWDTQPXPiCSxA3q/+YpZkcLwNDiCd88Gd4kVcZgzyPnswky8Zaw+Z1Cd9iEQx7c/qL0l8v6eihjDIgsm+kjkhj7rXfybe8Iw3Pj1Qe7gkdcXE7Db1rjqVMCm6A1PotK/99bxJVsg3ASH+E+u8ofwDsBoMZLbJZNa5uT05en9KfJoqGUlMSWcbwvNQgRF9n2q57QTZtwL+YEviDB2Yc6zDBEnrc0hHH1PeQO5XwyeSv+99xO31yWI84ZzWuRGJonDRtYEoaij0xm7cJ3qbM52XlOLZGSZA/IdiSM2MmmTbpFSPy5qQnk4zeu22OvHiFZXQ1610lBpgbzprvjsNqHrXA== 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=eqX1Hw2nD2guFmg9UZhj+6UoyEiFHqz2FvEHRaPqkpo=; b=VheYYVbKavGm8Cg0R18uW9QYcKiG5hS2pzSGYHBTIfnSjkg0Ux7ugs4xIzXkPOz0ycwkVfIpz91XCxI7KIBfLi6gSU5d1NVXc/otZwLl2GqXeJOfEi3BiPqzhw+UZv+eCMCijJuLXme6LPJIhqKtsc2snu8qcHwpvcCMBd0qlyY= Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com (52.133.39.139) by AM0PR0502MB3892.eurprd05.prod.outlook.com (52.133.50.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2707.28; Mon, 10 Feb 2020 06:32:20 +0000 Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::e495:9258:db09:1de8]) by AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::e495:9258:db09:1de8%7]) with mapi id 15.20.2707.028; Mon, 10 Feb 2020 06:32:20 +0000 From: Matan Azrad To: Thomas Monjalon , Shahaf Shuler , Slava Ovsiienko CC: "dev@dpdk.org" Thread-Topic: [PATCH] net/mlx: replace hardcoded value with macro Thread-Index: AQHV345fbqVxYUBB4EWCwcbSzXsYLqgT965w Date: Mon, 10 Feb 2020 06:32:19 +0000 Message-ID: References: <20200209211725.197237-1-thomas@monjalon.net> In-Reply-To: <20200209211725.197237-1-thomas@monjalon.net> 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: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 72c07c49-bc21-4768-429e-08d7adf2fb02 x-ms-traffictypediagnostic: AM0PR0502MB3892:|AM0PR0502MB3892: 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:3044; x-forefront-prvs: 03094A4065 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(39860400002)(366004)(396003)(376002)(136003)(189003)(199004)(71200400001)(316002)(6506007)(110136005)(9686003)(4326008)(7696005)(6636002)(55016002)(53546011)(86362001)(5660300002)(52536014)(66446008)(8936002)(186003)(26005)(64756008)(81156014)(8676002)(81166006)(2906002)(66476007)(33656002)(66946007)(478600001)(76116006)(66556008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3892; 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: BCL:0; x-microsoft-antispam-message-info: dOHlIBHK6kMOkWR9xVmGJLoImpZg/wtUsXksBb1AR4r50SU+dy5ykUJT5lUg33QCOEoHgT1WcJtzH+nj/jLeZc+UEIb0GDEaJJIs6JVfrbIsMokHZVZLZ4GLHlCznf/L1v4z8y84uG8GVO9uYXnNuQDIe/vVTKvlY5EMaBF8hmZPBVJ+8clC9bmKhN8z3bQCdUsA8IUFo57ZoX+KcHg6x4XI61/n7sslKe+BmiYk7mMkw/45DxQhwXn2IIq7+IUvTdW1Rf0FThU1wkIb5Yg7A/BW4YE8XuUQevnFPIKI6nvw576NGBu95sRRl+Of0r7fX/Gv6IOooMF0WbeCK/4ttC3DvKUZUD6aE5EHMWPcb7mXMewPlhEJvzuauGhDwkecDn3eLB3bGh/tDnq3syqq6ywUy8Dms5f0t9uDVOgNzPl9IpIXeUmudXrz5qimkyfM x-ms-exchange-antispam-messagedata: jsdldRyymgeQfzYehhm/lqeBioquiSfI1HLbQ3Fub/T8u7k5p/FJG7unsagAr7anrbQS3uRxAf2z8+Qc4S8QWZzaX3r7Wf/aYO94rUSXo6lR0qOFM77B+baWu0tegqq/CxgvDq/o1iEeTWTgjNW7gw== 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: 72c07c49-bc21-4768-429e-08d7adf2fb02 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Feb 2020 06:32:19.9405 (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: 3Z+cu49zuZwaYnsu0mLkvGlJIgkLydXg7XIiL1IqVdukwh1ShrGsuVBrlzEtcSOok+DDXsKiD2dkvdUGPuenBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3892 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 Thomas From: Thomas Monjalon > Sent: Sunday, February 9, 2020 11:17 PM > To: Matan Azrad ; Shahaf Shuler > ; Slava Ovsiienko > Cc: dev@dpdk.org > Subject: [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; No more misusing of *_MAX \ RTE_MIN\RTE_MAX in the mlx PMDs?