net/enic: use common min and max macros
authorJohn Daley <johndale@cisco.com>
Tue, 21 Jan 2020 20:35:07 +0000 (12:35 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 5 Feb 2020 08:51:19 +0000 (09:51 +0100)
Use the RTE_MIN and RTE_MAX macros instead of private macros.

Fixes: aae7dd40cda4 ("net/enic: move min/max macros")

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
drivers/net/enic/enic_res.c
drivers/net/enic/enic_res.h

index d72bef2..20888eb 100644 (file)
@@ -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 "
index b3bd4b2..34f15d5 100644 (file)
 #include "vnic_wq.h"
 #include "vnic_rq.h"
 
-#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; })
-
 #define ENIC_MIN_WQ_DESCS              64
 #define ENIC_MAX_WQ_DESCS              4096
 #define ENIC_MIN_RQ_DESCS              64