ib.h revision c0dd49bdd68c0d758a67d56f07826f3b45cfc664
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _RDSV3_IB_H
#define _RDSV3_IB_H
#define RDSV3_FMR_SIZE 256
#define RDSV3_IB_SEND_WRS 64
#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_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 {
};
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;
/* 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;
/* CPU to which the tasklet taskq should be bound */
/* sending acks */
unsigned long i_ack_flags;
#ifndef 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 rds_ib_mr_pool *mr_pool;
unsigned int fmr_max_remaps;
unsigned int max_fmrs;
unsigned int fmr_message_size;
int max_sge;
unsigned int max_wrs;
};
/* 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);
/* 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);
/* ib_recv.c */
int rdsv3_ib_recv_init(void);
void rdsv3_ib_recv_exit(void);
void rdsv3_ib_recv_tasklet_fn(void *data);
/* 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 */