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.h125
1 files changed, 53 insertions, 72 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index dd8ce35332fe..b996cb38ecb5 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -230,7 +230,9 @@ enum {
230 (((index) + (count)) & ((length) - 1)) 230 (((index) + (count)) & ((length) - 1))
231 231
232#define MPORT_SINGLE_FUNCTION_MODE 0x1111 232#define MPORT_SINGLE_FUNCTION_MODE 0x1111
233#define MPORT_MULTI_FUNCTION_MODE 0x2222
233 234
235#include "netxen_nic_phan_reg.h"
234extern unsigned long long netxen_dma_mask; 236extern unsigned long long netxen_dma_mask;
235extern unsigned long last_schedule_time; 237extern unsigned long last_schedule_time;
236 238
@@ -703,10 +705,8 @@ extern char netxen_nic_driver_name[];
703#else 705#else
704#define DPRINTK(klevel, fmt, args...) do { \ 706#define DPRINTK(klevel, fmt, args...) do { \
705 printk(KERN_##klevel PFX "%s: %s: " fmt, __FUNCTION__,\ 707 printk(KERN_##klevel PFX "%s: %s: " fmt, __FUNCTION__,\
706 (adapter != NULL && \ 708 (adapter != NULL && adapter->netdev != NULL) ? \
707 adapter->port[0] != NULL && \ 709 adapter->netdev->name : NULL, \
708 adapter->port[0]->netdev != NULL) ? \
709 adapter->port[0]->netdev->name : NULL, \
710 ## args); } while(0) 710 ## args); } while(0)
711#endif 711#endif
712 712
@@ -788,17 +788,27 @@ struct netxen_hardware_context {
788#define ETHERNET_FCS_SIZE 4 788#define ETHERNET_FCS_SIZE 4
789 789
790struct netxen_adapter_stats { 790struct netxen_adapter_stats {
791 u64 ints; 791 u64 rcvdbadskb;
792 u64 hostints; 792 u64 xmitcalled;
793 u64 otherints; 793 u64 xmitedframes;
794 u64 process_rcv; 794 u64 xmitfinished;
795 u64 process_xmit; 795 u64 badskblen;
796 u64 noxmitdone; 796 u64 nocmddescriptor;
797 u64 xmitcsummed; 797 u64 polled;
798 u64 post_called; 798 u64 uphappy;
799 u64 posted; 799 u64 updropped;
800 u64 lastposted; 800 u64 uplcong;
801 u64 goodskbposts; 801 u64 uphcong;
802 u64 upmcong;
803 u64 updunno;
804 u64 skbfreed;
805 u64 txdropped;
806 u64 txnullskb;
807 u64 csummed;
808 u64 no_rcv;
809 u64 rxbytes;
810 u64 txbytes;
811 u64 ints;
802}; 812};
803 813
804/* 814/*
@@ -846,13 +856,19 @@ struct netxen_dummy_dma {
846 856
847struct netxen_adapter { 857struct netxen_adapter {
848 struct netxen_hardware_context ahw; 858 struct netxen_hardware_context ahw;
849 int port_count; /* Number of configured ports */ 859
850 int active_ports; /* Number of open ports */ 860 struct netxen_adapter *master;
851 struct netxen_port *port[NETXEN_MAX_PORTS]; /* ptr to each port */ 861 struct net_device *netdev;
862 struct pci_dev *pdev;
863 unsigned char mac_addr[ETH_ALEN];
864 int mtu;
865 int portnum;
866
852 spinlock_t tx_lock; 867 spinlock_t tx_lock;
853 spinlock_t lock; 868 spinlock_t lock;
854 struct work_struct watchdog_task; 869 struct work_struct watchdog_task;
855 struct timer_list watchdog_timer; 870 struct timer_list watchdog_timer;
871 struct work_struct tx_timeout_task;
856 872
857 u32 curr_window; 873 u32 curr_window;
858 874
@@ -875,6 +891,15 @@ struct netxen_adapter {
875 u32 temp; 891 u32 temp;
876 892
877 struct netxen_adapter_stats stats; 893 struct netxen_adapter_stats stats;
894
895 u16 portno;
896 u16 link_speed;
897 u16 link_duplex;
898 u16 state;
899 u16 link_autoneg;
900 int rcsum;
901 int status;
902 spinlock_t stats_lock;
878 903
879 struct netxen_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */ 904 struct netxen_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */
880 905
@@ -894,62 +919,20 @@ struct netxen_adapter {
894 int (*enable_phy_interrupts) (struct netxen_adapter *, int); 919 int (*enable_phy_interrupts) (struct netxen_adapter *, int);
895 int (*disable_phy_interrupts) (struct netxen_adapter *, int); 920 int (*disable_phy_interrupts) (struct netxen_adapter *, int);
896 void (*handle_phy_intr) (struct netxen_adapter *); 921 void (*handle_phy_intr) (struct netxen_adapter *);
897 int (*macaddr_set) (struct netxen_port *, netxen_ethernet_macaddr_t); 922 int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t);
898 int (*set_mtu) (struct netxen_port *, int); 923 int (*set_mtu) (struct netxen_adapter *, int);
899 int (*set_promisc) (struct netxen_adapter *, int, 924 int (*set_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
900 netxen_niu_prom_mode_t); 925 int (*unset_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t);
901 int (*unset_promisc) (struct netxen_adapter *, int,
902 netxen_niu_prom_mode_t);
903 int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *); 926 int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *);
904 int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val); 927 int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
905 int (*init_port) (struct netxen_adapter *, int); 928 int (*init_port) (struct netxen_adapter *, int);
906 void (*init_niu) (struct netxen_adapter *); 929 void (*init_niu) (struct netxen_adapter *);
907 int (*stop_port) (struct netxen_adapter *, int); 930 int (*stop_port) (struct netxen_adapter *);
908}; /* netxen_adapter structure */ 931}; /* netxen_adapter structure */
909 932
910/* Max number of xmit producer threads that can run simultaneously */ 933/* Max number of xmit producer threads that can run simultaneously */
911#define MAX_XMIT_PRODUCERS 16 934#define MAX_XMIT_PRODUCERS 16
912 935
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) \ 936#define PCI_OFFSET_FIRST_RANGE(adapter, off) \
954 ((adapter)->ahw.pci_base0 + (off)) 937 ((adapter)->ahw.pci_base0 + (off))
955#define PCI_OFFSET_SECOND_RANGE(adapter, off) \ 938#define PCI_OFFSET_SECOND_RANGE(adapter, off) \
@@ -1011,8 +994,8 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy,
1011 long reg, __u32 val); 994 long reg, __u32 val);
1012 995
1013/* Functions available from netxen_nic_hw.c */ 996/* Functions available from netxen_nic_hw.c */
1014int netxen_nic_set_mtu_xgb(struct netxen_port *port, int new_mtu); 997int 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); 998int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu);
1016void netxen_nic_init_niu_gb(struct netxen_adapter *adapter); 999void netxen_nic_init_niu_gb(struct netxen_adapter *adapter);
1017void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw); 1000void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw);
1018void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val); 1001void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val);
@@ -1051,11 +1034,8 @@ int netxen_do_rom_se(struct netxen_adapter *adapter, int addr);
1051 1034
1052/* Functions from netxen_nic_isr.c */ 1035/* Functions from netxen_nic_isr.c */
1053void netxen_nic_isr_other(struct netxen_adapter *adapter); 1036void netxen_nic_isr_other(struct netxen_adapter *adapter);
1054void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 port, 1037void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link);
1055 u32 link); 1038void 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); 1039void netxen_initialize_adapter_sw(struct netxen_adapter *adapter);
1060void netxen_initialize_adapter_hw(struct netxen_adapter *adapter); 1040void netxen_initialize_adapter_hw(struct netxen_adapter *adapter);
1061void *netxen_alloc(struct pci_dev *pdev, size_t sz, dma_addr_t * ptr, 1041void *netxen_alloc(struct pci_dev *pdev, size_t sz, dma_addr_t * ptr,
@@ -1110,6 +1090,7 @@ static inline void netxen_nic_enable_int(struct netxen_adapter *adapter)
1110 1090
1111 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { 1091 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
1112 mask = 0xbff; 1092 mask = 0xbff;
1093 writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
1113 writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, 1094 writel(mask, PCI_OFFSET_SECOND_RANGE(adapter,
1114 ISR_INT_TARGET_MASK)); 1095 ISR_INT_TARGET_MASK));
1115 } 1096 }