From owner-dev-commits-src-branches@freebsd.org Fri Jan 22 12:30:33 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 608104F366B; Fri, 22 Jan 2021 12:30:33 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMdrl3ygMz4pJc; Fri, 22 Jan 2021 12:30:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36B4E1E91E; Fri, 22 Jan 2021 12:30:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MCUT0v000805; Fri, 22 Jan 2021 12:30:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MCUTcD000804; Fri, 22 Jan 2021 12:30:29 GMT (envelope-from git) Date: Fri, 22 Jan 2021 12:30:29 GMT Message-Id: <202101221230.10MCUTcD000804@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 2fadd4c723dc - stable/12 - MFC a00718e1dfcd: Implement SIOCGIFRSSKEY and SIOCGIFRSSHASH and mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2fadd4c723dc38eaa0606d69c4e59d554b4d7def Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 12:30:33 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2fadd4c723dc38eaa0606d69c4e59d554b4d7def commit 2fadd4c723dc38eaa0606d69c4e59d554b4d7def Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:12:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-22 12:19:13 +0000 MFC a00718e1dfcd: Implement SIOCGIFRSSKEY and SIOCGIFRSSHASH and mlx5en(4). Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 62 ++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index b22f949fdb87..2940546b73cc 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2727,6 +2727,31 @@ mlx5e_close_rqt(struct mlx5e_priv *priv) mlx5_cmd_exec(priv->mdev, in, sizeof(in), out, sizeof(out)); } +#define MLX5E_RSS_KEY_SIZE (10 * 4) /* bytes */ + +static void +mlx5e_get_rss_key(void *key_ptr) +{ +#ifdef RSS + rss_getkey(key_ptr); +#else + static const u32 rsskey[] = { + cpu_to_be32(0xD181C62C), + cpu_to_be32(0xF7F4DB5B), + cpu_to_be32(0x1983A2FC), + cpu_to_be32(0x943E1ADB), + cpu_to_be32(0xD9389E6B), + cpu_to_be32(0xD1039C2C), + cpu_to_be32(0xA74499AD), + cpu_to_be32(0x593D56D9), + cpu_to_be32(0xF3253C06), + cpu_to_be32(0x2ADC1FFC), + }; + CTASSERT(sizeof(rsskey) == MLX5E_RSS_KEY_SIZE); + memcpy(key_ptr, rsskey, MLX5E_RSS_KEY_SIZE); +#endif +} + static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) { @@ -2778,26 +2803,19 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) MLX5_SET(tirc, tirc, rx_hash_fn, MLX5_TIRC_RX_HASH_FN_HASH_TOEPLITZ); hkey = (__be32 *) MLX5_ADDR_OF(tirc, tirc, rx_hash_toeplitz_key); + + CTASSERT(MLX5_FLD_SZ_BYTES(tirc, rx_hash_toeplitz_key) >= + MLX5E_RSS_KEY_SIZE); #ifdef RSS /* * The FreeBSD RSS implementation does currently not * support symmetric Toeplitz hashes: */ MLX5_SET(tirc, tirc, rx_hash_symmetric, 0); - rss_getkey((uint8_t *)hkey); #else MLX5_SET(tirc, tirc, rx_hash_symmetric, 1); - hkey[0] = cpu_to_be32(0xD181C62C); - hkey[1] = cpu_to_be32(0xF7F4DB5B); - hkey[2] = cpu_to_be32(0x1983A2FC); - hkey[3] = cpu_to_be32(0x943E1ADB); - hkey[4] = cpu_to_be32(0xD9389E6B); - hkey[5] = cpu_to_be32(0xD1039C2C); - hkey[6] = cpu_to_be32(0xA74499AD); - hkey[7] = cpu_to_be32(0x593D56D9); - hkey[8] = cpu_to_be32(0xF3253C06); - hkey[9] = cpu_to_be32(0x2ADC1FFC); #endif + mlx5e_get_rss_key(hkey); break; } @@ -3225,6 +3243,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) struct ifreq *ifr; struct ifdownreason *ifdr; struct ifi2creq i2c; + struct ifrsskey *ifrk; + struct ifrsshash *ifrh; int error = 0; int mask = 0; int size_read = 0; @@ -3497,6 +3517,26 @@ err_i2c: ifdr->ifdr_reason = IFDR_REASON_MSG; break; + case SIOCGIFRSSKEY: + ifrk = (struct ifrsskey *)data; + ifrk->ifrk_func = RSS_FUNC_TOEPLITZ; + ifrk->ifrk_keylen = MLX5E_RSS_KEY_SIZE; + CTASSERT(sizeof(ifrk->ifrk_key) >= MLX5E_RSS_KEY_SIZE); + mlx5e_get_rss_key(ifrk->ifrk_key); + break; + + case SIOCGIFRSSHASH: + ifrh = (struct ifrsshash *)data; + ifrh->ifrh_func = RSS_FUNC_TOEPLITZ; + ifrh->ifrh_types = + RSS_TYPE_IPV4 | + RSS_TYPE_TCP_IPV4 | + RSS_TYPE_UDP_IPV4 | + RSS_TYPE_IPV6 | + RSS_TYPE_TCP_IPV6 | + RSS_TYPE_UDP_IPV6; + break; + default: error = ether_ioctl(ifp, command, data); break;