@@ -1803,7 +1803,9 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
int ibv_cmd_create_flow(struct ibv_qp *qp,
struct ibv_flow *flow_id,
- struct ibv_flow_attr *flow_attr)
+ struct ibv_flow_attr *flow_attr,
+ void *ucmd,
+ size_t ucmd_size)
{
struct ibv_create_flow *cmd;
struct ib_uverbs_destroy_flow resp;
@@ -1815,8 +1817,8 @@ int ibv_cmd_create_flow(struct ibv_qp *qp,
cmd_size = sizeof(*cmd) + (flow_attr->num_of_specs *
sizeof(struct ibv_kern_spec));
- cmd = alloca(cmd_size);
- memset(cmd, 0, cmd_size);
+ cmd = alloca(cmd_size + ucmd_size);
+ memset(cmd, 0, cmd_size + ucmd_size);
cmd->qp_handle = qp->handle;
@@ -1841,7 +1843,13 @@ int ibv_cmd_create_flow(struct ibv_qp *qp,
}
written_size = sizeof(*cmd) + cmd->flow_attr.size;
- IBV_INIT_CMD_RESP_EX_VCMD(cmd, written_size, written_size, CREATE_FLOW,
+ if (ucmd) {
+ memcpy((char *)cmd + written_size, ucmd, ucmd_size);
+ written_size += ucmd_size;
+ }
+
+ IBV_INIT_CMD_RESP_EX_VCMD(cmd, written_size - ucmd_size,
+ written_size, CREATE_FLOW,
&resp, sizeof(resp));
if (write(qp->context->cmd_fd, cmd, written_size) != written_size)
goto err;
@@ -514,7 +514,9 @@ int ibv_cmd_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t l
int ibv_cmd_create_flow(struct ibv_qp *qp,
struct ibv_flow *flow_id,
- struct ibv_flow_attr *flow_attr);
+ struct ibv_flow_attr *flow_attr,
+ void *ucmd,
+ size_t ucmd_size);
int ibv_cmd_destroy_flow(struct ibv_flow *flow_id);
int ibv_cmd_create_wq(struct ibv_context *context,
struct ibv_wq_init_attr *wq_init_attr,
@@ -1543,7 +1543,8 @@ struct ibv_flow *mlx4_create_flow(struct ibv_qp *qp, struct ibv_flow_attr *flow_
if (!flow_id)
return NULL;
- ret = ibv_cmd_create_flow(qp, flow_id, flow_attr);
+ ret = ibv_cmd_create_flow(qp, flow_id, flow_attr,
+ NULL, 0);
if (!ret)
return flow_id;
@@ -2942,7 +2942,8 @@ struct ibv_flow *mlx5_create_flow(struct ibv_qp *qp, struct ibv_flow_attr *flow_
if (!flow_id)
return NULL;
- ret = ibv_cmd_create_flow(qp, flow_id, flow_attr);
+ ret = ibv_cmd_create_flow(qp, flow_id, flow_attr,
+ NULL, 0);
if (!ret)
return flow_id;