iw_cxgb.h (225736) | iw_cxgb.h (237920) |
---|---|
1/************************************************************************** 2 3Copyright (c) 2007, 2008 Chelsio Inc. 4All rights reserved. 5 6Redistribution and use in source and binary forms, with or without 7modification, are permitted provided that the following conditions are met: 8 --- 11 unchanged lines hidden (view full) --- 20LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26POSSIBILITY OF SUCH DAMAGE. 27 | 1/************************************************************************** 2 3Copyright (c) 2007, 2008 Chelsio Inc. 4All rights reserved. 5 6Redistribution and use in source and binary forms, with or without 7modification, are permitted provided that the following conditions are met: 8 --- 11 unchanged lines hidden (view full) --- 20LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26POSSIBILITY OF SUCH DAMAGE. 27 |
28$FreeBSD: stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.h 178786 2008-05-05 18:46:18Z kmacy $ | 28$FreeBSD: stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.h 237920 2012-07-01 12:00:36Z np $ |
29 30***************************************************************************/ 31 32#ifndef __IWCH_H__ 33#define __IWCH_H__ 34 35struct iwch_pd; 36struct iwch_cq; 37struct iwch_qp; 38struct iwch_mr; 39 | 29 30***************************************************************************/ 31 32#ifndef __IWCH_H__ 33#define __IWCH_H__ 34 35struct iwch_pd; 36struct iwch_cq; 37struct iwch_qp; 38struct iwch_mr; 39 |
40enum t3ctype { 41 T3A = 0, 42 T3B, 43 T3C 44}; |
|
40 | 45 |
46#define PAGE_MASK_IWARP (~(PAGE_SIZE-1)) 47 |
|
41struct iwch_rnic_attributes { 42 u32 vendor_id; 43 u32 vendor_part_id; 44 u32 max_qps; 45 u32 max_wrs; /* Max for any SQ/RQ */ 46 u32 max_sge_per_wr; 47 u32 max_sge_per_rdma_write_wr; /* for RDMA Write WR */ 48 u32 max_cqs; 49 u32 max_cqes_per_cq; 50 u32 max_mem_regs; 51 u32 max_phys_buf_entries; /* for phys buf list */ 52 u32 max_pds; 53 54 /* 55 * The memory page sizes supported by this RNIC. 56 * Bit position i in bitmap indicates page of 57 * size (4k)^i. Phys block list mode unsupported. 58 */ 59 u32 mem_pgsizes_bitmask; | 48struct iwch_rnic_attributes { 49 u32 vendor_id; 50 u32 vendor_part_id; 51 u32 max_qps; 52 u32 max_wrs; /* Max for any SQ/RQ */ 53 u32 max_sge_per_wr; 54 u32 max_sge_per_rdma_write_wr; /* for RDMA Write WR */ 55 u32 max_cqs; 56 u32 max_cqes_per_cq; 57 u32 max_mem_regs; 58 u32 max_phys_buf_entries; /* for phys buf list */ 59 u32 max_pds; 60 61 /* 62 * The memory page sizes supported by this RNIC. 63 * Bit position i in bitmap indicates page of 64 * size (4k)^i. Phys block list mode unsupported. 65 */ 66 u32 mem_pgsizes_bitmask; |
67 u64 max_mr_size; |
|
60 u8 can_resize_wq; 61 62 /* 63 * The maximum number of RDMA Reads that can be outstanding 64 * per QP with this RNIC as the target. 65 */ 66 u32 max_rdma_reads_per_qp; 67 --- 24 unchanged lines hidden (view full) --- 92 u32 cq_overflow_detection; 93}; 94 95struct iwch_dev { 96 struct ib_device ibdev; 97 struct cxio_rdev rdev; 98 u32 device_cap_flags; 99 struct iwch_rnic_attributes attr; | 68 u8 can_resize_wq; 69 70 /* 71 * The maximum number of RDMA Reads that can be outstanding 72 * per QP with this RNIC as the target. 73 */ 74 u32 max_rdma_reads_per_qp; 75 --- 24 unchanged lines hidden (view full) --- 100 u32 cq_overflow_detection; 101}; 102 103struct iwch_dev { 104 struct ib_device ibdev; 105 struct cxio_rdev rdev; 106 u32 device_cap_flags; 107 struct iwch_rnic_attributes attr; |
100 struct kvl cqidr; 101 struct kvl qpidr; 102 struct kvl mmidr; | 108 struct idr cqidr; 109 struct idr qpidr; 110 struct idr mmidr; |
103 struct mtx lock; 104 TAILQ_ENTRY(iwch_dev) entry; 105}; 106 107#ifndef container_of 108#define container_of(p, stype, field) ((stype *)(((uint8_t *)(p)) - offsetof(stype, field))) 109#endif 110 111static inline struct iwch_dev *to_iwch_dev(struct ib_device *ibdev) 112{ 113 return container_of(ibdev, struct iwch_dev, ibdev); 114} 115 | 111 struct mtx lock; 112 TAILQ_ENTRY(iwch_dev) entry; 113}; 114 115#ifndef container_of 116#define container_of(p, stype, field) ((stype *)(((uint8_t *)(p)) - offsetof(stype, field))) 117#endif 118 119static inline struct iwch_dev *to_iwch_dev(struct ib_device *ibdev) 120{ 121 return container_of(ibdev, struct iwch_dev, ibdev); 122} 123 |
116static inline int t3b_device(const struct iwch_dev *rhp) | 124static inline int t3b_device(const struct iwch_dev *rhp __unused) |
117{ | 125{ |
118 return rhp->rdev.t3cdev_p->type == T3B; | 126 return (0); |
119} 120 | 127} 128 |
121static inline int t3a_device(const struct iwch_dev *rhp) | 129static inline int t3a_device(const struct iwch_dev *rhp __unused) |
122{ | 130{ |
123 return rhp->rdev.t3cdev_p->type == T3A; | 131 return (0); |
124} 125 126static inline struct iwch_cq *get_chp(struct iwch_dev *rhp, u32 cqid) 127{ | 132} 133 134static inline struct iwch_cq *get_chp(struct iwch_dev *rhp, u32 cqid) 135{ |
128 return kvl_lookup(&rhp->cqidr, cqid); | 136 return idr_find(&rhp->cqidr, cqid); |
129} 130 131static inline struct iwch_qp *get_qhp(struct iwch_dev *rhp, u32 qpid) 132{ | 137} 138 139static inline struct iwch_qp *get_qhp(struct iwch_dev *rhp, u32 qpid) 140{ |
133 return kvl_lookup(&rhp->qpidr, qpid); | 141 return idr_find(&rhp->qpidr, qpid); |
134} 135 136static inline struct iwch_mr *get_mhp(struct iwch_dev *rhp, u32 mmid) 137{ | 142} 143 144static inline struct iwch_mr *get_mhp(struct iwch_dev *rhp, u32 mmid) 145{ |
138 return kvl_lookup(&rhp->mmidr, mmid); | 146 return idr_find(&rhp->mmidr, mmid); |
139} 140 | 147} 148 |
141static inline int insert_handle(struct iwch_dev *rhp, struct kvl *kvlp, | 149static inline int insert_handle(struct iwch_dev *rhp, struct idr *idr, |
142 void *handle, u32 id) 143{ 144 int ret; 145 u32 newid; 146 147 do { | 150 void *handle, u32 id) 151{ 152 int ret; 153 u32 newid; 154 155 do { |
156 if (!idr_pre_get(idr, GFP_KERNEL)) { 157 return -ENOMEM; 158 } |
|
148 mtx_lock(&rhp->lock); | 159 mtx_lock(&rhp->lock); |
149 ret = kvl_alloc_above(kvlp, handle, id, &newid); | 160 ret = idr_get_new_above(idr, handle, id, &newid); |
150 WARN_ON(ret != 0); 151 WARN_ON(!ret && newid != id); 152 mtx_unlock(&rhp->lock); 153 } while (ret == -EAGAIN); 154 155 return ret; 156} 157 | 161 WARN_ON(ret != 0); 162 WARN_ON(!ret && newid != id); 163 mtx_unlock(&rhp->lock); 164 } while (ret == -EAGAIN); 165 166 return ret; 167} 168 |
158static inline void remove_handle(struct iwch_dev *rhp, struct kvl *kvlp, u32 id) | 169static inline void remove_handle(struct iwch_dev *rhp, struct idr *idr, u32 id) |
159{ 160 mtx_lock(&rhp->lock); | 170{ 171 mtx_lock(&rhp->lock); |
161 kvl_delete(kvlp, id); | 172 idr_remove(idr, id); |
162 mtx_unlock(&rhp->lock); 163} 164 | 173 mtx_unlock(&rhp->lock); 174} 175 |
165extern struct cxgb_client t3c_client; 166extern cxgb_cpl_handler_func t3c_handlers[NUM_CPL_CMDS]; 167extern void iwch_ev_dispatch(struct cxio_rdev *rdev_p, struct mbuf *m); | 176void iwch_ev_dispatch(struct iwch_dev *, struct mbuf *); |
168#endif | 177#endif |