mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
RDMA/hns: Use structs to describe the uABI instead of opencoding
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>
This commit is contained in:
parent
9a657b4c4a
commit
633fb4d9fd
2 changed files with 9 additions and 1 deletions
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
|
#include <uapi/rdma/hns-abi.h>
|
||||||
#include "hns_roce_device.h"
|
#include "hns_roce_device.h"
|
||||||
|
|
||||||
static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn)
|
static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn)
|
||||||
|
@ -77,7 +78,9 @@ struct ib_pd *hns_roce_alloc_pd(struct ib_device *ib_dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context) {
|
if (context) {
|
||||||
if (ib_copy_to_udata(udata, &pd->pdn, sizeof(u64))) {
|
struct hns_roce_ib_alloc_pd_resp uresp = {.pdn = pd->pdn};
|
||||||
|
|
||||||
|
if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
|
||||||
hns_roce_pd_free(to_hr_dev(ib_dev), pd->pdn);
|
hns_roce_pd_free(to_hr_dev(ib_dev), pd->pdn);
|
||||||
dev_err(dev, "[alloc_pd]ib_copy_to_udata failed!\n");
|
dev_err(dev, "[alloc_pd]ib_copy_to_udata failed!\n");
|
||||||
kfree(pd);
|
kfree(pd);
|
||||||
|
|
|
@ -63,4 +63,9 @@ struct hns_roce_ib_alloc_ucontext_resp {
|
||||||
__u32 qp_tab_size;
|
__u32 qp_tab_size;
|
||||||
__u32 reserved;
|
__u32 reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct hns_roce_ib_alloc_pd_resp {
|
||||||
|
__u32 pdn;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* HNS_ABI_USER_H */
|
#endif /* HNS_ABI_USER_H */
|
||||||
|
|
Loading…
Reference in a new issue