PCI: Change all drivers to use pci_device->revision
[GitHub/LineageOS/android_kernel_motorola_exynos9610.git] / drivers / net / s2io.h
index a5e1a513deb53039d1ac97e0514d3fe940bd382d..3887fe63a908146bc2fdff545a73ed2eebab098e 100644 (file)
@@ -1,6 +1,6 @@
 /************************************************************************
  * s2io.h: A Linux PCI-X Ethernet driver for Neterion 10GbE Server NIC
- * Copyright(c) 2002-2005 Neterion Inc.
+ * Copyright(c) 2002-2007 Neterion Inc.
 
  * This software may be used and distributed according to the terms of
  * the GNU General Public License (GPL), incorporated herein by reference.
@@ -32,7 +32,8 @@
 #define FAILURE -1
 #define S2IO_MINUS_ONE 0xFFFFFFFFFFFFFFFFULL
 #define S2IO_MAX_PCI_CONFIG_SPACE_REINIT 100
-
+#define S2IO_BIT_RESET 1
+#define S2IO_BIT_SET 2
 #define CHECKBIT(value, nbit) (value & (1 << nbit))
 
 /* Maximum time to flicker LED when asked to identify NIC using ethtool */
@@ -94,6 +95,32 @@ struct swStat {
        unsigned long long flush_max_pkts;
        unsigned long long sum_avg_pkts_aggregated;
        unsigned long long num_aggregations;
+       /* Other statistics */
+       unsigned long long mem_alloc_fail_cnt;
+       unsigned long long watchdog_timer_cnt;
+       unsigned long long mem_allocated;
+       unsigned long long mem_freed;
+       unsigned long long link_up_cnt;
+       unsigned long long link_down_cnt;
+       unsigned long long link_up_time;
+       unsigned long long link_down_time;
+
+       /* Transfer Code statistics */
+       unsigned long long tx_buf_abort_cnt;
+       unsigned long long tx_desc_abort_cnt;
+       unsigned long long tx_parity_err_cnt;
+       unsigned long long tx_link_loss_cnt;
+       unsigned long long tx_list_proc_err_cnt;
+
+       unsigned long long rx_parity_err_cnt;
+       unsigned long long rx_abort_cnt;
+       unsigned long long rx_parity_abort_cnt;
+       unsigned long long rx_rda_fail_cnt;
+       unsigned long long rx_unkn_prot_cnt;
+       unsigned long long rx_fcs_err_cnt;
+       unsigned long long rx_buf_size_err_cnt;
+       unsigned long long rx_rxd_corrupt_cnt;
+       unsigned long long rx_unkn_err_cnt;
 };
 
 /* Xpak releated alarm and warnings */
@@ -296,6 +323,9 @@ struct stat_block {
        struct xpakStat xpak_stat;
 };
 
+/* Default value for 'vlan_strip_tag' configuration parameter */
+#define NO_STRIP_IN_PROMISC 2
+
 /*
  * Structures representing different init time configuration
  * parameters of the NIC.
@@ -304,6 +334,11 @@ struct stat_block {
 #define MAX_TX_FIFOS 8
 #define MAX_RX_RINGS 8
 
+#define MAX_RX_DESC_1  (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 127 )
+#define MAX_RX_DESC_2  (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 85 )
+#define MAX_RX_DESC_3  (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 85 )
+#define MAX_TX_DESC    (MAX_AVAILABLE_TXDS)
+
 /* FIFO mappings for all possible number of fifos configured */
 static int fifo_map[][MAX_TX_FIFOS] = {
        {0, 0, 0, 0, 0, 0, 0, 0},
@@ -727,12 +762,12 @@ struct lro {
        struct iphdr    *iph;
        struct tcphdr   *tcph;
        u32             tcp_next_seq;
-       u32             tcp_ack;
+       __be32          tcp_ack;
        int             total_len;
        int             frags_len;
        int             sg_num;
        int             in_use;
-       u16             window;
+       __be16          window;
        u32             cur_tsval;
        u32             cur_tsecr;
        u8              saw_ts;
@@ -756,11 +791,9 @@ struct s2io_nic {
 #define MAX_SUPPORTED_MULTICASTS MAX_MAC_SUPPORTED
 
        struct mac_addr def_mac_addr[MAX_MAC_SUPPORTED];
-       struct mac_addr pre_mac_addr[MAX_MAC_SUPPORTED];
 
        struct net_device_stats stats;
        int high_dma_flag;
-       int device_close_flag;
        int device_enabled_once;
 
        char name[60];
@@ -790,11 +823,6 @@ struct s2io_nic {
        u16 all_multi_pos;
        u16 promisc_flg;
 
-       u16 tx_pkt_count;
-       u16 rx_pkt_count;
-       u16 tx_err_count;
-       u16 rx_err_count;
-
        /*  Id timer, used to blink NIC to physically identify NIC. */
        struct timer_list id_timer;
 
@@ -821,6 +849,7 @@ struct s2io_nic {
 #define        LINK_UP         2
 
        int task_flag;
+       unsigned long long start_time;
 #define CARD_DOWN 1
 #define CARD_UP 2
        atomic_t card_state;
@@ -1004,8 +1033,8 @@ static void s2io_set_link(struct work_struct *work);
 static int s2io_set_swapper(struct s2io_nic * sp);
 static void s2io_card_down(struct s2io_nic *nic);
 static int s2io_card_up(struct s2io_nic *nic);
-static int get_xena_rev_id(struct pci_dev *pdev);
-static int wait_for_cmd_complete(void *addr, u64 busy_bit);
+static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit,
+                                       int bit_state);
 static int s2io_add_isr(struct s2io_nic * sp);
 static void s2io_rem_isr(struct s2io_nic * sp);
 
@@ -1019,6 +1048,12 @@ static void queue_rx_frame(struct sk_buff *skb);
 static void update_L3L4_header(struct s2io_nic *sp, struct lro *lro);
 static void lro_append_pkt(struct s2io_nic *sp, struct lro *lro,
                           struct sk_buff *skb, u32 tcp_len);
+static int rts_ds_steer(struct s2io_nic *nic, u8 ds_codepoint, u8 ring);
+
+static pci_ers_result_t s2io_io_error_detected(struct pci_dev *pdev,
+                                             pci_channel_state_t state);
+static pci_ers_result_t s2io_io_slot_reset(struct pci_dev *pdev);
+static void s2io_io_resume(struct pci_dev *pdev);
 
 #define s2io_tcp_mss(skb) skb_shinfo(skb)->gso_size
 #define s2io_udp_mss(skb) skb_shinfo(skb)->gso_size