Commit 87915bf8 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Doug Ledford

RDMA/verbs: Return proper error code for not supported system call

The proper return error is -EOPNOTSUPP and not -ENOSYS, so update
all places in verbs.c to match this semantics.
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 372e15c5
...@@ -655,7 +655,7 @@ int rdma_modify_ah(struct ib_ah *ah, struct rdma_ah_attr *ah_attr) ...@@ -655,7 +655,7 @@ int rdma_modify_ah(struct ib_ah *ah, struct rdma_ah_attr *ah_attr)
return ah->device->modify_ah ? return ah->device->modify_ah ?
ah->device->modify_ah(ah, ah_attr) : ah->device->modify_ah(ah, ah_attr) :
-ENOSYS; -EOPNOTSUPP;
} }
EXPORT_SYMBOL(rdma_modify_ah); EXPORT_SYMBOL(rdma_modify_ah);
...@@ -663,7 +663,7 @@ int rdma_query_ah(struct ib_ah *ah, struct rdma_ah_attr *ah_attr) ...@@ -663,7 +663,7 @@ int rdma_query_ah(struct ib_ah *ah, struct rdma_ah_attr *ah_attr)
{ {
return ah->device->query_ah ? return ah->device->query_ah ?
ah->device->query_ah(ah, ah_attr) : ah->device->query_ah(ah, ah_attr) :
-ENOSYS; -EOPNOTSUPP;
} }
EXPORT_SYMBOL(rdma_query_ah); EXPORT_SYMBOL(rdma_query_ah);
...@@ -689,7 +689,7 @@ struct ib_srq *ib_create_srq(struct ib_pd *pd, ...@@ -689,7 +689,7 @@ struct ib_srq *ib_create_srq(struct ib_pd *pd,
struct ib_srq *srq; struct ib_srq *srq;
if (!pd->device->create_srq) if (!pd->device->create_srq)
return ERR_PTR(-ENOSYS); return ERR_PTR(-EOPNOTSUPP);
srq = pd->device->create_srq(pd, srq_init_attr, NULL); srq = pd->device->create_srq(pd, srq_init_attr, NULL);
...@@ -722,7 +722,7 @@ int ib_modify_srq(struct ib_srq *srq, ...@@ -722,7 +722,7 @@ int ib_modify_srq(struct ib_srq *srq,
{ {
return srq->device->modify_srq ? return srq->device->modify_srq ?
srq->device->modify_srq(srq, srq_attr, srq_attr_mask, NULL) : srq->device->modify_srq(srq, srq_attr, srq_attr_mask, NULL) :
-ENOSYS; -EOPNOTSUPP;
} }
EXPORT_SYMBOL(ib_modify_srq); EXPORT_SYMBOL(ib_modify_srq);
...@@ -730,7 +730,7 @@ int ib_query_srq(struct ib_srq *srq, ...@@ -730,7 +730,7 @@ int ib_query_srq(struct ib_srq *srq,
struct ib_srq_attr *srq_attr) struct ib_srq_attr *srq_attr)
{ {
return srq->device->query_srq ? return srq->device->query_srq ?
srq->device->query_srq(srq, srq_attr) : -ENOSYS; srq->device->query_srq(srq, srq_attr) : -EOPNOTSUPP;
} }
EXPORT_SYMBOL(ib_query_srq); EXPORT_SYMBOL(ib_query_srq);
...@@ -1457,7 +1457,7 @@ int ib_query_qp(struct ib_qp *qp, ...@@ -1457,7 +1457,7 @@ int ib_query_qp(struct ib_qp *qp,
{ {
return qp->device->query_qp ? return qp->device->query_qp ?
qp->device->query_qp(qp->real_qp, qp_attr, qp_attr_mask, qp_init_attr) : qp->device->query_qp(qp->real_qp, qp_attr, qp_attr_mask, qp_init_attr) :
-ENOSYS; -EOPNOTSUPP;
} }
EXPORT_SYMBOL(ib_query_qp); EXPORT_SYMBOL(ib_query_qp);
...@@ -1594,7 +1594,7 @@ EXPORT_SYMBOL(ib_create_cq); ...@@ -1594,7 +1594,7 @@ EXPORT_SYMBOL(ib_create_cq);
int rdma_set_cq_moderation(struct ib_cq *cq, u16 cq_count, u16 cq_period) int rdma_set_cq_moderation(struct ib_cq *cq, u16 cq_count, u16 cq_period)
{ {
return cq->device->modify_cq ? return cq->device->modify_cq ?
cq->device->modify_cq(cq, cq_count, cq_period) : -ENOSYS; cq->device->modify_cq(cq, cq_count, cq_period) : -EOPNOTSUPP;
} }
EXPORT_SYMBOL(rdma_set_cq_moderation); EXPORT_SYMBOL(rdma_set_cq_moderation);
...@@ -1611,7 +1611,7 @@ EXPORT_SYMBOL(ib_destroy_cq); ...@@ -1611,7 +1611,7 @@ EXPORT_SYMBOL(ib_destroy_cq);
int ib_resize_cq(struct ib_cq *cq, int cqe) int ib_resize_cq(struct ib_cq *cq, int cqe)
{ {
return cq->device->resize_cq ? return cq->device->resize_cq ?
cq->device->resize_cq(cq, cqe, NULL) : -ENOSYS; cq->device->resize_cq(cq, cqe, NULL) : -EOPNOTSUPP;
} }
EXPORT_SYMBOL(ib_resize_cq); EXPORT_SYMBOL(ib_resize_cq);
...@@ -1649,7 +1649,7 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd, ...@@ -1649,7 +1649,7 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
struct ib_mr *mr; struct ib_mr *mr;
if (!pd->device->alloc_mr) if (!pd->device->alloc_mr)
return ERR_PTR(-ENOSYS); return ERR_PTR(-EOPNOTSUPP);
mr = pd->device->alloc_mr(pd, mr_type, max_num_sg); mr = pd->device->alloc_mr(pd, mr_type, max_num_sg);
if (!IS_ERR(mr)) { if (!IS_ERR(mr)) {
...@@ -1673,7 +1673,7 @@ struct ib_fmr *ib_alloc_fmr(struct ib_pd *pd, ...@@ -1673,7 +1673,7 @@ struct ib_fmr *ib_alloc_fmr(struct ib_pd *pd,
struct ib_fmr *fmr; struct ib_fmr *fmr;
if (!pd->device->alloc_fmr) if (!pd->device->alloc_fmr)
return ERR_PTR(-ENOSYS); return ERR_PTR(-EOPNOTSUPP);
fmr = pd->device->alloc_fmr(pd, mr_access_flags, fmr_attr); fmr = pd->device->alloc_fmr(pd, mr_access_flags, fmr_attr);
if (!IS_ERR(fmr)) { if (!IS_ERR(fmr)) {
...@@ -1757,7 +1757,7 @@ int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) ...@@ -1757,7 +1757,7 @@ int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)
int ret; int ret;
if (!qp->device->attach_mcast) if (!qp->device->attach_mcast)
return -ENOSYS; return -EOPNOTSUPP;
if (!rdma_is_multicast_addr((struct in6_addr *)gid->raw) || if (!rdma_is_multicast_addr((struct in6_addr *)gid->raw) ||
qp->qp_type != IB_QPT_UD || !is_valid_mcast_lid(qp, lid)) qp->qp_type != IB_QPT_UD || !is_valid_mcast_lid(qp, lid))
...@@ -1775,7 +1775,7 @@ int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) ...@@ -1775,7 +1775,7 @@ int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)
int ret; int ret;
if (!qp->device->detach_mcast) if (!qp->device->detach_mcast)
return -ENOSYS; return -EOPNOTSUPP;
if (!rdma_is_multicast_addr((struct in6_addr *)gid->raw) || if (!rdma_is_multicast_addr((struct in6_addr *)gid->raw) ||
qp->qp_type != IB_QPT_UD || !is_valid_mcast_lid(qp, lid)) qp->qp_type != IB_QPT_UD || !is_valid_mcast_lid(qp, lid))
...@@ -1793,7 +1793,7 @@ struct ib_xrcd *__ib_alloc_xrcd(struct ib_device *device, const char *caller) ...@@ -1793,7 +1793,7 @@ struct ib_xrcd *__ib_alloc_xrcd(struct ib_device *device, const char *caller)
struct ib_xrcd *xrcd; struct ib_xrcd *xrcd;
if (!device->alloc_xrcd) if (!device->alloc_xrcd)
return ERR_PTR(-ENOSYS); return ERR_PTR(-EOPNOTSUPP);
xrcd = device->alloc_xrcd(device, NULL, NULL); xrcd = device->alloc_xrcd(device, NULL, NULL);
if (!IS_ERR(xrcd)) { if (!IS_ERR(xrcd)) {
...@@ -1847,7 +1847,7 @@ struct ib_wq *ib_create_wq(struct ib_pd *pd, ...@@ -1847,7 +1847,7 @@ struct ib_wq *ib_create_wq(struct ib_pd *pd,
struct ib_wq *wq; struct ib_wq *wq;
if (!pd->device->create_wq) if (!pd->device->create_wq)
return ERR_PTR(-ENOSYS); return ERR_PTR(-EOPNOTSUPP);
wq = pd->device->create_wq(pd, wq_attr, NULL); wq = pd->device->create_wq(pd, wq_attr, NULL);
if (!IS_ERR(wq)) { if (!IS_ERR(wq)) {
...@@ -1902,7 +1902,7 @@ int ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *wq_attr, ...@@ -1902,7 +1902,7 @@ int ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *wq_attr,
int err; int err;
if (!wq->device->modify_wq) if (!wq->device->modify_wq)
return -ENOSYS; return -EOPNOTSUPP;
err = wq->device->modify_wq(wq, wq_attr, wq_attr_mask, NULL); err = wq->device->modify_wq(wq, wq_attr, wq_attr_mask, NULL);
return err; return err;
...@@ -1927,7 +1927,7 @@ struct ib_rwq_ind_table *ib_create_rwq_ind_table(struct ib_device *device, ...@@ -1927,7 +1927,7 @@ struct ib_rwq_ind_table *ib_create_rwq_ind_table(struct ib_device *device,
u32 table_size; u32 table_size;
if (!device->create_rwq_ind_table) if (!device->create_rwq_ind_table)
return ERR_PTR(-ENOSYS); return ERR_PTR(-EOPNOTSUPP);
table_size = (1 << init_attr->log_ind_tbl_size); table_size = (1 << init_attr->log_ind_tbl_size);
rwq_ind_table = device->create_rwq_ind_table(device, rwq_ind_table = device->create_rwq_ind_table(device,
...@@ -1977,7 +1977,7 @@ struct ib_flow *ib_create_flow(struct ib_qp *qp, ...@@ -1977,7 +1977,7 @@ struct ib_flow *ib_create_flow(struct ib_qp *qp,
{ {
struct ib_flow *flow_id; struct ib_flow *flow_id;
if (!qp->device->create_flow) if (!qp->device->create_flow)
return ERR_PTR(-ENOSYS); return ERR_PTR(-EOPNOTSUPP);
flow_id = qp->device->create_flow(qp, flow_attr, domain); flow_id = qp->device->create_flow(qp, flow_attr, domain);
if (!IS_ERR(flow_id)) { if (!IS_ERR(flow_id)) {
...@@ -2004,7 +2004,7 @@ int ib_check_mr_status(struct ib_mr *mr, u32 check_mask, ...@@ -2004,7 +2004,7 @@ int ib_check_mr_status(struct ib_mr *mr, u32 check_mask,
struct ib_mr_status *mr_status) struct ib_mr_status *mr_status)
{ {
return mr->device->check_mr_status ? return mr->device->check_mr_status ?
mr->device->check_mr_status(mr, check_mask, mr_status) : -ENOSYS; mr->device->check_mr_status(mr, check_mask, mr_status) : -EOPNOTSUPP;
} }
EXPORT_SYMBOL(ib_check_mr_status); EXPORT_SYMBOL(ib_check_mr_status);
...@@ -2012,7 +2012,7 @@ int ib_set_vf_link_state(struct ib_device *device, int vf, u8 port, ...@@ -2012,7 +2012,7 @@ int ib_set_vf_link_state(struct ib_device *device, int vf, u8 port,
int state) int state)
{ {
if (!device->set_vf_link_state) if (!device->set_vf_link_state)
return -ENOSYS; return -EOPNOTSUPP;
return device->set_vf_link_state(device, vf, port, state); return device->set_vf_link_state(device, vf, port, state);
} }
...@@ -2022,7 +2022,7 @@ int ib_get_vf_config(struct ib_device *device, int vf, u8 port, ...@@ -2022,7 +2022,7 @@ int ib_get_vf_config(struct ib_device *device, int vf, u8 port,
struct ifla_vf_info *info) struct ifla_vf_info *info)
{ {
if (!device->get_vf_config) if (!device->get_vf_config)
return -ENOSYS; return -EOPNOTSUPP;
return device->get_vf_config(device, vf, port, info); return device->get_vf_config(device, vf, port, info);
} }
...@@ -2032,7 +2032,7 @@ int ib_get_vf_stats(struct ib_device *device, int vf, u8 port, ...@@ -2032,7 +2032,7 @@ int ib_get_vf_stats(struct ib_device *device, int vf, u8 port,
struct ifla_vf_stats *stats) struct ifla_vf_stats *stats)
{ {
if (!device->get_vf_stats) if (!device->get_vf_stats)
return -ENOSYS; return -EOPNOTSUPP;
return device->get_vf_stats(device, vf, port, stats); return device->get_vf_stats(device, vf, port, stats);
} }
...@@ -2042,7 +2042,7 @@ int ib_set_vf_guid(struct ib_device *device, int vf, u8 port, u64 guid, ...@@ -2042,7 +2042,7 @@ int ib_set_vf_guid(struct ib_device *device, int vf, u8 port, u64 guid,
int type) int type)
{ {
if (!device->set_vf_guid) if (!device->set_vf_guid)
return -ENOSYS; return -EOPNOTSUPP;
return device->set_vf_guid(device, vf, port, guid, type); return device->set_vf_guid(device, vf, port, guid, type);
} }
...@@ -2077,7 +2077,7 @@ int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents, ...@@ -2077,7 +2077,7 @@ int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents,
unsigned int *sg_offset, unsigned int page_size) unsigned int *sg_offset, unsigned int page_size)
{ {
if (unlikely(!mr->device->map_mr_sg)) if (unlikely(!mr->device->map_mr_sg))
return -ENOSYS; return -EOPNOTSUPP;
mr->page_size = page_size; mr->page_size = page_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment