From: James Hershaw <james.hers...@corigine.com>

Expand the selection of read/write helper functions to include values of
16 bits.

Signed-off-by: James Hershaw <james.hers...@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderl...@corigine.com>
Reviewed-by: Chaoyong He <chaoyong...@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

Reply via email to