aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netxen/netxen_nic.h')
-rw-r--r--drivers/net/netxen/netxen_nic.h189
1 files changed, 93 insertions, 96 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index dd8ce35332fe..ad6688eab265 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -64,9 +64,9 @@
64#include "netxen_nic_hw.h" 64#include "netxen_nic_hw.h"
65 65
66#define _NETXEN_NIC_LINUX_MAJOR 3 66#define _NETXEN_NIC_LINUX_MAJOR 3
67#define _NETXEN_NIC_LINUX_MINOR 3 67#define _NETXEN_NIC_LINUX_MINOR 4
68#define _NETXEN_NIC_LINUX_SUBVERSION 3 68#define _NETXEN_NIC_LINUX_SUBVERSION 2
69#define NETXEN_NIC_LINUX_VERSIONID "3.3.3" 69#define NETXEN_NIC_LINUX_VERSIONID "3.4.2"
70 70
71#define NUM_FLASH_SECTORS (64) 71#define NUM_FLASH_SECTORS (64)
72#define FLASH_SECTOR_SIZE (64 * 1024) 72#define FLASH_SECTOR_SIZE (64 * 1024)
@@ -131,8 +131,8 @@ extern struct workqueue_struct *netxen_workq;
131#define FIRST_PAGE_GROUP_START 0 131#define FIRST_PAGE_GROUP_START 0
132#define FIRST_PAGE_GROUP_END 0x100000 132#define FIRST_PAGE_GROUP_END 0x100000
133 133
134#define SECOND_PAGE_GROUP_START 0x4000000 134#define SECOND_PAGE_GROUP_START 0x6000000
135#define SECOND_PAGE_GROUP_END 0x66BC000 135#define SECOND_PAGE_GROUP_END 0x68BC000
136 136
137#define THIRD_PAGE_GROUP_START 0x70E4000 137#define THIRD_PAGE_GROUP_START 0x70E4000
138#define THIRD_PAGE_GROUP_END 0x8000000 138#define THIRD_PAGE_GROUP_END 0x8000000
@@ -205,6 +205,8 @@ enum {
205 205
206#define MAX_CMD_DESCRIPTORS 1024 206#define MAX_CMD_DESCRIPTORS 1024
207#define MAX_RCV_DESCRIPTORS 16384 207#define MAX_RCV_DESCRIPTORS 16384
208#define MAX_CMD_DESCRIPTORS_HOST (MAX_CMD_DESCRIPTORS / 4)
209#define MAX_RCV_DESCRIPTORS_1G (MAX_RCV_DESCRIPTORS / 4)
208#define MAX_JUMBO_RCV_DESCRIPTORS 1024 210#define MAX_JUMBO_RCV_DESCRIPTORS 1024
209#define MAX_LRO_RCV_DESCRIPTORS 64 211#define MAX_LRO_RCV_DESCRIPTORS 64
210#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS 212#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS
@@ -230,7 +232,9 @@ enum {
230 (((index) + (count)) & ((length) - 1)) 232 (((index) + (count)) & ((length) - 1))
231 233
232#define MPORT_SINGLE_FUNCTION_MODE 0x1111 234#define MPORT_SINGLE_FUNCTION_MODE 0x1111
235#define MPORT_MULTI_FUNCTION_MODE 0x2222
233 236
237#include "netxen_nic_phan_reg.h"
234extern unsigned long long netxen_dma_mask; 238extern unsigned long long netxen_dma_mask;
235extern unsigned long last_schedule_time; 239extern unsigned long last_schedule_time;
236 240
@@ -300,6 +304,8 @@ struct netxen_ring_ctx {
300 304
301#define netxen_set_cmd_desc_port(cmd_desc, var) \ 305#define netxen_set_cmd_desc_port(cmd_desc, var) \
302 ((cmd_desc)->port_ctxid |= ((var) & 0x0F)) 306 ((cmd_desc)->port_ctxid |= ((var) & 0x0F))
307#define netxen_set_cmd_desc_ctxid(cmd_desc, var) \
308 ((cmd_desc)->port_ctxid |= ((var) & 0xF0))
303 309
304#define netxen_set_cmd_desc_flags(cmd_desc, val) \ 310#define netxen_set_cmd_desc_flags(cmd_desc, val) \
305 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \ 311 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \
@@ -442,7 +448,7 @@ struct status_desc {
442 /* Bit pattern: 0-6 lro_count indicates frag sequence, 448 /* Bit pattern: 0-6 lro_count indicates frag sequence,
443 7 last_frag indicates last frag */ 449 7 last_frag indicates last frag */
444 u8 lro; 450 u8 lro;
445} __attribute__ ((aligned(8))); 451} __attribute__ ((aligned(16)));
446 452
447enum { 453enum {
448 NETXEN_RCV_PEG_0 = 0, 454 NETXEN_RCV_PEG_0 = 0,
@@ -703,10 +709,8 @@ extern char netxen_nic_driver_name[];
703#else 709#else
704#define DPRINTK(klevel, fmt, args...) do { \ 710#define DPRINTK(klevel, fmt, args...) do { \
705 printk(KERN_##klevel PFX "%s: %s: " fmt, __FUNCTION__,\ 711 printk(KERN_##klevel PFX "%s: %s: " fmt, __FUNCTION__,\
706 (adapter != NULL && \ 712 (adapter != NULL && adapter->netdev != NULL) ? \
707 adapter->port[0] != NULL && \ 713 adapter->netdev->name : NULL, \
708 adapter->port[0]->netdev != NULL) ? \
709 adapter->port[0]->netdev->name : NULL, \
710 ## args); } while(0) 714 ## args); } while(0)
711#endif 715#endif
712 716
@@ -722,6 +726,18 @@ struct netxen_skb_frag {
722 u32 length; 726 u32 length;
723}; 727};
724 728
729#define _netxen_set_bits(config_word, start, bits, val) {\
730 unsigned long long __tmask = (((1ULL << (bits)) - 1) << (start));\
731 unsigned long long __tvalue = (val); \
732 (config_word) &= ~__tmask; \
733 (config_word) |= (((__tvalue) << (start)) & __tmask); \
734}
735
736#define _netxen_clear_bits(config_word, start, bits) {\
737 unsigned long long __tmask = (((1ULL << (bits)) - 1) << (start)); \
738 (config_word) &= ~__tmask; \
739}
740
725/* Following defines are for the state of the buffers */ 741/* Following defines are for the state of the buffers */
726#define NETXEN_BUFFER_FREE 0 742#define NETXEN_BUFFER_FREE 0
727#define NETXEN_BUFFER_BUSY 1 743#define NETXEN_BUFFER_BUSY 1
@@ -766,6 +782,8 @@ struct netxen_hardware_context {
766 void __iomem *pci_base0; 782 void __iomem *pci_base0;
767 void __iomem *pci_base1; 783 void __iomem *pci_base1;
768 void __iomem *pci_base2; 784 void __iomem *pci_base2;
785 unsigned long first_page_group_end;
786 unsigned long first_page_group_start;
769 void __iomem *db_base; 787 void __iomem *db_base;
770 unsigned long db_len; 788 unsigned long db_len;
771 789
@@ -780,6 +798,7 @@ struct netxen_hardware_context {
780 struct pci_dev *cmd_desc_pdev; 798 struct pci_dev *cmd_desc_pdev;
781 dma_addr_t cmd_desc_phys_addr; 799 dma_addr_t cmd_desc_phys_addr;
782 struct netxen_adapter *adapter; 800 struct netxen_adapter *adapter;
801 int pci_func;
783}; 802};
784 803
785#define RCV_RING_LRO RCV_DESC_LRO 804#define RCV_RING_LRO RCV_DESC_LRO
@@ -788,17 +807,27 @@ struct netxen_hardware_context {
788#define ETHERNET_FCS_SIZE 4 807#define ETHERNET_FCS_SIZE 4
789 808
790struct netxen_adapter_stats { 809struct netxen_adapter_stats {
791 u64 ints; 810 u64 rcvdbadskb;
792 u64 hostints; 811 u64 xmitcalled;
793 u64 otherints; 812 u64 xmitedframes;
794 u64 process_rcv; 813 u64 xmitfinished;
795 u64 process_xmit; 814 u64 badskblen;
796 u64 noxmitdone; 815 u64 nocmddescriptor;
797 u64 xmitcsummed; 816 u64 polled;
798 u64 post_called; 817 u64 uphappy;
799 u64 posted; 818 u64 updropped;
800 u64 lastposted; 819 u64 uplcong;
801 u64 goodskbposts; 820 u64 uphcong;
821 u64 upmcong;
822 u64 updunno;
823 u64 skbfreed;
824 u64 txdropped;
825 u64 txnullskb;
826 u64 csummed;
827 u64 no_rcv;
828 u64 rxbytes;
829 u64 txbytes;
830 u64 ints;
802}; 831};
803 832
804/* 833/*
@@ -846,13 +875,20 @@ struct netxen_dummy_dma {
846 875
847struct netxen_adapter { 876struct netxen_adapter {
848 struct netxen_hardware_context ahw; 877 struct netxen_hardware_context ahw;
849 int port_count; /* Number of configured ports */ 878
850 int active_ports; /* Number of open ports */ 879 struct netxen_adapter *master;
851 struct netxen_port *port[NETXEN_MAX_PORTS]; /* ptr to each port */ 880 struct net_device *netdev;
881 struct pci_dev *pdev;
882 struct net_device_stats net_stats;
883 unsigned char mac_addr[ETH_ALEN];
884 int mtu;
885 int portnum;
886
852 spinlock_t tx_lock; 887 spinlock_t tx_lock;
853 spinlock_t lock; 888 spinlock_t lock;
854 struct work_struct watchdog_task; 889 struct work_struct watchdog_task;
855 struct timer_list watchdog_timer; 890 struct timer_list watchdog_timer;
891 struct work_struct tx_timeout_task;
856 892
857 u32 curr_window; 893 u32 curr_window;
858 894
@@ -875,6 +911,15 @@ struct netxen_adapter {
875 u32 temp; 911 u32 temp;
876 912
877 struct netxen_adapter_stats stats; 913 struct netxen_adapter_stats stats;
914
915 u16 portno;
916 u16 link_speed;
917 u16 link_duplex;
918 u16 state;
919 u16 link_autoneg;
920 int rcsum;
921 int status;
922 spinlock_t stats_lock;
878 923
879 struct netxen_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */ 924 struct netxen_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */
880 925
@@ -891,65 +936,23 @@ struct netxen_adapter {
891 struct netxen_ring_ctx *ctx_desc; 936 struct netxen_ring_ctx *ctx_desc;
892 struct pci_dev *ctx_desc_pdev; 937 struct pci_dev *ctx_desc_pdev;
893 dma_addr_t ctx_desc_phys_addr; 938 dma_addr_t ctx_desc_phys_addr;
894 int (*enable_phy_interrupts) (struct netxen_adapter *, int); 939 int (*enable_phy_interrupts) (struct netxen_adapter *);
895 int (*disable_phy_interrupts) (struct netxen_adapter *, int); 940 int (*disable_phy_interrupts) (struct netxen_adapter *);
896 void (*handle_phy_intr) (struct netxen_adapter *); 941 void (*handle_phy_intr) (struct netxen_adapter *);
897 int (*macaddr_set) (struct netxen_port *, netxen_ethernet_macaddr_t); 942 int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t);
898 int (*set_mtu) (struct netxen_port *, int); 943 int (*set_mtu) (struct netxen_adapter *, int);
899 int (*set_promisc) (struct netxen_adapter *, int, 944 int (*set_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
900 netxen_niu_prom_mode_t); 945 int (*unset_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
901 int (*unset_promisc) (struct netxen_adapter *, int, 946 int (*phy_read) (struct netxen_adapter *, long reg, u32 *);
902 netxen_niu_prom_mode_t); 947 int (*phy_write) (struct netxen_adapter *, long reg, u32 val);
903 int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *);
904 int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
905 int (*init_port) (struct netxen_adapter *, int); 948 int (*init_port) (struct netxen_adapter *, int);
906 void (*init_niu) (struct netxen_adapter *); 949 void (*init_niu) (struct netxen_adapter *);
907 int (*stop_port) (struct netxen_adapter *, int); 950 int (*stop_port) (struct netxen_adapter *);
908}; /* netxen_adapter structure */ 951}; /* netxen_adapter structure */
909 952
910/* Max number of xmit producer threads that can run simultaneously */ 953/* Max number of xmit producer threads that can run simultaneously */
911#define MAX_XMIT_PRODUCERS 16 954#define MAX_XMIT_PRODUCERS 16
912 955
913struct netxen_port_stats {
914 u64 rcvdbadskb;
915 u64 xmitcalled;
916 u64 xmitedframes;
917 u64 xmitfinished;
918 u64 badskblen;
919 u64 nocmddescriptor;
920 u64 polled;
921 u64 uphappy;
922 u64 updropped;
923 u64 uplcong;
924 u64 uphcong;
925 u64 upmcong;
926 u64 updunno;
927 u64 skbfreed;
928 u64 txdropped;
929 u64 txnullskb;
930 u64 csummed;
931 u64 no_rcv;
932 u64 rxbytes;
933 u64 txbytes;
934};
935
936struct netxen_port {
937 struct netxen_adapter *adapter;
938
939 u16 portnum; /* GBE port number */
940 u16 link_speed;
941 u16 link_duplex;
942 u16 link_autoneg;
943
944 int flags;
945
946 struct net_device *netdev;
947 struct pci_dev *pdev;
948 struct net_device_stats net_stats;
949 struct netxen_port_stats stats;
950 struct work_struct tx_timeout_task;
951};
952
953#define PCI_OFFSET_FIRST_RANGE(adapter, off) \ 956#define PCI_OFFSET_FIRST_RANGE(adapter, off) \
954 ((adapter)->ahw.pci_base0 + (off)) 957 ((adapter)->ahw.pci_base0 + (off))
955#define PCI_OFFSET_SECOND_RANGE(adapter, off) \ 958#define PCI_OFFSET_SECOND_RANGE(adapter, off) \
@@ -987,32 +990,26 @@ static inline void __iomem *pci_base(struct netxen_adapter *adapter,
987 return NULL; 990 return NULL;
988} 991}
989 992
990int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter, 993int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter);
991 int port); 994int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter);
992int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter, 995int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter);
993 int port); 996int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter);
994int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter, 997int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter);
995 int port); 998int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter);
996int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter,
997 int port);
998int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter,
999 int port);
1000int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter,
1001 int port);
1002void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter); 999void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter);
1003void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter); 1000void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter);
1004void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, int port, 1001void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, int port,
1005 long enable); 1002 long enable);
1006void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, int port, 1003void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, int port,
1007 long enable); 1004 long enable);
1008int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, long reg, 1005int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
1009 __u32 * readval); 1006 __u32 * readval);
1010int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy, 1007int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter,
1011 long reg, __u32 val); 1008 long reg, __u32 val);
1012 1009
1013/* Functions available from netxen_nic_hw.c */ 1010/* Functions available from netxen_nic_hw.c */
1014int netxen_nic_set_mtu_xgb(struct netxen_port *port, int new_mtu); 1011int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu);
1015int netxen_nic_set_mtu_gb(struct netxen_port *port, int new_mtu); 1012int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu);
1016void netxen_nic_init_niu_gb(struct netxen_adapter *adapter); 1013void netxen_nic_init_niu_gb(struct netxen_adapter *adapter);
1017void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw); 1014void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw);
1018void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val); 1015void 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,
1027 int len); 1024 int len);
1028void netxen_crb_writelit_adapter(struct netxen_adapter *adapter, 1025void netxen_crb_writelit_adapter(struct netxen_adapter *adapter,
1029 unsigned long off, int data); 1026 unsigned long off, int data);
1027int netxen_nic_erase_pxe(struct netxen_adapter *adapter);
1030 1028
1031/* Functions from netxen_nic_init.c */ 1029/* Functions from netxen_nic_init.c */
1032void netxen_free_adapter_offload(struct netxen_adapter *adapter); 1030void netxen_free_adapter_offload(struct netxen_adapter *adapter);
@@ -1051,11 +1049,8 @@ int netxen_do_rom_se(struct netxen_adapter *adapter, int addr);
1051 1049
1052/* Functions from netxen_nic_isr.c */ 1050/* Functions from netxen_nic_isr.c */
1053void netxen_nic_isr_other(struct netxen_adapter *adapter); 1051void netxen_nic_isr_other(struct netxen_adapter *adapter);
1054void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 port, 1052void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link);
1055 u32 link); 1053void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable);
1056void netxen_handle_port_int(struct netxen_adapter *adapter, u32 port,
1057 u32 enable);
1058void netxen_nic_stop_all_ports(struct netxen_adapter *adapter);
1059void netxen_initialize_adapter_sw(struct netxen_adapter *adapter); 1054void netxen_initialize_adapter_sw(struct netxen_adapter *adapter);
1060void netxen_initialize_adapter_hw(struct netxen_adapter *adapter); 1055void netxen_initialize_adapter_hw(struct netxen_adapter *adapter);
1061void *netxen_alloc(struct pci_dev *pdev, size_t sz, dma_addr_t * ptr, 1056void *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)
1110 1105
1111 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { 1106 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
1112 mask = 0xbff; 1107 mask = 0xbff;
1108 writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
1113 writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, 1109 writel(mask, PCI_OFFSET_SECOND_RANGE(adapter,
1114 ISR_INT_TARGET_MASK)); 1110 ISR_INT_TARGET_MASK));
1115 } 1111 }
@@ -1174,4 +1170,5 @@ extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr,
1174 1170
1175extern struct ethtool_ops netxen_nic_ethtool_ops; 1171extern struct ethtool_ops netxen_nic_ethtool_ops;
1176 1172
1173extern int physical_port[]; /* physical port # from virtual port.*/
1177#endif /* __NETXEN_NIC_H_ */ 1174#endif /* __NETXEN_NIC_H_ */