aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Grover <andy.grover@oracle.com>2010-01-27 19:07:30 -0500
committerAndy Grover <andy.grover@oracle.com>2010-09-08 21:11:56 -0400
commit4324879df06ba4db01a0b455af2d003f117e6aa3 (patch)
tree04629863049eb51433052669541ccd300b33c74a
parent241eef3e2f51fe4ad50abacd7f79c4e2d468197e (diff)
RDS: Inline rdma_prepare into cmsg_rdma_args
cmsg_rdma_args just calls rdma_prepare and does a little arg checking -- not quite enough to justify its existence. Plus, it is the only caller of rdma_prepare(). Signed-off-by: Andy Grover <andy.grover@oracle.com>
-rw-r--r--net/rds/rdma.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index 4df545a6eab8..91967c8bc572 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -497,12 +497,13 @@ int rds_rdma_extra_size(struct rds_rdma_args *args)
497} 497}
498 498
499/* 499/*
500 * args is a pointer to an in-kernel copy in the sendmsg cmsg. 500 * The application asks for a RDMA transfer.
501 * Extract all arguments and set up the rdma_op
501 */ 502 */
502static int rds_rdma_prepare(struct rds_message *rm, 503int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
503 struct rds_sock *rs, 504 struct cmsghdr *cmsg)
504 struct rds_rdma_args *args)
505{ 505{
506 struct rds_rdma_args *args;
506 struct rds_iovec vec; 507 struct rds_iovec vec;
507 struct rds_rdma_op *op = &rm->rdma.m_rdma_op; 508 struct rds_rdma_op *op = &rm->rdma.m_rdma_op;
508 unsigned int nr_pages; 509 unsigned int nr_pages;
@@ -513,6 +514,11 @@ static int rds_rdma_prepare(struct rds_message *rm,
513 unsigned int i, j; 514 unsigned int i, j;
514 int ret = 0; 515 int ret = 0;
515 516
517 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct rds_rdma_args))
518 || rm->rdma.m_rdma_op.r_active)
519 return -EINVAL;
520
521 args = CMSG_DATA(cmsg);
516 522
517 if (rs->rs_bound_addr == 0) { 523 if (rs->rs_bound_addr == 0) {
518 ret = -ENOTCONN; /* XXX not a great errno */ 524 ret = -ENOTCONN; /* XXX not a great errno */
@@ -623,7 +629,6 @@ static int rds_rdma_prepare(struct rds_message *rm,
623 op->r_nents += nr; 629 op->r_nents += nr;
624 } 630 }
625 631
626
627 if (nr_bytes > args->remote_vec.bytes) { 632 if (nr_bytes > args->remote_vec.bytes) {
628 rdsdebug("RDS nr_bytes %u remote_bytes %u do not match\n", 633 rdsdebug("RDS nr_bytes %u remote_bytes %u do not match\n",
629 nr_bytes, 634 nr_bytes,
@@ -639,28 +644,9 @@ out:
639 if (ret) 644 if (ret)
640 rds_rdma_free_op(op); 645 rds_rdma_free_op(op);
641 646
642 return ret;
643}
644
645/*
646 * The application asks for a RDMA transfer.
647 * Extract all arguments and set up the rdma_op
648 */
649int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
650 struct cmsghdr *cmsg)
651{
652 int ret;
653
654 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct rds_rdma_args)) ||
655 rm->rdma.m_rdma_op.r_active)
656 return -EINVAL;
657
658 ret = rds_rdma_prepare(rm, rs, CMSG_DATA(cmsg));
659 if (ret)
660 return ret;
661
662 rds_stats_inc(s_send_rdma); 647 rds_stats_inc(s_send_rdma);
663 return 0; 648
649 return ret;
664} 650}
665 651
666/* 652/*