Skip to content

Commit 2ea2620

Browse files
mark-blochjgunthorpe
authored andcommitted
RDMA/mlx5: Refactor flow action parsing to be more generic
Make the parsing of flow actions more generic so it could be used by mlx5 raw create flow. 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>
1 parent 86e1d46 commit 2ea2620

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

drivers/infiniband/hw/mlx5/main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2460,17 +2460,16 @@ static int check_mpls_supp_fields(u32 field_support, const __be32 *set_mask)
24602460
offsetof(typeof(filter), field) -\
24612461
sizeof(filter.field))
24622462

2463-
static int parse_flow_flow_action(const union ib_flow_spec *ib_spec,
2464-
const struct ib_flow_attr *flow_attr,
2465-
struct mlx5_flow_act *action)
2463+
int parse_flow_flow_action(struct mlx5_ib_flow_action *maction,
2464+
bool is_egress,
2465+
struct mlx5_flow_act *action)
24662466
{
2467-
struct mlx5_ib_flow_action *maction = to_mflow_act(ib_spec->action.act);
24682467

24692468
switch (maction->ib_action.type) {
24702469
case IB_FLOW_ACTION_ESP:
24712470
/* Currently only AES_GCM keymat is supported by the driver */
24722471
action->esp_id = (uintptr_t)maction->esp_aes_gcm.ctx;
2473-
action->action |= flow_attr->flags & IB_FLOW_ATTR_FLAGS_EGRESS ?
2472+
action->action |= is_egress ?
24742473
MLX5_FLOW_CONTEXT_ACTION_ENCRYPT :
24752474
MLX5_FLOW_CONTEXT_ACTION_DECRYPT;
24762475
return 0;
@@ -2831,7 +2830,8 @@ static int parse_flow_attr(struct mlx5_core_dev *mdev, u32 *match_c,
28312830
action->action |= MLX5_FLOW_CONTEXT_ACTION_DROP;
28322831
break;
28332832
case IB_FLOW_SPEC_ACTION_HANDLE:
2834-
ret = parse_flow_flow_action(ib_spec, flow_attr, action);
2833+
ret = parse_flow_flow_action(to_mflow_act(ib_spec->action.act),
2834+
flow_attr->flags & IB_FLOW_ATTR_FLAGS_EGRESS, action);
28352835
if (ret)
28362836
return ret;
28372837
break;

drivers/infiniband/hw/mlx5/mlx5_ib.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <linux/mlx5/cq.h>
4242
#include <linux/mlx5/qp.h>
4343
#include <linux/mlx5/srq.h>
44+
#include <linux/mlx5/fs.h>
4445
#include <linux/types.h>
4546
#include <linux/mlx5/transobj.h>
4647
#include <rdma/ib_user_verbs.h>
@@ -872,6 +873,9 @@ to_mcounters(struct ib_counters *ibcntrs)
872873
return container_of(ibcntrs, struct mlx5_ib_mcounters, ibcntrs);
873874
}
874875

876+
int parse_flow_flow_action(struct mlx5_ib_flow_action *maction,
877+
bool is_egress,
878+
struct mlx5_flow_act *action);
875879
struct mlx5_ib_dev {
876880
struct ib_device ib_dev;
877881
const struct uverbs_object_tree_def *driver_trees[7];

0 commit comments

Comments
 (0)