From: Harvey Harrison <harvey.harrison@gmail.com>
To: Eilon Greenstein <eilong@broadcom.com>
Cc: linux-netdev <netdev@vger.kernel.org>
Subject: [PATCH 2/9] bnx2x: annotate struct eth_tx_db_data
Date: Tue, 20 Jan 2009 21:50:47 -0800 [thread overview]
Message-ID: <1232517047.9701.20.camel@brick> (raw)
Always treated as little-endian values, annotate as such, use
the leXX_add_cpu helpers rather than opencoded byteswapping.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
drivers/net/bnx2x_hsi.h | 4 ++--
drivers/net/bnx2x_main.c | 12 ++++--------
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/net/bnx2x_hsi.h b/drivers/net/bnx2x_hsi.h
index efd7644..a3c1068 100644
--- a/drivers/net/bnx2x_hsi.h
+++ b/drivers/net/bnx2x_hsi.h
@@ -2355,8 +2355,8 @@ struct eth_spe {
* doorbell data in host memory
*/
struct eth_tx_db_data {
- u32 packets_prod;
- u16 bds_prod;
+ __le32 packets_prod;
+ __le16 bds_prod;
u16 reserved;
};
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 897f370..2f8d64c 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -8774,11 +8774,9 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
wmb();
- fp->hw_tx_prods->bds_prod =
- cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + 1);
+ le16_add_cpu(&fp->hw_tx_prods->bds_prod, 1);
mb(); /* FW restriction: must not reorder writing nbd and packets */
- fp->hw_tx_prods->packets_prod =
- cpu_to_le32(le32_to_cpu(fp->hw_tx_prods->packets_prod) + 1);
+ le32_add_cpu(&fp->hw_tx_prods->packets_prod, 1);
DOORBELL(bp, fp->index, 0);
mmiowb();
@@ -9774,11 +9772,9 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
*/
wmb();
- fp->hw_tx_prods->bds_prod =
- cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + nbd);
+ le16_add_cpu(&fp->hw_tx_prods->bds_prod, nbd);
mb(); /* FW restriction: must not reorder writing nbd and packets */
- fp->hw_tx_prods->packets_prod =
- cpu_to_le32(le32_to_cpu(fp->hw_tx_prods->packets_prod) + 1);
+ le32_add_cpu(&fp->hw_tx_prods->packets_prod, 1);
DOORBELL(bp, fp->index, 0);
mmiowb();
--
1.6.1.249.g455e5
next reply other threads:[~2009-01-21 5:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-21 5:50 Harvey Harrison [this message]
2009-01-22 17:49 ` [PATCH 2/9] bnx2x: annotate struct eth_tx_db_data Eilon Greenstein
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=1232517047.9701.20.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=eilong@broadcom.com \
--cc=netdev@vger.kernel.org \
/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).