diff options
Diffstat (limited to 'drivers/net/netxen/netxen_nic.h')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 189 |
1 files changed, 93 insertions, 96 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index dd8ce35332f..ad6688eab26 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h @@ -64,9 +64,9 @@ #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) @@ -131,8 +131,8 @@ extern struct workqueue_struct *netxen_workq; #define FIRST_PAGE_GROUP_START 0 #define FIRST_PAGE_GROUP_END 0x100000 -#define SECOND_PAGE_GROUP_START 0x4000000 -#define SECOND_PAGE_GROUP_END 0x66BC000 +#define SECOND_PAGE_GROUP_START 0x6000000 +#define SECOND_PAGE_GROUP_END 0x68BC000 #define THIRD_PAGE_GROUP_START 0x70E4000 #define THIRD_PAGE_GROUP_END 0x8000000 @@ -205,6 +205,8 @@ enum { #define MAX_CMD_DESCRIPTORS 1024 #define MAX_RCV_DESCRIPTORS 16384 +#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_DESCRIPTORS 64 #define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS @@ -230,7 +232,9 @@ enum { (((index) + (count)) & ((length) - 1)) #define MPORT_SINGLE_FUNCTION_MODE 0x1111 +#define MPORT_MULTI_FUNCTION_MODE 0x2222 +#include "netxen_nic_phan_reg.h" extern unsigned long long netxen_dma_mask; extern unsigned long last_schedule_time; @@ -300,6 +304,8 @@ struct netxen_ring_ctx { #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), \ @@ -442,7 +448,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, @@ -703,10 +709,8 @@ extern char netxen_nic_driver_name[]; #else #define DPRINTK(klevel, fmt, args...) do { \ printk(KERN_##klevel PFX "%s: %s: " fmt, __FUNCTION__,\ - (adapter != NULL && \ - adapter->port[0] != NULL && \ - adapter->port[0]->netdev != NULL) ? \ - adapter->port[0]->netdev->name : NULL, \ + (adapter != NULL && adapter->netdev != NULL) ? \ + adapter->netdev->name : NULL, \ ## args); } while(0) #endif @@ -722,6 +726,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 */ #define NETXEN_BUFFER_FREE 0 #define NETXEN_BUFFER_BUSY 1 @@ -766,6 +782,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; @@ -780,6 +798,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 @@ -788,17 +807,27 @@ struct netxen_hardware_context { #define ETHERNET_FCS_SIZE 4 struct netxen_adapter_stats { - u64 ints; - u64 hostints; - u64 otherints; - u64 process_rcv; - u64 process_xmit; - u64 noxmitdone; - u64 xmitcsummed; - u64 post_called; - u64 posted; - u64 lastposted; - u64 goodskbposts; + u64 rcvdbadskb; + u64 xmitcalled; + u64 xmitedframes; + u64 xmitfinished; + u64 badskblen; + u64 nocmddescriptor; + u64 polled; + u64 uphappy; + u64 updropped; + u64 uplcong; + u64 uphcong; + u64 upmcong; + u64 updunno; + u64 skbfreed; + u64 txdropped; + u64 txnullskb; + u64 csummed; + u64 no_rcv; + u64 rxbytes; + u64 txbytes; + u64 ints; }; /* @@ -846,13 +875,20 @@ struct netxen_dummy_dma { struct netxen_adapter { struct netxen_hardware_context ahw; - int port_count; /* Number of configured ports */ - int active_ports; /* Number of open ports */ - struct netxen_port *port[NETXEN_MAX_PORTS]; /* ptr to each port */ + + struct netxen_adapter *master; + struct net_device *netdev; + struct pci_dev *pdev; + struct net_device_stats net_stats; + unsigned char mac_addr[ETH_ALEN]; + int mtu; + int portnum; + spinlock_t tx_lock; spinlock_t lock; struct work_struct watchdog_task; struct timer_list watchdog_timer; + struct work_struct tx_timeout_task; u32 curr_window; @@ -875,6 +911,15 @@ struct netxen_adapter { u32 temp; struct netxen_adapter_stats stats; + + u16 portno; + u16 link_speed; + u16 link_duplex; + u16 state; + u16 link_autoneg; + int rcsum; + int status; + spinlock_t stats_lock; struct netxen_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */ @@ -891,65 +936,23 @@ 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_port *, netxen_ethernet_macaddr_t); - int (*set_mtu) (struct netxen_port *, int); - int (*set_promisc) (struct netxen_adapter *, int, - netxen_niu_prom_mode_t); - int (*unset_promisc) (struct netxen_adapter *, int, - 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 (*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 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 *, int); + int (*stop_port) (struct netxen_adapter *); }; /* netxen_adapter structure */ /* Max number of xmit producer threads that can run simultaneously */ #define MAX_XMIT_PRODUCERS 16 -struct netxen_port_stats { - u64 rcvdbadskb; - u64 xmitcalled; - u64 xmitedframes; - u64 xmitfinished; - u64 badskblen; - u64 nocmddescriptor; - u64 polled; - u64 uphappy; - u64 updropped; - u64 uplcong; - u64 uphcong; - u64 upmcong; - u64 updunno; - u64 skbfreed; - u64 txdropped; - u64 txnullskb; - u64 csummed; - u64 no_rcv; - u64 rxbytes; - u64 txbytes; -}; - -struct netxen_port { - struct netxen_adapter *adapter; - - u16 portnum; /* GBE port number */ - u16 link_speed; - u16 link_duplex; - u16 link_autoneg; - - int flags; - - struct net_device *netdev; - struct pci_dev *pdev; - struct net_device_stats net_stats; - struct netxen_port_stats stats; - struct work_struct tx_timeout_task; -}; - #define PCI_OFFSET_FIRST_RANGE(adapter, off) \ ((adapter)->ahw.pci_base0 + (off)) #define PCI_OFFSET_SECOND_RANGE(adapter, off) \ @@ -987,32 +990,26 @@ static inline void __iomem *pci_base(struct netxen_adapter *adapter, 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 */ -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); +int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu); +int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu); void netxen_nic_init_niu_gb(struct netxen_adapter *adapter); void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw); void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val); @@ -1027,6 +1024,7 @@ int netxen_nic_hw_write_wx(struct netxen_adapter *adapter, u64 off, void *data, int len); void netxen_crb_writelit_adapter(struct netxen_adapter *adapter, unsigned long off, int data); +int netxen_nic_erase_pxe(struct netxen_adapter *adapter); /* Functions from netxen_nic_init.c */ void netxen_free_adapter_offload(struct netxen_adapter *adapter); @@ -1051,11 +1049,8 @@ 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); -void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 port, - u32 link); -void netxen_handle_port_int(struct netxen_adapter *adapter, u32 port, - u32 enable); -void netxen_nic_stop_all_ports(struct netxen_adapter *adapter); +void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link); +void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable); 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, @@ -1110,6 +1105,7 @@ static inline void netxen_nic_enable_int(struct netxen_adapter *adapter) if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { mask = 0xbff; + writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR)); writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK)); } @@ -1174,4 +1170,5 @@ extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, extern struct ethtool_ops netxen_nic_ethtool_ops; +extern int physical_port[]; /* physical port # from virtual port.*/ #endif /* __NETXEN_NIC_H_ */ |