aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds/iw_send.c
diff options
context:
space:
mode:
authorAndy Grover <andy.grover@oracle.com>2010-01-12 15:15:02 -0500
committerAndy Grover <andy.grover@oracle.com>2010-09-08 21:11:33 -0400
commite779137aa76d38d5c33a98ed887092ae4e4f016f (patch)
treeaf0a34f9334bd11ca507d4e63a963c561ff981ae /net/rds/iw_send.c
parent8690bfa17aea4c42da1bcf90a7af93d161eca624 (diff)
RDS: break out rdma and data ops into nested structs in rds_message
Clearly separate rdma-related variables in rm from data-related ones. This is in anticipation of adding atomic support. Signed-off-by: Andy Grover <andy.grover@oracle.com>
Diffstat (limited to 'net/rds/iw_send.c')
-rw-r--r--net/rds/iw_send.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/net/rds/iw_send.c b/net/rds/iw_send.c
index dced532f9cfb..c187e8fdeab1 100644
--- a/net/rds/iw_send.c
+++ b/net/rds/iw_send.c
@@ -83,11 +83,11 @@ static void rds_iw_send_unmap_rm(struct rds_iw_connection *ic,
83 rdsdebug("ic %p send %p rm %p\n", ic, send, rm); 83 rdsdebug("ic %p send %p rm %p\n", ic, send, rm);
84 84
85 ib_dma_unmap_sg(ic->i_cm_id->device, 85 ib_dma_unmap_sg(ic->i_cm_id->device,
86 rm->m_sg, rm->m_nents, 86 rm->data.m_sg, rm->data.m_nents,
87 DMA_TO_DEVICE); 87 DMA_TO_DEVICE);
88 88
89 if (rm->m_rdma_op) { 89 if (rm->rdma.m_rdma_op) {
90 rds_iw_send_unmap_rdma(ic, rm->m_rdma_op); 90 rds_iw_send_unmap_rdma(ic, rm->rdma.m_rdma_op);
91 91
92 /* If the user asked for a completion notification on this 92 /* If the user asked for a completion notification on this
93 * message, we can implement three different semantics: 93 * message, we can implement three different semantics:
@@ -111,10 +111,10 @@ static void rds_iw_send_unmap_rm(struct rds_iw_connection *ic,
111 */ 111 */
112 rds_iw_send_rdma_complete(rm, wc_status); 112 rds_iw_send_rdma_complete(rm, wc_status);
113 113
114 if (rm->m_rdma_op->r_write) 114 if (rm->rdma.m_rdma_op->r_write)
115 rds_stats_add(s_send_rdma_bytes, rm->m_rdma_op->r_bytes); 115 rds_stats_add(s_send_rdma_bytes, rm->rdma.m_rdma_op->r_bytes);
116 else 116 else
117 rds_stats_add(s_recv_rdma_bytes, rm->m_rdma_op->r_bytes); 117 rds_stats_add(s_recv_rdma_bytes, rm->rdma.m_rdma_op->r_bytes);
118 } 118 }
119 119
120 /* If anyone waited for this message to get flushed out, wake 120 /* If anyone waited for this message to get flushed out, wake
@@ -563,18 +563,20 @@ int rds_iw_xmit(struct rds_connection *conn, struct rds_message *rm,
563 rm->m_inc.i_hdr.h_flags, 563 rm->m_inc.i_hdr.h_flags,
564 be32_to_cpu(rm->m_inc.i_hdr.h_len)); 564 be32_to_cpu(rm->m_inc.i_hdr.h_len));
565 */ 565 */
566 if (rm->m_nents) { 566 if (rm->data.m_nents) {
567 rm->m_count = ib_dma_map_sg(dev, 567 rm->data.m_count = ib_dma_map_sg(dev,
568 rm->m_sg, rm->m_nents, DMA_TO_DEVICE); 568 rm->data.m_sg,
569 rdsdebug("ic %p mapping rm %p: %d\n", ic, rm, rm->m_count); 569 rm->data.m_nents,
570 if (rm->m_count == 0) { 570 DMA_TO_DEVICE);
571 rdsdebug("ic %p mapping rm %p: %d\n", ic, rm, rm->data.m_count);
572 if (rm->data.m_count == 0) {
571 rds_iw_stats_inc(s_iw_tx_sg_mapping_failure); 573 rds_iw_stats_inc(s_iw_tx_sg_mapping_failure);
572 rds_iw_ring_unalloc(&ic->i_send_ring, work_alloc); 574 rds_iw_ring_unalloc(&ic->i_send_ring, work_alloc);
573 ret = -ENOMEM; /* XXX ? */ 575 ret = -ENOMEM; /* XXX ? */
574 goto out; 576 goto out;
575 } 577 }
576 } else { 578 } else {
577 rm->m_count = 0; 579 rm->data.m_count = 0;
578 } 580 }
579 581
580 ic->i_unsignaled_wrs = rds_iw_sysctl_max_unsig_wrs; 582 ic->i_unsignaled_wrs = rds_iw_sysctl_max_unsig_wrs;
@@ -590,10 +592,10 @@ int rds_iw_xmit(struct rds_connection *conn, struct rds_message *rm,
590 592
591 /* If it has a RDMA op, tell the peer we did it. This is 593 /* If it has a RDMA op, tell the peer we did it. This is
592 * used by the peer to release use-once RDMA MRs. */ 594 * used by the peer to release use-once RDMA MRs. */
593 if (rm->m_rdma_op) { 595 if (rm->rdma.m_rdma_op) {
594 struct rds_ext_header_rdma ext_hdr; 596 struct rds_ext_header_rdma ext_hdr;
595 597
596 ext_hdr.h_rdma_rkey = cpu_to_be32(rm->m_rdma_op->r_key); 598 ext_hdr.h_rdma_rkey = cpu_to_be32(rm->rdma.m_rdma_op->r_key);
597 rds_message_add_extension(&rm->m_inc.i_hdr, 599 rds_message_add_extension(&rm->m_inc.i_hdr,
598 RDS_EXTHDR_RDMA, &ext_hdr, sizeof(ext_hdr)); 600 RDS_EXTHDR_RDMA, &ext_hdr, sizeof(ext_hdr));
599 } 601 }
@@ -621,7 +623,7 @@ int rds_iw_xmit(struct rds_connection *conn, struct rds_message *rm,
621 send = &ic->i_sends[pos]; 623 send = &ic->i_sends[pos];
622 first = send; 624 first = send;
623 prev = NULL; 625 prev = NULL;
624 scat = &rm->m_sg[sg]; 626 scat = &rm->data.m_sg[sg];
625 sent = 0; 627 sent = 0;
626 i = 0; 628 i = 0;
627 629
@@ -631,7 +633,7 @@ int rds_iw_xmit(struct rds_connection *conn, struct rds_message *rm,
631 * or when requested by the user. Right now, we let 633 * or when requested by the user. Right now, we let
632 * the application choose. 634 * the application choose.
633 */ 635 */
634 if (rm->m_rdma_op && rm->m_rdma_op->r_fence) 636 if (rm->rdma.m_rdma_op && rm->rdma.m_rdma_op->r_fence)
635 send_flags = IB_SEND_FENCE; 637 send_flags = IB_SEND_FENCE;
636 638
637 /* 639 /*
@@ -650,7 +652,7 @@ int rds_iw_xmit(struct rds_connection *conn, struct rds_message *rm,
650 } 652 }
651 653
652 /* if there's data reference it with a chain of work reqs */ 654 /* if there's data reference it with a chain of work reqs */
653 for (; i < work_alloc && scat != &rm->m_sg[rm->m_count]; i++) { 655 for (; i < work_alloc && scat != &rm->data.m_sg[rm->data.m_count]; i++) {
654 unsigned int len; 656 unsigned int len;
655 657
656 send = &ic->i_sends[pos]; 658 send = &ic->i_sends[pos];
@@ -728,7 +730,7 @@ add_header:
728 sent += sizeof(struct rds_header); 730 sent += sizeof(struct rds_header);
729 731
730 /* if we finished the message then send completion owns it */ 732 /* if we finished the message then send completion owns it */
731 if (scat == &rm->m_sg[rm->m_count]) { 733 if (scat == &rm->data.m_sg[rm->data.m_count]) {
732 prev->s_rm = ic->i_rm; 734 prev->s_rm = ic->i_rm;
733 prev->s_wr.send_flags |= IB_SEND_SIGNALED | IB_SEND_SOLICITED; 735 prev->s_wr.send_flags |= IB_SEND_SIGNALED | IB_SEND_SOLICITED;
734 ic->i_rm = NULL; 736 ic->i_rm = NULL;