Re: [PATCH 1/3] NetXen: Fixes for ppc architecture.

2007-02-06 Thread Jeff Garzik

Amit S. Kale wrote:

NetXen: Fixes for ppc architecture.

Signed-off-by: Amit S. Kale [EMAIL PROTECTED]


applied 2-3.  patch #1 failed to apply.


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] NetXen: Fixes for ppc architecture.

2007-02-05 Thread Amit S. Kale
NetXen: Fixes for ppc architecture.

Signed-off-by: Amit S. Kale [EMAIL PROTECTED]

---

 netxen_nic.h  |   98 --
 netxen_nic_hw.c   |   31 -
 netxen_nic_init.c |   16 
 netxen_nic_main.c |7 ++-
 netxen_nic_niu.c  |2 -
 5 files changed, 89 insertions(+), 65 deletions(-)
  
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 59324b1..d689476 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -246,6 +246,18 @@ #define _netxen_set_bits(config_word, st
(config_word) |= (((value)  (start))  mask); \
 }
 
+static inline u32 netxen_set_32bits(u32 config_word, int start,
+ int bits, u32 val)
+{
+   _netxen_set_bits(config_word, start, bits, val);
+   return config_word;
+}
+static inline u16 netxen_set_16bits(u16 config_word, int start,
+ int bits, u16 val)
+{
+   _netxen_set_bits(config_word, start, bits, val);
+   return config_word;
+}
 #define netxen_set_msg_peg_id(config_word, val)\
_netxen_set_bits(config_word, 0, 2, val)
 #define netxen_set_msg_privid(config_word) \
@@ -305,69 +317,77 @@ #define netxen_set_cmd_desc_port(cmd_des
((cmd_desc)-port_ctxid |= ((var)  0x0F))
 
 #define netxen_set_cmd_desc_flags(cmd_desc, val)   \
-   _netxen_set_bits((cmd_desc)-flags_opcode, 0, 7, val)
+   (cmd_desc)-flags_opcode = cpu_to_le16( \
+   netxen_set_16bits(le16_to_cpu((cmd_desc)-flags_opcode), 0, 7, val))
+
 #define netxen_set_cmd_desc_opcode(cmd_desc, val)  \
-   _netxen_set_bits((cmd_desc)-flags_opcode, 7, 6, val)
+   (cmd_desc)-flags_opcode = cpu_to_le16( \
+   netxen_set_16bits(le16_to_cpu((cmd_desc)-flags_opcode), 7, 6, val))
 
 #define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \
-   _netxen_set_bits((cmd_desc)-num_of_buffers_total_length, 0, 8, val);
+   (cmd_desc)-num_of_buffers_total_length = cpu_to_le32(  \
+   netxen_set_32bits(le32_to_cpu((cmd_desc)-num_of_buffers_total_length), 
\
+ 0, 8, val))
+
 #define netxen_set_cmd_desc_totallength(cmd_desc, val) \
-   _netxen_set_bits((cmd_desc)-num_of_buffers_total_length, 8, 24, val);
+   (cmd_desc)-num_of_buffers_total_length = cpu_to_le32(  \
+   netxen_set_32bits(le32_to_cpu((cmd_desc)-num_of_buffers_total_length), 
\
+ 8, 24, val))
 
 #define netxen_get_cmd_desc_opcode(cmd_desc)   \
-   (((cmd_desc)-flags_opcode  7)  0x003F)
+   ((le16_to_cpu((cmd_desc)-flags_opcode)  7)  0x003F)
 #define netxen_get_cmd_desc_totallength(cmd_desc)  \
-   (((cmd_desc)-num_of_buffers_total_length  8)  0x0FF)
+   ((le32_to_cpu((cmd_desc)-num_of_buffers_total_length)  8)  
0x0FF)
 
 struct cmd_desc_type0 {
u8 tcp_hdr_offset;  /* For LSO only */
u8 ip_hdr_offset;   /* For LSO only */
/* Bit pattern: 0-6 flags, 7-12 opcode, 13-15 unused */
-   u16 flags_opcode;
+   __le16 flags_opcode;
/* Bit pattern: 0-7 total number of segments,
   8-31 Total size of the packet */
-   u32 num_of_buffers_total_length;
+   __le32 num_of_buffers_total_length;
union {
struct {
-   u32 addr_low_part2;
-   u32 addr_high_part2;
+   __le32 addr_low_part2;
+   __le32 addr_high_part2;
};
-   u64 addr_buffer2;
+   __le64 addr_buffer2;
};
 
-   u16 reference_handle;   /* changed to u16 to add mss */
-   u16 mss;/* passed by NDIS_PACKET for LSO */
+   __le16 reference_handle;/* changed to u16 to add mss */
+   __le16 mss; /* passed by NDIS_PACKET for LSO */
/* Bit pattern 0-3 port, 0-3 ctx id */
u8 port_ctxid;
u8 total_hdr_length;/* LSO only : MAC+IP+TCP Hdr size */
-   u16 conn_id;/* IPSec offoad only */
+   __le16 conn_id; /* IPSec offoad only */
 
union {
struct {
-   u32 addr_low_part3;
-   u32 addr_high_part3;
+   __le32 addr_low_part3;
+   __le32 addr_high_part3;
};
-   u64 addr_buffer3;
+   __le64 addr_buffer3;
};
union {
struct {
-   u32 addr_low_part1;
-   u32 addr_high_part1;
+   __le32 addr_low_part1;
+   __le32 addr_high_part1;
};
-   u64 addr_buffer1;
+   __le64 addr_buffer1;
};
 
-   u16 buffer1_length;
-   u16 buffer2_length;
-   u16 buffer3_length;
-   u16 buffer4_length;
+   __le16 buffer1_length;
+   __le16 buffer2_length;
+   __le16