diff options
author | Mark Bloch <markb@mellanox.com> | 2018-10-10 09:55:10 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-10-16 00:24:45 -0600 |
commit | ba4a41198324be2e6fbb06c270fdc8500c0e38de (patch) | |
tree | 248e948fad5e04630bdd4db1c8636fa18fff48c4 /drivers/infiniband/hw/mlx5/flow.c | |
parent | 645ba5970c0766c610920fd5e8dd34e62766af5a (diff) | |
download | linux-stable-ba4a41198324be2e6fbb06c270fdc8500c0e38de.tar.gz linux-stable-ba4a41198324be2e6fbb06c270fdc8500c0e38de.tar.bz2 linux-stable-ba4a41198324be2e6fbb06c270fdc8500c0e38de.zip |
RDMA/mlx5: Add support for flow tag to raw create flow
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@mellanox.com>
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx5/flow.c')
-rw-r--r-- | drivers/infiniband/hw/mlx5/flow.c | 15 |
1 files changed, 14 insertions, 1 deletions
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; + } + flow_handler = mlx5_ib_raw_fs_rule_add(dev, fs_matcher, &flow_act, cmd_in, inlen, dest_id, dest_type); @@ -513,7 +523,10 @@ DECLARE_UVERBS_NAMED_METHOD( UVERBS_OBJECT_FLOW_ACTION, UVERBS_ACCESS_READ, 1, MLX5_IB_CREATE_FLOW_MAX_FLOW_ACTIONS, - UA_OPTIONAL)); + UA_OPTIONAL), + UVERBS_ATTR_PTR_IN(MLX5_IB_ATTR_CREATE_FLOW_TAG, + UVERBS_ATTR_TYPE(u32), + UA_OPTIONAL)); DECLARE_UVERBS_NAMED_METHOD_DESTROY( MLX5_IB_METHOD_DESTROY_FLOW, |