From e5ae2208026c398e5c515ef27b5bff3775ee1511 Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Sat, 18 Jul 2009 23:26:34 -0600 Subject: Make the gid argument to ibv_attach_mcast and ibv_detach_mcast const ibv_attach_mcast() and ibv_detach_mcast() don't change the gid argument, so the arguments should be const to allow applications to pass in constant gids. This constness flows through to the driver call struct and into the drivers and back into ibv_cmd_attach_mcast()/ibv_cmd_detach_mcast(). Signed-off-by: Jason Gunthorpe Signed-off-by: Roland Dreier --- include/infiniband/driver.h | 4 ++-- include/infiniband/verbs.h | 8 ++++---- man/ibv_attach_mcast.3 | 4 ++-- src/cmd.c | 4 ++-- src/verbs.c | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/infiniband/driver.h b/include/infiniband/driver.h index 67a3bf8..e54e0e3 100644 --- a/include/infiniband/driver.h +++ b/include/infiniband/driver.h @@ -129,8 +129,8 @@ int ibv_cmd_post_srq_recv(struct ibv_srq *srq, struct ibv_recv_wr *wr, int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah, struct ibv_ah_attr *attr); int ibv_cmd_destroy_ah(struct ibv_ah *ah); -int ibv_cmd_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid); -int ibv_cmd_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid); +int ibv_cmd_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid); +int ibv_cmd_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid); int ibv_dontfork_range(void *base, size_t size); int ibv_dofork_range(void *base, size_t size); diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h index a04cc62..226d85e 100644 --- a/include/infiniband/verbs.h +++ b/include/infiniband/verbs.h @@ -676,9 +676,9 @@ struct ibv_context_ops { struct ibv_recv_wr **bad_wr); struct ibv_ah * (*create_ah)(struct ibv_pd *pd, struct ibv_ah_attr *attr); int (*destroy_ah)(struct ibv_ah *ah); - int (*attach_mcast)(struct ibv_qp *qp, union ibv_gid *gid, + int (*attach_mcast)(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid); - int (*detach_mcast)(struct ibv_qp *qp, union ibv_gid *gid, + int (*detach_mcast)(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid); void (*async_event)(struct ibv_async_event *event); }; @@ -1060,7 +1060,7 @@ int ibv_destroy_ah(struct ibv_ah *ah); * the fabric appropriately. The port associated with the specified * QP must also be a member of the multicast group. */ -int ibv_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid); +int ibv_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid); /** * ibv_detach_mcast - Detaches the specified QP from a multicast group. @@ -1068,7 +1068,7 @@ int ibv_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid); * @gid: Multicast group GID. * @lid: Multicast group LID in host byte order. */ -int ibv_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid); +int ibv_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid); /** * ibv_fork_init - Prepare data structures so that fork() may be used diff --git a/man/ibv_attach_mcast.3 b/man/ibv_attach_mcast.3 index 7d83d56..722ac9f 100644 --- a/man/ibv_attach_mcast.3 +++ b/man/ibv_attach_mcast.3 @@ -8,10 +8,10 @@ ibv_attach_mcast, ibv_detach_mcast \- attach and detach a queue pair .nf .B #include .sp -.BI "int ibv_attach_mcast(struct ibv_qp " "*qp" ", union ibv_gid " "*gid" ", +.BI "int ibv_attach_mcast(struct ibv_qp " "*qp" ", const union ibv_gid " "*gid" ", .BI " uint16_t " "lid" "); .sp -.BI "int ibv_detach_mcast(struct ibv_qp " "*qp" ", union ibv_gid " "*gid" ", +.BI "int ibv_detach_mcast(struct ibv_qp " "*qp" ", const union ibv_gid " "*gid" ", .BI " uint16_t " "lid" "); .fi .SH "DESCRIPTION" diff --git a/src/cmd.c b/src/cmd.c index 66d7134..c2e76cf 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1091,7 +1091,7 @@ int ibv_cmd_destroy_qp(struct ibv_qp *qp) return 0; } -int ibv_cmd_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid) +int ibv_cmd_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid) { struct ibv_attach_mcast cmd; @@ -1107,7 +1107,7 @@ int ibv_cmd_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid) return 0; } -int ibv_cmd_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid) +int ibv_cmd_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid) { struct ibv_detach_mcast cmd; diff --git a/src/verbs.c b/src/verbs.c index 9e370ce..477e412 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -532,13 +532,13 @@ int __ibv_destroy_ah(struct ibv_ah *ah) } default_symver(__ibv_destroy_ah, ibv_destroy_ah); -int __ibv_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid) +int __ibv_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid) { return qp->context->ops.attach_mcast(qp, gid, lid); } default_symver(__ibv_attach_mcast, ibv_attach_mcast); -int __ibv_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid) +int __ibv_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid) { return qp->context->ops.detach_mcast(qp, gid, lid); } -- cgit 1.2.3-korg