Commit ce2b6eb4 authored by David S. Miller's avatar David S. Miller
Browse files

Merge tag 'mlx5-updates-2021-12-28' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux



Saeed Mahameed says:

====================
mlx5 Software steering, New features and optimizations

This patch series brings various SW steering features, optimizations and
debug-ability focused improvements.

 1) Expose debugfs for dumping the SW steering resources
 2) Removing unused fields
 3) support for matching on new fields
 4) steering optimization for RX/TX-only rules
 5) Make Software steering the default steering mechanism when
    available, applies only to Switchdev mode FDB

From Yevgeny Kliteynik and Muhammad Sammar:

 - Patch 1 fixes an error flow in creating matchers
 - Patch 2 fix lower case macro prefix "mlx5_" to "MLX5_"
 - Patch 3 removes unused struct member in mlx5dr_matcher
 - Patch 4 renames list field in matcher struct to list_node to reflect the
   fact that is field is for list node that is stored on another struct's lists
 - Patch 5 adds checking for valid Flex parser ID value
 - Patch 6 adds the missing reserved fields to dr_match_param and aligns it to
   the format that is defined by HW spec
 - Patch 7 adds support for dumping SW steering (SMFS) resources using debugfs
   in CSV format: domain and its tables, matchers and rules
 - Patch 8 adds support for a new destination type - UPLINK
 - Patch 9 adds WARN_ON_ONCE on refcount checks in SW steering object destructors
 - Patches 10, 11, 12 add misc5 flow table match parameters and add support for
   matching on tunnel headers 0 and 1
 - Patch 13 adds support for matching on geneve_tlv_option_0_exist field
 - Patch 14 implements performance optimization for for empty or RX/TX-only
   matchers by splitting RX and TX matchers handling: matcher connection in the
   matchers chain is split into two separate lists (RX only and TX only), which
   solves a usecase of many RX or TX only rules that create a long chain of
   RX/TX-only paths w/o the actual rules
 - Patch 15 ignores modify TTL if device doesn't support it instead of
   adding and unsupported action
 - Patch 16 sets SMFS as a default steering mode
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 20a9013e aa36c948
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -104,7 +104,8 @@ mlx5_core-$(CONFIG_MLX5_SW_STEERING) += steering/dr_domain.o steering/dr_table.o
					steering/dr_ste.o steering/dr_send.o \
					steering/dr_ste_v0.o steering/dr_ste_v1.o \
					steering/dr_cmd.o steering/dr_fw.o \
					steering/dr_action.o steering/fs_dr.o
					steering/dr_action.o steering/fs_dr.o \
					steering/dr_dbg.o
#
# SF device
#
+2 −1
Original line number Diff line number Diff line
@@ -451,7 +451,8 @@ static int mlx5_set_extended_dest(struct mlx5_core_dev *dev,
	list_for_each_entry(dst, &fte->node.children, node.list) {
		if (dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER)
			continue;
		if (dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_VPORT &&
		if ((dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_VPORT ||
		     dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_UPLINK) &&
		    dst->dest_attr.vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID)
			num_encap++;
		num_fwd_destinations++;
+7 −1
Original line number Diff line number Diff line
@@ -1525,7 +1525,8 @@ static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
				struct mlx5_flow_destination *d2)
{
	if (d1->type == d2->type) {
		if ((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT &&
		if (((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT ||
		      d1->type == MLX5_FLOW_DESTINATION_TYPE_UPLINK) &&
		     d1->vport.num == d2->vport.num &&
		     d1->vport.flags == d2->vport.flags &&
		     ((d1->vport.flags & MLX5_FLOW_DEST_VPORT_VHCA_ID) ?
@@ -3082,6 +3083,11 @@ int mlx5_init_fs(struct mlx5_core_dev *dev)
	steering->dev = dev;
	dev->priv.steering = steering;

	if (mlx5_fs_dr_is_supported(dev))
		steering->mode = MLX5_FLOW_STEERING_MODE_SMFS;
	else
		steering->mode = MLX5_FLOW_STEERING_MODE_DMFS;

	steering->fgs_cache = kmem_cache_create("mlx5_fs_fgs",
						sizeof(struct mlx5_flow_group), 0,
						0, NULL);
+1 −1
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@ struct mlx5_ft_underlay_qp {
	u32 qpn;
};

#define MLX5_FTE_MATCH_PARAM_RESERVED	reserved_at_c00
#define MLX5_FTE_MATCH_PARAM_RESERVED	reserved_at_e00
/* Calculate the fte_match_param length and without the reserved length.
 * Make sure the reserved field is the last.
 */
+19 −4
Original line number Diff line number Diff line
@@ -1560,6 +1560,12 @@ dr_action_modify_check_is_ttl_modify(const void *sw_action)
	return sw_field == MLX5_ACTION_IN_FIELD_OUT_IP_TTL;
}

static bool dr_action_modify_ttl_ignore(struct mlx5dr_domain *dmn)
{
	return !mlx5dr_ste_supp_ttl_cs_recalc(&dmn->info.caps) &&
	       !MLX5_CAP_ESW_FLOWTABLE(dmn->mdev, fdb_ipv4_ttl_modify);
}

static int dr_actions_convert_modify_header(struct mlx5dr_action *action,
					    u32 max_hw_actions,
					    u32 num_sw_actions,
@@ -1591,8 +1597,13 @@ static int dr_actions_convert_modify_header(struct mlx5dr_action *action,
		if (ret)
			return ret;

		if (!(*modify_ttl))
			*modify_ttl = dr_action_modify_check_is_ttl_modify(sw_action);
		if (!(*modify_ttl) &&
		    dr_action_modify_check_is_ttl_modify(sw_action)) {
			if (dr_action_modify_ttl_ignore(dmn))
				continue;

			*modify_ttl = true;
		}

		/* Convert SW action to HW action */
		ret = dr_action_modify_sw_to_hw(dmn,
@@ -1631,7 +1642,7 @@ static int dr_actions_convert_modify_header(struct mlx5dr_action *action,
			 * modify actions doesn't exceeds the limit
			 */
			hw_idx++;
			if ((num_sw_actions + hw_idx - i) >= max_hw_actions) {
			if (hw_idx >= max_hw_actions) {
				mlx5dr_dbg(dmn, "Modify header action number exceeds HW limit\n");
				return -EINVAL;
			}
@@ -1642,6 +1653,10 @@ static int dr_actions_convert_modify_header(struct mlx5dr_action *action,
		hw_idx++;
	}

	/* if the resulting HW actions list is empty, add NOP action */
	if (!hw_idx)
		hw_idx++;

	*num_hw_actions = hw_idx;

	return 0;
@@ -1792,7 +1807,7 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_domain *dmn,

int mlx5dr_action_destroy(struct mlx5dr_action *action)
{
	if (refcount_read(&action->refcount) > 1)
	if (WARN_ON_ONCE(refcount_read(&action->refcount) > 1))
		return -EBUSY;

	switch (action->action_type) {
Loading