* [PATCH 8/9] bnx2x: further annotations
@ 2009-01-21 5:50 Harvey Harrison
2009-01-22 17:49 ` Eilon Greenstein
0 siblings, 1 reply; 3+ messages in thread
From: Harvey Harrison @ 2009-01-21 5:50 UTC (permalink / raw)
To: Eilon Greenstein; +Cc: linux-netdev
No functional annotations, just documenting the status quo.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
drivers/net/bnx2x_hsi.h | 8 ++++----
drivers/net/bnx2x_main.c | 10 +++++-----
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/bnx2x_hsi.h b/drivers/net/bnx2x_hsi.h
index 33d6d5d..2834f37 100644
--- a/drivers/net/bnx2x_hsi.h
+++ b/drivers/net/bnx2x_hsi.h
@@ -1955,10 +1955,10 @@ struct eth_tx_parse_bd {
#define ETH_TX_PARSE_BD_CWR_FLG_SHIFT 7
u8 ip_hlen;
s8 cs_offset;
- u16 total_hlen;
- u16 lso_mss;
+ __le16 total_hlen;
+ __le16 lso_mss;
u16 tcp_pseudo_csum;
- u16 ip_id;
+ __le16 ip_id;
u32 tcp_send_seq;
};
@@ -2424,7 +2424,7 @@ struct tstorm_cam_entry {
u16 lsb_mac_addr;
u16 middle_mac_addr;
u16 msb_mac_addr;
- u16 flags;
+ __le16 flags;
#define TSTORM_CAM_ENTRY_PORT_ID (0x1<<0)
#define TSTORM_CAM_ENTRY_PORT_ID_SHIFT 0
#define TSTORM_CAM_ENTRY_RSRVVAL0 (0x7<<1)
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 3d0907b..5e5e008 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -468,7 +468,7 @@ static int bnx2x_mc_assert(struct bnx2x *bp)
static void bnx2x_fw_dump(struct bnx2x *bp)
{
u32 mark, offset;
- u32 data[9];
+ __be32 data[9];
int word;
mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104);
@@ -479,14 +479,14 @@ static void bnx2x_fw_dump(struct bnx2x *bp)
for (word = 0; word < 8; word++)
data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH +
offset + 4*word));
- data[8] = 0x0;
+ data[8] = cpu_to_be32(0);
printk(KERN_CONT "%s", (char *)data);
}
for (offset = 0xF108; offset <= mark - 0x08000000; offset += 0x8*4) {
for (word = 0; word < 8; word++)
data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH +
offset + 4*word));
- data[8] = 0x0;
+ data[8] = cpu_to_be32(0);
printk(KERN_CONT "%s", (char *)data);
}
printk("\n" KERN_ERR PFX "end of fw dump\n");
@@ -9699,11 +9699,11 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
bd_prod, ++nbd);
pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
- pbd->tcp_send_seq = swab32(tcp_hdr(skb)->seq);
+ pbd->tcp_send_seq = cpu_to_le32(be32_to_cpu(tcp_hdr(skb)->seq));
pbd->tcp_flags = pbd_tcp_flags(skb);
if (xmit_type & XMIT_GSO_V4) {
- pbd->ip_id = swab16(ip_hdr(skb)->id);
+ pbd->ip_id = cpu_to_le16(be16_to_cpu(ip_hdr(skb)->id));
pbd->tcp_pseudo_csum =
swab16(~csum_tcpudp_magic(ip_hdr(skb)->saddr,
ip_hdr(skb)->daddr,
--
1.6.1.249.g455e5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 8/9] bnx2x: further annotations
2009-01-21 5:50 [PATCH 8/9] bnx2x: further annotations Harvey Harrison
@ 2009-01-22 17:49 ` Eilon Greenstein
2009-01-22 18:17 ` Harvey Harrison
0 siblings, 1 reply; 3+ messages in thread
From: Eilon Greenstein @ 2009-01-22 17:49 UTC (permalink / raw)
To: Harvey Harrison; +Cc: linux-netdev
On Tue, 2009-01-20 at 21:50 -0800, Harvey Harrison wrote:
> No functional annotations, just documenting the status quo.
>
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
[...]
> @@ -9699,11 +9699,11 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
> bd_prod, ++nbd);
>
> pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
> - pbd->tcp_send_seq = swab32(tcp_hdr(skb)->seq);
> + pbd->tcp_send_seq = cpu_to_le32(be32_to_cpu(tcp_hdr(skb)->seq));
Hmmm.... That looks worse to me. Do we really need to replace swab with
cpu_to_le on top of be_to_cpu?
> pbd->tcp_flags = pbd_tcp_flags(skb);
>
> if (xmit_type & XMIT_GSO_V4) {
> - pbd->ip_id = swab16(ip_hdr(skb)->id);
> + pbd->ip_id = cpu_to_le16(be16_to_cpu(ip_hdr(skb)->id));
Same question
> pbd->tcp_pseudo_csum =
> swab16(~csum_tcpudp_magic(ip_hdr(skb)->saddr,
> ip_hdr(skb)->daddr,
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 8/9] bnx2x: further annotations
2009-01-22 17:49 ` Eilon Greenstein
@ 2009-01-22 18:17 ` Harvey Harrison
0 siblings, 0 replies; 3+ messages in thread
From: Harvey Harrison @ 2009-01-22 18:17 UTC (permalink / raw)
To: Eilon Greenstein; +Cc: linux-netdev
On Thu, 2009-01-22 at 19:49 +0200, Eilon Greenstein wrote:
> On Tue, 2009-01-20 at 21:50 -0800, Harvey Harrison wrote:
> > No functional annotations, just documenting the status quo.
> >
> > Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
>
> [...]
>
> > @@ -9699,11 +9699,11 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
> > bd_prod, ++nbd);
> >
> > pbd->lso_mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
> > - pbd->tcp_send_seq = swab32(tcp_hdr(skb)->seq);
> > + pbd->tcp_send_seq = cpu_to_le32(be32_to_cpu(tcp_hdr(skb)->seq));
>
> Hmmm.... That looks worse to me. Do we really need to replace swab with
> cpu_to_le on top of be_to_cpu?
Agreed that it is ugly, in a future patch I was thinking of changing tcp_send_seq
to just be treated as a be-value throughout the driver, or at least a cpu-endian.
These patches are more about documenting the status quo than making functional
changes like that, so I went with the somewhat ugly annotation for now. Once
the endian noise has been reduced, it will be a lot easier to make changes
without introducing bugs.
Harvey
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-22 18:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-21 5:50 [PATCH 8/9] bnx2x: further annotations Harvey Harrison
2009-01-22 17:49 ` Eilon Greenstein
2009-01-22 18:17 ` Harvey Harrison
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).