cxgb3: use request_firmware() for the EDC registers setup
[safe/jmp/linux-2.6] / drivers / net / cxgb3 / adapter.h
index e9da285..74723f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2007 Chelsio, Inc. All rights reserved.
+ * Copyright (c) 2003-2008 Chelsio, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -42,7 +42,6 @@
 #include <linux/cache.h>
 #include <linux/mutex.h>
 #include <linux/bitops.h>
-#include <linux/inet_lro.h>
 #include "t3cdev.h"
 #include <asm/io.h>
 
@@ -50,13 +49,17 @@ struct vlan_group;
 struct adapter;
 struct sge_qset;
 
+enum {                 /* rx_offload flags */
+       T3_RX_CSUM      = 1 << 0,
+       T3_LRO          = 1 << 1,
+};
+
 struct port_info {
        struct adapter *adapter;
        struct vlan_group *vlan_grp;
        struct sge_qset *qs;
-       const struct port_type_info *port_type;
        u8 port_id;
-       u8 rx_csum_offload;
+       u8 rx_offload;
        u8 nqsets;
        u8 first_qset;
        struct cphy phy;
@@ -64,6 +67,9 @@ struct port_info {
        struct link_config link_config;
        struct net_device_stats netstats;
        int activity;
+       __be32 iscsi_ipv4addr;
+
+       int link_fault; /* link fault was detected */
 };
 
 enum {                         /* adapter flags */
@@ -79,6 +85,8 @@ struct fl_pg_chunk {
        struct page *page;
        void *va;
        unsigned int offset;
+       unsigned long *p_cnt;
+       dma_addr_t mapping;
 };
 
 struct rx_desc;
@@ -87,6 +95,7 @@ struct rx_sw_desc;
 struct sge_fl {                     /* SGE per free-buffer list state */
        unsigned int buf_size;      /* size of each Rx buffer */
        unsigned int credits;       /* # of available Rx buffers */
+       unsigned int pend_cred;     /* new buffers since last FL DB ring */
        unsigned int size;          /* capacity of free list */
        unsigned int cidx;          /* consumer index */
        unsigned int pidx;          /* producer index */
@@ -94,6 +103,7 @@ struct sge_fl {                     /* SGE per free-buffer list state */
        struct fl_pg_chunk pg_chunk;/* page chunk cache */
        unsigned int use_pages;     /* whether FL uses pages or sk_buffs */
        unsigned int order;         /* order of page allocations */
+       unsigned int alloc_size;    /* size of allocated buffer */
        struct rx_desc *desc;       /* address of HW Rx descriptor ring */
        struct rx_sw_desc *sdesc;   /* address of SW Rx descriptor ring */
        dma_addr_t   phys_addr;     /* physical address of HW ring start */
@@ -173,15 +183,11 @@ enum {                            /* per port SGE statistics */
        SGE_PSTAT_TX_CSUM,      /* # of TX checksum offloads */
        SGE_PSTAT_VLANEX,       /* # of VLAN tag extractions */
        SGE_PSTAT_VLANINS,      /* # of VLAN tag insertions */
-       SGE_PSTAT_LRO_AGGR,     /* # of page chunks added to LRO sessions */
-       SGE_PSTAT_LRO_FLUSHED,  /* # of flushed LRO sessions */
-       SGE_PSTAT_LRO_NO_DESC,  /* # of overflown LRO sessions */
 
        SGE_PSTAT_MAX           /* must be last */
 };
 
-#define T3_MAX_LRO_SES 8
-#define T3_MAX_LRO_MAX_PKTS 64
+struct napi_gro_fraginfo;
 
 struct sge_qset {              /* an SGE queue set */
        struct adapter *adap;
@@ -189,16 +195,14 @@ struct sge_qset {         /* an SGE queue set */
        struct sge_rspq rspq;
        struct sge_fl fl[SGE_RXQ_PER_SET];
        struct sge_txq txq[SGE_TXQ_PER_SET];
-       struct net_lro_mgr lro_mgr;
-       struct net_lro_desc lro_desc[T3_MAX_LRO_SES];
-       struct skb_frag_struct *lro_frag_tbl;
-       int lro_nfrags;
+       int nomem;
        int lro_enabled;
-       int lro_frag_len;
        void *lro_va;
        struct net_device *netdev;
+       struct netdev_queue *tx_q;      /* associated netdev TX queue */
        unsigned long txq_stopped;      /* which Tx queues are stopped */
        struct timer_list tx_reclaim_timer;     /* reclaims TX buffers */
+       struct timer_list rx_reclaim_timer;     /* reclaims RX buffers */
        unsigned long port_stats[SGE_PSTAT_MAX];
 } ____cacheline_aligned;
 
@@ -224,6 +228,7 @@ struct adapter {
        unsigned int slow_intr_mask;
        unsigned long irq_stats[IRQ_NUM_STATS];
 
+       int msix_nvectors;
        struct {
                unsigned short vec;
                char desc[22];
@@ -240,12 +245,16 @@ struct adapter {
        unsigned int check_task_cnt;
        struct delayed_work adap_check_task;
        struct work_struct ext_intr_handler_task;
+       struct work_struct fatal_error_handler_task;
+       struct work_struct link_fault_handler_task;
 
        struct dentry *debugfs_root;
 
        struct mutex mdio_lock;
        spinlock_t stats_lock;
        spinlock_t work_lock;
+
+       struct sk_buff *nofail_skb;
 };
 
 static inline u32 t3_read_reg(struct adapter *adapter, u32 reg_addr)
@@ -267,6 +276,14 @@ static inline struct port_info *adap2pinfo(struct adapter *adap, int idx)
        return netdev_priv(adap->port[idx]);
 }
 
+static inline int phy2portid(struct cphy *phy)
+{
+       struct adapter *adap = phy->adapter;
+       struct port_info *port0 = adap2pinfo(adap, 0);
+
+       return &port0->phy == phy ? 0 : 1;
+}
+
 #define OFFLOAD_DEVMAP_BIT 15
 
 #define tdev2adap(d) container_of(d, struct adapter, tdev)
@@ -281,9 +298,13 @@ int t3_offload_tx(struct t3cdev *tdev, struct sk_buff *skb);
 void t3_os_ext_intr_handler(struct adapter *adapter);
 void t3_os_link_changed(struct adapter *adapter, int port_id, int link_status,
                        int speed, int duplex, int fc);
+void t3_os_phymod_changed(struct adapter *adap, int port_id);
+void t3_os_link_fault(struct adapter *adapter, int port_id, int state);
+void t3_os_link_fault_handler(struct adapter *adapter, int port_id);
 
 void t3_sge_start(struct adapter *adap);
 void t3_sge_stop(struct adapter *adap);
+void t3_start_sge_timers(struct adapter *adap);
 void t3_stop_sge_timers(struct adapter *adap);
 void t3_free_sge_resources(struct adapter *adap);
 void t3_sge_err_intr_handler(struct adapter *adapter);
@@ -293,9 +314,12 @@ int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb);
 void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p);
 int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
                      int irq_vec_idx, const struct qset_params *p,
-                     int ntxq, struct net_device *dev);
+                     int ntxq, struct net_device *dev,
+                     struct netdev_queue *netdevq);
 int t3_get_desc(const struct sge_qset *qs, unsigned int qnum, unsigned int idx,
                unsigned char *data);
 irqreturn_t t3_sge_intr_msix(int irq, void *cookie);
 
+int t3_get_edc_fw(struct cphy *phy, int edc_idx, int size);
+
 #endif                         /* __T3_ADAPTER_H__ */