RDS/IB: Use SLAB_HWCACHE_ALIGN flag for kmem_cache_create()
[linux-2.6.git] / net / rds / rds.h
index 830e2bb..4510344 100644 (file)
@@ -80,6 +80,7 @@ enum {
 /* Bits for c_flags */
 #define RDS_LL_SEND_FULL       0
 #define RDS_RECONNECT_PENDING  1
+#define RDS_IN_XMIT            2
 
 struct rds_connection {
        struct hlist_node       c_hash_node;
@@ -91,13 +92,13 @@ struct rds_connection {
        struct rds_cong_map     *c_lcong;
        struct rds_cong_map     *c_fcong;
 
-       struct mutex            c_send_lock;    /* protect send ring */
        struct rds_message      *c_xmit_rm;
        unsigned long           c_xmit_sg;
        unsigned int            c_xmit_hdr_off;
        unsigned int            c_xmit_data_off;
-       unsigned int            c_xmit_rdma_sent;
        unsigned int            c_xmit_atomic_sent;
+       unsigned int            c_xmit_rdma_sent;
+       unsigned int            c_xmit_data_sent;
 
        spinlock_t              c_lock;         /* protect msg queues */
        u64                     c_next_tx_seq;
@@ -117,11 +118,10 @@ struct rds_connection {
        struct delayed_work     c_conn_w;
        struct work_struct      c_down_w;
        struct mutex            c_cm_lock;      /* protect conn state & cm */
+       wait_queue_head_t       c_waitq;
 
        struct list_head        c_map_item;
        unsigned long           c_map_queued;
-       unsigned long           c_map_offset;
-       unsigned long           c_map_bytes;
 
        unsigned int            c_unacked_packets;
        unsigned int            c_unacked_bytes;
@@ -230,22 +230,6 @@ struct rds_mr {
 /* Flags for mr->r_state */
 #define RDS_MR_DEAD            0
 
-struct rds_rdma_op {
-       u32                     r_key;
-       u64                     r_remote_addr;
-       unsigned int            r_write:1;
-       unsigned int            r_fence:1;
-       unsigned int            r_notify:1;
-       unsigned int            r_recverr:1;
-       unsigned int            r_mapped:1;
-       unsigned int            r_active:1;
-       struct rds_notifier     *r_notifier;
-       unsigned int            r_bytes;
-       unsigned int            r_nents;
-       unsigned int            r_count;
-       struct scatterlist      *r_sg;
-};
-
 static inline rds_rdma_cookie_t rds_rdma_make_cookie(u32 r_key, u32 offset)
 {
        return r_key | (((u64) offset) << 32);
@@ -317,8 +301,18 @@ struct rds_message {
         *   -> rs->rs_lock
         */
        spinlock_t              m_rs_lock;
+       wait_queue_head_t       m_flush_wait;
+
        struct rds_sock         *m_rs;
+
+       /* cookie to send to remote, in rds header */
        rds_rdma_cookie_t       m_rdma_cookie;
+
+       unsigned int            m_used_sgs;
+       unsigned int            m_total_sgs;
+
+       void                    *m_final_op;
+
        struct {
                struct rm_atomic_op {
                        int                     op_type;
@@ -330,24 +324,38 @@ struct rds_message {
                        unsigned int            op_notify:1;
                        unsigned int            op_recverr:1;
                        unsigned int            op_mapped:1;
+                       unsigned int            op_silent:1;
                        unsigned int            op_active:1;
-                       struct rds_notifier     *op_notifier;
                        struct scatterlist      *op_sg;
+                       struct rds_notifier     *op_notifier;
 
                        struct rds_mr           *op_rdma_mr;
                } atomic;
                struct rm_rdma_op {
-                       struct rds_rdma_op      m_rdma_op;
-                       struct rds_mr           *m_rdma_mr;
+                       u32                     op_rkey;
+                       u64                     op_remote_addr;
+                       unsigned int            op_write:1;
+                       unsigned int            op_fence:1;
+                       unsigned int            op_notify:1;
+                       unsigned int            op_recverr:1;
+                       unsigned int            op_mapped:1;
+                       unsigned int            op_silent:1;
+                       unsigned int            op_active:1;
+                       unsigned int            op_bytes;
+                       unsigned int            op_nents;
+                       unsigned int            op_count;
+                       struct scatterlist      *op_sg;
+                       struct rds_notifier     *op_notifier;
+
+                       struct rds_mr           *op_rdma_mr;
                } rdma;
                struct rm_data_op {
-                       unsigned int            m_nents;
-                       unsigned int            m_count;
-                       struct scatterlist      *m_sg;
+                       unsigned int            op_active:1;
+                       unsigned int            op_nents;
+                       unsigned int            op_count;
+                       struct scatterlist      *op_sg;
                } data;
        };
-       unsigned int            m_used_sgs;
-       unsigned int            m_total_sgs;
 };
 
 /*
@@ -388,10 +396,6 @@ struct rds_notifier {
  *                 transport is responsible for other serialization, including
  *                 rds_recv_incoming().  This is called in process context but
  *                 should try hard not to block.
- *
- * @xmit_cong_map: This asks the transport to send the local bitmap down the
- *                given connection.  XXX get a better story about the bitmap
- *                flag and header.
  */
 
 #define RDS_TRANS_IB   0
@@ -415,14 +419,11 @@ struct rds_transport {
        void (*xmit_complete)(struct rds_connection *conn);
        int (*xmit)(struct rds_connection *conn, struct rds_message *rm,
                    unsigned int hdr_off, unsigned int sg, unsigned int off);
-       int (*xmit_cong_map)(struct rds_connection *conn,
-                            struct rds_cong_map *map, unsigned long offset);
-       int (*xmit_rdma)(struct rds_connection *conn, struct rds_rdma_op *op);
+       int (*xmit_rdma)(struct rds_connection *conn, struct rm_rdma_op *op);
        int (*xmit_atomic)(struct rds_connection *conn, struct rm_atomic_op *op);
        int (*recv)(struct rds_connection *conn);
        int (*inc_copy_to_user)(struct rds_incoming *inc, struct iovec *iov,
                                size_t size);
-       void (*inc_purge)(struct rds_incoming *inc);
        void (*inc_free)(struct rds_incoming *inc);
 
        int (*cm_handle_connect)(struct rdma_cm_id *cm_id,
@@ -451,7 +452,7 @@ struct rds_sock {
         * bound_addr used for both incoming and outgoing, no INADDR_ANY
         * support.
         */
-       struct rb_node          rs_bound_node;
+       struct hlist_node       rs_bound_node;
        __be32                  rs_bound_addr;
        __be32                  rs_conn_addr;
        __be16                  rs_bound_port;
@@ -550,8 +551,8 @@ struct rds_statistics {
        uint64_t        s_recv_ping;
        uint64_t        s_send_queue_empty;
        uint64_t        s_send_queue_full;
-       uint64_t        s_send_sem_contention;
-       uint64_t        s_send_sem_queue_raced;
+       uint64_t        s_send_lock_contention;
+       uint64_t        s_send_lock_queue_raced;
        uint64_t        s_send_immediate_retry;
        uint64_t        s_send_delayed_retry;
        uint64_t        s_send_drop_acked;
@@ -568,8 +569,6 @@ struct rds_statistics {
        uint64_t        s_cong_update_received;
        uint64_t        s_cong_send_error;
        uint64_t        s_cong_send_blocked;
-       uint64_t        s_atomic_cswp;
-       uint64_t        s_atomic_fadd;
 };
 
 /* af_rds.c */
@@ -617,6 +616,7 @@ void rds_conn_shutdown(struct rds_connection *conn);
 void rds_conn_destroy(struct rds_connection *conn);
 void rds_conn_reset(struct rds_connection *conn);
 void rds_conn_drop(struct rds_connection *conn);
+void rds_conn_connect_if_down(struct rds_connection *conn);
 void rds_for_each_conn_info(struct socket *sock, unsigned int len,
                          struct rds_info_iterator *iter,
                          struct rds_info_lengths *lens,
@@ -668,7 +668,6 @@ int rds_message_get_version_extension(struct rds_header *hdr, unsigned int *vers
 int rds_message_add_rdma_dest_extension(struct rds_header *hdr, u32 r_key, u32 offset);
 int rds_message_inc_copy_to_user(struct rds_incoming *inc,
                                 struct iovec *first_iov, size_t size);
-void rds_message_inc_purge(struct rds_incoming *inc);
 void rds_message_inc_free(struct rds_incoming *inc);
 void rds_message_addref(struct rds_message *rm);
 void rds_message_put(struct rds_message *rm);
@@ -724,11 +723,10 @@ void rds_send_drop_to(struct rds_sock *rs, struct sockaddr_in *dest);
 typedef int (*is_acked_func)(struct rds_message *rm, uint64_t ack);
 void rds_send_drop_acked(struct rds_connection *conn, u64 ack,
                         is_acked_func is_acked);
-int rds_send_acked_before(struct rds_connection *conn, u64 seq);
 void rds_send_remove_from_sock(struct list_head *messages, int status);
 int rds_send_pong(struct rds_connection *conn, __be16 dport);
 struct rds_message *rds_send_get_message(struct rds_connection *,
-                                        struct rds_rdma_op *);
+                                        struct rm_rdma_op *);
 
 /* rdma.c */
 void rds_rdma_unuse(struct rds_sock *rs, u32 r_key, int force);
@@ -745,7 +743,8 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
                          struct cmsghdr *cmsg);
 int rds_cmsg_rdma_map(struct rds_sock *rs, struct rds_message *rm,
                          struct cmsghdr *cmsg);
-void rds_rdma_free_op(struct rds_rdma_op *ro);
+void rds_rdma_free_op(struct rm_rdma_op *ro);
+void rds_atomic_free_op(struct rm_atomic_op *ao);
 void rds_rdma_send_complete(struct rds_message *rm, int wc_status);
 void rds_atomic_send_complete(struct rds_message *rm, int wc_status);
 int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm,