mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 18:20:52 +07:00
RDMA/mlx4: Delete duplicated offsetofend implementation
Convert mlx4 to use in-kernel offsetofend() instead of its duplicated implementation. Link: https://lore.kernel.org/r/20200310091438.248429-3-leon@kernel.org Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
41e684ef3f
commit
282e79c1c6
@ -434,9 +434,6 @@ int mlx4_ib_gid_index_to_real_index(struct mlx4_ib_dev *ibdev,
|
|||||||
return real_index;
|
return real_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define field_avail(type, fld, sz) (offsetof(type, fld) + \
|
|
||||||
sizeof(((type *)0)->fld) <= (sz))
|
|
||||||
|
|
||||||
static int mlx4_ib_query_device(struct ib_device *ibdev,
|
static int mlx4_ib_query_device(struct ib_device *ibdev,
|
||||||
struct ib_device_attr *props,
|
struct ib_device_attr *props,
|
||||||
struct ib_udata *uhw)
|
struct ib_udata *uhw)
|
||||||
@ -447,7 +444,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
|
|||||||
int err;
|
int err;
|
||||||
int have_ib_ports;
|
int have_ib_ports;
|
||||||
struct mlx4_uverbs_ex_query_device cmd;
|
struct mlx4_uverbs_ex_query_device cmd;
|
||||||
struct mlx4_uverbs_ex_query_device_resp resp = {.comp_mask = 0};
|
struct mlx4_uverbs_ex_query_device_resp resp = {};
|
||||||
struct mlx4_clock_params clock_params;
|
struct mlx4_clock_params clock_params;
|
||||||
|
|
||||||
if (uhw->inlen) {
|
if (uhw->inlen) {
|
||||||
@ -602,7 +599,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
|
|||||||
sizeof(struct mlx4_wqe_data_seg);
|
sizeof(struct mlx4_wqe_data_seg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field_avail(typeof(resp), rss_caps, uhw->outlen)) {
|
if (offsetofend(typeof(resp), rss_caps) <= uhw->outlen) {
|
||||||
if (props->rss_caps.supported_qpts) {
|
if (props->rss_caps.supported_qpts) {
|
||||||
resp.rss_caps.rx_hash_function =
|
resp.rss_caps.rx_hash_function =
|
||||||
MLX4_IB_RX_HASH_FUNC_TOEPLITZ;
|
MLX4_IB_RX_HASH_FUNC_TOEPLITZ;
|
||||||
@ -626,7 +623,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
|
|||||||
sizeof(resp.rss_caps);
|
sizeof(resp.rss_caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field_avail(typeof(resp), tso_caps, uhw->outlen)) {
|
if (offsetofend(typeof(resp), tso_caps) <= uhw->outlen) {
|
||||||
if (dev->dev->caps.max_gso_sz &&
|
if (dev->dev->caps.max_gso_sz &&
|
||||||
((mlx4_ib_port_link_layer(ibdev, 1) ==
|
((mlx4_ib_port_link_layer(ibdev, 1) ==
|
||||||
IB_LINK_LAYER_ETHERNET) ||
|
IB_LINK_LAYER_ETHERNET) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user