Skip to content

Commit 83bd511

Browse files
Jack Morgensteindavem330
authored andcommitted
net/mlx4_core: Reduce harmless SRIOV error message to debug level
Under SRIOV resource management, extra counters are allocated to VFs from a free pool. If that pool is empty, the ALLOC_RES command for a counter resource fails -- and this generates a misleading error message in the message log. Under SRIOV, each VF is allocated (i.e., guaranteed) 2 counters -- one counter per port. For ETH ports, the RoCE driver requests an additional counter (above the guaranteed counters). If that request fails, the VF RoCE driver simply uses the default (i.e., guaranteed) counter for that port. Thus, failing to allocate an additional counter does not constitute a problem, and the error message on the PF when this occurs should be reduced to debug level. Finally, to identify the situation that the reason for the failure is that no resources are available to grant to the VF, we modified the error returned by mlx4_grant_resource to -EDQUOT (Quota exceeded), which more accurately describes the error. Fixes: c3abb51 ("IB/mlx4: Add RoCE/IB dedicated counters") Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 89c5576 commit 83bd511

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

drivers/net/ethernet/mellanox/mlx4/cmd.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,9 +1789,17 @@ static int mlx4_master_process_vhcr(struct mlx4_dev *dev, int slave,
17891789
}
17901790

17911791
if (err) {
1792-
if (!(dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR))
1793-
mlx4_warn(dev, "vhcr command:0x%x slave:%d failed with error:%d, status %d\n",
1794-
vhcr->op, slave, vhcr->errno, err);
1792+
if (!(dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR)) {
1793+
if (vhcr->op == MLX4_CMD_ALLOC_RES &&
1794+
(vhcr->in_modifier & 0xff) == RES_COUNTER &&
1795+
err == -EDQUOT)
1796+
mlx4_dbg(dev,
1797+
"Unable to allocate counter for slave %d (%d)\n",
1798+
slave, err);
1799+
else
1800+
mlx4_warn(dev, "vhcr command:0x%x slave:%d failed with error:%d, status %d\n",
1801+
vhcr->op, slave, vhcr->errno, err);
1802+
}
17951803
vhcr_cmd->status = mlx4_errno_to_status(err);
17961804
goto out_status;
17971805
}

drivers/net/ethernet/mellanox/mlx4/resource_tracker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static inline int mlx4_grant_resource(struct mlx4_dev *dev, int slave,
311311
struct mlx4_priv *priv = mlx4_priv(dev);
312312
struct resource_allocator *res_alloc =
313313
&priv->mfunc.master.res_tracker.res_alloc[res_type];
314-
int err = -EINVAL;
314+
int err = -EDQUOT;
315315
int allocated, free, reserved, guaranteed, from_free;
316316
int from_rsvd;
317317

0 commit comments

Comments
 (0)