diff mbox

[8/9] bnx2x: further annotations

Message ID 1232517051.9701.26.camel@brick
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Harvey Harrison Jan. 21, 2009, 5:50 a.m. UTC
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(-)

Comments

Eilon Greenstein Jan. 22, 2009, 5:49 p.m. UTC | #1
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,


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Harvey Harrison Jan. 22, 2009, 6:17 p.m. UTC | #2
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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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,