qlge: Get rid of split addresses in hardware control blocks.
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / net / qlge / qlge.h
index 459663a4023daaa24cbb5c30ff402d59e919890a..969700232265501357e21fbd72b29d7149c446fc 100644 (file)
@@ -961,8 +961,7 @@ struct ib_mac_iocb_rsp {
 #define IB_MAC_IOCB_RSP_DS     0x40    /* data is in small buffer */
 #define IB_MAC_IOCB_RSP_DL     0x80    /* data is in large buffer */
        __le32 data_len;        /* */
-       __le32 data_addr_lo;    /* */
-       __le32 data_addr_hi;    /* */
+       __le64 data_addr;       /* */
        __le32 rss;             /* */
        __le16 vlan_id;         /* 12 bits */
 #define IB_MAC_IOCB_RSP_C      0x1000  /* VLAN CFI bit */
@@ -976,8 +975,7 @@ struct ib_mac_iocb_rsp {
 #define IB_MAC_IOCB_RSP_HS     0x40
 #define IB_MAC_IOCB_RSP_HL     0x80
        __le32 hdr_len;         /* */
-       __le32 hdr_addr_lo;     /* */
-       __le32 hdr_addr_hi;     /* */
+       __le64 hdr_addr;        /* */
 } __attribute((packed));
 
 struct ib_ae_iocb_rsp {
@@ -1042,10 +1040,8 @@ struct wqicb {
        __le16 cq_id_rss;
 #define Q_CQ_ID_RSS_RV 0x8000
        __le16 rid;
-       __le32 addr_lo;
-       __le32 addr_hi;
-       __le32 cnsmr_idx_addr_lo;
-       __le32 cnsmr_idx_addr_hi;
+       __le64 addr;
+       __le64 cnsmr_idx_addr;
 } __attribute((packed));
 
 /*
@@ -1070,18 +1066,14 @@ struct cqicb {
 #define LEN_CPP_64     0x0002
 #define LEN_CPP_128    0x0003
        __le16 rid;
-       __le32 addr_lo;
-       __le32 addr_hi;
-       __le32 prod_idx_addr_lo;
-       __le32 prod_idx_addr_hi;
+       __le64 addr;
+       __le64 prod_idx_addr;
        __le16 pkt_delay;
        __le16 irq_delay;
-       __le32 lbq_addr_lo;
-       __le32 lbq_addr_hi;
+       __le64 lbq_addr;
        __le16 lbq_buf_size;
        __le16 lbq_len;         /* entry count */
-       __le32 sbq_addr_lo;
-       __le32 sbq_addr_hi;
+       __le64 sbq_addr;
        __le16 sbq_buf_size;
        __le16 sbq_len;         /* entry count */
 } __attribute((packed));
@@ -1145,7 +1137,7 @@ struct tx_ring {
        struct wqicb wqicb;     /* structure used to inform chip of new queue */
        void *wq_base;          /* pci_alloc:virtual addr for tx */
        dma_addr_t wq_base_dma; /* pci_alloc:dma addr for tx */
-       u32 *cnsmr_idx_sh_reg;  /* shadow copy of consumer idx */
+       __le32 *cnsmr_idx_sh_reg;       /* shadow copy of consumer idx */
        dma_addr_t cnsmr_idx_sh_reg_dma;        /* dma-shadow copy of consumer */
        u32 wq_size;            /* size in bytes of queue area */
        u32 wq_len;             /* number of entries in queue */
@@ -1181,7 +1173,7 @@ struct rx_ring {
        u32 cq_size;
        u32 cq_len;
        u16 cq_id;
-       volatile __le32 *prod_idx_sh_reg;       /* Shadowed producer register. */
+       __le32 *prod_idx_sh_reg;        /* Shadowed producer register. */
        dma_addr_t prod_idx_sh_reg_dma;
        void __iomem *cnsmr_idx_db_reg; /* PCI doorbell mem area + 0 */
        u32 cnsmr_idx;          /* current sw idx */
@@ -1459,6 +1451,24 @@ static inline void ql_write_db_reg(u32 val, void __iomem *addr)
        mmiowb();
 }
 
+/*
+ * Shadow Registers:
+ * Outbound queues have a consumer index that is maintained by the chip.
+ * Inbound queues have a producer index that is maintained by the chip.
+ * For lower overhead, these registers are "shadowed" to host memory
+ * which allows the device driver to track the queue progress without
+ * PCI reads. When an entry is placed on an inbound queue, the chip will
+ * update the relevant index register and then copy the value to the
+ * shadow register in host memory.
+ */
+static inline u32 ql_read_sh_reg(__le32  *addr)
+{
+       u32 reg;
+       reg =  le32_to_cpu(*addr);
+       rmb();
+       return reg;
+}
+
 extern char qlge_driver_name[];
 extern const char qlge_driver_version[];
 extern const struct ethtool_ops qlge_ethtool_ops;