diff mbox

RDMA/cxgb3: Use structs to describe the uABI instead of opencoding

Message ID 20180320195950.GA4095@ziepe.ca (mailing list archive)
State Accepted
Headers show

Commit Message

Jason Gunthorpe March 20, 2018, 7:59 p.m. UTC
Open coding a loose value is not acceptable for describing the uABI in
RDMA. Provide the missing struct.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 drivers/infiniband/hw/cxgb3/iwch_provider.c | 4 +++-
 include/uapi/rdma/cxgb3-abi.h               | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

Same thing as for cxgb4

Comments

Steve Wise March 20, 2018, 8:03 p.m. UTC | #1
> 
> Open coding a loose value is not acceptable for describing the uABI in
> RDMA. Provide the missing struct.
> 
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

Acked-by: Steve Wise <swise@opengridcomputing.com>


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe March 21, 2018, 8:07 p.m. UTC | #2
On Tue, Mar 20, 2018 at 01:59:50PM -0600, Jason Gunthorpe wrote:
> Open coding a loose value is not acceptable for describing the uABI in
> RDMA. Provide the missing struct.
> 
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> Acked-by: Steve Wise <swise@opengridcomputing.com>
> ---
>  drivers/infiniband/hw/cxgb3/iwch_provider.c | 4 +++-
>  include/uapi/rdma/cxgb3-abi.h               | 5 +++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> Same thing as for cxgb4

Applied to for-next

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 1804b6c4a6ec13..be097c6723c0f2 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -440,7 +440,9 @@  static struct ib_pd *iwch_allocate_pd(struct ib_device *ibdev,
 	php->pdid = pdid;
 	php->rhp = rhp;
 	if (context) {
-		if (ib_copy_to_udata(udata, &php->pdid, sizeof (__u32))) {
+		struct iwch_alloc_pd_resp resp = {.pdid = php->pdid};
+
+		if (ib_copy_to_udata(udata, &resp, sizeof(resp))) {
 			iwch_deallocate_pd(&php->ibpd);
 			return ERR_PTR(-EFAULT);
 		}
diff --git a/include/uapi/rdma/cxgb3-abi.h b/include/uapi/rdma/cxgb3-abi.h
index bb1c582c4ff07c..9acb4b7a624633 100644
--- a/include/uapi/rdma/cxgb3-abi.h
+++ b/include/uapi/rdma/cxgb3-abi.h
@@ -74,4 +74,9 @@  struct iwch_create_qp_resp {
 struct iwch_reg_user_mr_resp {
 	__u32 pbl_addr;
 };
+
+struct iwch_alloc_pd_resp {
+	__u32 pdid;
+};
+
 #endif /* CXGB3_ABI_USER_H */