aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds
diff options
context:
space:
mode:
authorAndy Grover <andy.grover@oracle.com>2010-01-13 19:32:24 -0500
committerAndy Grover <andy.grover@oracle.com>2010-09-08 21:11:50 -0400
commit919ced4ce7d6ac62dd5be62d8993fe22a527d53a (patch)
treef201cb777e39cee0fa030ebf0e71558b3227b9c9 /net/rds
parent6f3d05db0da0b874afd2dd229bed715133532f8d (diff)
RDS/IB: Remove ib_[header/data]_sge() functions
These functions were to cope with differently ordered sg entries depending on RDS 3.0 or 3.1+. Now that we've dropped 3.0 compatibility we no longer need them. Also, modify usage sites for these to refer to sge[0] or [1] directly. Reorder code to initialize header sgs first. Signed-off-by: Andy Grover <andy.grover@oracle.com>
Diffstat (limited to 'net/rds')
-rw-r--r--net/rds/ib.h24
-rw-r--r--net/rds/ib_recv.c22
-rw-r--r--net/rds/ib_send.c32
3 files changed, 23 insertions, 55 deletions
diff --git a/net/rds/ib.h b/net/rds/ib.h
index 426035ac54a1..dbf8d6e31493 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -356,28 +356,4 @@ extern unsigned long rds_ib_sysctl_max_recv_allocation;
356extern unsigned int rds_ib_sysctl_flow_control; 356extern unsigned int rds_ib_sysctl_flow_control;
357extern ctl_table rds_ib_sysctl_table[]; 357extern ctl_table rds_ib_sysctl_table[];
358 358
359/*
360 * Helper functions for getting/setting the header and data SGEs in
361 * RDS packets (not RDMA)
362 *
363 * From version 3.1 onwards, header is in front of data in the sge.
364 */
365static inline struct ib_sge *
366rds_ib_header_sge(struct rds_ib_connection *ic, struct ib_sge *sge)
367{
368 if (ic->conn->c_version > RDS_PROTOCOL_3_0)
369 return &sge[0];
370 else
371 return &sge[1];
372}
373
374static inline struct ib_sge *
375rds_ib_data_sge(struct rds_ib_connection *ic, struct ib_sge *sge)
376{
377 if (ic->conn->c_version > RDS_PROTOCOL_3_0)
378 return &sge[1];
379 else
380 return &sge[0];
381}
382
383#endif 359#endif
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index a68a3a721c6c..e9fe08a86c40 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -95,15 +95,15 @@ void rds_ib_recv_init_ring(struct rds_ib_connection *ic)
95 recv->r_wr.sg_list = recv->r_sge; 95 recv->r_wr.sg_list = recv->r_sge;
96 recv->r_wr.num_sge = RDS_IB_RECV_SGE; 96 recv->r_wr.num_sge = RDS_IB_RECV_SGE;
97 97
98 sge = rds_ib_data_sge(ic, recv->r_sge); 98 sge = &recv->r_sge[0];
99 sge->addr = 0;
100 sge->length = RDS_FRAG_SIZE;
101 sge->lkey = ic->i_mr->lkey;
102
103 sge = rds_ib_header_sge(ic, recv->r_sge);
104 sge->addr = ic->i_recv_hdrs_dma + (i * sizeof(struct rds_header)); 99 sge->addr = ic->i_recv_hdrs_dma + (i * sizeof(struct rds_header));
105 sge->length = sizeof(struct rds_header); 100 sge->length = sizeof(struct rds_header);
106 sge->lkey = ic->i_mr->lkey; 101 sge->lkey = ic->i_mr->lkey;
102
103 sge = &recv->r_sge[1];
104 sge->addr = 0;
105 sge->length = RDS_FRAG_SIZE;
106 sge->lkey = ic->i_mr->lkey;
107 } 107 }
108} 108}
109 109
@@ -190,14 +190,14 @@ static int rds_ib_recv_refill_one(struct rds_connection *conn,
190 recv->r_frag->f_offset = ic->i_frag.f_offset; 190 recv->r_frag->f_offset = ic->i_frag.f_offset;
191 recv->r_frag->f_mapped = dma_addr; 191 recv->r_frag->f_mapped = dma_addr;
192 192
193 sge = rds_ib_data_sge(ic, recv->r_sge); 193 sge = &recv->r_sge[0];
194 sge->addr = dma_addr;
195 sge->length = RDS_FRAG_SIZE;
196
197 sge = rds_ib_header_sge(ic, recv->r_sge);
198 sge->addr = ic->i_recv_hdrs_dma + (recv - ic->i_recvs) * sizeof(struct rds_header); 194 sge->addr = ic->i_recv_hdrs_dma + (recv - ic->i_recvs) * sizeof(struct rds_header);
199 sge->length = sizeof(struct rds_header); 195 sge->length = sizeof(struct rds_header);
200 196
197 sge = &recv->r_sge[1];
198 sge->addr = dma_addr;
199 sge->length = RDS_FRAG_SIZE;
200
201 get_page(recv->r_frag->f_page); 201 get_page(recv->r_frag->f_page);
202 202
203 if (ic->i_frag.f_offset < RDS_PAGE_LAST_OFF) { 203 if (ic->i_frag.f_offset < RDS_PAGE_LAST_OFF) {
diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c
index e86908497fcf..46026d9091f1 100644
--- a/net/rds/ib_send.c
+++ b/net/rds/ib_send.c
@@ -156,18 +156,14 @@ void rds_ib_send_init_ring(struct rds_ib_connection *ic)
156 156
157 send->s_wr.wr_id = i; 157 send->s_wr.wr_id = i;
158 send->s_wr.sg_list = send->s_sge; 158 send->s_wr.sg_list = send->s_sge;
159 send->s_wr.num_sge = 1;
160 send->s_wr.opcode = IB_WR_SEND;
161 send->s_wr.send_flags = 0;
162 send->s_wr.ex.imm_data = 0; 159 send->s_wr.ex.imm_data = 0;
163 160
164 sge = rds_ib_data_sge(ic, send->s_sge); 161 sge = &send->s_sge[0];
165 sge->lkey = ic->i_mr->lkey;
166
167 sge = rds_ib_header_sge(ic, send->s_sge);
168 sge->addr = ic->i_send_hdrs_dma + (i * sizeof(struct rds_header)); 162 sge->addr = ic->i_send_hdrs_dma + (i * sizeof(struct rds_header));
169 sge->length = sizeof(struct rds_header); 163 sge->length = sizeof(struct rds_header);
170 sge->lkey = ic->i_mr->lkey; 164 sge->lkey = ic->i_mr->lkey;
165
166 send->s_sge[1].lkey = ic->i_mr->lkey;
171 } 167 }
172} 168}
173 169
@@ -441,28 +437,24 @@ rds_ib_xmit_populate_wr(struct rds_ib_connection *ic,
441 437
442 send->s_wr.send_flags = send_flags; 438 send->s_wr.send_flags = send_flags;
443 send->s_wr.opcode = IB_WR_SEND; 439 send->s_wr.opcode = IB_WR_SEND;
444 send->s_wr.num_sge = 2; 440 send->s_wr.num_sge = 1;
445 send->s_wr.next = NULL; 441 send->s_wr.next = NULL;
446 send->s_queued = jiffies; 442 send->s_queued = jiffies;
447 send->s_op = NULL; 443 send->s_op = NULL;
448 444
445 sge = &send->s_sge[0];
446 sge->addr = ic->i_send_hdrs_dma + (pos * sizeof(struct rds_header));
447 sge->length = sizeof(struct rds_header);
448 sge->lkey = ic->i_mr->lkey;
449
449 if (length != 0) { 450 if (length != 0) {
450 sge = rds_ib_data_sge(ic, send->s_sge); 451 send->s_wr.num_sge = 2;
452
453 sge = &send->s_sge[1];
451 sge->addr = buffer; 454 sge->addr = buffer;
452 sge->length = length; 455 sge->length = length;
453 sge->lkey = ic->i_mr->lkey; 456 sge->lkey = ic->i_mr->lkey;
454
455 sge = rds_ib_header_sge(ic, send->s_sge);
456 } else {
457 /* We're sending a packet with no payload. There is only
458 * one SGE */
459 send->s_wr.num_sge = 1;
460 sge = &send->s_sge[0];
461 } 457 }
462
463 sge->addr = ic->i_send_hdrs_dma + (pos * sizeof(struct rds_header));
464 sge->length = sizeof(struct rds_header);
465 sge->lkey = ic->i_mr->lkey;
466} 458}
467 459
468/* 460/*