ib.h revision 3f756f37bfdcab561a4d84fb80f41f1e1a15c135
/*
* This file contains definitions imported from the OFED rds header ib.h.
* Oracle elects to have and use the contents of ib.h under and
* governed by the OpenIB.org BSD license.
*/
/*
*/
#ifndef _RDSV3_IB_H
#define _RDSV3_IB_H
#define RDSV3_FMR_SIZE 256
#define RDSV3_IB_MAX_SGE 8
#define RDSV3_IB_RECV_SGE 2
#define RDSV3_IB_DEFAULT_RECV_WR 1024
#define RDSV3_IB_DEFAULT_SEND_WR 256
#define RDSV3_IB_DEFAULT_RETRY_COUNT 2
/* minor versions supported */
#define RDSV3_IB_SUPPORTED_PROTOCOLS 0x00000003
extern struct list rdsv3_ib_devices;
/*
* IB posts RDSV3_FRAG_SIZE fragments of pages to the receive queues to
* try and minimize the amount of memory tied up both the device and
* socket receive queues.
*/
/* page offset of the final full frag that fits in the page */
#define RDSV3_PAGE_LAST_OFF \
struct rdsv3_page_frag {
unsigned long f_offset;
};
struct rdsv3_ib_incoming {
struct rdsv3_incoming ii_inc;
struct rdsv3_inc_pool *ii_pool;
struct rdsv3_ib_device *ii_ibdev;
};
struct rdsv3_ib_connect_private {
/* Add new fields at the end, and don't permute existing fields. */
};
struct rdsv3_ib_send_work {
struct rdsv3_message *s_rm;
struct rdsv3_rdma_op *s_op;
unsigned long s_queued;
};
struct rdsv3_ib_recv_work {
struct rdsv3_ib_incoming *r_ibinc;
struct rdsv3_page_frag *r_frag;
};
struct rdsv3_ib_work_ring {
};
/*
* Rings are posted with all the allocations they'll need to queue the
* incoming message to the receiving socket so this can't fail.
* All fragments start with a header, so we can make sure we're not receiving
* garbage, and we can tell a small 8 byte fragment from an ACK frame.
*/
struct rdsv3_ib_ack_state {
unsigned int ack_required:1;
unsigned int ack_next_valid:1;
unsigned int ack_recv_valid:1;
};
struct rdsv3_ib_device;
struct rdsv3_ib_connection {
struct rdsv3_ib_device *rds_ibdev;
struct rdsv3_connection *conn;
/* alphabet soup, IBTA style */
struct rdma_cm_id *i_cm_id;
struct rdsv3_hdrs_mr *i_mr;
/* tx */
struct rdsv3_ib_work_ring i_send_ring;
struct rdsv3_message *i_rm;
struct rdsv3_header *i_send_hdrs;
struct rdsv3_ib_send_work *i_sends;
/* soft CQ */
/* rx */
struct mutex i_recv_mutex;
struct rdsv3_ib_work_ring i_recv_ring;
struct rdsv3_ib_incoming *i_ibinc;
struct rdsv3_header *i_recv_hdrs;
struct rdsv3_ib_recv_work *i_recvs;
struct rdsv3_page_frag i_frag;
/* sending acks */
unsigned long i_ack_flags;
#ifdef KERNEL_HAS_ATOMIC64
#else
#endif
struct rdsv3_header *i_ack;
unsigned long i_ack_queued;
/*
* Flow control related information
*
* Our algorithm uses a pair variables that we need to access
* atomically - one for the send credits, and one posted
* recv credits we need to transfer to remote.
* Rather than protect them using a slow spinlock, we put both into
* a single atomic_t and update it using cmpxchg
*/
/* Protocol version specific information */
/* Batched completions */
unsigned int i_unsignaled_wrs;
long i_unsignaled_bytes;
};
/* This assumes that atomic_t is at least 32 bits */
#define IB_GET_SEND_CREDITS(v) ((v) & 0xffff)
#define IB_GET_POST_CREDITS(v) ((v) >> 16)
#define IB_SET_SEND_CREDITS(v) ((v) & 0xffff)
#define IB_SET_POST_CREDITS(v) ((v) << 16)
struct rdsv3_ib_ipaddr {
};
struct rdsv3_ib_device {
struct list ipaddr_list;
struct kmem_cache *ib_frag_slab;
unsigned int fmr_max_remaps;
unsigned int max_fmrs;
unsigned int fmr_message_size;
int max_sge;
unsigned int max_wrs;
unsigned int max_initiator_depth;
unsigned int max_responder_resources;
struct rdsv3_fmr_pool *fmr_pool;
struct rdsv3_inc_pool *inc_pool;
};
/* bits for i_ack_flags */
#define IB_ACK_IN_FLIGHT 0
#define IB_ACK_REQUESTED 1
/* Magic WR_ID for ACKs */
#define RDSV3_IB_ACK_WR_ID (~(uint64_t)0)
struct rdsv3_ib_statistics {
};
extern struct rdsv3_workqueue_struct_s *rds_ib_wq;
/* ib.c */
extern struct rdsv3_transport rdsv3_ib_transport;
extern struct ib_client rdsv3_ib_client;
extern unsigned int fmr_pool_size;
extern unsigned int fmr_message_size;
extern unsigned int rdsv3_ib_retry_count;
extern kmutex_t ib_nodev_conns_lock;
extern struct list ib_nodev_conns;
/* ib_cm.c */
void rdsv3_ib_conn_free(void *arg);
struct rdma_cm_event *event);
struct rdma_cm_event *event);
void rdsv3_ib_tasklet_fn(void *data);
void rdsv3_ib_snd_tasklet_fn(void *data);
void rdsv3_ib_refill_fn(void *data);
/* ib_rdma.c */
struct rdsv3_connection *conn);
struct rdsv3_connection *conn);
static inline void rdsv3_ib_destroy_nodev_conns(void)
{
}
{
}
int rdsv3_ib_create_mr_pool(struct rdsv3_ib_device *);
void rdsv3_ib_destroy_mr_pool(struct rdsv3_ib_device *);
struct rdsv3_info_rdma_connection *iinfo);
void rdsv3_ib_flush_mrs(void);
void rdsv3_ib_drain_mrlist_fn(void *data);
/* ib_recv.c */
int rdsv3_ib_recv_init(void);
void rdsv3_ib_recv_exit(void);
struct rdsv3_ib_ack_state *state);
int ack_required);
int rdsv3_ib_create_inc_pool(struct rdsv3_ib_device *);
void rdsv3_ib_destroy_inc_pool(struct rdsv3_ib_device *);
void rdsv3_ib_drain_inclist(void *);
/* ib_ring.c */
/* ib_send.c */
unsigned int credits);
unsigned int posted);
/* ib_stats.c */
unsigned int avail);
/* ib_sysctl.c */
int rdsv3_ib_sysctl_init(void);
void rdsv3_ib_sysctl_exit(void);
extern unsigned long rdsv3_ib_sysctl_max_send_wr;
extern unsigned long rdsv3_ib_sysctl_max_recv_wr;
extern unsigned long rdsv3_ib_sysctl_max_unsig_wrs;
extern unsigned long rdsv3_ib_sysctl_max_unsig_bytes;
extern unsigned long rdsv3_ib_sysctl_max_recv_allocation;
extern unsigned int rdsv3_ib_sysctl_flow_control;
#endif /* _RDSV3_IB_H */