diff options
author | Andy Grover <andy.grover@oracle.com> | 2010-01-12 17:33:38 -0500 |
---|---|---|
committer | Andy Grover <andy.grover@oracle.com> | 2010-09-08 21:11:41 -0400 |
commit | 15133f6e67d8d646d0744336b4daa3135452cb0d (patch) | |
tree | e5675d5a3ab240edc9a66af6b891dd75fa9eabae /net/rds/rds.h | |
parent | a63273d4992603979ddb181b6a8f07082839b39f (diff) |
RDS: Implement atomic operations
Implement a CMSG-based interface to do FADD and CSWP ops.
Alter send routines to handle atomic ops.
Add atomic counters to stats.
Add xmit_atomic() to struct rds_transport
Inline rds_ib_send_unmap_rdma into unmap_rm
Signed-off-by: Andy Grover <andy.grover@oracle.com>
Diffstat (limited to 'net/rds/rds.h')
-rw-r--r-- | net/rds/rds.h | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/net/rds/rds.h b/net/rds/rds.h index 0bb4957e0cfc..830e2bbb3332 100644 --- a/net/rds/rds.h +++ b/net/rds/rds.h | |||
@@ -97,6 +97,7 @@ struct rds_connection { | |||
97 | unsigned int c_xmit_hdr_off; | 97 | unsigned int c_xmit_hdr_off; |
98 | unsigned int c_xmit_data_off; | 98 | unsigned int c_xmit_data_off; |
99 | unsigned int c_xmit_rdma_sent; | 99 | unsigned int c_xmit_rdma_sent; |
100 | unsigned int c_xmit_atomic_sent; | ||
100 | 101 | ||
101 | spinlock_t c_lock; /* protect msg queues */ | 102 | spinlock_t c_lock; /* protect msg queues */ |
102 | u64 c_next_tx_seq; | 103 | u64 c_next_tx_seq; |
@@ -260,6 +261,10 @@ static inline u32 rds_rdma_cookie_offset(rds_rdma_cookie_t cookie) | |||
260 | return cookie >> 32; | 261 | return cookie >> 32; |
261 | } | 262 | } |
262 | 263 | ||
264 | /* atomic operation types */ | ||
265 | #define RDS_ATOMIC_TYPE_CSWP 0 | ||
266 | #define RDS_ATOMIC_TYPE_FADD 1 | ||
267 | |||
263 | /* | 268 | /* |
264 | * m_sock_item and m_conn_item are on lists that are serialized under | 269 | * m_sock_item and m_conn_item are on lists that are serialized under |
265 | * conn->c_lock. m_sock_item has additional meaning in that once it is empty | 270 | * conn->c_lock. m_sock_item has additional meaning in that once it is empty |
@@ -315,11 +320,27 @@ struct rds_message { | |||
315 | struct rds_sock *m_rs; | 320 | struct rds_sock *m_rs; |
316 | rds_rdma_cookie_t m_rdma_cookie; | 321 | rds_rdma_cookie_t m_rdma_cookie; |
317 | struct { | 322 | struct { |
318 | struct { | 323 | struct rm_atomic_op { |
324 | int op_type; | ||
325 | uint64_t op_swap_add; | ||
326 | uint64_t op_compare; | ||
327 | |||
328 | u32 op_rkey; | ||
329 | u64 op_remote_addr; | ||
330 | unsigned int op_notify:1; | ||
331 | unsigned int op_recverr:1; | ||
332 | unsigned int op_mapped:1; | ||
333 | unsigned int op_active:1; | ||
334 | struct rds_notifier *op_notifier; | ||
335 | struct scatterlist *op_sg; | ||
336 | |||
337 | struct rds_mr *op_rdma_mr; | ||
338 | } atomic; | ||
339 | struct rm_rdma_op { | ||
319 | struct rds_rdma_op m_rdma_op; | 340 | struct rds_rdma_op m_rdma_op; |
320 | struct rds_mr *m_rdma_mr; | 341 | struct rds_mr *m_rdma_mr; |
321 | } rdma; | 342 | } rdma; |
322 | struct { | 343 | struct rm_data_op { |
323 | unsigned int m_nents; | 344 | unsigned int m_nents; |
324 | unsigned int m_count; | 345 | unsigned int m_count; |
325 | struct scatterlist *m_sg; | 346 | struct scatterlist *m_sg; |
@@ -397,6 +418,7 @@ struct rds_transport { | |||
397 | int (*xmit_cong_map)(struct rds_connection *conn, | 418 | int (*xmit_cong_map)(struct rds_connection *conn, |
398 | struct rds_cong_map *map, unsigned long offset); | 419 | struct rds_cong_map *map, unsigned long offset); |
399 | int (*xmit_rdma)(struct rds_connection *conn, struct rds_rdma_op *op); | 420 | int (*xmit_rdma)(struct rds_connection *conn, struct rds_rdma_op *op); |
421 | int (*xmit_atomic)(struct rds_connection *conn, struct rm_atomic_op *op); | ||
400 | int (*recv)(struct rds_connection *conn); | 422 | int (*recv)(struct rds_connection *conn); |
401 | int (*inc_copy_to_user)(struct rds_incoming *inc, struct iovec *iov, | 423 | int (*inc_copy_to_user)(struct rds_incoming *inc, struct iovec *iov, |
402 | size_t size); | 424 | size_t size); |
@@ -546,6 +568,8 @@ struct rds_statistics { | |||
546 | uint64_t s_cong_update_received; | 568 | uint64_t s_cong_update_received; |
547 | uint64_t s_cong_send_error; | 569 | uint64_t s_cong_send_error; |
548 | uint64_t s_cong_send_blocked; | 570 | uint64_t s_cong_send_blocked; |
571 | uint64_t s_atomic_cswp; | ||
572 | uint64_t s_atomic_fadd; | ||
549 | }; | 573 | }; |
550 | 574 | ||
551 | /* af_rds.c */ | 575 | /* af_rds.c */ |
@@ -722,7 +746,10 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm, | |||
722 | int rds_cmsg_rdma_map(struct rds_sock *rs, struct rds_message *rm, | 746 | int rds_cmsg_rdma_map(struct rds_sock *rs, struct rds_message *rm, |
723 | struct cmsghdr *cmsg); | 747 | struct cmsghdr *cmsg); |
724 | void rds_rdma_free_op(struct rds_rdma_op *ro); | 748 | void rds_rdma_free_op(struct rds_rdma_op *ro); |
725 | void rds_rdma_send_complete(struct rds_message *rm, int); | 749 | void rds_rdma_send_complete(struct rds_message *rm, int wc_status); |
750 | void rds_atomic_send_complete(struct rds_message *rm, int wc_status); | ||
751 | int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm, | ||
752 | struct cmsghdr *cmsg); | ||
726 | 753 | ||
727 | extern void __rds_put_mr_final(struct rds_mr *mr); | 754 | extern void __rds_put_mr_final(struct rds_mr *mr); |
728 | static inline void rds_mr_put(struct rds_mr *mr) | 755 | static inline void rds_mr_put(struct rds_mr *mr) |