]> git.droids-corp.org - dpdk.git/commitdiff
net/nfp: move round macros to header file
authorJin Liu <jin.liu@corigine.com>
Fri, 17 Jun 2022 09:34:42 +0000 (11:34 +0200)
committerFerruh Yigit <ferruh.yigit@xilinx.com>
Fri, 17 Jun 2022 13:32:41 +0000 (15:32 +0200)
Move macro __round_mask, round_up and round_down from C file to
corresponding head file, will be used by TX function of nfp net
firmware with NFDk.

Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
drivers/net/nfp/nfpcore/nfp_rtsym.c
drivers/net/nfp/nfpcore/nfp_rtsym.h

index 2feca2ed81ec394f5844c6877667f28a558e2869..56bbf05cd87eb9ec4c57749818da4e20afd6325e 100644 (file)
@@ -94,25 +94,6 @@ nfp_rtsym_table_read(struct nfp_cpp *cpp)
        return rtbl;
 }
 
-/*
- * This looks more complex than it should be. But we need to get the type for
- * the ~ right in round_down (it needs to be as wide as the result!), and we
- * want to evaluate the macro arguments just once each.
- */
-#define __round_mask(x, y) ((__typeof__(x))((y) - 1))
-
-#define round_up(x, y) \
-       (__extension__ ({ \
-               typeof(x) _x = (x); \
-               ((((_x) - 1) | __round_mask(_x, y)) + 1); \
-       }))
-
-#define round_down(x, y) \
-       (__extension__ ({ \
-               typeof(x) _x = (x); \
-               ((_x) & ~__round_mask(_x, y)); \
-       }))
-
 struct nfp_rtsym_table *
 __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip)
 {
index 8b494211bc2145edfdee44b83d273065a101de41..d2856e19c3933dd65d3d0d30ae45b790570c69c3 100644 (file)
 #define NFP_RTSYM_TARGET_LMEM           -1
 #define NFP_RTSYM_TARGET_EMU_CACHE      -7
 
+/*
+ * This looks more complex than it should be. But we need to get the type for
+ * the ~ right in round_down (it needs to be as wide as the result!), and we
+ * want to evaluate the macro arguments just once each.
+ */
+#define __round_mask(x, y) ((__typeof__(x))((y) - 1))
+
+#define round_up(x, y) \
+       (__extension__ ({ \
+               typeof(x) _x = (x); \
+               ((((_x) - 1) | __round_mask(_x, y)) + 1); \
+       }))
+
+#define round_down(x, y) \
+       (__extension__ ({ \
+               typeof(x) _x = (x); \
+               ((_x) & ~__round_mask(_x, y)); \
+       }))
+
 /*
  * Structure describing a run-time NFP symbol.
  *