From owner-svn-src-all@freebsd.org Wed Oct 2 11:05:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1083812B65D; Wed, 2 Oct 2019 11:05:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46jtZn6dMLz4G7V; Wed, 2 Oct 2019 11:05:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6C882A8BB; Wed, 2 Oct 2019 11:05:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x92B55MK065255; Wed, 2 Oct 2019 11:05:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x92B55V5065254; Wed, 2 Oct 2019 11:05:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910021105.x92B55V5065254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 2 Oct 2019 11:05:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352996 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 352996 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Oct 2019 11:05:06 -0000 Author: hselasky Date: Wed Oct 2 11:05:05 2019 New Revision: 352996 URL: https://svnweb.freebsd.org/changeset/base/352996 Log: Add print to show user a reason for rejecting buffer size change in mlx5en(4). Submitted by: kib@ MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Wed Oct 2 11:02:54 2019 (r352995) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Wed Oct 2 11:05:05 2019 (r352996) @@ -139,8 +139,8 @@ static u32 calculate_xoff(struct mlx5e_priv *priv, uns return xoff; } -static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer, - u32 xoff) +static int update_xoff_threshold(struct mlx5e_priv *priv, + struct mlx5e_port_buffer *port_buffer, u32 xoff) { int i; @@ -152,8 +152,14 @@ static int update_xoff_threshold(struct mlx5e_port_buf } if (port_buffer->buffer[i].size < - (xoff + MLX5E_MAX_PORT_MTU + (1 << MLX5E_BUFFER_CELL_SHIFT))) + (xoff + MLX5E_MAX_PORT_MTU + (1 << MLX5E_BUFFER_CELL_SHIFT))) { + mlx5_en_info(priv->ifp, + "non-lossy buffer %d size %d less than xoff threshold %d\n", + i, port_buffer->buffer[i].size, + xoff + MLX5E_MAX_PORT_MTU + + (1 << MLX5E_BUFFER_CELL_SHIFT)); return -ENOMEM; + } port_buffer->buffer[i].xoff = port_buffer->buffer[i].size - xoff; port_buffer->buffer[i].xon = @@ -182,7 +188,7 @@ static int update_xoff_threshold(struct mlx5e_port_buf * Return 0 if no error. * Set change to true if buffer configuration is modified. */ -static int update_buffer_lossy(unsigned int mtu, +static int update_buffer_lossy(struct mlx5e_priv *priv, unsigned int mtu, u8 pfc_en, u8 *buffer, u32 xoff, struct mlx5e_port_buffer *port_buffer, bool *change) @@ -219,7 +225,7 @@ static int update_buffer_lossy(unsigned int mtu, } if (changed) { - err = update_xoff_threshold(port_buffer, xoff); + err = update_xoff_threshold(priv, port_buffer, xoff); if (err) return err; @@ -253,7 +259,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv if (change & MLX5E_PORT_BUFFER_CABLE_LEN) { update_buffer = true; - err = update_xoff_threshold(&port_buffer, xoff); + err = update_xoff_threshold(priv, &port_buffer, xoff); if (err) return err; } @@ -264,7 +270,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv return err; priv->sw_is_port_buf_owner = true; - err = update_buffer_lossy(mtu, pfc->pfc_en, buffer, xoff, + err = update_buffer_lossy(priv, mtu, pfc->pfc_en, buffer, xoff, &port_buffer, &update_buffer); if (err) return err; @@ -276,7 +282,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv if (err) return err; - err = update_buffer_lossy(mtu, curr_pfc_en, prio2buffer, xoff, + err = update_buffer_lossy(priv, mtu, curr_pfc_en, prio2buffer, xoff, &port_buffer, &update_buffer); if (err) return err; @@ -301,7 +307,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv return -EINVAL; update_buffer = true; - err = update_xoff_threshold(&port_buffer, xoff); + err = update_xoff_threshold(priv, &port_buffer, xoff); if (err) return err; } @@ -309,7 +315,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv /* Need to update buffer configuration if xoff value is changed */ if (!update_buffer && xoff != priv->dcbx.xoff) { update_buffer = true; - err = update_xoff_threshold(&port_buffer, xoff); + err = update_xoff_threshold(priv, &port_buffer, xoff); if (err) return err; }