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

Merge tag 'mlx5-fixes-2021-03-22' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux



Saeed Mahameed says:

====================
mlx5 fixes 2021-03-22

This series introduces some fixes to mlx5 driver.
Please pull and let me know if there is any problem.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 5ee7d4c7 7c1ef195
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1181,7 +1181,8 @@ int mlx5_tc_ct_add_no_trk_match(struct mlx5_flow_spec *spec)

	mlx5e_tc_match_to_reg_get_match(spec, CTSTATE_TO_REG,
					&ctstate, &ctstate_mask);
	if (ctstate_mask)

	if ((ctstate & ctstate_mask) == MLX5_CT_STATE_TRK_BIT)
		return -EOPNOTSUPP;

	ctstate_mask |= MLX5_CT_STATE_TRK_BIT;
+5 −1
Original line number Diff line number Diff line
@@ -1887,6 +1887,7 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev,
{
	struct mlx5e_priv *priv = netdev_priv(netdev);
	struct mlx5_core_dev *mdev = priv->mdev;
	int err;

	if (!MLX5_CAP_GEN(mdev, cqe_compression))
		return -EOPNOTSUPP;
@@ -1896,7 +1897,10 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev,
		return -EINVAL;
	}

	mlx5e_modify_rx_cqe_compression_locked(priv, enable);
	err = mlx5e_modify_rx_cqe_compression_locked(priv, enable);
	if (err)
		return err;

	priv->channels.params.rx_cqe_compress_def = enable;

	return 0;
+12 −0
Original line number Diff line number Diff line
@@ -3846,10 +3846,17 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
	}

	if (mlx5e_is_uplink_rep(priv)) {
		struct mlx5e_vport_stats *vstats = &priv->stats.vport;

		stats->rx_packets = PPORT_802_3_GET(pstats, a_frames_received_ok);
		stats->rx_bytes   = PPORT_802_3_GET(pstats, a_octets_received_ok);
		stats->tx_packets = PPORT_802_3_GET(pstats, a_frames_transmitted_ok);
		stats->tx_bytes   = PPORT_802_3_GET(pstats, a_octets_transmitted_ok);

		/* vport multicast also counts packets that are dropped due to steering
		 * or rx out of buffer
		 */
		stats->multicast = VPORT_COUNTER_GET(vstats, received_eth_multicast.packets);
	} else {
		mlx5e_fold_sw_stats64(priv, stats);
	}
@@ -4972,6 +4979,11 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16
				     priv->max_nch);
	params->num_tc       = 1;

	/* Set an initial non-zero value, so that mlx5e_select_queue won't
	 * divide by zero if called before first activating channels.
	 */
	priv->num_tc_x_num_ch = params->num_channels * params->num_tc;

	/* SQ */
	params->log_sq_size = is_kdump_kernel() ?
		MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE :
+43 −11
Original line number Diff line number Diff line
@@ -2296,6 +2296,16 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
			*match_level = MLX5_MATCH_L4;
	}

	/* Currenlty supported only for MPLS over UDP */
	if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_MPLS) &&
	    !netif_is_bareudp(filter_dev)) {
		NL_SET_ERR_MSG_MOD(extack,
				   "Matching on MPLS is supported only for MPLS over UDP");
		netdev_err(priv->netdev,
			   "Matching on MPLS is supported only for MPLS over UDP\n");
		return -EOPNOTSUPP;
	}

	return 0;
}

@@ -2899,6 +2909,37 @@ static int is_action_keys_supported(const struct flow_action_entry *act,
	return 0;
}

static bool modify_tuple_supported(bool modify_tuple, bool ct_clear,
				   bool ct_flow, struct netlink_ext_ack *extack,
				   struct mlx5e_priv *priv,
				   struct mlx5_flow_spec *spec)
{
	if (!modify_tuple || ct_clear)
		return true;

	if (ct_flow) {
		NL_SET_ERR_MSG_MOD(extack,
				   "can't offload tuple modification with non-clear ct()");
		netdev_info(priv->netdev,
			    "can't offload tuple modification with non-clear ct()");
		return false;
	}

	/* Add ct_state=-trk match so it will be offloaded for non ct flows
	 * (or after clear action), as otherwise, since the tuple is changed,
	 * we can't restore ct state
	 */
	if (mlx5_tc_ct_add_no_trk_match(spec)) {
		NL_SET_ERR_MSG_MOD(extack,
				   "can't offload tuple modification with ct matches and no ct(clear) action");
		netdev_info(priv->netdev,
			    "can't offload tuple modification with ct matches and no ct(clear) action");
		return false;
	}

	return true;
}

static bool modify_header_match_supported(struct mlx5e_priv *priv,
					  struct mlx5_flow_spec *spec,
					  struct flow_action *flow_action,
@@ -2937,18 +2978,9 @@ static bool modify_header_match_supported(struct mlx5e_priv *priv,
			return err;
	}

	/* Add ct_state=-trk match so it will be offloaded for non ct flows
	 * (or after clear action), as otherwise, since the tuple is changed,
	 *  we can't restore ct state
	 */
	if (!ct_clear && modify_tuple &&
	    mlx5_tc_ct_add_no_trk_match(spec)) {
		NL_SET_ERR_MSG_MOD(extack,
				   "can't offload tuple modify header with ct matches");
		netdev_info(priv->netdev,
			    "can't offload tuple modify header with ct matches");
	if (!modify_tuple_supported(modify_tuple, ct_clear, ct_flow, extack,
				    priv, spec))
		return false;
	}

	ip_proto = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ip_protocol);
	if (modify_ip_header && ip_proto != IPPROTO_TCP &&
+1 −3
Original line number Diff line number Diff line
@@ -181,15 +181,13 @@ static int mlx5_sf_dev_vhca_arm_all(struct mlx5_sf_dev_table *table)
	u16 max_functions;
	u16 function_id;
	int err = 0;
	bool ecpu;
	int i;

	max_functions = mlx5_sf_max_functions(dev);
	function_id = MLX5_CAP_GEN(dev, sf_base_id);
	ecpu = mlx5_read_embedded_cpu(dev);
	/* Arm the vhca context as the vhca event notifier */
	for (i = 0; i < max_functions; i++) {
		err = mlx5_vhca_event_arm(dev, function_id, ecpu);
		err = mlx5_vhca_event_arm(dev, function_id);
		if (err)
			return err;

Loading