NetXen: 1G/10G Ethernet Driver updates
Subsystems (2)
cover NetXen: 1G/10G Ethernet Driver updates
Hi All,
I will be sending NetXen 1G/10G ethernet driver updates in subsequent emails. Kindly review it and feel free to send feedback.
Thanks,
--Amit
PATCH 1/3 NetXen: Fixed /sys mapping between device and driver
netxen_nic_main.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/netxen/netxen_nic_main.c +2 -1
@@ -270,6 +270,7 @@ netxen_nic_probe(struct pci_dev *pdev, c }SET_MODULE_OWNER (netdev); +SET_NETDEV_DEV (netdev, &pdev->dev); port =netdev_priv (netdev); port->netdev = netdev;
@@ -1040,7 +1041,7 @@ static int netxen_nic_poll(struct net_denetxen_nic_enable_int (adapter); } -return (done ?0 :1 ); +return (!done); }#ifdef CONFIG_NET_POLL_CONTROLLER
Re: [PATCH 1/3] NetXen: Fixed /sys mapping between device and driver
Hi Amit,
one minor nitpick:
Quoted 4 lines · You
drivers/net/netxen/netxen_nic_main.c +0
-0
[...]
drivers/net/netxen/netxen_nic_main.c static int netxen_nic_poll(struct net_de · line 1044
Quoted 6 lines
drivers/net/netxen/netxen_nic_main.c +1
-1@@ -1040,7 +1041,7 @@ static int netxen_nic_poll(struct net_denetxen_nic_enable_int (adapter); } -return (done ?0 :1 ); +return (!done);
return !done;
Please lose the braces here (CodingStyle).
Just respin or send this change along with later patchsets.
Regards
Ingo Oeser
Re: [PATCH 1/3] NetXen: Fixed /sys mapping between device and driver
Hi Ingo,
Will do.
Thanks for reviewing it.
-Amit
Quoted 28 lines · Ingo Oeser
Hi Amit,
one minor nitpick:
Quoted 4 lines · You
(quoted diff) +0
-0
b/drivers/net/netxen/netxen_nic_main.cindex b54ea16..4effb87 100644drivers/net/netxen/netxen_nic_main.c +0
-0[...]
drivers/net/netxen/netxen_nic_main.c static int netxen_nic_poll(struct net_de · line 1044
Quoted 6 lines
drivers/net/netxen/netxen_nic_main.c +1
-1@@ -1040,7 +1041,7 @@ static int netxen_nic_poll(struct net_denetxen_nic_enable_int (adapter); } -return (done ?0 :1 ); +return (!done);return !done;Please lose the braces here (CodingStyle).
Just respin or send this change along with later patchsets.
Regards
Ingo Oeser
Re: [PATCH 1/3] NetXen: Fixed /sys mapping between device and driver
In reply to Amit S. KaleQuoted 2 lines · Amit S. Kale
Signed-off-by Amit S. Kale <[email protected]>
ACK technical content, but git-applymbox claims the patches are corrupted.
Also, please realize that your email subject line is used as a one-line summary for your change, copied directly into the kernel change log. ref http://linux.yyz.us/patch-format.html
As such, having two patches with the identical subject "NetXen: 1G/10G Ethernet Driver updates" is bad form, because it is overly vague, and fails to adequately summarize the changeset.
Example summaries:
patch #2: NetXen: temp monitoring, de-bloat, support newer firmware patch #3: NetXen: driver cleanup, 64-bit memory fixes
PATCH 2/3 NetXen: 1G/10G Ethernet Driver updates
In reply to Amit S. KaleNetXen: 1G/10G Ethernet Driver updates
- Tempature monitoring, and device control
- Memory footprint reduction
- Driver changes to support newer version of firmware
netxen_nic.h | 165 ++++++++++++++++++++++++++++++++-- netxen_nic_ethtool.c | 89 ++++++++++++------ netxen_nic_hdr.h | 71 +++++++++++++- netxen_nic_hw.c | 206 +++++++++++++++++++++++++++++-------------- netxen_nic_hw.h | 8 + netxen_nic_init.c | 239 +++++++++++++++++++++++++++++++++++++++++--------- netxen_nic_ioctl.h | 12 +- netxen_nic_isr.c | 54 +++++------ netxen_nic_main.c | 121 +++++++++++++++++-------- netxen_nic_niu.c | 172 +++++++++++++++++++++++++++-------- netxen_nic_phan_reg.h | 24 ++++- 11 files changed, 891 insertions(+), 270 deletions(-)
drivers/net/netxen/netxen_nic.h +153 -12
@@ -64,12 +64,12 @@ #include <asm/pgtable.h>#include "netxen_nic_hw.h" -#define NETXEN_NIC_BUILD_NO "232" +#define NETXEN_NIC_BUILD_NO "5"#define _NETXEN_NIC_LINUX_MAJOR 2#define _NETXEN_NIC_LINUX_MINOR 3 -#define _NETXEN_NIC_LINUX_SUBVERSION 57 -#define NETXEN_NIC_LINUX_VERSIONID "2.3.57" -#define NETXEN_NIC_FW_VERSIONID "2.3.57" +#define _NETXEN_NIC_LINUX_SUBVERSION 59 +#define NETXEN_NIC_LINUX_VERSIONID "2.3.59" "-" NETXEN_NIC_BUILD_NO +#define NETXEN_NIC_FW_VERSIONID "2.3.59"#define RCV_DESC_RINGSIZE \ (sizeof(struct rcv_desc) * adapter->max_rx_desc_count)
@@ -90,9 +90,24 @@ #define ADDR_IN_WINDOW1(off) \* normalize a 64MB crb address to 32MB PCI window * To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1 */ +#define NETXEN_CRB_NORMAL (reg) \ + (reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST +#define NETXEN_CRB_NORMALIZE (adapter, reg) \ - ((adapter)->ahw.pci_base + (reg) \ - - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST) + pci_base_offset(adapter, NETXEN_CRB_NORMAL(reg)) + +#define FIRST_PAGE_GROUP_START 0 +#define FIRST_PAGE_GROUP_END 0x400000 + +#define SECOND_PAGE_GROUP_START 0x4000000 +#define SECOND_PAGE_GROUP_END 0x66BC000 + +#define THIRD_PAGE_GROUP_START 0x70E4000 +#define THIRD_PAGE_GROUP_END 0x8000000 + +#define FIRST_PAGE_GROUP_SIZE FIRST_PAGE_GROUP_END - FIRST_PAGE_GROUP_START +#define SECOND_PAGE_GROUP_SIZE SECOND_PAGE_GROUP_END - SECOND_PAGE_GROUP_START +#define THIRD_PAGE_GROUP_SIZE THIRD_PAGE_GROUP_END - THIRD_PAGE_GROUP_START#define MAX_RX_BUFFER_LENGTH 2000#define MAX_RX_JUMBO_BUFFER_LENGTH 9046
@@ -329,6 +344,7 @@ typedef enum {NETXEN_BRDTYPE_P2_SB31_10G_HMEZ =0x000e , NETXEN_BRDTYPE_P2_SB31_10G_CX4 = 0x000f } netxen_brdtype_t; +#define NUM_SUPPORTED_BOARDS (sizeof(netxen_boards)/sizeof(netxen_brdinfo_t)) typedef enum { NETXEN_BRDMFG_INVENTEC = 1
@@ -616,15 +632,23 @@ #define NETXEN_NIC_XGBE 0x02*/ struct netxen_hardware_context {struct pci_dev *pdev; -void __iomem *pci_base;/* base of mapped phantom memory */ +void __iomem *pci_base0; +void __iomem *pci_base1; +void __iomem *pci_base2; +u8 revision_id;u16 board_type;u16 max_ports;struct netxen_board_info boardcfg;u32 xg_linkup; +u32 qg_linksup;/* Address of cmd ring in Phantom */ struct cmd_desc_type0 *cmd_desc_head; +char *pauseaddr; +struct pci_dev *cmd_desc_pdev;dma_addr_t cmd_desc_phys_addr; +dma_addr_t pause_physaddr; +struct pci_dev *pause_pdev;struct netxen_adapter *adapter; };
@@ -655,6 +679,7 @@ struct netxen_rcv_desc_ctx {u32 rcv_pending;/* Num of bufs posted in phantom */ u32 rcv_free;/* Num of bufs in free list */ dma_addr_t phys_addr; +struct pci_dev *phys_pdev;struct rcv_desc *desc_head;/* address of rx ring in Phantom */ u32 max_rx_desc_count;u32 dma_size;
@@ -674,6 +699,7 @@ struct netxen_recv_context {u32 status_rx_producer;u32 status_rx_consumer;dma_addr_t rcv_status_desc_phys_addr; +struct pci_dev *rcv_status_desc_pdev;struct status_desc *rcv_status_desc_head; };
@@ -709,6 +735,7 @@ struct netxen_adapter {u32 flags;u32 irq;int driver_mismatch; +u32 temp;struct netxen_adapter_stats stats;
@@ -767,6 +794,43 @@ struct netxen_port {struct netxen_port_stats stats; }; +#define PCI_OFFSET_FIRST_RANGE (adapter, off) \ + ((adapter)->ahw.pci_base0 + (off)) +#define PCI_OFFSET_SECOND_RANGE (adapter, off) \ + ((adapter)->ahw.pci_base1 + (off) - SECOND_PAGE_GROUP_START) +#define PCI_OFFSET_THIRD_RANGE (adapter, off) \ + ((adapter)->ahw.pci_base2 + (off) - THIRD_PAGE_GROUP_START) + +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 )) { +return (adapter->ahw.pci_base0 + off); + }else if ((off <SECOND_PAGE_GROUP_END ) && + (off >=SECOND_PAGE_GROUP_START )) { +return (adapter->ahw.pci_base1 + off -SECOND_PAGE_GROUP_START ); + }else if ((off <THIRD_PAGE_GROUP_END ) && + (off >=THIRD_PAGE_GROUP_START )) { +return (adapter->ahw.pci_base2 + off -THIRD_PAGE_GROUP_START ); + } +return NULL ; +} + +static inline void __iomem *pci_base (struct netxen_adapter *adapter, +unsigned long off) +{ +if ((off <FIRST_PAGE_GROUP_END ) && (off >=FIRST_PAGE_GROUP_START )) { +return adapter->ahw.pci_base0; + }else if ((off <SECOND_PAGE_GROUP_END ) && + (off >=SECOND_PAGE_GROUP_START )) { +return adapter->ahw.pci_base1; + }else if ((off <THIRD_PAGE_GROUP_END ) && + (off >=THIRD_PAGE_GROUP_START )) { +return adapter->ahw.pci_base2; + } +return NULL ; +} +struct netxen_drvops {int (*enable_phy_interrupts) (struct netxen_adapter *,int );int (*disable_phy_interrupts) (struct netxen_adapter *,int );
@@ -810,7 +874,6 @@ int netxen_niu_gbe_phy_write(struct netx long reg, __le32 val);/* Functions available from netxen_nic_hw.c */ -int netxen_niu_xginit (struct netxen_adapter *);int netxen_nic_set_mtu_xgb (struct netxen_port *port,int new_mtu);int netxen_nic_set_mtu_gb (struct netxen_port *port,int new_mtu);void netxen_nic_init_niu_gb (struct netxen_adapter *adapter);
@@ -829,10 +892,13 @@ void netxen_crb_writelit_adapter(struct unsigned long off, int data);/* Functions from netxen_nic_init.c */ -void netxen_phantom_init (struct netxen_adapter *adapter); +void netxen_phantom_init (struct netxen_adapter *adapter,int pegtune_val);void netxen_load_firmware (struct netxen_adapter *adapter);int netxen_pinit_from_rom (struct netxen_adapter *adapter,int verbose);int netxen_rom_fast_read (struct netxen_adapter *adapter,int addr,int *valp); +int netxen_rom_fast_write (struct netxen_adapter *adapter,int addr,int data); +int netxen_rom_se (struct netxen_adapter *adapter,int addr); +int netxen_do_rom_se (struct netxen_adapter *adapter,int addr);/* Functions from netxen_nic_isr.c */ void netxen_nic_isr_other (struct netxen_adapter *adapter);
@@ -843,6 +909,8 @@ void netxen_handle_port_int(struct netxevoid netxen_nic_stop_all_ports (struct netxen_adapter *adapter);void netxen_initialize_adapter_sw (struct netxen_adapter *adapter);void netxen_initialize_adapter_hw (struct netxen_adapter *adapter); +void *netxen_alloc (struct pci_dev *pdev,size_t sz,dma_addr_t * ptr, +struct pci_dev **used_dev);void netxen_initialize_adapter_ops (struct netxen_adapter *adapter);int netxen_init_firmware (struct netxen_adapter *adapter);void netxen_free_hw_resources (struct netxen_adapter *adapter);
@@ -870,7 +938,10 @@ static inline void netxen_nic_disable_in/* * ISR_INT_MASK: Can be read from window 0 or 1. */ -writel (0x7ff , (void __iomem *)(adapter->ahw.pci_base +ISR_INT_MASK )); +writel (0x7ff , + (void __iomem + *)(PCI_OFFSET_SECOND_RANGE (adapter,ISR_INT_MASK ))); + }static inline void netxen_nic_enable_int (struct netxen_adapter *adapter)
@@ -889,13 +960,83 @@ static inline void netxen_nic_enable_intbreak ; } -writel (mask, (void __iomem *)(adapter->ahw.pci_base +ISR_INT_MASK )); +writel (mask, + (void __iomem + *)(PCI_OFFSET_SECOND_RANGE (adapter,ISR_INT_MASK )));if (!(adapter->flags &NETXEN_NIC_MSI_ENABLED )) { mask =0xbff ;writel (mask, (void __iomem *) - (adapter->ahw.pci_base +ISR_INT_TARGET_MASK )); + (PCI_OFFSET_SECOND_RANGE (adapter,ISR_INT_TARGET_MASK ))); + } +} + +/* +* NetXen Board information +*/ + +#define NETXEN_MAX_SHORT_NAME 16 +typedef struct { +netxen_brdtype_t brdtype;/* type of board */ +long ports;/* max no of physical ports */ +char short_name[NETXEN_MAX_SHORT_NAME ]; +}netxen_brdinfo_t ; + +static const netxen_brdinfo_t netxen_boards[] = { + {NETXEN_BRDTYPE_P2_SB31_10G_CX4 ,1 ,"XGb CX4" }, + {NETXEN_BRDTYPE_P2_SB31_10G_HMEZ ,1 ,"XGb HMEZ" }, + {NETXEN_BRDTYPE_P2_SB31_10G_IMEZ ,2 ,"XGb IMEZ" }, + {NETXEN_BRDTYPE_P2_SB31_10G ,1 ,"XGb XFP" }, + {NETXEN_BRDTYPE_P2_SB35_4G ,4 ,"Quad Gb" }, + {NETXEN_BRDTYPE_P2_SB31_2G ,2 ,"Dual Gb" }, +}; + +#define NUM_SUPPORTED_BOARDS (sizeof(netxen_boards)/sizeof(netxen_brdinfo_t)) + +static inline void get_brd_ports_name_by_type (u32 type,int *ports,char *name) +{ +int i, found =0 ; +for (i =0 ; i <NUM_SUPPORTED_BOARDS ; ++i) { +if (netxen_boards[i].brdtype == type) { + *ports = netxen_boards[i].ports; +strcpy (name, netxen_boards[i].short_name); + found =1 ; +break ; + } + } +if (!found) { + *ports =0 ; + name ="Unknown" ; + } +} + +static inline void get_brd_port_by_type (u32 type,int *ports) +{ +int i, found =0 ; +for (i =0 ; i <NUM_SUPPORTED_BOARDS ; ++i) { +if (netxen_boards[i].brdtype == type) { + *ports = netxen_boards[i].ports; + found =1 ; +break ; + } + } +if (!found) + *ports =0 ; +} + +static inline void get_brd_name_by_type (u32 type,char *name) +{ +int i, found =0 ; +for (i =0 ; i <NUM_SUPPORTED_BOARDS ; ++i) { +if (netxen_boards[i].brdtype == type) { +strcpy (name, netxen_boards[i].short_name); + found =1 ; +break ; + } + } +if (!found) + name ="Unknown" ; }int netxen_is_flash_supported (struct netxen_adapter *adapter);
drivers/net/netxen/netxen_nic_ethtool.c +58 -31
165 lines not on this page · raw message
drivers/net/netxen/netxen_nic_hdr.h +64 -5
115 lines not on this page · raw message
drivers/net/netxen/netxen_nic_hw.c +139 -65
429 lines not on this page · raw message
drivers/net/netxen/netxen_nic_hw.h +5 -3
@@ -82,9 +82,9 @@ struct netxen_adapter;#define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20) -#define NETXEN_NIC_LOCKED_READ_REG (X ,Y ) \ - addr = (adapter->ahw.pci_base + X); \ - *(u32 *)Y = readl((void __iomem*) addr); +#define NETXEN_NIC_LOCKED_READ_REG (X ,Y ) \ + addr = pci_base_offset(adapter, (X)); \ + *(u32 *)Y = readl(addr);struct netxen_port ;void netxen_nic_set_link_parameters (struct netxen_port *port);
@@ -472,6 +472,8 @@ int netxen_niu_xg_macaddr_set(struct net/* Generic enable for GbE ports. Will detect the speed of the link. */ int netxen_niu_gbe_init_port (struct netxen_adapter *adapter,int port); +int netxen_niu_xg_init_port (struct netxen_adapter *adapter,int port); +/* Disable a GbE interface */ int netxen_niu_disable_gbe_port (struct netxen_adapter *adapter,int port);
drivers/net/netxen/netxen_nic_init.c +200 -39
362 lines not on this page · raw message
drivers/net/netxen/netxen_nic_ioctl.h +5 -5
@@ -6,12 +6,12 @@* modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. -* + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
@@ -32,9 +32,11 @@ #define __NETXEN_NIC_IOCTL_H__#include <linux/sockios.h> -#define NETXEN_CMD_START SIOCDEVPRIVATE -#define NETXEN_NIC_CMD (NETXEN_CMD_START + 1) -#define NETXEN_NIC_NAME (NETXEN_CMD_START + 2) +#define NETXEN_CMD_START SIOCDEVPRIVATE +#define NETXEN_NIC_CMD (NETXEN_CMD_START + 1) +#define NETXEN_NIC_NAME (NETXEN_CMD_START + 2) +#define NETXEN_NIC_NAME_LEN 16 +#define NETXEN_NIC_NAME_RSP "NETXEN" typedef enum { netxen_nic_cmd_none = 0,
drivers/net/netxen/netxen_nic_isr.c +24 -30
71 lines not on this page · raw message
drivers/net/netxen/netxen_nic_main.c +82 -39
252 lines not on this page · raw message
drivers/net/netxen/netxen_nic_niu.c +131 -39
267 lines not on this page · raw message
drivers/net/netxen/netxen_nic_phan_reg.h +20 -2
@@ -6,12 +6,12 @@* modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. -* + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
@@ -58,6 +58,9 @@ #define CRB_PHAN_CNTRL_HI_OFFSET NETXEN_#define CRB_CMD_PRODUCER_OFFSET NETXEN_NIC_REG(0x08)#define CRB_CMD_CONSUMER_OFFSET NETXEN_NIC_REG(0x0c) +#define CRB_PAUSE_ADDR_LO NETXEN_NIC_REG(0x10) +#define CRB_PAUSE_ADDR_HI NETXEN_NIC_REG(0x14) +/* address of command descriptors in the host memory */ #define CRB_HOST_CMD_ADDR_HI NETXEN_NIC_REG(0x30)#define CRB_HOST_CMD_ADDR_LO NETXEN_NIC_REG(0x34)
@@ -82,10 +85,18 @@ #define CRB_RX_PKT_TIMER NETXEN_NIC_REG#define CRB_TX_PKT_TIMER NETXEN_NIC_REG(0x94)#define CRB_RX_PKT_CNT NETXEN_NIC_REG(0x98)#define CRB_RX_TMR_CNT NETXEN_NIC_REG(0x9c) +#define CRB_INT_THRESH NETXEN_NIC_REG(0xa4)/* Register for communicating XG link status */ #define CRB_XG_STATE NETXEN_NIC_REG(0xa0) +/* Register for communicating card temperature */ +/* Upper 16 bits are temperature value. Lower 16 bits are the state */ +#define CRB_TEMP_STATE NETXEN_NIC_REG(0xa8) +#define nx_get_temp_val (x) ((x) >> 16) +#define nx_get_temp_state (x) ((x) & 0xffff) +#define nx_encode_temp (val, state) (((val) << 16) | (state)) +/* Debug registers for controlling NIC pkt gen agent */ #define CRB_AGENT_GO NETXEN_NIC_REG(0xb0)#define CRB_AGENT_TX_SIZE NETXEN_NIC_REG(0xb4)
@@ -192,4 +203,13 @@ #elseextern struct netxen_recv_crb recv_crb_registers[];#endif /* DEFINE_GLOBAL_RECEIVE_CRB */ +/* +* Temperature control. +*/ +enum { +NX_TEMP_NORMAL =0x1 ,/* Normal operating range */ +NX_TEMP_WARN ,/* Sound alert, temperature getting high */ +NX_TEMP_PANIC /* Fatal error, hardware has shut down. */ +}; +#endif /* __NIC_PHAN_REG_H_ */
PATCH 3/3 NetXen: 1G/10G Ethernet Driver updates
In reply to Amit S. KaleNetXen: 1G/10G Ethernet Driver updates
- Driver cleanup
- These fixes take care of driver on machines with >4G memory
netxen_nic.h | 41 ++++++---- netxen_nic_ethtool.c | 19 ++-- netxen_nic_hdr.h | 0 netxen_nic_hw.c | 10 +- netxen_nic_hw.h | 4 netxen_nic_init.c | 51 +++++++++++- netxen_nic_ioctl.h | 0 netxen_nic_isr.c | 3 netxen_nic_main.c | 204 +++++++++++++++++++++++++++++++++++++++++++++++--- netxen_nic_niu.c | 0 netxen_nic_phan_reg.h | 10 +- 11 files changed, 293 insertions(+), 49 deletions(-)
drivers/net/netxen/netxen_nic.h +26 -13
@@ -6,12 +6,12 @@* modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. -* + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
@@ -90,8 +90,8 @@ #define ADDR_IN_WINDOW1(off) \* normalize a 64MB crb address to 32MB PCI window * To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1 */ -#define NETXEN_CRB_NORMAL (reg) \ - (reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST +#define NETXEN_CRB_NORMAL (reg) \ + ((reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST)#define NETXEN_CRB_NORMALIZE (adapter, reg) \ pci_base_offset(adapter, NETXEN_CRB_NORMAL(reg))
@@ -165,7 +165,7 @@ #define RCV_DESC_TYPE(ID) \#define MAX_CMD_DESCRIPTORS 1024#define MAX_RCV_DESCRIPTORS 32768 -#define MAX_JUMBO_RCV_DESCRIPTORS 1024 +#define MAX_JUMBO_RCV_DESCRIPTORS 4096#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS#define MAX_RCV_DESC MAX_RCV_DESCRIPTORS
@@ -593,6 +593,16 @@ struct netxen_skb_frag {u32 length; }; +/* Bounce buffer index */ +struct bounce_index { +/* Index of a buffer */ +unsigned buffer_index; +/* Offset inside the buffer */ +unsigned buffer_offset; +}; + +#define IS_BOUNCE 0xcafebb +/* Following defines are for the state of the buffers */ #define NETXEN_BUFFER_FREE 0#define NETXEN_BUFFER_BUSY 1
@@ -612,6 +622,8 @@ struct netxen_cmd_buffer {unsigned long time_stamp;u32 state;u32 no_of_descriptors; +u32 tx_bounce_buff; +struct bounce_index bnext; };/* In rx_buffer, we do not need multiple fragments as is a single buffer */
@@ -620,6 +632,9 @@ struct netxen_rx_buffer {u64 dma;u16 ref_handle;u16 state; +u32 rx_bounce_buff; +struct bounce_index bnext; +char *bounce_ptr; };/* Board types */
@@ -704,6 +719,7 @@ struct netxen_recv_context { };#define NETXEN_NIC_MSI_ENABLED 0x02 +#define NETXEN_DMA_MASK 0xfffffffestruct netxen_drvops ;
@@ -938,9 +954,7 @@ static inline void netxen_nic_disable_in/* * ISR_INT_MASK: Can be read from window 0 or 1. */ -writel (0x7ff , - (void __iomem - *)(PCI_OFFSET_SECOND_RANGE (adapter,ISR_INT_MASK ))); +writel (0x7ff ,PCI_OFFSET_SECOND_RANGE (adapter,ISR_INT_MASK )); }
@@ -960,14 +974,12 @@ static inline void netxen_nic_enable_intbreak ; } -writel (mask, - (void __iomem - *)(PCI_OFFSET_SECOND_RANGE (adapter,ISR_INT_MASK ))); +writel (mask,PCI_OFFSET_SECOND_RANGE (adapter,ISR_INT_MASK ));if (!(adapter->flags &NETXEN_NIC_MSI_ENABLED )) { mask =0xbff ; -writel (mask, (void __iomem *) - (PCI_OFFSET_SECOND_RANGE (adapter,ISR_INT_TARGET_MASK ))); +writel (mask,PCI_OFFSET_SECOND_RANGE (adapter, +ISR_INT_TARGET_MASK )); } }
@@ -1041,6 +1053,9 @@ static inline void get_brd_name_by_type(int netxen_is_flash_supported (struct netxen_adapter *adapter);int netxen_get_flash_mac_addr (struct netxen_adapter *adapter,u64 mac[]); +int netxen_get_next_bounce_buffer (struct bounce_index *head, +struct bounce_index *tail, +struct bounce_index *biret,unsigned len);extern void netxen_change_ringparam (struct netxen_adapter *adapter); extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr,
drivers/net/netxen/netxen_nic_ethtool.c +8 -9
@@ -6,12 +6,12 @@* modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. -* + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
@@ -118,7 +118,7 @@ netxen_nic_get_drvinfo(struct net_deviceu32 fw_minor =0 ;u32 fw_build =0 ; -strncpy (drvinfo->driver,"netxen_nic" ,32 ); +strncpy (drvinfo->driver, netxen_nic_driver_name,32 );strncpy (drvinfo->version,NETXEN_NIC_LINUX_VERSIONID ,32 ); fw_major =readl (NETXEN_CRB_NORMALIZE (adapter,NETXEN_FW_VERSION_MAJOR ));
@@ -211,7 +211,6 @@ netxen_nic_get_settings(struct net_devicprintk ("ERROR: Unsupported board model %d\n" , (netxen_brdtype_t ) boardinfo->board_type);return -EIO ; - }return 0 ;
@@ -461,20 +460,22 @@ netxen_nic_get_ringparam(struct net_devi {struct netxen_port *port =netdev_priv (dev);struct netxen_adapter *adapter = port->adapter; -int i, j; +int i; ring->rx_pending =0 ; + ring->rx_jumbo_pending =0 ;for (i =0 ; i <MAX_RCV_CTX ; ++i) { -for (j =0 ; j <NUM_RCV_DESC_RINGS ; j++) - ring->rx_pending += - adapter->recv_ctx[i].rcv_desc[j].rcv_pending; + ring->rx_pending += adapter->recv_ctx[i]. + rcv_desc[RCV_DESC_NORMAL_CTXID ].rcv_pending; + ring->rx_jumbo_pending += adapter->recv_ctx[i]. + rcv_desc[RCV_DESC_JUMBO_CTXID ].rcv_pending; } ring->rx_max_pending = adapter->max_rx_desc_count; ring->tx_max_pending = adapter->max_tx_desc_count; + ring->rx_jumbo_max_pending = adapter->max_jumbo_rx_desc_count; ring->rx_mini_max_pending =0 ; ring->rx_mini_pending =0 ; - ring->rx_jumbo_max_pending =0 ; ring->rx_jumbo_pending =0 ; }
drivers/net/netxen/netxen_nic_hdr.h +0 -0
drivers/net/netxen/netxen_nic_hw.c +5 -5
@@ -650,7 +650,7 @@ void netxen_nic_reg_write(struct netxen_ addr =NETXEN_CRB_NORMALIZE (adapter, off);DPRINTK (INFO ,"writing to base %lx offset %llx addr %p data %x\n" , -pci_base (adapter, off), off, addr); +pci_base (adapter, off), off, addr, val);writel (val, addr); }
@@ -662,7 +662,7 @@ int netxen_nic_reg_read(struct netxen_ad addr =NETXEN_CRB_NORMALIZE (adapter, off);DPRINTK (INFO ,"reading from base %lx offset %llx addr %p\n" , - adapter->ahw.pci_base, off, addr); +pci_base (adapter, off), off, addr); val =readl (addr);writel (val, addr);
@@ -675,7 +675,7 @@ void netxen_nic_write_w0(struct netxen_avoid __iomem *addr;netxen_nic_pci_change_crbwindow (adapter,0 ); - addr = (void __iomem *)(pci_base_offset (adapter, index)); + addr =pci_base_offset (adapter, index);writel (value, addr);netxen_nic_pci_change_crbwindow (adapter,1 ); }
@@ -685,7 +685,7 @@ void netxen_nic_read_w0(struct netxen_ad {void __iomem *addr; - addr = (void __iomem *)(pci_base_offset (adapter, index)); + addr =pci_base_offset (adapter, index);netxen_nic_pci_change_crbwindow (adapter,0 ); *value =readl (addr);
@@ -865,7 +865,7 @@ netxen_crb_writelit_adapter(struct netxewritel (data,NETXEN_CRB_NORMALIZE (adapter, off)); }else {netxen_nic_pci_change_crbwindow (adapter,0 ); - addr = (void __iomem *)(pci_base_offset (adapter, off)); + addr =pci_base_offset (adapter, off);writel (data, addr);netxen_nic_pci_change_crbwindow (adapter,1 ); }
drivers/net/netxen/netxen_nic_hw.h +2 -2
@@ -83,8 +83,8 @@ struct netxen_adapter;#define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20)#define NETXEN_NIC_LOCKED_READ_REG (X ,Y ) \ - addr = pci_base_offset(adapter, (X)); \ - *(u32 *)Y = readl(addr); + addr = pci_base_offset(adapter, X); \ + *(u32 *)Y = readl((void __iomem*) addr);struct netxen_port ;void netxen_nic_set_link_parameters (struct netxen_port *port);
drivers/net/netxen/netxen_nic_init.c +47 -4
99 lines not on this page · raw message
drivers/net/netxen/netxen_nic_ioctl.h +0 -0
drivers/net/netxen/netxen_nic_isr.c +1 -2
@@ -68,8 +68,7 @@ struct net_device_stats *netxen_nic_get_void netxen_indicate_link_status (struct netxen_adapter *adapter,u32 portno,u32 link) { -struct netxen_port *pport = adapter->port[portno]; -struct net_device *netdev = pport->netdev; +struct net_device *netdev = (adapter->port[portno])->netdev;if (link)netif_carrier_on (netdev);
drivers/net/netxen/netxen_nic_main.c +195 -9
301 lines not on this page · raw message
drivers/net/netxen/netxen_nic_niu.c +0 -0
drivers/net/netxen/netxen_nic_phan_reg.h +5 -5
@@ -85,17 +85,17 @@ #define CRB_RX_PKT_TIMER NETXEN_NIC_REG#define CRB_TX_PKT_TIMER NETXEN_NIC_REG(0x94)#define CRB_RX_PKT_CNT NETXEN_NIC_REG(0x98)#define CRB_RX_TMR_CNT NETXEN_NIC_REG(0x9c) -#define CRB_INT_THRESH NETXEN_NIC_REG(0xa4) +#define CRB_INT_THRESH NETXEN_NIC_REG(0xa4)/* Register for communicating XG link status */ #define CRB_XG_STATE NETXEN_NIC_REG(0xa0)/* Register for communicating card temperature */ /* Upper 16 bits are temperature value. Lower 16 bits are the state */ -#define CRB_TEMP_STATE NETXEN_NIC_REG(0xa8) -#define nx_get_temp_val (x) ((x) >> 16) -#define nx_get_temp_state (x) ((x) & 0xffff) -#define nx_encode_temp (val, state) (((val) << 16) | (state)) +#define CRB_TEMP_STATE NETXEN_NIC_REG(0xa8) +#define nx_get_temp_val (x) ((x) >> 16) +#define nx_get_temp_state (x) ((x) & 0xffff) +#define nx_encode_temp (val, state) (((val) << 16) | (state))/* Debug registers for controlling NIC pkt gen agent */ #define CRB_AGENT_GO NETXEN_NIC_REG(0xb0)