[PATCH v2 1/2] net/nfp: add helper functions for read/write 16b values
Chaoyong He
chaoyong.he at corigine.com
Fri Mar 10 07:25:41 CET 2023
From: James Hershaw <james.hershaw at corigine.com>
Expand the selection of read/write helper functions to include values of
16 bits.
Signed-off-by: James Hershaw <james.hershaw at corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he at corigine.com>
---
drivers/net/nfp/nfp_common.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 4486ffa72c..3a8b023c75 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -283,6 +283,11 @@ static inline void nn_writel(uint32_t val, volatile void *addr)
rte_write32(val, addr);
}
+static inline uint16_t nn_readw(volatile const void *addr)
+{
+ return rte_read16(addr);
+}
+
static inline void nn_writew(uint16_t val, volatile void *addr)
{
rte_write16(val, addr);
@@ -321,6 +326,18 @@ nn_cfg_writeb(struct nfp_net_hw *hw, int off, uint8_t val)
nn_writeb(val, hw->ctrl_bar + off);
}
+static inline uint16_t
+nn_cfg_readw(struct nfp_net_hw *hw, int off)
+{
+ return rte_le_to_cpu_16(nn_readw(hw->ctrl_bar + off));
+}
+
+static inline void
+nn_cfg_writew(struct nfp_net_hw *hw, int off, uint16_t val)
+{
+ nn_writew(rte_cpu_to_le_16(val), hw->ctrl_bar + off);
+}
+
static inline uint32_t
nn_cfg_readl(struct nfp_net_hw *hw, int off)
{
--
2.39.1
More information about the dev
mailing list