Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 1 | #ifndef _RDS_IB_H |
| 2 | #define _RDS_IB_H |
| 3 | |
| 4 | #include <rdma/ib_verbs.h> |
| 5 | #include <rdma/rdma_cm.h> |
Andy Grover | e4c52c9 | 2010-04-23 10:49:53 -0700 | [diff] [blame] | 6 | #include <linux/pci.h> |
| 7 | #include <linux/slab.h> |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 8 | #include "rds.h" |
| 9 | #include "rdma_transport.h" |
| 10 | |
| 11 | #define RDS_FMR_SIZE 256 |
Chris Mason | eabb732 | 2010-06-11 11:18:57 -0700 | [diff] [blame] | 12 | #define RDS_FMR_POOL_SIZE 8192 |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 13 | |
| 14 | #define RDS_IB_MAX_SGE 8 |
| 15 | #define RDS_IB_RECV_SGE 2 |
| 16 | |
| 17 | #define RDS_IB_DEFAULT_RECV_WR 1024 |
| 18 | #define RDS_IB_DEFAULT_SEND_WR 256 |
| 19 | |
Andy Grover | 3ba23ad | 2009-07-17 13:13:22 +0000 | [diff] [blame] | 20 | #define RDS_IB_DEFAULT_RETRY_COUNT 2 |
| 21 | |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 22 | #define RDS_IB_SUPPORTED_PROTOCOLS 0x00000003 /* minor versions supported */ |
| 23 | |
Chris Mason | 3324412 | 2010-05-26 22:05:37 -0700 | [diff] [blame] | 24 | #define RDS_IB_RECYCLE_BATCH_COUNT 32 |
| 25 | |
Zach Brown | ea81986 | 2010-07-15 12:34:33 -0700 | [diff] [blame] | 26 | extern struct rw_semaphore rds_ib_devices_lock; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 27 | extern struct list_head rds_ib_devices; |
| 28 | |
| 29 | /* |
| 30 | * IB posts RDS_FRAG_SIZE fragments of pages to the receive queues to |
| 31 | * try and minimize the amount of memory tied up both the device and |
| 32 | * socket receive queues. |
| 33 | */ |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 34 | struct rds_page_frag { |
| 35 | struct list_head f_item; |
Chris Mason | 3324412 | 2010-05-26 22:05:37 -0700 | [diff] [blame] | 36 | struct list_head f_cache_entry; |
Andy Grover | 0b088e0 | 2010-05-24 20:12:41 -0700 | [diff] [blame] | 37 | struct scatterlist f_sg; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | struct rds_ib_incoming { |
| 41 | struct list_head ii_frags; |
Chris Mason | 3324412 | 2010-05-26 22:05:37 -0700 | [diff] [blame] | 42 | struct list_head ii_cache_entry; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 43 | struct rds_incoming ii_inc; |
| 44 | }; |
| 45 | |
Chris Mason | 3324412 | 2010-05-26 22:05:37 -0700 | [diff] [blame] | 46 | struct rds_ib_cache_head { |
| 47 | struct list_head *first; |
| 48 | unsigned long count; |
| 49 | }; |
| 50 | |
| 51 | struct rds_ib_refill_cache { |
| 52 | struct rds_ib_cache_head *percpu; |
| 53 | struct list_head *xfer; |
| 54 | struct list_head *ready; |
| 55 | }; |
| 56 | |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 57 | struct rds_ib_connect_private { |
| 58 | /* Add new fields at the end, and don't permute existing fields. */ |
| 59 | __be32 dp_saddr; |
| 60 | __be32 dp_daddr; |
| 61 | u8 dp_protocol_major; |
| 62 | u8 dp_protocol_minor; |
| 63 | __be16 dp_protocol_minor_mask; /* bitmask */ |
| 64 | __be32 dp_reserved1; |
| 65 | __be64 dp_ack_seq; |
| 66 | __be32 dp_credit; /* non-zero enables flow ctl */ |
| 67 | }; |
| 68 | |
| 69 | struct rds_ib_send_work { |
Andy Grover | ff3d7d3 | 2010-03-01 14:03:09 -0800 | [diff] [blame] | 70 | void *s_op; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 71 | struct ib_send_wr s_wr; |
| 72 | struct ib_sge s_sge[RDS_IB_MAX_SGE]; |
| 73 | unsigned long s_queued; |
| 74 | }; |
| 75 | |
| 76 | struct rds_ib_recv_work { |
| 77 | struct rds_ib_incoming *r_ibinc; |
| 78 | struct rds_page_frag *r_frag; |
| 79 | struct ib_recv_wr r_wr; |
| 80 | struct ib_sge r_sge[2]; |
| 81 | }; |
| 82 | |
| 83 | struct rds_ib_work_ring { |
| 84 | u32 w_nr; |
| 85 | u32 w_alloc_ptr; |
| 86 | u32 w_alloc_ctr; |
| 87 | u32 w_free_ptr; |
| 88 | atomic_t w_free_ctr; |
| 89 | }; |
| 90 | |
| 91 | struct rds_ib_device; |
| 92 | |
| 93 | struct rds_ib_connection { |
| 94 | |
| 95 | struct list_head ib_node; |
| 96 | struct rds_ib_device *rds_ibdev; |
| 97 | struct rds_connection *conn; |
| 98 | |
| 99 | /* alphabet soup, IBTA style */ |
| 100 | struct rdma_cm_id *i_cm_id; |
| 101 | struct ib_pd *i_pd; |
| 102 | struct ib_mr *i_mr; |
| 103 | struct ib_cq *i_send_cq; |
| 104 | struct ib_cq *i_recv_cq; |
| 105 | |
| 106 | /* tx */ |
| 107 | struct rds_ib_work_ring i_send_ring; |
Andy Grover | ff3d7d3 | 2010-03-01 14:03:09 -0800 | [diff] [blame] | 108 | struct rm_data_op *i_data_op; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 109 | struct rds_header *i_send_hdrs; |
| 110 | u64 i_send_hdrs_dma; |
| 111 | struct rds_ib_send_work *i_sends; |
Zach Brown | f046011 | 2010-07-14 13:55:35 -0700 | [diff] [blame] | 112 | atomic_t i_signaled_sends; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 113 | |
| 114 | /* rx */ |
Andy Grover | d521b63 | 2009-10-30 08:51:57 +0000 | [diff] [blame] | 115 | struct tasklet_struct i_recv_tasklet; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 116 | struct mutex i_recv_mutex; |
| 117 | struct rds_ib_work_ring i_recv_ring; |
| 118 | struct rds_ib_incoming *i_ibinc; |
| 119 | u32 i_recv_data_rem; |
| 120 | struct rds_header *i_recv_hdrs; |
| 121 | u64 i_recv_hdrs_dma; |
| 122 | struct rds_ib_recv_work *i_recvs; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 123 | u64 i_ack_recv; /* last ACK received */ |
Chris Mason | 3324412 | 2010-05-26 22:05:37 -0700 | [diff] [blame] | 124 | struct rds_ib_refill_cache i_cache_incs; |
| 125 | struct rds_ib_refill_cache i_cache_frags; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 126 | |
| 127 | /* sending acks */ |
| 128 | unsigned long i_ack_flags; |
Andy Grover | 8cbd960 | 2009-04-01 08:20:20 +0000 | [diff] [blame] | 129 | #ifdef KERNEL_HAS_ATOMIC64 |
| 130 | atomic64_t i_ack_next; /* next ACK to send */ |
| 131 | #else |
| 132 | spinlock_t i_ack_lock; /* protect i_ack_next */ |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 133 | u64 i_ack_next; /* next ACK to send */ |
Andy Grover | 8cbd960 | 2009-04-01 08:20:20 +0000 | [diff] [blame] | 134 | #endif |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 135 | struct rds_header *i_ack; |
| 136 | struct ib_send_wr i_ack_wr; |
| 137 | struct ib_sge i_ack_sge; |
| 138 | u64 i_ack_dma; |
| 139 | unsigned long i_ack_queued; |
| 140 | |
| 141 | /* Flow control related information |
| 142 | * |
| 143 | * Our algorithm uses a pair variables that we need to access |
| 144 | * atomically - one for the send credits, and one posted |
| 145 | * recv credits we need to transfer to remote. |
| 146 | * Rather than protect them using a slow spinlock, we put both into |
| 147 | * a single atomic_t and update it using cmpxchg |
| 148 | */ |
| 149 | atomic_t i_credits; |
| 150 | |
| 151 | /* Protocol version specific information */ |
| 152 | unsigned int i_flowctl:1; /* enable/disable flow ctl */ |
| 153 | |
| 154 | /* Batched completions */ |
| 155 | unsigned int i_unsignaled_wrs; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 156 | }; |
| 157 | |
| 158 | /* This assumes that atomic_t is at least 32 bits */ |
| 159 | #define IB_GET_SEND_CREDITS(v) ((v) & 0xffff) |
| 160 | #define IB_GET_POST_CREDITS(v) ((v) >> 16) |
| 161 | #define IB_SET_SEND_CREDITS(v) ((v) & 0xffff) |
| 162 | #define IB_SET_POST_CREDITS(v) ((v) << 16) |
| 163 | |
| 164 | struct rds_ib_ipaddr { |
| 165 | struct list_head list; |
| 166 | __be32 ipaddr; |
| 167 | }; |
| 168 | |
| 169 | struct rds_ib_device { |
| 170 | struct list_head list; |
| 171 | struct list_head ipaddr_list; |
| 172 | struct list_head conn_list; |
| 173 | struct ib_device *dev; |
| 174 | struct ib_pd *pd; |
| 175 | struct ib_mr *mr; |
| 176 | struct rds_ib_mr_pool *mr_pool; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 177 | unsigned int fmr_max_remaps; |
| 178 | unsigned int max_fmrs; |
| 179 | int max_sge; |
| 180 | unsigned int max_wrs; |
Andy Grover | 40589e7 | 2010-01-12 10:50:48 -0800 | [diff] [blame] | 181 | unsigned int max_initiator_depth; |
| 182 | unsigned int max_responder_resources; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 183 | spinlock_t spinlock; /* protect the above */ |
Zach Brown | 3e0249f | 2010-05-18 15:48:51 -0700 | [diff] [blame] | 184 | atomic_t refcount; |
| 185 | struct work_struct free_work; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 186 | }; |
| 187 | |
Andy Grover | e4c52c9 | 2010-04-23 10:49:53 -0700 | [diff] [blame] | 188 | #define pcidev_to_node(pcidev) pcibus_to_node(pcidev->bus) |
| 189 | #define ibdev_to_node(ibdev) pcidev_to_node(to_pci_dev(ibdev->dma_device)) |
| 190 | #define rdsibdev_to_node(rdsibdev) ibdev_to_node(rdsibdev->dev) |
| 191 | |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 192 | /* bits for i_ack_flags */ |
| 193 | #define IB_ACK_IN_FLIGHT 0 |
| 194 | #define IB_ACK_REQUESTED 1 |
| 195 | |
| 196 | /* Magic WR_ID for ACKs */ |
| 197 | #define RDS_IB_ACK_WR_ID (~(u64) 0) |
| 198 | |
| 199 | struct rds_ib_statistics { |
| 200 | uint64_t s_ib_connect_raced; |
| 201 | uint64_t s_ib_listen_closed_stale; |
| 202 | uint64_t s_ib_tx_cq_call; |
| 203 | uint64_t s_ib_tx_cq_event; |
| 204 | uint64_t s_ib_tx_ring_full; |
| 205 | uint64_t s_ib_tx_throttle; |
| 206 | uint64_t s_ib_tx_sg_mapping_failure; |
| 207 | uint64_t s_ib_tx_stalled; |
| 208 | uint64_t s_ib_tx_credit_updates; |
| 209 | uint64_t s_ib_rx_cq_call; |
| 210 | uint64_t s_ib_rx_cq_event; |
| 211 | uint64_t s_ib_rx_ring_empty; |
| 212 | uint64_t s_ib_rx_refill_from_cq; |
| 213 | uint64_t s_ib_rx_refill_from_thread; |
| 214 | uint64_t s_ib_rx_alloc_limit; |
| 215 | uint64_t s_ib_rx_credit_updates; |
| 216 | uint64_t s_ib_ack_sent; |
| 217 | uint64_t s_ib_ack_send_failure; |
| 218 | uint64_t s_ib_ack_send_delayed; |
| 219 | uint64_t s_ib_ack_send_piggybacked; |
| 220 | uint64_t s_ib_ack_received; |
| 221 | uint64_t s_ib_rdma_mr_alloc; |
| 222 | uint64_t s_ib_rdma_mr_free; |
| 223 | uint64_t s_ib_rdma_mr_used; |
| 224 | uint64_t s_ib_rdma_mr_pool_flush; |
| 225 | uint64_t s_ib_rdma_mr_pool_wait; |
| 226 | uint64_t s_ib_rdma_mr_pool_depleted; |
Andy Grover | 51e2cba | 2010-03-29 17:47:30 -0700 | [diff] [blame] | 227 | uint64_t s_ib_atomic_cswp; |
| 228 | uint64_t s_ib_atomic_fadd; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 229 | }; |
| 230 | |
| 231 | extern struct workqueue_struct *rds_ib_wq; |
| 232 | |
| 233 | /* |
| 234 | * Fake ib_dma_sync_sg_for_{cpu,device} as long as ib_verbs.h |
| 235 | * doesn't define it. |
| 236 | */ |
| 237 | static inline void rds_ib_dma_sync_sg_for_cpu(struct ib_device *dev, |
| 238 | struct scatterlist *sg, unsigned int sg_dma_len, int direction) |
| 239 | { |
| 240 | unsigned int i; |
| 241 | |
| 242 | for (i = 0; i < sg_dma_len; ++i) { |
| 243 | ib_dma_sync_single_for_cpu(dev, |
| 244 | ib_sg_dma_address(dev, &sg[i]), |
| 245 | ib_sg_dma_len(dev, &sg[i]), |
| 246 | direction); |
| 247 | } |
| 248 | } |
| 249 | #define ib_dma_sync_sg_for_cpu rds_ib_dma_sync_sg_for_cpu |
| 250 | |
| 251 | static inline void rds_ib_dma_sync_sg_for_device(struct ib_device *dev, |
| 252 | struct scatterlist *sg, unsigned int sg_dma_len, int direction) |
| 253 | { |
| 254 | unsigned int i; |
| 255 | |
| 256 | for (i = 0; i < sg_dma_len; ++i) { |
| 257 | ib_dma_sync_single_for_device(dev, |
| 258 | ib_sg_dma_address(dev, &sg[i]), |
| 259 | ib_sg_dma_len(dev, &sg[i]), |
| 260 | direction); |
| 261 | } |
| 262 | } |
| 263 | #define ib_dma_sync_sg_for_device rds_ib_dma_sync_sg_for_device |
| 264 | |
| 265 | |
| 266 | /* ib.c */ |
| 267 | extern struct rds_transport rds_ib_transport; |
Zach Brown | 3e0249f | 2010-05-18 15:48:51 -0700 | [diff] [blame] | 268 | struct rds_ib_device *rds_ib_get_client_data(struct ib_device *device); |
| 269 | void rds_ib_dev_put(struct rds_ib_device *rds_ibdev); |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 270 | extern struct ib_client rds_ib_client; |
| 271 | |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 272 | extern unsigned int fmr_message_size; |
Andy Grover | 3ba23ad | 2009-07-17 13:13:22 +0000 | [diff] [blame] | 273 | extern unsigned int rds_ib_retry_count; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 274 | |
| 275 | extern spinlock_t ib_nodev_conns_lock; |
| 276 | extern struct list_head ib_nodev_conns; |
| 277 | |
| 278 | /* ib_cm.c */ |
| 279 | int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp); |
| 280 | void rds_ib_conn_free(void *arg); |
| 281 | int rds_ib_conn_connect(struct rds_connection *conn); |
| 282 | void rds_ib_conn_shutdown(struct rds_connection *conn); |
| 283 | void rds_ib_state_change(struct sock *sk); |
Zach Brown | ef87b7e | 2010-07-09 12:26:20 -0700 | [diff] [blame] | 284 | int rds_ib_listen_init(void); |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 285 | void rds_ib_listen_stop(void); |
| 286 | void __rds_ib_conn_error(struct rds_connection *conn, const char *, ...); |
| 287 | int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id, |
| 288 | struct rdma_cm_event *event); |
| 289 | int rds_ib_cm_initiate_connect(struct rdma_cm_id *cm_id); |
| 290 | void rds_ib_cm_connect_complete(struct rds_connection *conn, |
| 291 | struct rdma_cm_event *event); |
| 292 | |
| 293 | |
| 294 | #define rds_ib_conn_error(conn, fmt...) \ |
| 295 | __rds_ib_conn_error(conn, KERN_WARNING "RDS/IB: " fmt) |
| 296 | |
| 297 | /* ib_rdma.c */ |
| 298 | int rds_ib_update_ipaddr(struct rds_ib_device *rds_ibdev, __be32 ipaddr); |
Andy Grover | 745cbcc | 2009-04-01 08:20:19 +0000 | [diff] [blame] | 299 | void rds_ib_add_conn(struct rds_ib_device *rds_ibdev, struct rds_connection *conn); |
| 300 | void rds_ib_remove_conn(struct rds_ib_device *rds_ibdev, struct rds_connection *conn); |
Zach Brown | 8aeb1ba | 2010-06-25 14:58:16 -0700 | [diff] [blame] | 301 | void rds_ib_destroy_nodev_conns(void); |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 302 | struct rds_ib_mr_pool *rds_ib_create_mr_pool(struct rds_ib_device *); |
| 303 | void rds_ib_get_mr_info(struct rds_ib_device *rds_ibdev, struct rds_info_rdma_connection *iinfo); |
| 304 | void rds_ib_destroy_mr_pool(struct rds_ib_mr_pool *); |
| 305 | void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents, |
| 306 | struct rds_sock *rs, u32 *key_ret); |
| 307 | void rds_ib_sync_mr(void *trans_private, int dir); |
| 308 | void rds_ib_free_mr(void *trans_private, int invalidate); |
| 309 | void rds_ib_flush_mrs(void); |
Zach Brown | ef87b7e | 2010-07-09 12:26:20 -0700 | [diff] [blame] | 310 | int rds_ib_fmr_init(void); |
| 311 | void rds_ib_fmr_exit(void); |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 312 | |
| 313 | /* ib_recv.c */ |
Zach Brown | ef87b7e | 2010-07-09 12:26:20 -0700 | [diff] [blame] | 314 | int rds_ib_recv_init(void); |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 315 | void rds_ib_recv_exit(void); |
| 316 | int rds_ib_recv(struct rds_connection *conn); |
Chris Mason | 3324412 | 2010-05-26 22:05:37 -0700 | [diff] [blame] | 317 | int rds_ib_recv_alloc_caches(struct rds_ib_connection *ic); |
| 318 | void rds_ib_recv_free_caches(struct rds_ib_connection *ic); |
Andy Grover | b6fb0df | 2010-06-23 18:06:30 -0700 | [diff] [blame] | 319 | void rds_ib_recv_refill(struct rds_connection *conn, int prefill); |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 320 | void rds_ib_inc_free(struct rds_incoming *inc); |
| 321 | int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iovec *iov, |
| 322 | size_t size); |
| 323 | void rds_ib_recv_cq_comp_handler(struct ib_cq *cq, void *context); |
Andy Grover | d521b63 | 2009-10-30 08:51:57 +0000 | [diff] [blame] | 324 | void rds_ib_recv_tasklet_fn(unsigned long data); |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 325 | void rds_ib_recv_init_ring(struct rds_ib_connection *ic); |
| 326 | void rds_ib_recv_clear_ring(struct rds_ib_connection *ic); |
| 327 | void rds_ib_recv_init_ack(struct rds_ib_connection *ic); |
| 328 | void rds_ib_attempt_ack(struct rds_ib_connection *ic); |
| 329 | void rds_ib_ack_send_complete(struct rds_ib_connection *ic); |
| 330 | u64 rds_ib_piggyb_ack(struct rds_ib_connection *ic); |
| 331 | |
| 332 | /* ib_ring.c */ |
| 333 | void rds_ib_ring_init(struct rds_ib_work_ring *ring, u32 nr); |
| 334 | void rds_ib_ring_resize(struct rds_ib_work_ring *ring, u32 nr); |
| 335 | u32 rds_ib_ring_alloc(struct rds_ib_work_ring *ring, u32 val, u32 *pos); |
| 336 | void rds_ib_ring_free(struct rds_ib_work_ring *ring, u32 val); |
| 337 | void rds_ib_ring_unalloc(struct rds_ib_work_ring *ring, u32 val); |
| 338 | int rds_ib_ring_empty(struct rds_ib_work_ring *ring); |
| 339 | int rds_ib_ring_low(struct rds_ib_work_ring *ring); |
| 340 | u32 rds_ib_ring_oldest(struct rds_ib_work_ring *ring); |
| 341 | u32 rds_ib_ring_completed(struct rds_ib_work_ring *ring, u32 wr_id, u32 oldest); |
| 342 | extern wait_queue_head_t rds_ib_ring_empty_wait; |
| 343 | |
| 344 | /* ib_send.c */ |
Zach Brown | 59f740a | 2010-08-03 13:52:47 -0700 | [diff] [blame] | 345 | char *rds_ib_wc_status_str(enum ib_wc_status status); |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 346 | void rds_ib_xmit_complete(struct rds_connection *conn); |
| 347 | int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, |
| 348 | unsigned int hdr_off, unsigned int sg, unsigned int off); |
| 349 | void rds_ib_send_cq_comp_handler(struct ib_cq *cq, void *context); |
| 350 | void rds_ib_send_init_ring(struct rds_ib_connection *ic); |
| 351 | void rds_ib_send_clear_ring(struct rds_ib_connection *ic); |
Andy Grover | f8b3aaf | 2010-03-01 14:11:53 -0800 | [diff] [blame] | 352 | int rds_ib_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op); |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 353 | void rds_ib_send_add_credits(struct rds_connection *conn, unsigned int credits); |
| 354 | void rds_ib_advertise_credits(struct rds_connection *conn, unsigned int posted); |
| 355 | int rds_ib_send_grab_credits(struct rds_ib_connection *ic, u32 wanted, |
Steve Wise | 7b70d03 | 2009-04-09 14:09:39 +0000 | [diff] [blame] | 356 | u32 *adv_credits, int need_posted, int max_posted); |
Andy Grover | ff3d7d3 | 2010-03-01 14:03:09 -0800 | [diff] [blame] | 357 | int rds_ib_xmit_atomic(struct rds_connection *conn, struct rm_atomic_op *op); |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 358 | |
| 359 | /* ib_stats.c */ |
| 360 | DECLARE_PER_CPU(struct rds_ib_statistics, rds_ib_stats); |
| 361 | #define rds_ib_stats_inc(member) rds_stats_inc_which(rds_ib_stats, member) |
| 362 | unsigned int rds_ib_stats_info_copy(struct rds_info_iterator *iter, |
| 363 | unsigned int avail); |
| 364 | |
| 365 | /* ib_sysctl.c */ |
Zach Brown | ef87b7e | 2010-07-09 12:26:20 -0700 | [diff] [blame] | 366 | int rds_ib_sysctl_init(void); |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 367 | void rds_ib_sysctl_exit(void); |
| 368 | extern unsigned long rds_ib_sysctl_max_send_wr; |
| 369 | extern unsigned long rds_ib_sysctl_max_recv_wr; |
| 370 | extern unsigned long rds_ib_sysctl_max_unsig_wrs; |
| 371 | extern unsigned long rds_ib_sysctl_max_unsig_bytes; |
| 372 | extern unsigned long rds_ib_sysctl_max_recv_allocation; |
| 373 | extern unsigned int rds_ib_sysctl_flow_control; |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 374 | |
Andy Grover | ec16227 | 2009-02-24 15:30:30 +0000 | [diff] [blame] | 375 | #endif |