Date: Mon, 13 Apr 2020 08:28:02 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359846 - stable/11/sys/dev/mlx5/mlx5_en Message-ID: <202004130828.03D8S2eO077083@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Mon Apr 13 08:28:02 2020 New Revision: 359846 URL: https://svnweb.freebsd.org/changeset/base/359846 Log: MFC r359654: Ensure a minimum inline size of 16 bytes in mlx5en(4). This includes 14 bytes of ethernet header and 2 bytes of VLAN header. This allows for making assumptions about the inline size limit in the fast transmit path later on. Use a signed integer variable to catch underflow. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Apr 13 08:27:19 2020 (r359845) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Apr 13 08:28:02 2020 (r359846) @@ -3351,15 +3351,19 @@ mlx5e_check_required_hca_cap(struct mlx5_core_dev *mde static u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev) { - uint32_t bf_buf_size = (1U << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2U; + const int min_size = ETHER_VLAN_ENCAP_LEN + ETHER_HDR_LEN; + const int max_size = MLX5E_MAX_TX_INLINE; + const int bf_buf_size = + ((1U << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2U) - + (sizeof(struct mlx5e_tx_wqe) - 2); - bf_buf_size -= sizeof(struct mlx5e_tx_wqe) - 2; - - /* verify against driver hardware limit */ - if (bf_buf_size > MLX5E_MAX_TX_INLINE) - bf_buf_size = MLX5E_MAX_TX_INLINE; - - return (bf_buf_size); + /* verify against driver limits */ + if (bf_buf_size > max_size) + return (max_size); + else if (bf_buf_size < min_size) + return (min_size); + else + return (bf_buf_size); } static int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004130828.03D8S2eO077083>