From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com,
James Hershaw <james.hershaw@corigine.com>,
Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH v2 1/2] net/nfp: add helper functions for read/write 16b values
Date: Fri, 10 Mar 2023 14:25:41 +0800 [thread overview]
Message-ID: <20230310062542.817107-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20230310062542.817107-1-chaoyong.he@corigine.com>
From: James Hershaw <james.hershaw@corigine.com>
Expand the selection of read/write helper functions to include values of
16 bits.
Signed-off-by: James Hershaw <james.hershaw@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@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
next prev parent reply other threads:[~2023-03-10 6:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 6:29 [PATCH] net/nfp: write link speed to control BAR Chaoyong He
2023-02-23 16:39 ` Ferruh Yigit
2023-03-06 7:06 ` Chaoyong He
2023-03-07 13:24 ` Ferruh Yigit
2023-03-10 6:07 ` Chaoyong He
2023-03-10 6:25 ` [PATCH v2 0/2] " Chaoyong He
2023-03-10 6:25 ` Chaoyong He [this message]
2023-03-10 6:25 ` [PATCH v2 2/2] net/nfp: " Chaoyong He
2023-03-10 11:15 ` Ferruh Yigit
2023-03-13 3:03 ` Chaoyong He
2023-03-13 8:39 ` Ferruh Yigit
2023-03-13 10:18 ` [PATCH v2 0/2] " Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230310062542.817107-2-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=james.hershaw@corigine.com \
--cc=niklas.soderlund@corigine.com \
--cc=oss-drivers@corigine.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).