[PATCH 7/7] NetXen: Fix for vmalloc issues

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix vmalloc errors on seen on some X86 high end machines.

Signed-off by: Milan Bag <[EMAIL PROTECTED]> 
Acked-by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 7ba2383..6907244 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -131,8 +131,8 @@ #define NX_P2_C10x25
 #define FIRST_PAGE_GROUP_START 0
 #define FIRST_PAGE_GROUP_END   0x10
 
-#define SECOND_PAGE_GROUP_START0x400
-#define SECOND_PAGE_GROUP_END  0x66BC000
+#define SECOND_PAGE_GROUP_START0x600
+#define SECOND_PAGE_GROUP_END  0x68BC000
 
 #define THIRD_PAGE_GROUP_START 0x70E4000
 #define THIRD_PAGE_GROUP_END   0x800
-
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 6/7] NetXen: Fixes for Power PC architecture

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix PPC architecture specific bugs
Fixes some issues seen on Big endian machines.

Signed-off by: Milan Bag <[EMAIL PROTECTED]> 
Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h  |6 +++---
 drivers/net/netxen/netxen_nic_hw.c   |3 +--
 drivers/net/netxen/netxen_nic_init.c |4 ++--
 drivers/net/netxen/netxen_nic_main.c |0 
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 43e712d..e0c3aab 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -64,9 +64,9 @@ #include 
 #include "netxen_nic_hw.h"
 
 #define _NETXEN_NIC_LINUX_MAJOR 3
-#define _NETXEN_NIC_LINUX_MINOR 3
-#define _NETXEN_NIC_LINUX_SUBVERSION 3
-#define NETXEN_NIC_LINUX_VERSIONID  "3.3.3"
+#define _NETXEN_NIC_LINUX_MINOR 4
+#define _NETXEN_NIC_LINUX_SUBVERSION 2
+#define NETXEN_NIC_LINUX_VERSIONID  "3.4.2"
 
 #define NUM_FLASH_SECTORS (64)
 #define FLASH_SECTOR_SIZE (64 * 1024)
diff --git a/drivers/net/netxen/netxen_nic_hw.c 
b/drivers/net/netxen/netxen_nic_hw.c
index fba8790..2af5a9d 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -1115,7 +1115,7 @@ void netxen_nic_flash_print(struct netxe
char brd_name[NETXEN_MAX_SHORT_NAME];
struct netxen_new_user_info user_info;
int i, addr = USER_START;
-   u32 *ptr32;
+   __le32 *ptr32;
 
struct netxen_board_info *board_info = &(adapter->ahw.boardcfg);
if (board_info->magic != NETXEN_BDINFO_MAGIC) {
@@ -1141,7 +1141,6 @@ void netxen_nic_flash_print(struct netxe
   netxen_nic_driver_name);
return;
}
-   *ptr32 = le32_to_cpu(*ptr32);
ptr32++;
addr += sizeof(u32);
}
diff --git a/drivers/net/netxen/netxen_nic_init.c 
b/drivers/net/netxen/netxen_nic_init.c
index ca3d78b..b75998d 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -439,6 +439,7 @@ do_rom_fast_read_words(struct netxen_ada
ret = do_rom_fast_read(adapter, addridx, (int *)bytes);
if (ret != 0)
break;
+   *(int *)bytes = cpu_to_le32(*(int *)bytes);
bytes += 4;
}
 
@@ -496,8 +497,7 @@ static inline int do_rom_fast_write_word
int timeout = 0;
int data;
 
-   data = *(u32*)bytes;
-
+   data = le32_to_cpu((*(u32*)bytes));
ret = do_rom_fast_write(adapter, addridx, data);
if (ret < 0)
return ret;
diff --git a/drivers/net/netxen/netxen_nic_main.c 
b/drivers/net/netxen/netxen_nic_main.c
-
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 5/7] NetXen: Port swap feature for multi port cards

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
NetXen: Port Swap feature
This patch will allow a port numbers on the card to be swapped in
host driver. This feature is applicable to cards having more than
1 port. 

Signed-off by: Milan Bag <[EMAIL PROTECTED]> 
Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h  |   21 +
 drivers/net/netxen/netxen_nic_ethtool.c  |  143 ++---
 drivers/net/netxen/netxen_nic_hdr.h  |3 
 drivers/net/netxen/netxen_nic_hw.c   |   67 
 drivers/net/netxen/netxen_nic_hw.h   |   63 
 drivers/net/netxen/netxen_nic_init.c |2 
 drivers/net/netxen/netxen_nic_isr.c  |   29 -
 drivers/net/netxen/netxen_nic_main.c |  306 -
 drivers/net/netxen/netxen_nic_niu.c  |   93 --
 drivers/net/netxen/netxen_nic_phan_reg.h |7 
 10 files changed, 468 insertions(+), 266 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index c85c2cb..43e712d 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -205,6 +205,7 @@ #define RCV_DESC_TYPE(ID) \
 
 #define MAX_CMD_DESCRIPTORS1024
 #define MAX_RCV_DESCRIPTORS16384
+#define MAX_CMD_DESCRIPTORS_HOST   (MAX_CMD_DESCRIPTORS / 4)
 #define MAX_RCV_DESCRIPTORS_1G (MAX_RCV_DESCRIPTORS / 4)
 #define MAX_JUMBO_RCV_DESCRIPTORS  1024
 #define MAX_LRO_RCV_DESCRIPTORS64
@@ -304,6 +305,8 @@ #define FLAGS_VLAN_TAGGED   0x10
 
 #define netxen_set_cmd_desc_port(cmd_desc, var)\
((cmd_desc)->port_ctxid |= ((var) & 0x0F))
+#define netxen_set_cmd_desc_ctxid(cmd_desc, var)   \
+   ((cmd_desc)->port_ctxid |= ((var) & 0xF0))
 
 #define netxen_set_cmd_desc_flags(cmd_desc, val)   \
((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \
@@ -446,7 +449,7 @@ struct status_desc {
/* Bit pattern: 0-6 lro_count indicates frag sequence,
   7 last_frag indicates last frag */
u8 lro;
-} __attribute__ ((aligned(8)));
+} __attribute__ ((aligned(16)));
 
 enum {
NETXEN_RCV_PEG_0 = 0,
@@ -724,6 +727,18 @@ struct netxen_skb_frag {
u32 length;
 };
 
+#define _netxen_set_bits(config_word, start, bits, val){\
+   unsigned long long __tmask = (((1ULL << (bits)) - 1) << (start));\
+   unsigned long long __tvalue = (val);\
+   (config_word) &= ~__tmask;  \
+   (config_word) |= (((__tvalue) << (start)) & __tmask); \
+}
+   
+#define _netxen_clear_bits(config_word, start, bits) {\
+   unsigned long long __tmask = (((1ULL << (bits)) - 1) << (start));  \
+   (config_word) &= ~__tmask; \
+}  
+
 /*Following defines are for the state of the buffers*/
 #defineNETXEN_BUFFER_FREE  0
 #defineNETXEN_BUFFER_BUSY  1
@@ -768,6 +783,8 @@ struct netxen_hardware_context {
void __iomem *pci_base0;
void __iomem *pci_base1;
void __iomem *pci_base2;
+   unsigned long first_page_group_end;
+   unsigned long first_page_group_start;
void __iomem *db_base;
unsigned long db_len;
 
@@ -863,6 +880,7 @@ struct netxen_adapter {
struct netxen_adapter *master;
struct net_device *netdev;
struct pci_dev *pdev;
+   struct net_device_stats net_stats;
unsigned char mac_addr[MAC_ADDR_LEN];
int mtu;
int portnum;
@@ -1153,4 +1171,5 @@ extern int netxen_rom_fast_read(struct n
 
 extern struct ethtool_ops netxen_nic_ethtool_ops;
 
+extern int physical_port[];/* physical port # from virtual port.*/
 #endif /* __NETXEN_NIC_H_ */
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c 
b/drivers/net/netxen/netxen_nic_ethtool.c
index 24c68f4..16fabb3 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -40,8 +40,8 @@ #include 
 #include 
 #include 
 
-#include "netxen_nic_hw.h"
 #include "netxen_nic.h"
+#include "netxen_nic_hw.h"
 #include "netxen_nic_phan_reg.h"
 
 struct netxen_nic_stats {
@@ -379,7 +379,7 @@ netxen_nic_get_regs(struct net_device *d
for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) {
/* GB: port specific registers */
if (mode == 0 && i >= 19)
-   window = adapter->portnum * 
+   window = physical_port[adapter->portnum] *
NETXEN_NIC_PORT_WINDOW;
 
NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode].
@@ -537,16 +537,43 @@ netxen_nic_get_pauseparam(struct net_dev
 {
struct netxen_adapter *adapter = netdev_priv(dev);
__u32 val;
+   int port = physical_port[adapter->portnum];
 
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
+   if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
+   return;
/* get flow control settings */
-   netxen_nic_r

[PATCH 3/7] NetXen: Multi PCI support for Quad cards

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix the multi PCI function for cards with more than 2 ports.
This patch fixes the working of multi PCI capable driver on cards with 
more than 2 ports by adding the addresses for their rings and sizes.

Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic_hw.c   |  115 +++--
 drivers/net/netxen/netxen_nic_init.c |4 
 drivers/net/netxen/netxen_nic_main.c |   61 +--
 drivers/net/netxen/netxen_nic_phan_reg.h |6 -
 4 files changed, 144 insertions(+), 42 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic_hw.c 
b/drivers/net/netxen/netxen_nic_hw.c
index a066208..c464bc7 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -140,8 +140,105 @@ struct netxen_recv_crb recv_crb_register
 NETXEN_NIC_REG(0x180),
 /* crb_status_ring_size */
 NETXEN_NIC_REG(0x184),
-
 },
+   /*
+* Instance 3,
+*/
+   {
+ {
+   {
+   /* crb_rcv_producer_offset: */
+   NETXEN_NIC_REG(0x1d8),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x1dc),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x1f0),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x1f4),
+   },
+   /* Jumbo frames */
+   {
+   /* crb_rcv_producer_offset: */  
+   NETXEN_NIC_REG(0x1f8),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x1fc),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x200),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x204),
+   },
+   /* LRO */
+   {
+   /* crb_rcv_producer_offset: */
+   NETXEN_NIC_REG(0x208),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x20c),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x210),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x214),
+   }
+ },
+ /* crb_rcvstatus_ring: */
+ NETXEN_NIC_REG(0x218),
+ /* crb_rcv_status_producer: */
+ NETXEN_NIC_REG(0x21c),
+ /* crb_rcv_status_consumer: */
+ NETXEN_NIC_REG(0x220),
+ /* crb_rcvpeg_state: */
+ NETXEN_NIC_REG(0x224),
+ /* crb_status_ring_size */
+ NETXEN_NIC_REG(0x228),
+   },
+   /*
+* Instance 4,
+*/
+   {
+ {
+   {
+   /* crb_rcv_producer_offset: */
+   NETXEN_NIC_REG(0x22c),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x230),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x234),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x238),
+   },
+   /* Jumbo frames */
+   {
+   /* crb_rcv_producer_offset: */ 
+   NETXEN_NIC_REG(0x23c),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x240),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x244),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x248),
+   },
+   /* LRO */
+   {
+   /* crb_rcv_producer_offset: */
+   NETXEN_NIC_REG(0x24c),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x250),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x254),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x258),
+   }
+ },
+ /* crb_rcvstatus_ring: */
+ NETXEN_NIC_REG(0x25c),
+ /* crb_rcv_status_producer: */
+ NETXEN_NIC_REG(0x260),
+ /* crb_rcv_status_consumer: */
+ NETXEN_NIC_REG(0x264),
+ /* crb_rcvpeg_state: */
+ NETXEN_NIC_REG(0x268),
+ /* crb_status_ring_size */
+ NETXEN_NIC_REG(0x26c),
+   },
 };
 
 u64 ctx_addr_sig_regs[][3] = {
@@ -294,6 +391,7 @@ int netxen_nic_hw_resources(struct netxe
u32 card_cmdring = 0;
struct netxen_recv_context *recv_ctx;
struct netxen_rcv_desc_ctx *rcv_desc;
+   int func_id = adapter->portnum;
 
DPRINTK(INFO, "crb_base: %lx %x", NETXEN_PCI_CRBSPACE,
PCI_OFFSET_SECOND_RANGE(adapter, NETXEN_PCI_CRBSPACE));
@@ -349,6 +447,7 @@ int netxen_nic_hw_resources(struct netxe
}
memset(addr, 0, sizeof(struct netxen_ring_ctx));
adapter->ctx_desc = (struct netxen_ring_ctx *)addr;
+   adapter->ctx_desc->ctx_id = adapter->portnum;
adapter->ctx_desc->cmd_consumer_offset =
cpu_to_le64(adapter->ctx_desc_phys_addr +
sizeof(struct netxen_ring_ctx));
@@ -419,11 +518,11 @@ int netxen_nic_hw_resources(struct netxe
/* Window = 1 */
 
writel(lower32(adapter->ctx_desc_phys_addr),
-  NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_ADDR_REG_LO));
+  NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_ADDR_REG_LO(fun

[PATCH 4/7] NetXen: Removal of redundant macros

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
NetXen: Remove 2 redundant macro definitions from header file.

Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic_phan_reg.h |2 --
 1 files changed, 2 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h 
b/drivers/net/netxen/netxen_nic_phan_reg.h
index cb9acf1..12bcaf9 100644
--- a/drivers/net/netxen/netxen_nic_phan_reg.h
+++ b/drivers/net/netxen/netxen_nic_phan_reg.h
@@ -100,8 +100,6 @@ #define CRB_JUMBO_BUFFER_CONS   NETX
 
 #define CRB_CMD_PRODUCER_OFFSET_1   NETXEN_NIC_REG(0x1ac)
 #define CRB_CMD_CONSUMER_OFFSET_1   NETXEN_NIC_REG(0x1b0)
-#define CRB_CMD_PRODUCER_OFFSET_1   NETXEN_NIC_REG(0x1ac)
-#define CRB_CMD_CONSUMER_OFFSET_1   NETXEN_NIC_REG(0x1b0)
 #define CRB_CMD_PRODUCER_OFFSET_2   NETXEN_NIC_REG(0x1b8)
 #define CRB_CMD_CONSUMER_OFFSET_2   NETXEN_NIC_REG(0x1bc)
 
-
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 2/7] NetXen: Removal of redundant argument passing

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
NetXen: Removal of redundant function call parameters and bug fixes.
This patch will remove the redundant paramters which were being passed to
many functions since now adapter->portnum can be used.

Signed-off-by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h |   33 +++
 drivers/net/netxen/netxen_nic_ethtool.c |   10 +-
 drivers/net/netxen/netxen_nic_hdr.h |1 
 drivers/net/netxen/netxen_nic_hw.c  |   23 +++--
 drivers/net/netxen/netxen_nic_hw.h  |4 
 drivers/net/netxen/netxen_nic_init.c|7 -
 drivers/net/netxen/netxen_nic_isr.c |9 +-
 drivers/net/netxen/netxen_nic_main.c|   32 +--
 drivers/net/netxen/netxen_nic_niu.c |   96 +-
 9 files changed, 114 insertions(+), 101 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 7a5a95e..c85c2cb 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -205,6 +205,7 @@ #define RCV_DESC_TYPE(ID) \
 
 #define MAX_CMD_DESCRIPTORS1024
 #define MAX_RCV_DESCRIPTORS16384
+#define MAX_RCV_DESCRIPTORS_1G (MAX_RCV_DESCRIPTORS / 4)
 #define MAX_JUMBO_RCV_DESCRIPTORS  1024
 #define MAX_LRO_RCV_DESCRIPTORS64
 #define MAX_RCVSTATUS_DESCRIPTORS  MAX_RCV_DESCRIPTORS
@@ -781,6 +782,7 @@ struct netxen_hardware_context {
struct pci_dev *cmd_desc_pdev;
dma_addr_t cmd_desc_phys_addr;
struct netxen_adapter *adapter;
+   int pci_func;
 };
 
 #define RCV_RING_LRO   RCV_DESC_LRO
@@ -917,15 +919,15 @@ struct netxen_adapter {
struct netxen_ring_ctx *ctx_desc;
struct pci_dev *ctx_desc_pdev;
dma_addr_t ctx_desc_phys_addr;
-   int (*enable_phy_interrupts) (struct netxen_adapter *, int);
-   int (*disable_phy_interrupts) (struct netxen_adapter *, int);
+   int (*enable_phy_interrupts) (struct netxen_adapter *);
+   int (*disable_phy_interrupts) (struct netxen_adapter *);
void (*handle_phy_intr) (struct netxen_adapter *);
int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t);
int (*set_mtu) (struct netxen_adapter *, int);
int (*set_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
int (*unset_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
-   int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *);
-   int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
+   int (*phy_read) (struct netxen_adapter *, long reg, u32 *);
+   int (*phy_write) (struct netxen_adapter *, long reg, u32 val);
int (*init_port) (struct netxen_adapter *, int);
void (*init_niu) (struct netxen_adapter *);
int (*stop_port) (struct netxen_adapter *);
@@ -971,27 +973,21 @@ static inline void __iomem *pci_base(str
return NULL;
 }
 
-int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter,
- int port);
-int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter,
-int port);
-int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter,
-  int port);
-int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter,
- int port);
-int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter,
-int port);
-int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter,
-   int port);
+int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter);
 void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter);
 void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter);
 void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, int port,
 long enable);
 void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, int port,
  long enable);
-int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, long reg,
+int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
__u32 * readval);
-int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy,
+int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter,
 long reg, __u32 val);
 
 /* Functions available from netxen_nic_hw.c */
@@ -1011,6 +1007,7 @@ int netxen_nic_hw_writ

[PATCH 0/7] NetXen: Make driver use multiple PCI functions

2007-04-19 Thread Linsys Contractor Mithlesh Thukral
hi All,

Thanks Christoph and Stephen for your feedback. I am resending the 7 patches
after incorporating their suggestions.
These patches are with respect to netdev#upstream and we wish their inclusion 
in 2.6.22 kernel.

Out of these the first 2 patches were already accepted into the netdev tree, 
but we have requested them to be dropped. So we are resending those 2.
Please see the following thread for more details :
http://www.spinics.net/lists/netdev/msg26805.html

Regards,
Mithlesh Thukral
-
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 7/7] NetXen: Fix for vmalloc issues

2007-04-13 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix vmalloc errors on seen on some X86 high end machines.

Signed-off by: Milan Bag <[EMAIL PROTECTED]> 
Acked-by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 7ba2383..6907244 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -131,8 +131,8 @@ #define NX_P2_C10x25
 #define FIRST_PAGE_GROUP_START 0
 #define FIRST_PAGE_GROUP_END   0x10
 
-#define SECOND_PAGE_GROUP_START0x400
-#define SECOND_PAGE_GROUP_END  0x66BC000
+#define SECOND_PAGE_GROUP_START0x600
+#define SECOND_PAGE_GROUP_END  0x68BC000
 
 #define THIRD_PAGE_GROUP_START 0x70E4000
 #define THIRD_PAGE_GROUP_END   0x800
-
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 6/7] NetXen: Fixes for Power PC architecture

2007-04-13 Thread Linsys Contractor Mithlesh Thukral
NetXen: Configurable interrupts on PPC architecture
This patch will add support to add command line argument to specify
the interrupt type on a PPC machine. Fixes some issues seen on Big endian
machines.

Signed-off by: Milan Bag <[EMAIL PROTECTED]> 
Acked-by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h  |6 +++---
 drivers/net/netxen/netxen_nic_hw.c   |2 +-
 drivers/net/netxen/netxen_nic_init.c |4 ++--
 drivers/net/netxen/netxen_nic_main.c |6 ++
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 3549c7c..7ba2383 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -64,9 +64,9 @@ #include 
 #include "netxen_nic_hw.h"
 
 #define _NETXEN_NIC_LINUX_MAJOR 3
-#define _NETXEN_NIC_LINUX_MINOR 3
-#define _NETXEN_NIC_LINUX_SUBVERSION 3
-#define NETXEN_NIC_LINUX_VERSIONID  "3.3.3"
+#define _NETXEN_NIC_LINUX_MINOR 4
+#define _NETXEN_NIC_LINUX_SUBVERSION 2
+#define NETXEN_NIC_LINUX_VERSIONID  "3.4.2"
 
 #define NUM_FLASH_SECTORS (64)
 #define FLASH_SECTOR_SIZE (64 * 1024)
diff --git a/drivers/net/netxen/netxen_nic_hw.c 
b/drivers/net/netxen/netxen_nic_hw.c
index 3195fa5..4206125 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -1141,7 +1141,7 @@ void netxen_nic_flash_print(struct netxe
   netxen_nic_driver_name);
return;
}
-   *ptr32 = le32_to_cpu(*ptr32);
+   *ptr32 = cpu_to_le32(*ptr32);
ptr32++;
addr += sizeof(u32);
}
diff --git a/drivers/net/netxen/netxen_nic_init.c 
b/drivers/net/netxen/netxen_nic_init.c
index 3c68eea..3e2b541 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -439,6 +439,7 @@ do_rom_fast_read_words(struct netxen_ada
ret = do_rom_fast_read(adapter, addridx, (int *)bytes);
if (ret != 0)
break;
+   *(int *)bytes = cpu_to_le32(*(int *)bytes);
bytes += 4;
}
 
@@ -496,8 +497,7 @@ static inline int do_rom_fast_write_word
int timeout = 0;
int data;
 
-   data = *(u32*)bytes;
-
+   data = le32_to_cpu((*(u32*)bytes));
ret = do_rom_fast_write(adapter, addridx, data);
if (ret < 0)
return ret;
diff --git a/drivers/net/netxen/netxen_nic_main.c 
b/drivers/net/netxen/netxen_nic_main.c
index 1739308..18521a4 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -51,6 +51,12 @@ module_param(nx_ppc_msi_enable, int, 064
 MODULE_PARM_DESC(nx_ppc_msi_enable, "NetXen PPC MSI enable value");
 #endif /* CONFIG_PPC */
 
+#ifdef CONFIG_PPC
+static int nx_ppc_msi_enable = 0;  /* by default donot enable msi */
+module_param(nx_ppc_msi_enable, int, 0644);
+MODULE_PARM_DESC(nx_ppc_msi_enable, "NetXen PPC MSI enable value");
+#endif /* CONFIG_PPC */
+
 char netxen_nic_driver_name[] = "netxen-nic";
 static char netxen_nic_driver_string[] = "NetXen Network Driver version "
 NETXEN_NIC_LINUX_VERSIONID;
-
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 5/7] NetXen: Port swap feature for multi port cards

2007-04-13 Thread Linsys Contractor Mithlesh Thukral
NetXen: Port Swap feature
This patch will allow a port numbers on the card to be swapped in
host driver. This feature is applicable to cards having more than
1 port. 

Signed-off by: Milan Bag <[EMAIL PROTECTED]> 
Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h  |   21 +
 drivers/net/netxen/netxen_nic_ethtool.c  |  144 ++---
 drivers/net/netxen/netxen_nic_hdr.h  |3 
 drivers/net/netxen/netxen_nic_hw.c   |   67 
 drivers/net/netxen/netxen_nic_hw.h   |   63 
 drivers/net/netxen/netxen_nic_init.c |2 
 drivers/net/netxen/netxen_nic_isr.c  |   29 -
 drivers/net/netxen/netxen_nic_main.c |  327 +
 drivers/net/netxen/netxen_nic_niu.c  |   93 -
 drivers/net/netxen/netxen_nic_phan_reg.h |7 
 10 files changed, 490 insertions(+), 266 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index c85c2cb..3549c7c 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -205,6 +205,7 @@ #define RCV_DESC_TYPE(ID) \
 
 #define MAX_CMD_DESCRIPTORS1024
 #define MAX_RCV_DESCRIPTORS16384
+#define MAX_CMD_DESCRIPTORS_HOST   (MAX_CMD_DESCRIPTORS / 4)
 #define MAX_RCV_DESCRIPTORS_1G (MAX_RCV_DESCRIPTORS / 4)
 #define MAX_JUMBO_RCV_DESCRIPTORS  1024
 #define MAX_LRO_RCV_DESCRIPTORS64
@@ -304,6 +305,8 @@ #define FLAGS_VLAN_TAGGED   0x10
 
 #define netxen_set_cmd_desc_port(cmd_desc, var)\
((cmd_desc)->port_ctxid |= ((var) & 0x0F))
+#define netxen_set_cmd_desc_ctxid(cmd_desc, var)   \
+   ((cmd_desc)->port_ctxid |= ((var) & 0xF0))
 
 #define netxen_set_cmd_desc_flags(cmd_desc, val)   \
((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \
@@ -446,7 +449,7 @@ struct status_desc {
/* Bit pattern: 0-6 lro_count indicates frag sequence,
   7 last_frag indicates last frag */
u8 lro;
-} __attribute__ ((aligned(8)));
+} __attribute__ ((aligned(16)));
 
 enum {
NETXEN_RCV_PEG_0 = 0,
@@ -724,6 +727,18 @@ struct netxen_skb_frag {
u32 length;
 };
 
+#define _netxen_set_bits(config_word, start, bits, val){\
+   unsigned long long __tmask = (((1ULL << (bits)) - 1) << (start));\
+   unsigned long long __tvalue = (val);\
+   (config_word) &= ~__tmask;  \
+   (config_word) |= (((__tvalue) << (start)) & __tmask); \
+}
+   
+#define _netxen_clear_bits(config_word, start, bits) {\
+   unsigned long long __tmask = (((1ULL << (bits)) - 1) << (start));  \
+   (config_word) &= ~__tmask; \
+}  
+
 /*Following defines are for the state of the buffers*/
 #defineNETXEN_BUFFER_FREE  0
 #defineNETXEN_BUFFER_BUSY  1
@@ -768,6 +783,8 @@ struct netxen_hardware_context {
void __iomem *pci_base0;
void __iomem *pci_base1;
void __iomem *pci_base2;
+   unsigned long first_page_group_end;
+   unsigned long first_page_group_start;
void __iomem *db_base;
unsigned long db_len;
 
@@ -863,6 +880,7 @@ struct netxen_adapter {
struct netxen_adapter *master;
struct net_device *netdev;
struct pci_dev *pdev;
+   struct net_device_stats net_stats;
unsigned char mac_addr[MAC_ADDR_LEN];
int mtu;
int portnum;
@@ -1153,4 +1171,5 @@ extern int netxen_rom_fast_read(struct n
 
 extern struct ethtool_ops netxen_nic_ethtool_ops;
 
+extern int physical_port[];/* physical port # from virtual port.*/
 #endif /* __NETXEN_NIC_H_ */
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c 
b/drivers/net/netxen/netxen_nic_ethtool.c
index d49a7d8..f808da0 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -40,8 +40,8 @@ #include 
 #include 
 #include 
 
-#include "netxen_nic_hw.h"
 #include "netxen_nic.h"
+#include "netxen_nic_hw.h"
 #include "netxen_nic_phan_reg.h"
 
 struct netxen_nic_stats {
@@ -379,7 +379,8 @@ netxen_nic_get_regs(struct net_device *d
for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) {
/* GB: port specific registers */
if (mode == 0 && i >= 19)
-   window = adapter->portnum * 
NETXEN_NIC_PORT_WINDOW;
+   window = physical_port[adapter->portnum] * 
+   NETXEN_NIC_PORT_WINDOW;
 
NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode].
   reg[i - 3] + window,
@@ -535,16 +536,43 @@ netxen_nic_get_pauseparam(struct net_dev
 {
struct netxen_adapter *adapter = netdev_priv(dev);
__u32 val;
+   int port = physical_port[adapter->portnum];
 
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
+   if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
+   

[PATCH 4/7] NetXen: Removal of redundant macros

2007-04-13 Thread Linsys Contractor Mithlesh Thukral
NetXen: Remove 2 redundant macro definitions from header file.

Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic_phan_reg.h |2 --
 1 files changed, 2 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h 
b/drivers/net/netxen/netxen_nic_phan_reg.h
index cb9acf1..12bcaf9 100644
--- a/drivers/net/netxen/netxen_nic_phan_reg.h
+++ b/drivers/net/netxen/netxen_nic_phan_reg.h
@@ -100,8 +100,6 @@ #define CRB_JUMBO_BUFFER_CONS   NETX
 
 #define CRB_CMD_PRODUCER_OFFSET_1   NETXEN_NIC_REG(0x1ac)
 #define CRB_CMD_CONSUMER_OFFSET_1   NETXEN_NIC_REG(0x1b0)
-#define CRB_CMD_PRODUCER_OFFSET_1   NETXEN_NIC_REG(0x1ac)
-#define CRB_CMD_CONSUMER_OFFSET_1   NETXEN_NIC_REG(0x1b0)
 #define CRB_CMD_PRODUCER_OFFSET_2   NETXEN_NIC_REG(0x1b8)
 #define CRB_CMD_CONSUMER_OFFSET_2   NETXEN_NIC_REG(0x1bc)
 
-
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 3/7] NetXen: Multi PCI support for Quad cards

2007-04-13 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix the multi PCI function for cards with more than 2 ports.
This patch fixes the working of multi PCI capable driver on cards with 
more than 2 ports by adding the addresses for their rings and sizes.

Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic_hw.c   |  119 +++--
 drivers/net/netxen/netxen_nic_init.c |4 
 drivers/net/netxen/netxen_nic_main.c |   61 +-
 drivers/net/netxen/netxen_nic_phan_reg.h |6 -
 4 files changed, 146 insertions(+), 44 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic_hw.c 
b/drivers/net/netxen/netxen_nic_hw.c
index a066208..274a261 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -140,8 +140,105 @@ struct netxen_recv_crb recv_crb_register
 NETXEN_NIC_REG(0x180),
 /* crb_status_ring_size */
 NETXEN_NIC_REG(0x184),
-
 },
+   /*
+* Instance 3,
+*/
+   {
+ {
+   {
+   /* crb_rcv_producer_offset: */
+   NETXEN_NIC_REG(0x1d8),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x1dc),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x1f0),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x1f4),
+   },
+   /* Jumbo frames */
+   {
+   /* crb_rcv_producer_offset: */  
+   NETXEN_NIC_REG(0x1f8),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x1fc),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x200),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x204),
+   },
+   /* LRO */
+   {
+   /* crb_rcv_producer_offset: */
+   NETXEN_NIC_REG(0x208),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x20c),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x210),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x214),
+   }
+ },
+ /* crb_rcvstatus_ring: */
+ NETXEN_NIC_REG(0x218),
+ /* crb_rcv_status_producer: */
+ NETXEN_NIC_REG(0x21c),
+ /* crb_rcv_status_consumer: */
+ NETXEN_NIC_REG(0x220),
+ /* crb_rcvpeg_state: */
+ NETXEN_NIC_REG(0x224),
+ /* crb_status_ring_size */
+ NETXEN_NIC_REG(0x228),
+   },
+   /*
+* Instance 4,
+*/
+   {
+ {
+   {
+   /* crb_rcv_producer_offset: */
+   NETXEN_NIC_REG(0x22c),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x230),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x234),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x238),
+   },
+   /* Jumbo frames */
+   {
+   /* crb_rcv_producer_offset: */ 
+   NETXEN_NIC_REG(0x23c),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x240),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x244),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x248),
+   },
+   /* LRO */
+   {
+   /* crb_rcv_producer_offset: */
+   NETXEN_NIC_REG(0x24c),
+   /* crb_rcv_consumer_offset: */
+   NETXEN_NIC_REG(0x250),
+   /* crb_gloablrcv_ring: */
+   NETXEN_NIC_REG(0x254),
+   /* crb_rcv_ring_size */
+   NETXEN_NIC_REG(0x258),
+   }
+ },
+ /* crb_rcvstatus_ring: */
+ NETXEN_NIC_REG(0x25c),
+ /* crb_rcv_status_producer: */
+ NETXEN_NIC_REG(0x260),
+ /* crb_rcv_status_consumer: */
+ NETXEN_NIC_REG(0x264),
+ /* crb_rcvpeg_state: */
+ NETXEN_NIC_REG(0x268),
+ /* crb_status_ring_size */
+ NETXEN_NIC_REG(0x26c),
+   },
 };
 
 u64 ctx_addr_sig_regs[][3] = {
@@ -294,6 +391,7 @@ int netxen_nic_hw_resources(struct netxe
u32 card_cmdring = 0;
struct netxen_recv_context *recv_ctx;
struct netxen_rcv_desc_ctx *rcv_desc;
+   int func_id = adapter->portnum;
 
DPRINTK(INFO, "crb_base: %lx %x", NETXEN_PCI_CRBSPACE,
PCI_OFFSET_SECOND_RANGE(adapter, NETXEN_PCI_CRBSPACE));
@@ -341,7 +439,7 @@ int netxen_nic_hw_resources(struct netxe
&adapter->ctx_desc_pdev);
 
printk(KERN_INFO "ctx_desc_phys_addr: 0x%llx\n",
-  (unsigned long long) adapter->ctx_desc_phys_addr);
+  (u64) adapter->ctx_desc_phys_addr);
if (addr == NULL) {
DPRINTK(ERR, "bad return from pci_alloc_consistent\n");
err = -ENOMEM;
@@ -349,6 +447,7 @@ int netxen_nic_hw_resources(struct netxe
}
memset(addr, 0, sizeof(struct netxen_ring_ctx));
adapter->ctx_desc = (struct netxen_ring_ctx *)addr;
+   adapter->ctx_desc->ctx_id = adapter->portnum;
adapter->c

[PATCH 2/7] NetXen: removal of redundant argument passing

2007-04-13 Thread Linsys Contractor Mithlesh Thukral
NetXen: Removal of redundant function call parameters and bug fixes.
This patch will remove the redundant paramters which were being passed to
many functions since now adapter->portnum can be used.

Signed-off-by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h |   33 +++
 drivers/net/netxen/netxen_nic_ethtool.c |   10 +-
 drivers/net/netxen/netxen_nic_hdr.h |1 
 drivers/net/netxen/netxen_nic_hw.c  |   23 +++--
 drivers/net/netxen/netxen_nic_hw.h  |4 
 drivers/net/netxen/netxen_nic_init.c|7 -
 drivers/net/netxen/netxen_nic_isr.c |9 +-
 drivers/net/netxen/netxen_nic_main.c|   32 +--
 drivers/net/netxen/netxen_nic_niu.c |   96 +-
 9 files changed, 114 insertions(+), 101 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 7a5a95e..c85c2cb 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -205,6 +205,7 @@ #define RCV_DESC_TYPE(ID) \
 
 #define MAX_CMD_DESCRIPTORS1024
 #define MAX_RCV_DESCRIPTORS16384
+#define MAX_RCV_DESCRIPTORS_1G (MAX_RCV_DESCRIPTORS / 4)
 #define MAX_JUMBO_RCV_DESCRIPTORS  1024
 #define MAX_LRO_RCV_DESCRIPTORS64
 #define MAX_RCVSTATUS_DESCRIPTORS  MAX_RCV_DESCRIPTORS
@@ -781,6 +782,7 @@ struct netxen_hardware_context {
struct pci_dev *cmd_desc_pdev;
dma_addr_t cmd_desc_phys_addr;
struct netxen_adapter *adapter;
+   int pci_func;
 };
 
 #define RCV_RING_LRO   RCV_DESC_LRO
@@ -917,15 +919,15 @@ struct netxen_adapter {
struct netxen_ring_ctx *ctx_desc;
struct pci_dev *ctx_desc_pdev;
dma_addr_t ctx_desc_phys_addr;
-   int (*enable_phy_interrupts) (struct netxen_adapter *, int);
-   int (*disable_phy_interrupts) (struct netxen_adapter *, int);
+   int (*enable_phy_interrupts) (struct netxen_adapter *);
+   int (*disable_phy_interrupts) (struct netxen_adapter *);
void (*handle_phy_intr) (struct netxen_adapter *);
int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t);
int (*set_mtu) (struct netxen_adapter *, int);
int (*set_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
int (*unset_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
-   int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *);
-   int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
+   int (*phy_read) (struct netxen_adapter *, long reg, u32 *);
+   int (*phy_write) (struct netxen_adapter *, long reg, u32 val);
int (*init_port) (struct netxen_adapter *, int);
void (*init_niu) (struct netxen_adapter *);
int (*stop_port) (struct netxen_adapter *);
@@ -971,27 +973,21 @@ static inline void __iomem *pci_base(str
return NULL;
 }
 
-int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter,
- int port);
-int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter,
-int port);
-int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter,
-  int port);
-int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter,
- int port);
-int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter,
-int port);
-int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter,
-   int port);
+int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter);
 void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter);
 void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter);
 void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, int port,
 long enable);
 void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, int port,
  long enable);
-int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, long reg,
+int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
__u32 * readval);
-int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy,
+int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter,
 long reg, __u32 val);
 
 /* Functions available from netxen_nic_hw.c */
@@ -1011,6 +1007,7 @@ int netxen_nic_hw_writ

[PATCH 0/7] NetXen: Make driver use multiple PCI functions

2007-04-13 Thread Linsys Contractor Mithlesh Thukral
hi All,

I will be sending patches for NetXen 1/10G Ethernet driver in subsequent mails.
These patches are with respect to netdev#upstream and we wish their inclusion 
in 2.6.22 kernel.

Out of these the first 2 patches were already accepted into the netdev tree, 
but we have requested them to be dropped. So we are resending those 2.
Please see the following thread for more details :
http://www.spinics.net/lists/netdev/msg26805.html

Regards,
Mithlesh Thukral
-
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 2/2] NetXen: Fix softlockup seen during hardware access

2007-03-13 Thread Linsys Contractor Mithlesh Thukral
NetXen: This will fix a softlock seen on some machines.
The reason was too much time was spent waiting for hardware access
to go through.

Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>
---

 drivers/net/netxen/netxen_nic.h |1 +
 drivers/net/netxen/netxen_nic_ethtool.c |1 +
 drivers/net/netxen/netxen_nic_init.c|   11 +--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 81742e4..dd8ce35 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -232,6 +232,7 @@ #define get_index_range(index,length,cou
 #define MPORT_SINGLE_FUNCTION_MODE 0x
 
 extern unsigned long long netxen_dma_mask;
+extern unsigned long last_schedule_time;
 
 /*
  * NetXen host-peg signal message structure
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c 
b/drivers/net/netxen/netxen_nic_ethtool.c
index 986ef98..ee1b5a2 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -462,6 +462,7 @@ netxen_nic_set_eeprom(struct net_device 
}
printk(KERN_INFO "%s: flash unlocked. \n", 
netxen_nic_driver_name);
+   last_schedule_time = jiffies;
ret = netxen_flash_erase_secondary(adapter);
if (ret != FLASH_SUCCESS) {
printk(KERN_ERR "%s: Flash erase failed.\n", 
diff --git a/drivers/net/netxen/netxen_nic_init.c 
b/drivers/net/netxen/netxen_nic_init.c
index 586d32b..229aa1c 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -42,6 +42,8 @@ struct crb_addr_pair {
u32 data;
 };
 
+unsigned long last_schedule_time;
+
 #define NETXEN_MAX_CRB_XFORM 60
 static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM];
 #define NETXEN_ADDR_ERROR (0x)
@@ -404,9 +406,14 @@ static inline int do_rom_fast_write(stru
 static inline int
 do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp)
 {
+   if (jiffies > (last_schedule_time + (8 * HZ))) {
+   last_schedule_time = jiffies;
+   schedule();
+   }
+
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr);
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3);
-   udelay(70); /* prevent bursting on CRB */
+   udelay(100);/* prevent bursting on CRB */
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb);
if (netxen_wait_rom_done(adapter)) {
@@ -415,7 +422,7 @@ do_rom_fast_read(struct netxen_adapter *
}
/* reset abyte_cnt and dummy_byte_cnt */
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0);
-   udelay(70); /* prevent bursting on CRB */
+   udelay(100);/* prevent bursting on CRB */
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
 
*valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA);
-
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/2] NetXen: Bug fix for Jumbo frames on XG card

2007-03-13 Thread Linsys Contractor Mithlesh Thukral
NetXen: Set the MTU for the right port depending upon the port number
for XG cards.

Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>
---

 drivers/net/netxen/netxen_nic_hw.c |5 -
 1 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/netxen/netxen_nic_hw.c 
b/drivers/net/netxen/netxen_nic_hw.c
index 1be5570..6537574 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -822,7 +822,10 @@ int netxen_nic_set_mtu_xgb(struct netxen
 {
struct netxen_adapter *adapter = port->adapter;
new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE;
-   netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, new_mtu);
+   if (port->portnum == 0)
+   netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, 
new_mtu);
+   else if (port->portnum == 1)
+   netxen_nic_write_w0(adapter, NETXEN_NIU_XG1_MAX_FRAME_SIZE, 
new_mtu);
return 0;
 }
 
-
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 0/2] NetXen: Bug fixes

2007-03-13 Thread Linsys Contractor Mithlesh Thukral
Hi All,

I will be sending bug fixes to NetXen: 1G/10G Ethernet driver in subsequent 
mails.
The patches are with respect to netdev#upstream-fixes.

Regards,
Mithlesh Thukral
-
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 5/5] NetXen: Fix the setup of resources for hardware on multi port cards

2007-03-09 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix the setup of resources for hardware on multi port cards.

Signed-off-by: Mithlesh Thukral <[EMAIL PROTECTED]>
---

 drivers/net/netxen/netxen_nic_hw.c   |8 +---
 drivers/net/netxen/netxen_nic_phan_reg.h |6 +++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic_hw.c 
b/drivers/net/netxen/netxen_nic_hw.c
index 81ebc81..4ce33d8 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -294,6 +294,7 @@ int netxen_nic_hw_resources(struct netxe
u32 card_cmdring = 0;
struct netxen_recv_context *recv_ctx;
struct netxen_rcv_desc_ctx *rcv_desc;
+   int func_id = adapter->portnum;
 
DPRINTK(INFO, "crb_base: %lx %x", NETXEN_PCI_CRBSPACE,
PCI_OFFSET_SECOND_RANGE(adapter, NETXEN_PCI_CRBSPACE));
@@ -349,6 +350,7 @@ int netxen_nic_hw_resources(struct netxe
}
memset(addr, 0, sizeof(struct netxen_ring_ctx));
adapter->ctx_desc = (struct netxen_ring_ctx *)addr;
+   adapter->ctx_desc->ctx_id = adapter->portnum;
adapter->ctx_desc->cmd_consumer_offset =
cpu_to_le64(adapter->ctx_desc_phys_addr +
sizeof(struct netxen_ring_ctx));
@@ -418,11 +420,11 @@ int netxen_nic_hw_resources(struct netxe
/* Window = 1 */
 
writel(lower32(adapter->ctx_desc_phys_addr),
-  NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_ADDR_REG_LO));
+  NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_ADDR_REG_LO(func_id)));
writel(upper32(adapter->ctx_desc_phys_addr),
-  NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_ADDR_REG_HI));
+  NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_ADDR_REG_HI(func_id)));
writel(NETXEN_CTX_SIGNATURE,
-  NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_SIGNATURE_REG));
+  NETXEN_CRB_NORMALIZE(adapter, CRB_CTX_SIGNATURE_REG(func_id)));
return err;
 }
 
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h 
b/drivers/net/netxen/netxen_nic_phan_reg.h
index f7eb627..97e34e6 100644
--- a/drivers/net/netxen/netxen_nic_phan_reg.h
+++ b/drivers/net/netxen/netxen_nic_phan_reg.h
@@ -151,9 +151,9 @@ #else
 extern struct netxen_recv_crb recv_crb_registers[];
 extern u64 ctx_addr_sig_regs[][3];
 #endif /* DEFINE_GLOBAL_RECEIVE_CRB */
-#define CRB_CTX_ADDR_REG_LO(ctx_addr_sig_regs[0][0])
-#define CRB_CTX_ADDR_REG_HI(ctx_addr_sig_regs[0][2])
-#define CRB_CTX_SIGNATURE_REG   (ctx_addr_sig_regs[0][1])
+#define CRB_CTX_ADDR_REG_LO(FUNC_ID)   (ctx_addr_sig_regs[FUNC_ID][0])
+#define CRB_CTX_ADDR_REG_HI(FUNC_ID)   (ctx_addr_sig_regs[FUNC_ID][2])
+#define CRB_CTX_SIGNATURE_REG(FUNC_ID) (ctx_addr_sig_regs[FUNC_ID][1])
 
 /*
  * Temperature control.
-
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 4/5] NetXen: Fix the reading of MAC adddress during probe

2007-03-09 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix the reading of MAC adddress during probe

Signed-off-by: Mithlesh Thukral <[EMAIL PROTECTED]>
---

 drivers/net/netxen/netxen_nic_main.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/netxen/netxen_nic_main.c 
b/drivers/net/netxen/netxen_nic_main.c
index 121a5f9..7c27f15 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -451,7 +451,7 @@ #endif
valid_mac = 0;
 
if (valid_mac) {
-   unsigned char *p = (unsigned char *)&mac_addr[i];
+   unsigned char *p = (unsigned char *)&mac_addr[adapter->portnum];
netdev->dev_addr[0] = *(p + 5);
netdev->dev_addr[1] = *(p + 4);
netdev->dev_addr[2] = *(p + 3);
-
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 3/5] NetXen: Fix the driver for reduced PCIE footprint cards

2007-03-09 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix the driver for reduced PCIE footprint cards.

Signed-off-by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic.h  |8 +-
 drivers/net/netxen/netxen_nic_hdr.h  |2 +
 drivers/net/netxen/netxen_nic_main.c |   30 -
 3 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index c85c2cb..d5e9d46 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -770,6 +770,8 @@ struct netxen_hardware_context {
void __iomem *pci_base2;
void __iomem *db_base;
unsigned long db_len;
+   unsigned long first_page_group_start;
+   unsigned long first_page_group_end;
 
u8 revision_id;
u16 board_type;
@@ -946,7 +948,8 @@ #define PCI_OFFSET_THIRD_RANGE(adapter, 
 static inline void __iomem *pci_base_offset(struct netxen_adapter *adapter,
unsigned long off)
 {
-   if ((off < FIRST_PAGE_GROUP_END) && (off >= FIRST_PAGE_GROUP_START)) {
+   if ((off < adapter->ahw.first_page_group_end) && 
+   (off >= adapter->ahw.first_page_group_start)) {
return (adapter->ahw.pci_base0 + off);
} else if ((off < SECOND_PAGE_GROUP_END) &&
   (off >= SECOND_PAGE_GROUP_START)) {
@@ -961,7 +964,8 @@ static inline void __iomem *pci_base_off
 static inline void __iomem *pci_base(struct netxen_adapter *adapter,
 unsigned long off)
 {
-   if ((off < FIRST_PAGE_GROUP_END) && (off >= FIRST_PAGE_GROUP_START)) {
+   if ((off < adapter->ahw.first_page_group_end) && 
+   (off >= adapter->ahw.first_page_group_start)) {
return adapter->ahw.pci_base0;
} else if ((off < SECOND_PAGE_GROUP_END) &&
   (off >= SECOND_PAGE_GROUP_START)) {
diff --git a/drivers/net/netxen/netxen_nic_hdr.h 
b/drivers/net/netxen/netxen_nic_hdr.h
index b826bca..20dbebc 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -467,6 +467,8 @@ #define NETXEN_PCI_OCM0_MAX (0x050fU
 #define NETXEN_PCI_OCM1(0x0510UL)
 #define NETXEN_PCI_OCM1_MAX(0x051fUL)
 #define NETXEN_PCI_CRBSPACE(0x0600UL)
+#define NETXEN_PCI_128MB_SIZE  (0x0800UL)
+#define NETXEN_PCI_32MB_SIZE   (0x0200UL)
 
 #define NETXEN_CRB_CAM NETXEN_PCI_CRB_WINDOW(NETXEN_HW_PX_MAP_CRB_CAM)
 
diff --git a/drivers/net/netxen/netxen_nic_main.c 
b/drivers/net/netxen/netxen_nic_main.c
index 5fbf6b0..121a5f9 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -174,6 +174,7 @@ netxen_nic_probe(struct pci_dev *pdev, c
 
u8 __iomem *db_ptr = NULL;
unsigned long mem_base, mem_len, db_base, db_len;
+   unsigned long first_page_group_start, first_page_group_end;
int pci_using_dac, i = 0, err;
int ring;
struct netxen_recv_context *recv_ctx = NULL;
@@ -237,13 +238,28 @@ netxen_nic_probe(struct pci_dev *pdev, c
mem_len = pci_resource_len(pdev, 0);
 
/* 128 Meg of memory */
-   mem_ptr0 = ioremap(mem_base, FIRST_PAGE_GROUP_SIZE);
-   mem_ptr1 =
-   ioremap(mem_base + SECOND_PAGE_GROUP_START, SECOND_PAGE_GROUP_SIZE);
-   mem_ptr2 =
-   ioremap(mem_base + THIRD_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE);
+   if (mem_len == NETXEN_PCI_128MB_SIZE) {
+   mem_ptr0 = ioremap(mem_base, FIRST_PAGE_GROUP_SIZE);
+   mem_ptr1 = ioremap(mem_base + SECOND_PAGE_GROUP_START,
+   SECOND_PAGE_GROUP_SIZE);
+   mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START,
+   THIRD_PAGE_GROUP_SIZE);
+   first_page_group_start = FIRST_PAGE_GROUP_START;
+   first_page_group_end   = FIRST_PAGE_GROUP_END;
+   } else if (mem_len == NETXEN_PCI_32MB_SIZE) {
+   mem_ptr1 = ioremap(mem_base, SECOND_PAGE_GROUP_SIZE);
+   mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START -
+   SECOND_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE);
+   first_page_group_start = 0;
+   first_page_group_end   = 0;
+   } else {
+   DPRINTK(1, ERR, "Invalid PCI memory mapped length\n");
+   err = -EIO;
+   goto err_out_free_res;
+   }
 
-   if ((mem_ptr0 == 0UL) || (mem_ptr1 == 0UL) || (mem_ptr2 == 0UL)) {
+   if (((mem_ptr0 == 0UL) && (mem_len == NETXEN_PCI_128MB_SIZE))
+   || (mem_ptr1 == 0UL) || (mem_ptr2 == 0UL)) {
DPRINTK(ERR,
"Cannot remap adapter memory aborting.:"
"0 -> %p, 1 -> %p, 2 -> %p\n",
@@ -379,6 +395,8 @@ #endif
 
adapter->cmd_buf_arr = cmd_buf_arr;
adapter->ahw.pci_base0 = mem_ptr0;
+   adapter->ahw.first_page_group_start = first_page_group_start;
+  

[PATCH 2/5] NetXen: Update the statistics counter for interrupts

2007-03-09 Thread Linsys Contractor Mithlesh Thukral
NetXen: Update the statistics counter for interrupts which have occured.

Signed-off-by: Mithlesh Thukral <[EMAIL PROTECTED]>
---

 drivers/net/netxen/netxen_nic_main.c |1 +
 1 files changed, 1 insertion(+)

diff --git a/drivers/net/netxen/netxen_nic_main.c 
b/drivers/net/netxen/netxen_nic_main.c
index bfeca9a..5fbf6b0 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -1023,6 +1023,7 @@ netxen_handle_int(struct netxen_adapter 
u32 ret = 0;
 
DPRINTK(INFO, "Entered handle ISR\n");
+   adapter->stats.ints++;
 
if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
int count = 0;
-
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/5] NetXen: Fix softlock seen on some machines during hardware writes

2007-03-09 Thread Linsys Contractor Mithlesh Thukral
NetXen: This will fix a softlock seen on some machines.
The reason was too much time was spent waiting for writes to go through.

Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>
---
 drivers/net/netxen/netxen_nic.h |1 +
 drivers/net/netxen/netxen_nic_ethtool.c |1 +
 drivers/net/netxen/netxen_nic_init.c|   11 +--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 38d7409..c85c2cb 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -236,6 +236,7 @@ #define MPORT_MULTI_FUNCTION_MODE 0x
 
 #include "netxen_nic_phan_reg.h"
 extern unsigned long long netxen_dma_mask;
+extern unsigned long last_schedule_time;
 
 /*
  * NetXen host-peg signal message structure
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c 
b/drivers/net/netxen/netxen_nic_ethtool.c
index 3752d2a..d49a7d8 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -455,6 +455,7 @@ netxen_nic_set_eeprom(struct net_device 
}
printk(KERN_INFO "%s: flash unlocked. \n", 
netxen_nic_driver_name);
+   last_schedule_time = jiffies;
ret = netxen_flash_erase_secondary(adapter);
if (ret != FLASH_SUCCESS) {
printk(KERN_ERR "%s: Flash erase failed.\n", 
diff --git a/drivers/net/netxen/netxen_nic_init.c 
b/drivers/net/netxen/netxen_nic_init.c
index b2e776f..53ca21e 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -42,6 +42,8 @@ struct crb_addr_pair {
u32 data;
 };
 
+unsigned long last_schedule_time;
+
 #define NETXEN_MAX_CRB_XFORM 60
 static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM];
 #define NETXEN_ADDR_ERROR (0x)
@@ -404,9 +406,14 @@ static inline int do_rom_fast_write(stru
 static inline int
 do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp)
 {
+   if (jiffies > (last_schedule_time + (8 * HZ))) {
+   last_schedule_time = jiffies;
+   schedule();
+   }
+
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr);
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3);
-   udelay(70); /* prevent bursting on CRB */
+   udelay(100);/* prevent bursting on CRB */
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb);
if (netxen_wait_rom_done(adapter)) {
@@ -415,7 +422,7 @@ do_rom_fast_read(struct netxen_adapter *
}
/* reset abyte_cnt and dummy_byte_cnt */
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0);
-   udelay(70); /* prevent bursting on CRB */
+   udelay(100);/* prevent bursting on CRB */
netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0);
 
*valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA);
-
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 0/5] NetXen: Driver bug fixes

2007-03-09 Thread Linsys Contractor Mithlesh Thukral
Hi All,

I will be sending updates to NetXen: 1G/10G Ethernet driver in subsequent mails.
The patches will be with respect to netdev#upstream.

Regards,
Mithlesh Thukral
-
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 3/3] NetXen: Fix ping failure of Jumbo frames on MEZ cards.

2007-03-05 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix ping failure of Jumbo frames on MEZ cards.

Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 drivers/net/netxen/netxen_nic_hw.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletion(-)
 
diff --git a/drivers/net/netxen/netxen_nic_hw.c 
b/drivers/net/netxen/netxen_nic_hw.c
index 693d01a..81ebc81 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -962,7 +962,12 @@ int netxen_nic_set_mtu_gb(struct netxen_
 int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu)
 {
new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE;
-   netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, new_mtu);
+   if (adapter->portnum == 0)
+   netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, 
+   new_mtu);
+   else if (adapter->portnum == 1)
+   netxen_nic_write_w0(adapter, NETXEN_NIU_XG1_MAX_FRAME_SIZE,
+   new_mtu);
return 0;
 }
 
-
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 2/3] NetXen: Removal of redundant function call parameters

2007-03-05 Thread Linsys Contractor Mithlesh Thukral
NetXen: Removal of redundant function call parameters and bug fixes.
This patch will remove the redundant paramters which were being passed to
many functions since now adapter->portnum can be used.

Signed-off-by: Mithlesh Thukral <[EMAIL PROTECTED]>

---
 drivers/net/netxen/netxen_nic.h |   33 +++
 drivers/net/netxen/netxen_nic_ethtool.c |   10 +-
 drivers/net/netxen/netxen_nic_hdr.h |1 
 drivers/net/netxen/netxen_nic_hw.c  |   19 +++-
 drivers/net/netxen/netxen_nic_hw.h  |4 
 drivers/net/netxen/netxen_nic_init.c|7 -
 drivers/net/netxen/netxen_nic_isr.c |9 +-
 drivers/net/netxen/netxen_nic_main.c|   30 --
 drivers/net/netxen/netxen_nic_niu.c |   96 +-
 9 files changed, 111 insertions(+), 98 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 64f22ef..38d7409 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -205,6 +205,7 @@ #define RCV_DESC_TYPE(ID) \
 
 #define MAX_CMD_DESCRIPTORS1024
 #define MAX_RCV_DESCRIPTORS16384
+#define MAX_RCV_DESCRIPTORS_1G (MAX_RCV_DESCRIPTORS / 4)
 #define MAX_JUMBO_RCV_DESCRIPTORS  1024
 #define MAX_LRO_RCV_DESCRIPTORS64
 #define MAX_RCVSTATUS_DESCRIPTORS  MAX_RCV_DESCRIPTORS
@@ -780,6 +781,7 @@ struct netxen_hardware_context {
struct pci_dev *cmd_desc_pdev;
dma_addr_t cmd_desc_phys_addr;
struct netxen_adapter *adapter;
+   int pci_func;
 };
 
 #define RCV_RING_LRO   RCV_DESC_LRO
@@ -916,15 +918,15 @@ struct netxen_adapter {
struct netxen_ring_ctx *ctx_desc;
struct pci_dev *ctx_desc_pdev;
dma_addr_t ctx_desc_phys_addr;
-   int (*enable_phy_interrupts) (struct netxen_adapter *, int);
-   int (*disable_phy_interrupts) (struct netxen_adapter *, int);
+   int (*enable_phy_interrupts) (struct netxen_adapter *);
+   int (*disable_phy_interrupts) (struct netxen_adapter *);
void (*handle_phy_intr) (struct netxen_adapter *);
int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t);
int (*set_mtu) (struct netxen_adapter *, int);
int (*set_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
int (*unset_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
-   int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *);
-   int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
+   int (*phy_read) (struct netxen_adapter *, long reg, u32 *);
+   int (*phy_write) (struct netxen_adapter *, long reg, u32 val);
int (*init_port) (struct netxen_adapter *, int);
void (*init_niu) (struct netxen_adapter *);
int (*stop_port) (struct netxen_adapter *);
@@ -970,27 +972,21 @@ static inline void __iomem *pci_base(str
return NULL;
 }
 
-int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter,
- int port);
-int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter,
-int port);
-int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter,
-  int port);
-int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter,
- int port);
-int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter,
-int port);
-int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter,
-   int port);
+int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter);
+int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter);
 void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter);
 void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter);
 void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, int port,
 long enable);
 void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, int port,
  long enable);
-int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, long reg,
+int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
__u32 * readval);
-int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy,
+int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter,
 long reg, __u32 val);
 
 /* Functions available from netxen_nic_hw.c */
@@ -1010,6 +1006,7 @@ int netxen_nic_hw_write_wx

[PATCH 0/3] NetXen: Make driver use multiple PCI functions

2007-03-05 Thread Linsys Contractor Mithlesh Thukral
Hi All,

I will be sending updates to NetXen: 1G/10G Ethernet driver in subsequent mails.
The patches will be with respect to netdev#upstream.

My apologies for insufficient explanation of the patches in my last patchset.

Regards,
Mithlesh Thukral
-
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 0/3]: NetXen 1G/10G Ethernet driver updates

2007-02-28 Thread Linsys Contractor Mithlesh Thukral
Hi All,

I will be sending updates to NetXen: 1G/10G Ethernet driver in subsequent mails.
The patches will be with respect to netdev#upstream.

Regards,
Mithlesh Thukral
-
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 2/3]: Fix second rmmod failure observed on PowerPC machines.

2007-02-28 Thread Linsys Contractor Mithlesh Thukral
NetXen: Fix second rmmod failure observed on PowerPC machines.

Signed-off by: Mithlesh Thukral <[EMAIL PROTECTED]>

---

 netxen_nic_hw.c   |5 +++--
 netxen_nic_init.c |   23 +--
 netxen_nic_main.c |9 -
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic_hw.c 
b/drivers/net/netxen/netxen_nic_hw.c
index deec796..a2877f3 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -508,8 +508,8 @@ void netxen_nic_pci_change_crbwindow(str
 void netxen_load_firmware(struct netxen_adapter *adapter)
 {
int i;
-   long data, size = 0;
-   long flashaddr = NETXEN_FLASH_BASE, memaddr = NETXEN_PHANTOM_MEM_BASE;
+   u32 data, size = 0;
+   u32 flashaddr = NETXEN_FLASH_BASE, memaddr = NETXEN_PHANTOM_MEM_BASE;
u64 off;
void __iomem *addr;
 
@@ -951,6 +951,7 @@ void netxen_nic_flash_print(struct netxe
   netxen_nic_driver_name);
return;
}
+   *ptr32 = le32_to_cpu(*ptr32);
ptr32++;
addr += sizeof(u32);
}
diff --git a/drivers/net/netxen/netxen_nic_init.c 
b/drivers/net/netxen/netxen_nic_init.c
index 2f96570..586d32b 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -38,13 +38,13 @@ #include "netxen_nic_hw.h"
 #include "netxen_nic_phan_reg.h"
 
 struct crb_addr_pair {
-   long addr;
-   long data;
+   u32 addr;
+   u32 data;
 };
 
 #define NETXEN_MAX_CRB_XFORM 60
 static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM];
-#define NETXEN_ADDR_ERROR ((unsigned long ) 0x )
+#define NETXEN_ADDR_ERROR (0x)
 
 #define crb_addr_transform(name) \
crb_addr_xform[NETXEN_HW_PX_MAP_CRB_##name] = \
@@ -252,10 +252,10 @@ void netxen_initialize_adapter_ops(struc
  * netxen_decode_crb_addr(0 - utility to translate from internal Phantom CRB
  * address to external PCI CRB address.
  */
-unsigned long netxen_decode_crb_addr(unsigned long addr)
+u32 netxen_decode_crb_addr(u32 addr)
 {
int i;
-   unsigned long base_addr, offset, pci_base;
+   u32 base_addr, offset, pci_base;
 
crb_addr_transform_setup();
 
@@ -756,7 +756,7 @@ int netxen_pinit_from_rom(struct netxen_
int n, i;
int init_delay = 0;
struct crb_addr_pair *buf;
-   unsigned long off;
+   u32 off;
 
/* resetall */
status = netxen_nic_get_board_info(adapter);
@@ -813,14 +813,13 @@ int netxen_pinit_from_rom(struct netxen_
if (verbose)
printk("%s: PCI: 0x%08x == 0x%08x\n",
   netxen_nic_driver_name, (unsigned int)
-  netxen_decode_crb_addr((unsigned long)
- addr), val);
+  netxen_decode_crb_addr(addr), val);
}
for (i = 0; i < n; i++) {
 
-   off = netxen_decode_crb_addr((unsigned 
long)buf[i].addr);
+   off = netxen_decode_crb_addr(buf[i].addr);
if (off == NETXEN_ADDR_ERROR) {
-   printk(KERN_ERR"CRB init value out of range 
%lx\n",
+   printk(KERN_ERR"CRB init value out of range 
%x\n",
buf[i].addr);
continue;
}
@@ -927,6 +926,10 @@ int netxen_initialize_adapter_offload(st
 void netxen_free_adapter_offload(struct netxen_adapter *adapter)
 {
if (adapter->dummy_dma.addr) {
+   writel(0, NETXEN_CRB_NORMALIZE(adapter,
+   CRB_HOST_DUMMY_BUF_ADDR_HI));
+   writel(0, NETXEN_CRB_NORMALIZE(adapter,
+   CRB_HOST_DUMMY_BUF_ADDR_LO));
pci_free_consistent(adapter->ahw.pdev,
NETXEN_HOST_DUMMY_DMA_SIZE,
adapter->dummy_dma.addr,
diff --git a/drivers/net/netxen/netxen_nic_main.c 
b/drivers/net/netxen/netxen_nic_main.c
index 2227504..7d2525e 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -434,13 +434,11 @@ #endif
adapter->port_count++;
adapter->port[i] = port;
}
-#ifndef CONFIG_PPC64
writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
netxen_pinit_from_rom(adapter, 0);
udelay(500);
netxen_load_firmware(adapter);
netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
-#endif
/*
 * delay a while to ensure that the Pegs are up & running.
 * Otherwise, we might see some flaky behaviour.
@@ -529,12 +527,13 @@ static void __devexit netxen_nic_remove(
  

[PATCH 1/3]: Updates, removal of unsupported features and minor bug fixes.

2007-02-28 Thread Linsys Contractor Mithlesh Thukral
NetXen: Updates, removal of unsupported features and minor bug fixes.

Signed-off-by: Mithlesh Thukral <[EMAIL PROTECTED]>

---
 netxen_nic.h  |4 +
 netxen_nic_ethtool.c  |  144 +-
 netxen_nic_main.c |4 -
 netxen_nic_phan_reg.h |3 +
 4 files changed, 34 insertions(+), 121 deletions(-)

diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 2807ef4..81742e4 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -72,6 +72,8 @@ #define NUM_FLASH_SECTORS (64)
 #define FLASH_SECTOR_SIZE (64 * 1024)
 #define FLASH_TOTAL_SIZE  (NUM_FLASH_SECTORS * FLASH_SECTOR_SIZE)
 
+#define PHAN_VENDOR_ID 0x4040
+
 #define RCV_DESC_RINGSIZE  \
(sizeof(struct rcv_desc) * adapter->max_rx_desc_count)
 #define STATUS_DESC_RINGSIZE   \
@@ -82,7 +84,7 @@ #define TX_RINGSIZE   \
(sizeof(struct netxen_cmd_buffer) * adapter->max_tx_desc_count)
 #define RCV_BUFFSIZE   \
(sizeof(struct netxen_rx_buffer) * rcv_desc->max_rx_desc_count)
-#define find_diff_among(a,b,range) ((a)<(b)?((b)-(a)):((b)+(range)-(a)))
+#define find_diff_among(a,b,range) ((a)<=(b)?((b)-(a)):((b)+(range)-(a)))
 
 #define NETXEN_NETDEV_STATUS   0x1
 #define NETXEN_RCV_PRODUCER_OFFSET 0
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c 
b/drivers/net/netxen/netxen_nic_ethtool.c
index 6252e9a..986ef98 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -82,8 +82,7 @@ static const struct netxen_nic_stats net
 #define NETXEN_NIC_STATS_LEN   ARRAY_SIZE(netxen_nic_gstrings_stats)
 
 static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = {
-   "Register_Test_offline", "EEPROM_Test_offline",
-   "Interrupt_Test_offline", "Loopback_Test_offline",
+   "Register_Test_on_offline",
"Link_Test_on_offline"
 };
 
@@ -394,19 +393,12 @@ netxen_nic_get_regs(struct net_device *d
}
 }
 
-static void
-netxen_nic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
-{
-   wol->supported = WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | WAKE_MAGIC;
-   /* options can be added depending upon the mode */
-   wol->wolopts = 0;
-}
-
 static u32 netxen_nic_test_link(struct net_device *dev)
 {
struct netxen_port *port = netdev_priv(dev);
struct netxen_adapter *adapter = port->adapter;
__u32 status;
+   int val;
 
/* read which mode */
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
@@ -415,11 +407,13 @@ static u32 netxen_nic_test_link(struct n
 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
 &status) != 0)
return -EIO;
-   else
-   return (netxen_get_phy_link(status));
+   else {
+   val = netxen_get_phy_link(status);
+   return !val;
+   }
} else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
-   int val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
-   return val == XG_LINK_UP;
+   val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
+   return (val == XG_LINK_UP) ? 0 : 1;
}
return -EIO;
 }
@@ -606,100 +600,21 @@ netxen_nic_set_pauseparam(struct net_dev
 
 static int netxen_nic_reg_test(struct net_device *dev)
 {
-   struct netxen_port *port = netdev_priv(dev);
-   struct netxen_adapter *adapter = port->adapter;
-   u32 data_read, data_written, save;
-   __u32 mode;
-
-   /* 
-* first test the "Read Only" registers by writing which mode
-*/
-   netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode);
-   if (netxen_get_niu_enable_ge(mode)) {   /* GB Mode */
-   netxen_nic_read_w0(adapter,
-  NETXEN_NIU_GB_MII_MGMT_STATUS(port->portnum),
-  &data_read);
-
-   save = data_read;
-   if (data_read)
-   data_written = data_read & NETXEN_NIC_INVALID_DATA;
-   else
-   data_written = NETXEN_NIC_INVALID_DATA;
-   netxen_nic_write_w0(adapter,
-   NETXEN_NIU_GB_MII_MGMT_STATUS(port->
- portnum),
-   data_written);
-   netxen_nic_read_w0(adapter,
-  NETXEN_NIU_GB_MII_MGMT_STATUS(port->portnum),
-  &data_read);
-
-   if (data_written == data_read) {
-   netxen_nic_write_w0(adapter,
-   NETXEN_NIU_GB_MII_MGMT_STATUS(port->
- 
portnum),
-