DPDK patches and discussions
 help / color / mirror / Atom feed
* raw/gdtc: use standard macros to optimize code style
@ 2024-12-10  2:11 Yong Zhang
  2024-12-10 20:37 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Yong Zhang @ 2024-12-10  2:11 UTC (permalink / raw)
  To: thomas, dev; +Cc: zhang.yong25, wang.yong19, li.min10, ran.ming


[-- Attachment #1.1.1: Type: text/plain, Size: 2877 bytes --]

Use RTE_BIT to optimize non-standard macro definitions

Signed-off-by: Yong Zhang <zhang.yong25@zte.com.cn>
---
 drivers/raw/gdtc/gdtc_rawdev.c | 16 ++++++++--------
 drivers/raw/gdtc/gdtc_rawdev.h |  6 +++---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/raw/gdtc/gdtc_rawdev.c b/drivers/raw/gdtc/gdtc_rawdev.c
index ac6aee3fb3..ee83a67bad 100644
--- a/drivers/raw/gdtc/gdtc_rawdev.c
+++ b/drivers/raw/gdtc/gdtc_rawdev.c
@@ -70,19 +70,19 @@
 #define ZXDH_GDMA_BURST_SIZE_MEDIUM             0x4         /* 4 word */
 #define ZXDH_GDMA_BURST_SIZE_MAX                0x6         /* 16 word */
 #define ZXDH_GDMA_DEFAULT_BURST_LEN             0xf         /* 16 beats */
-#define ZXDH_GDMA_TC_CNT_ENABLE                 (1 << 27)
-#define ZXDH_GDMA_CHAN_FORCE_CLOSE              (1 << 31)
+#define ZXDH_GDMA_TC_CNT_ENABLE                 RTE_BIT32(27)
+#define ZXDH_GDMA_CHAN_FORCE_CLOSE              RTE_BIT32(31)
 
 /* TC count & Error interrupt status register */
-#define ZXDH_GDMA_SRC_LLI_ERR                   (1 << 16)
-#define ZXDH_GDMA_SRC_DATA_ERR                  (1 << 17)
-#define ZXDH_GDMA_DST_ADDR_ERR                  (1 << 18)
-#define ZXDH_GDMA_ERR_STATUS                    (1 << 19)
-#define ZXDH_GDMA_ERR_INTR_ENABLE               (1 << 20)
+#define ZXDH_GDMA_SRC_LLI_ERR                   RTE_BIT32(16)
+#define ZXDH_GDMA_SRC_DATA_ERR                  RTE_BIT32(17)
+#define ZXDH_GDMA_DST_ADDR_ERR                  RTE_BIT32(18)
+#define ZXDH_GDMA_ERR_STATUS                    RTE_BIT32(19)
+#define ZXDH_GDMA_ERR_INTR_ENABLE               RTE_BIT32(20)
 #define ZXDH_GDMA_TC_CNT_CLEAN                  (1)
 
 #define ZXDH_GDMA_CHAN_SHIFT                    0x80
-#define ZXDH_GDMA_LINK_END_NODE                 (1 << 30)
+#define ZXDH_GDMA_LINK_END_NODE                 RTE_BIT32(30)
 #define ZXDH_GDMA_CHAN_CONTINUE                 (1)
 
 #define LOW32_MASK                              0xffffffff
diff --git a/drivers/raw/gdtc/gdtc_rawdev.h b/drivers/raw/gdtc/gdtc_rawdev.h
index bc6b0a8e28..1baa9696eb 100644
--- a/drivers/raw/gdtc/gdtc_rawdev.h
+++ b/drivers/raw/gdtc/gdtc_rawdev.h
@@ -28,13 +28,13 @@ extern int zxdh_gdma_rawdev_logtype;
 #define ZXDH_GDMA_JOB_SRC_PHY                   (1UL)
 
 /* States if the destination addresses is physical. */
-#define ZXDH_GDMA_JOB_DEST_PHY                  (1UL << 1)
+#define ZXDH_GDMA_JOB_DEST_PHY                  RTE_BIT32(1)
 
 /* ZF->HOST */
-#define ZXDH_GDMA_JOB_DIR_TX                    (1UL << 2)
+#define ZXDH_GDMA_JOB_DIR_TX                    RTE_BIT32(2)
 
 /* HOST->ZF */
-#define ZXDH_GDMA_JOB_DIR_RX                    (1UL << 3)
+#define ZXDH_GDMA_JOB_DIR_RX                    RTE_BIT32(3)
 
 #define ZXDH_GDMA_JOB_DIR_MASK                  (ZXDH_GDMA_JOB_DIR_TX | ZXDH_GDMA_JOB_DIR_RX)
 
-- 
2.43.0

[-- Attachment #1.1.2: Type: text/html , Size: 6910 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: raw/gdtc: use standard macros to optimize code style
  2024-12-10  2:11 raw/gdtc: use standard macros to optimize code style Yong Zhang
@ 2024-12-10 20:37 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2024-12-10 20:37 UTC (permalink / raw)
  To: Yong Zhang; +Cc: thomas, dev, wang.yong19, li.min10, ran.ming

On Tue, 10 Dec 2024 10:11:30 +0800
Yong Zhang <zhang.yong25@zte.com.cn> wrote:

> Use RTE_BIT to optimize non-standard macro definitions
> 
> Signed-off-by: Yong Zhang <zhang.yong25@zte.com.cn>
> ---

Code will end up the same, but it is easier to read.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-10 20:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-10  2:11 raw/gdtc: use standard macros to optimize code style Yong Zhang
2024-12-10 20:37 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).