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

Merge tag 'mlx5-fixes-2022-01-06' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux



Saeed Mahameed says:

====================
mlx5 fixes 2022-01-06

This series provides bug 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 29507144 4f6626b0
Loading
Loading
Loading
Loading
+7 −29
Original line number Diff line number Diff line
@@ -148,8 +148,12 @@ static void cmd_ent_put(struct mlx5_cmd_work_ent *ent)
	if (!refcount_dec_and_test(&ent->refcnt))
		return;

	if (ent->idx >= 0)
		cmd_free_index(ent->cmd, ent->idx);
	if (ent->idx >= 0) {
		struct mlx5_cmd *cmd = ent->cmd;

		cmd_free_index(cmd, ent->idx);
		up(ent->page_queue ? &cmd->pages_sem : &cmd->sem);
	}

	cmd_free_ent(ent);
}
@@ -900,25 +904,6 @@ static bool opcode_allowed(struct mlx5_cmd *cmd, u16 opcode)
	return cmd->allowed_opcode == opcode;
}

static int cmd_alloc_index_retry(struct mlx5_cmd *cmd)
{
	unsigned long alloc_end = jiffies + msecs_to_jiffies(1000);
	int idx;

retry:
	idx = cmd_alloc_index(cmd);
	if (idx < 0 && time_before(jiffies, alloc_end)) {
		/* Index allocation can fail on heavy load of commands. This is a temporary
		 * situation as the current command already holds the semaphore, meaning that
		 * another command completion is being handled and it is expected to release
		 * the entry index soon.
		 */
		cpu_relax();
		goto retry;
	}
	return idx;
}

bool mlx5_cmd_is_down(struct mlx5_core_dev *dev)
{
	return pci_channel_offline(dev->pdev) ||
@@ -946,7 +931,7 @@ static void cmd_work_handler(struct work_struct *work)
	sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem;
	down(sem);
	if (!ent->page_queue) {
		alloc_ret = cmd_alloc_index_retry(cmd);
		alloc_ret = cmd_alloc_index(cmd);
		if (alloc_ret < 0) {
			mlx5_core_err_rl(dev, "failed to allocate command entry\n");
			if (ent->callback) {
@@ -1602,8 +1587,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force
	vector = vec & 0xffffffff;
	for (i = 0; i < (1 << cmd->log_sz); i++) {
		if (test_bit(i, &vector)) {
			struct semaphore *sem;

			ent = cmd->ent_arr[i];

			/* if we already completed the command, ignore it */
@@ -1626,10 +1609,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force
			    dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
				cmd_ent_put(ent);

			if (ent->page_queue)
				sem = &cmd->pages_sem;
			else
				sem = &cmd->sem;
			ent->ts2 = ktime_get_ns();
			memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out));
			dump_command(dev, ent, 0);
@@ -1683,7 +1662,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force
				 */
				complete(&ent->done);
			}
			up(sem);
		}
	}
}
+2 −0
Original line number Diff line number Diff line
@@ -1579,6 +1579,8 @@ mlx5e_init_fib_work_ipv4(struct mlx5e_priv *priv,
	struct net_device *fib_dev;

	fen_info = container_of(info, struct fib_entry_notifier_info, info);
	if (fen_info->fi->nh)
		return NULL;
	fib_dev = fib_info_nh(fen_info->fi, 0)->fib_nh_dev;
	if (!fib_dev || fib_dev->netdev_ops != &mlx5e_netdev_ops ||
	    fen_info->dst_len != 32)
+2 −2
Original line number Diff line number Diff line
@@ -11,13 +11,13 @@ static int mlx5e_xsk_map_pool(struct mlx5e_priv *priv,
{
	struct device *dev = mlx5_core_dma_dev(priv->mdev);

	return xsk_pool_dma_map(pool, dev, 0);
	return xsk_pool_dma_map(pool, dev, DMA_ATTR_SKIP_CPU_SYNC);
}

static void mlx5e_xsk_unmap_pool(struct mlx5e_priv *priv,
				 struct xsk_buff_pool *pool)
{
	return xsk_pool_dma_unmap(pool, 0);
	return xsk_pool_dma_unmap(pool, DMA_ATTR_SKIP_CPU_SYNC);
}

static int mlx5e_xsk_get_pools(struct mlx5e_xsk *xsk)
+13 −6
Original line number Diff line number Diff line
@@ -4789,15 +4789,22 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
	}

	if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) {
		netdev->hw_features     |= NETIF_F_GSO_UDP_TUNNEL;
		netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL;
		netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL;
		netdev->hw_features     |= NETIF_F_GSO_UDP_TUNNEL |
					   NETIF_F_GSO_UDP_TUNNEL_CSUM;
		netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL |
					   NETIF_F_GSO_UDP_TUNNEL_CSUM;
		netdev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM;
		netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL |
					 NETIF_F_GSO_UDP_TUNNEL_CSUM;
	}

	if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_GRE)) {
		netdev->hw_features     |= NETIF_F_GSO_GRE;
		netdev->hw_enc_features |= NETIF_F_GSO_GRE;
		netdev->gso_partial_features |= NETIF_F_GSO_GRE;
		netdev->hw_features     |= NETIF_F_GSO_GRE |
					   NETIF_F_GSO_GRE_CSUM;
		netdev->hw_enc_features |= NETIF_F_GSO_GRE |
					   NETIF_F_GSO_GRE_CSUM;
		netdev->gso_partial_features |= NETIF_F_GSO_GRE |
						NETIF_F_GSO_GRE_CSUM;
	}

	if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_IPIP)) {
+3 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
#include "fs_core.h"
#include "lib/mlx5.h"
#include "lib/devcom.h"
#include "lib/vxlan.h"
#define CREATE_TRACE_POINTS
#include "diag/en_rep_tracepoint.h"
#include "en_accel/ipsec.h"
@@ -1027,6 +1028,7 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv)
	rtnl_lock();
	if (netif_running(netdev))
		mlx5e_open(netdev);
	udp_tunnel_nic_reset_ntf(priv->netdev);
	netif_device_attach(netdev);
	rtnl_unlock();
}
@@ -1048,6 +1050,7 @@ static void mlx5e_uplink_rep_disable(struct mlx5e_priv *priv)
	mlx5_notifier_unregister(mdev, &priv->events_nb);
	mlx5e_rep_tc_disable(priv);
	mlx5_lag_remove_netdev(mdev, priv->netdev);
	mlx5_vxlan_reset_to_default(mdev->vxlan);
}

static MLX5E_DEFINE_STATS_GRP(sw_rep, 0);
Loading