On 10/15/2018 11:29 PM, Jason Gunthorpe wrote: > On Wed, Oct 10, 2018 at 09:55:10AM +0300, Leon Romanovsky wrote: >> From: Mark Bloch <markb@xxxxxxxxxxxx> >> >> A user can provide a hint which will be attached to the packet and >> written to the CQE on receive. This can be used as a way to offload >> operations into the HW, for example parsing a packet which is a tunneled >> packet, and if so, pass 0x1 as the hint. The software can use that hint >> to decapsulate the packet and parse only the inner headers thus saving >> CPU cycles. >> >> Signed-off-by: Mark Bloch <markb@xxxxxxxxxxxx> >> Reviewed-by: Yishai Hadas <yishaih@xxxxxxxxxxxx> >> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> >> --- >> drivers/infiniband/hw/mlx5/flow.c | 15 ++++++++++++++- >> include/uapi/rdma/mlx5_user_ioctl_cmds.h | 1 + >> 2 files changed, 15 insertions(+), 1 deletion(-) > > Applied to for-next, thanks > >> diff --git a/drivers/infiniband/hw/mlx5/flow.c b/drivers/infiniband/hw/mlx5/flow.c >> index 4ee4af450720..e57435cb6d96 100644 >> --- a/drivers/infiniband/hw/mlx5/flow.c >> +++ b/drivers/infiniband/hw/mlx5/flow.c >> @@ -153,6 +153,16 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_CREATE_FLOW)( >> arr_flow_actions[i]->object); >> } >> >> + ret = uverbs_copy_from(&flow_act.flow_tag, attrs, >> + MLX5_IB_ATTR_CREATE_FLOW_TAG); >> + if (!ret) { >> + if (flow_act.flow_tag >= BIT(24)) { >> + ret = -EINVAL; >> + goto err_out; >> + } >> + flow_act.has_flow_tag = true; >> + } > > I'm not super keen on this pattern though, uverbs_copy_from can fail > with more than ENOENT, but since the attribute is inline it can't in > this case. Little too tricky perhaps. I know, the entire handler isn't very pretty (I'm mostly to blame :)) There was a lot of code/logic pushed recently, I hope/want to clean it up a bit once things settle down. > > Jason > Mark