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 4F5D5A052E; Tue, 21 Jan 2020 21:35:32 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2428E11A2; Tue, 21 Jan 2020 21:35:31 +0100 (CET) Received: from rcdn-iport-8.cisco.com (rcdn-iport-8.cisco.com [173.37.86.79]) by dpdk.org (Postfix) with ESMTP id 39D012AB for ; Tue, 21 Jan 2020 21:35:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2852; q=dns/txt; s=iport; t=1579638929; x=1580848529; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sQIVRgbar3LqSeaZcpxpG/j27OYQBf1BboKaZr6sljc=; b=Giv1WNZLQn/ZRrQLB414hmxpFSsva9PBxmwmhKXd5QYGV2juTna/8uuk e0Qrt5cWJ8dMFhv35Cd3goryKfoYRErA8TGeJwFXnxeKgha9VnffobTim 2jiyf/yYSqB85zbmQ0Xl/xS9/Huxn4Yd24GdvtpIqGCBw8M0wTFlldXrQ k=; X-IronPort-AV: E=Sophos;i="5.70,347,1574121600"; d="scan'208";a="704966731" Received: from alln-core-9.cisco.com ([173.36.13.129]) by rcdn-iport-8.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 21 Jan 2020 20:35:27 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-9.cisco.com (8.15.2/8.15.2) with ESMTP id 00LKZRZ9009078; Tue, 21 Jan 2020 20:35:27 GMT Received: by cisco.com (Postfix, from userid 392789) id 85D5020F2007; Tue, 21 Jan 2020 12:35:27 -0800 (PST) From: John Daley To: ferruh.yigit@intel.com, arybchenko@solarflare.com Cc: thomas@monjalon.net, dev@dpdk.org, John Daley , Hyong Youb Kim Date: Tue, 21 Jan 2020 12:35:07 -0800 Message-Id: <20200121203507.5798-1-johndale@cisco.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20200114002451.16248-3-johndale@cisco.com> References: <20200114002451.16248-3-johndale@cisco.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: alln-core-9.cisco.com Subject: [dpdk-dev] [PATCH v2] net/enic: use RTE min and max macros 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" Use the RTE_MIN and RTE_MAX macros instead of private macros. Signed-off-by: John Daley Reviewed-by: Hyong Youb Kim --- v2 - remove the min_t and max_t macros all together drivers/net/enic/enic_compat.h | 10 ---------- drivers/net/enic/enic_res.c | 20 ++++++++------------ 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/drivers/net/enic/enic_compat.h b/drivers/net/enic/enic_compat.h index eb1fc941e4..7741273037 100644 --- a/drivers/net/enic/enic_compat.h +++ b/drivers/net/enic/enic_compat.h @@ -73,14 +73,4 @@ static inline void writel(unsigned int val, volatile void __iomem *addr) rte_write32(val, addr); } -#define min_t(type, x, y) ({ \ - type __min1 = (x); \ - type __min2 = (y); \ - __min1 < __min2 ? __min1 : __min2; }) - -#define max_t(type, x, y) ({ \ - type __max1 = (x); \ - type __max2 = (y); \ - __max1 > __max2 ? __max1 : __max2; }) - #endif /* _ENIC_COMPAT_H_ */ diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c index d72bef233b..20888eb257 100644 --- a/drivers/net/enic/enic_res.c +++ b/drivers/net/enic/enic_res.c @@ -68,8 +68,8 @@ int enic_get_vnic_config(struct enic *enic) if (c->mtu == 0) c->mtu = 1500; - enic->rte_dev->data->mtu = min_t(uint16_t, enic->max_mtu, - max_t(uint16_t, ENIC_MIN_MTU, c->mtu)); + enic->rte_dev->data->mtu = RTE_MIN(enic->max_mtu, + RTE_MAX((uint16_t)ENIC_MIN_MTU, c->mtu)); enic->adv_filters = vnic_dev_capable_adv_filters(enic->vdev); dev_info(enic, "Advanced Filters %savailable\n", ((enic->adv_filters) @@ -100,20 +100,16 @@ int enic_get_vnic_config(struct enic *enic) ((enic->filter_actions & FILTER_ACTION_COUNTER_FLAG) ? "count " : "")); - c->wq_desc_count = - min_t(uint32_t, ENIC_MAX_WQ_DESCS, - max_t(uint32_t, ENIC_MIN_WQ_DESCS, - c->wq_desc_count)); + c->wq_desc_count = RTE_MIN((uint32_t)ENIC_MAX_WQ_DESCS, + RTE_MAX((uint32_t)ENIC_MIN_WQ_DESCS, c->wq_desc_count)); c->wq_desc_count &= 0xffffffe0; /* must be aligned to groups of 32 */ - c->rq_desc_count = - min_t(uint32_t, ENIC_MAX_RQ_DESCS, - max_t(uint32_t, ENIC_MIN_RQ_DESCS, - c->rq_desc_count)); + c->rq_desc_count = RTE_MIN((uint32_t)ENIC_MAX_RQ_DESCS, + RTE_MAX((uint32_t)ENIC_MIN_RQ_DESCS, c->rq_desc_count)); c->rq_desc_count &= 0xffffffe0; /* must be aligned to groups of 32 */ - c->intr_timer_usec = min_t(uint32_t, c->intr_timer_usec, - vnic_dev_get_intr_coal_timer_max(enic->vdev)); + c->intr_timer_usec = RTE_MIN(c->intr_timer_usec, + vnic_dev_get_intr_coal_timer_max(enic->vdev)); dev_info(enic_get_dev(enic), "vNIC MAC addr %02x:%02x:%02x:%02x:%02x:%02x " -- 2.22.0