Commit 5ac94332 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma

Pull more rdma updates from Jason Gunthorpe:
 "This is being sent to get a fix for the gcc 9.1 build warnings, and
  I've also pulled in some bug fix patches that were posted in the last
  two weeks.

   - Avoid the gcc 9.1 warning about overflowing a union member

   - Fix the wrong callback type for a single response netlink to doit

   - Bug fixes from more usage of the mlx5 devx interface"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
  net/mlx5: Set completion EQs as shared resources
  IB/mlx5: Verify DEVX general object type correctly
  RDMA/core: Change system parameters callback from dumpit to doit
  RDMA: Directly cast the sockaddr union to sockaddr
parents 1064d857 c191f934
...@@ -731,8 +731,8 @@ int roce_resolve_route_from_path(struct sa_path_rec *rec, ...@@ -731,8 +731,8 @@ int roce_resolve_route_from_path(struct sa_path_rec *rec,
if (rec->roce.route_resolved) if (rec->roce.route_resolved)
return 0; return 0;
rdma_gid2ip(&sgid._sockaddr, &rec->sgid); rdma_gid2ip((struct sockaddr *)&sgid, &rec->sgid);
rdma_gid2ip(&dgid._sockaddr, &rec->dgid); rdma_gid2ip((struct sockaddr *)&dgid, &rec->dgid);
if (sgid._sockaddr.sa_family != dgid._sockaddr.sa_family) if (sgid._sockaddr.sa_family != dgid._sockaddr.sa_family)
return -EINVAL; return -EINVAL;
...@@ -743,7 +743,7 @@ int roce_resolve_route_from_path(struct sa_path_rec *rec, ...@@ -743,7 +743,7 @@ int roce_resolve_route_from_path(struct sa_path_rec *rec,
dev_addr.net = &init_net; dev_addr.net = &init_net;
dev_addr.sgid_attr = attr; dev_addr.sgid_attr = attr;
ret = addr_resolve(&sgid._sockaddr, &dgid._sockaddr, ret = addr_resolve((struct sockaddr *)&sgid, (struct sockaddr *)&dgid,
&dev_addr, false, true, 0); &dev_addr, false, true, 0);
if (ret) if (ret)
return ret; return ret;
...@@ -815,22 +815,22 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid, ...@@ -815,22 +815,22 @@ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
struct rdma_dev_addr dev_addr; struct rdma_dev_addr dev_addr;
struct resolve_cb_context ctx; struct resolve_cb_context ctx;
union { union {
struct sockaddr _sockaddr;
struct sockaddr_in _sockaddr_in; struct sockaddr_in _sockaddr_in;
struct sockaddr_in6 _sockaddr_in6; struct sockaddr_in6 _sockaddr_in6;
} sgid_addr, dgid_addr; } sgid_addr, dgid_addr;
int ret; int ret;
rdma_gid2ip(&sgid_addr._sockaddr, sgid); rdma_gid2ip((struct sockaddr *)&sgid_addr, sgid);
rdma_gid2ip(&dgid_addr._sockaddr, dgid); rdma_gid2ip((struct sockaddr *)&dgid_addr, dgid);
memset(&dev_addr, 0, sizeof(dev_addr)); memset(&dev_addr, 0, sizeof(dev_addr));
dev_addr.net = &init_net; dev_addr.net = &init_net;
dev_addr.sgid_attr = sgid_attr; dev_addr.sgid_attr = sgid_attr;
init_completion(&ctx.comp); init_completion(&ctx.comp);
ret = rdma_resolve_ip(&sgid_addr._sockaddr, &dgid_addr._sockaddr, ret = rdma_resolve_ip((struct sockaddr *)&sgid_addr,
&dev_addr, 1000, resolve_cb, true, &ctx); (struct sockaddr *)&dgid_addr, &dev_addr, 1000,
resolve_cb, true, &ctx);
if (ret) if (ret)
return ret; return ret;
......
...@@ -1347,32 +1347,35 @@ static int nldev_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -1347,32 +1347,35 @@ static int nldev_dellink(struct sk_buff *skb, struct nlmsghdr *nlh,
return 0; return 0;
} }
static int nldev_get_sys_get_dumpit(struct sk_buff *skb, static int nldev_sys_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
struct netlink_callback *cb) struct netlink_ext_ack *extack)
{ {
struct nlattr *tb[RDMA_NLDEV_ATTR_MAX]; struct nlattr *tb[RDMA_NLDEV_ATTR_MAX];
struct nlmsghdr *nlh; struct sk_buff *msg;
int err; int err;
err = nlmsg_parse(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1, err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1,
nldev_policy, NULL); nldev_policy, extack);
if (err) if (err)
return err; return err;
nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!msg)
return -ENOMEM;
nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
RDMA_NLDEV_CMD_SYS_GET), RDMA_NLDEV_CMD_SYS_GET),
0, 0); 0, 0);
err = nla_put_u8(skb, RDMA_NLDEV_SYS_ATTR_NETNS_MODE, err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_NETNS_MODE,
(u8)ib_devices_shared_netns); (u8)ib_devices_shared_netns);
if (err) { if (err) {
nlmsg_cancel(skb, nlh); nlmsg_free(msg);
return err; return err;
} }
nlmsg_end(msg, nlh);
nlmsg_end(skb, nlh); return rdma_nl_unicast(msg, NETLINK_CB(skb).portid);
return skb->len;
} }
static int nldev_set_sys_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh, static int nldev_set_sys_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
...@@ -1442,7 +1445,7 @@ static const struct rdma_nl_cbs nldev_cb_table[RDMA_NLDEV_NUM_OPS] = { ...@@ -1442,7 +1445,7 @@ static const struct rdma_nl_cbs nldev_cb_table[RDMA_NLDEV_NUM_OPS] = {
.dump = nldev_res_get_pd_dumpit, .dump = nldev_res_get_pd_dumpit,
}, },
[RDMA_NLDEV_CMD_SYS_GET] = { [RDMA_NLDEV_CMD_SYS_GET] = {
.dump = nldev_get_sys_get_dumpit, .doit = nldev_sys_get_doit,
}, },
[RDMA_NLDEV_CMD_SYS_SET] = { [RDMA_NLDEV_CMD_SYS_SET] = {
.doit = nldev_set_sys_set_doit, .doit = nldev_set_sys_set_doit,
......
...@@ -154,7 +154,7 @@ bool mlx5_ib_devx_is_flow_counter(void *obj, u32 *counter_id) ...@@ -154,7 +154,7 @@ bool mlx5_ib_devx_is_flow_counter(void *obj, u32 *counter_id)
* must be considered upon checking for a valid object id. * must be considered upon checking for a valid object id.
* For that the opcode of the creator command is encoded as part of the obj_id. * For that the opcode of the creator command is encoded as part of the obj_id.
*/ */
static u64 get_enc_obj_id(u16 opcode, u32 obj_id) static u64 get_enc_obj_id(u32 opcode, u32 obj_id)
{ {
return ((u64)opcode << 32) | obj_id; return ((u64)opcode << 32) | obj_id;
} }
...@@ -167,7 +167,9 @@ static u64 devx_get_obj_id(const void *in) ...@@ -167,7 +167,9 @@ static u64 devx_get_obj_id(const void *in)
switch (opcode) { switch (opcode) {
case MLX5_CMD_OP_MODIFY_GENERAL_OBJECT: case MLX5_CMD_OP_MODIFY_GENERAL_OBJECT:
case MLX5_CMD_OP_QUERY_GENERAL_OBJECT: case MLX5_CMD_OP_QUERY_GENERAL_OBJECT:
obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_GENERAL_OBJECT, obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_GENERAL_OBJECT |
MLX5_GET(general_obj_in_cmd_hdr, in,
obj_type) << 16,
MLX5_GET(general_obj_in_cmd_hdr, in, MLX5_GET(general_obj_in_cmd_hdr, in,
obj_id)); obj_id));
break; break;
...@@ -1171,6 +1173,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)( ...@@ -1171,6 +1173,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
struct mlx5_ib_dev *dev = to_mdev(c->ibucontext.device); struct mlx5_ib_dev *dev = to_mdev(c->ibucontext.device);
u32 out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)]; u32 out[MLX5_ST_SZ_DW(general_obj_out_cmd_hdr)];
struct devx_obj *obj; struct devx_obj *obj;
u16 obj_type = 0;
int err; int err;
int uid; int uid;
u32 obj_id; u32 obj_id;
...@@ -1230,7 +1233,11 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)( ...@@ -1230,7 +1233,11 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
if (err) if (err)
goto err_copy; goto err_copy;
obj->obj_id = get_enc_obj_id(opcode, obj_id); if (opcode == MLX5_CMD_OP_CREATE_GENERAL_OBJECT)
obj_type = MLX5_GET(general_obj_in_cmd_hdr, cmd_in, obj_type);
obj->obj_id = get_enc_obj_id(opcode | obj_type << 16, obj_id);
return 0; return 0;
err_copy: err_copy:
......
...@@ -83,7 +83,6 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, ...@@ -83,7 +83,6 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah,
struct iphdr ipv4; struct iphdr ipv4;
const struct ib_global_route *ib_grh; const struct ib_global_route *ib_grh;
union { union {
struct sockaddr _sockaddr;
struct sockaddr_in _sockaddr_in; struct sockaddr_in _sockaddr_in;
struct sockaddr_in6 _sockaddr_in6; struct sockaddr_in6 _sockaddr_in6;
} sgid_addr, dgid_addr; } sgid_addr, dgid_addr;
...@@ -133,9 +132,9 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, ...@@ -133,9 +132,9 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah,
ipv4.tot_len = htons(0); ipv4.tot_len = htons(0);
ipv4.ttl = ib_grh->hop_limit; ipv4.ttl = ib_grh->hop_limit;
ipv4.protocol = nxthdr; ipv4.protocol = nxthdr;
rdma_gid2ip(&sgid_addr._sockaddr, sgid); rdma_gid2ip((struct sockaddr *)&sgid_addr, sgid);
ipv4.saddr = sgid_addr._sockaddr_in.sin_addr.s_addr; ipv4.saddr = sgid_addr._sockaddr_in.sin_addr.s_addr;
rdma_gid2ip(&dgid_addr._sockaddr, &ib_grh->dgid); rdma_gid2ip((struct sockaddr*)&dgid_addr, &ib_grh->dgid);
ipv4.daddr = dgid_addr._sockaddr_in.sin_addr.s_addr; ipv4.daddr = dgid_addr._sockaddr_in.sin_addr.s_addr;
memcpy((u8 *)ah->av + eth_sz, &ipv4, sizeof(struct iphdr)); memcpy((u8 *)ah->av + eth_sz, &ipv4, sizeof(struct iphdr));
} else { } else {
......
...@@ -2499,7 +2499,6 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp, ...@@ -2499,7 +2499,6 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp,
u16 vlan_id = 0xFFFF; u16 vlan_id = 0xFFFF;
u8 mac_addr[6], hdr_type; u8 mac_addr[6], hdr_type;
union { union {
struct sockaddr _sockaddr;
struct sockaddr_in _sockaddr_in; struct sockaddr_in _sockaddr_in;
struct sockaddr_in6 _sockaddr_in6; struct sockaddr_in6 _sockaddr_in6;
} sgid_addr, dgid_addr; } sgid_addr, dgid_addr;
...@@ -2542,8 +2541,8 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp, ...@@ -2542,8 +2541,8 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp,
hdr_type = rdma_gid_attr_network_type(sgid_attr); hdr_type = rdma_gid_attr_network_type(sgid_attr);
if (hdr_type == RDMA_NETWORK_IPV4) { if (hdr_type == RDMA_NETWORK_IPV4) {
rdma_gid2ip(&sgid_addr._sockaddr, &sgid_attr->gid); rdma_gid2ip((struct sockaddr *)&sgid_addr, &sgid_attr->gid);
rdma_gid2ip(&dgid_addr._sockaddr, &grh->dgid); rdma_gid2ip((struct sockaddr *)&dgid_addr, &grh->dgid);
memcpy(&cmd->params.dgid[0], memcpy(&cmd->params.dgid[0],
&dgid_addr._sockaddr_in.sin_addr.s_addr, 4); &dgid_addr._sockaddr_in.sin_addr.s_addr, 4);
memcpy(&cmd->params.sgid[0], memcpy(&cmd->params.sgid[0],
......
...@@ -291,6 +291,9 @@ create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, const char *name, ...@@ -291,6 +291,9 @@ create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, const char *name,
mlx5_fill_page_array(&eq->buf, pas); mlx5_fill_page_array(&eq->buf, pas);
MLX5_SET(create_eq_in, in, opcode, MLX5_CMD_OP_CREATE_EQ); MLX5_SET(create_eq_in, in, opcode, MLX5_CMD_OP_CREATE_EQ);
if (!param->mask && MLX5_CAP_GEN(dev, log_max_uctx))
MLX5_SET(create_eq_in, in, uid, MLX5_SHARED_RESOURCE_UID);
MLX5_SET64(create_eq_in, in, event_bitmask, param->mask); MLX5_SET64(create_eq_in, in, event_bitmask, param->mask);
eqc = MLX5_ADDR_OF(create_eq_in, in, eq_context_entry); eqc = MLX5_ADDR_OF(create_eq_in, in, eq_context_entry);
......
...@@ -7344,7 +7344,7 @@ struct mlx5_ifc_create_eq_out_bits { ...@@ -7344,7 +7344,7 @@ struct mlx5_ifc_create_eq_out_bits {
struct mlx5_ifc_create_eq_in_bits { struct mlx5_ifc_create_eq_in_bits {
u8 opcode[0x10]; u8 opcode[0x10];
u8 reserved_at_10[0x10]; u8 uid[0x10];
u8 reserved_at_20[0x10]; u8 reserved_at_20[0x10];
u8 op_mod[0x10]; u8 op_mod[0x10];
......
...@@ -250,7 +250,7 @@ enum rdma_nldev_command { ...@@ -250,7 +250,7 @@ enum rdma_nldev_command {
RDMA_NLDEV_CMD_PORT_GET, /* can dump */ RDMA_NLDEV_CMD_PORT_GET, /* can dump */
RDMA_NLDEV_CMD_SYS_GET, /* can dump */ RDMA_NLDEV_CMD_SYS_GET,
RDMA_NLDEV_CMD_SYS_SET, RDMA_NLDEV_CMD_SYS_SET,
/* 8 is free to use */ /* 8 is free to use */
......
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