When Direct Rules API is not supported we don't set the errno.
This results in failing the function but with errno equals to zero.
The result of this is that a function that failed, is considered as
a function that worked correctly.
This commit fixes this issue by setting the errno to ENOTSUP and
returning this error when error value should be returned.
Since RDMA-CORE are returning positive errno we are also returning
positive error values.
Fixes:
4f84a19779ca ("net/mlx5: add Direct Rules API")
Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V45
(void)context;
(void)init_attr;
+ errno = ENOTSUP;
return NULL;
#else
return ibv_create_counters(context, init_attr);
return mlx5dv_dr_action_create_dest_table(tbl);
#else
(void)tbl;
+ errno = ENOTSUP;
return NULL;
#endif
}
#else
(void)domain;
(void)vport;
+ errno = ENOTSUP;
return NULL;
#endif
}
#ifdef HAVE_MLX5DV_DR_ESWITCH
return mlx5dv_dr_action_create_drop();
#else
+ errno = ENOTSUP;
return NULL;
#endif
}
#else
(void)domain;
(void)level;
+ errno = ENOTSUP;
return NULL;
#endif
}
return mlx5dv_dr_table_destroy(tbl);
#else
(void)tbl;
- return 0;
+ errno = ENOTSUP;
+ return errno;
#endif
}
#else
(void)ctx;
(void)domain;
+ errno = ENOTSUP;
return NULL;
#endif
}
return mlx5dv_dr_domain_destroy(domain);
#else
(void)domain;
- return 0;
+ errno = ENOTSUP;
+ return errno;
#endif
}
(void)context;
(void)wq_attr;
(void)mlx5_wq_attr;
+ errno = ENOTSUP;
return NULL;
#else
return mlx5dv_create_wq(context, wq_attr, mlx5_wq_attr);
(void)context;
(void)qp_init_attr_ex;
(void)dv_qp_init_attr;
+ errno = ENOTSUP;
return NULL;
#endif
}
(void)context;
(void)matcher_attr;
(void)tbl;
+ errno = ENOTSUP;
return NULL;
#endif
}
#else
(void)counter_obj;
(void)offset;
+ errno = ENOTSUP;
return NULL;
#endif
}
#endif
#else
(void)qp;
+ errno = ENOTSUP;
return NULL;
#endif
}
(void)flags;
(void)actions_sz;
(void)actions;
+ errno = ENOTSUP;
return NULL;
#endif
}
(void)flags;
(void)data_sz;
(void)data;
+ errno = ENOTSUP;
return NULL;
#endif
}
#endif
#endif
(void)tag;
+ errno = ENOTSUP;
return NULL;
}
#endif
#else
(void)matcher;
- return 0;
+ errno = ENOTSUP;
+ return errno;
#endif
}
});
#else
(void)device;
+ errno = ENOTSUP;
return NULL;
#endif
}
(void)inlen;
(void)out;
(void)outlen;
+ errno = ENOTSUP;
return NULL;
#endif
}