From nobody Tue Feb 01 15:24:37 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 30F951917158; Tue, 1 Feb 2022 15:24:38 +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 4Jp7yY5SlCz3Fp2; Tue, 1 Feb 2022 15:24:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643729077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=y2MjeZIit2opnP2LgtJL9JvP6wYn29vy+iv5CmQ+JOU=; b=RLTq1yz4Pbca/uLq1fPKpbQ5QsXBFGIxycFb6MWzvkjvya+5ZsTFXIBZumF3e0wljziOIb 8E94gIBZAKrYmkM0rPyHuoZ0ewvHKKJbsyhz2arXYq+CeVqfEESLV8aATa7heJjG9ZPCj6 y888+1zGbFvFWpgrY8dtWKMH9/jsALBLlbItPxSAGBgrBdmDnPySsd2mvcFbmqHJim7ILa 3mv98IUv1zGH0PWIBg/zOe/Bx4tBy6/8mHgjOLvanBDYpmysNTORnbH0O7KhC6AP7NDY42 M68f9EB+hskjW7c8DS4ehv3Wod5H+aB42FJWnhhZbvRC51ezbhx9/EIa7K1qsQ== 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 253A613176; Tue, 1 Feb 2022 15:24:37 +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 211FObS5051373; Tue, 1 Feb 2022 15:24:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 211FObZT051372; Tue, 1 Feb 2022 15:24:37 GMT (envelope-from git) Date: Tue, 1 Feb 2022 15:24:37 GMT Message-Id: <202202011524.211FObZT051372@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 8e332232a5ac - main - mlx5en: Implement one RQT object per channel. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/main X-Git-Reftype: branch X-Git-Commit: 8e332232a5ac8b11fb1c34c70f48bf586267ffda Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643729077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=y2MjeZIit2opnP2LgtJL9JvP6wYn29vy+iv5CmQ+JOU=; b=c2+DH9QhwJaUisRgIjvT5AXTuvuf4ECyB3WVqDn67NE26H1KSWsotxWzs/fzscnDkY/b1W cmBmOtdjxDSOIsfr6sjG/vb3PggzzOeUIcS2zOtTnyOEBoc0T6GwFXkQLU+ADcz+e+bFYG OH04xB0P8IztJYBQ95k4HclAaELfwjOLfAoJkyWF5s6fioIPdUJTtQg7XGWfzxUmV8AL65 471DU5BzGKY6S85Q+92/sqgATPssq1gB/OF7553VRlw6qDjoi8yhmpaF7eK5oDl/OxaA5D DxOUcN/28vjAyJGU4d0CVv7zWu2R4pk+7ThQPtTe+eh7HyN1FJvKjfKgy6AvOw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643729077; a=rsa-sha256; cv=none; b=wAsIGHU71bA1QylKE6+Ma3JO40L3p1H5K8U4qGnDB2dzX+Ic46sIHV+l/hLaM4kWMcWeJM OgADfiq8Jd/ryiHAcP0wi/0ETYSrL/4TMVZvIcu9nZyTnUMqospnPDF/8Y6EZjelubeUC9 O/U6GEaH7j/d0XKRwBki7TLAPjLuzL0zvphwpqC9mRM6lZyR0jC94q06LAH3AklmCcOCBb eNmExDHRgNlxHoOaO7resGzONH7q5HdTx9GlMKN4Y2n/JMiE1z0ylrjHMeqVLLNP3ph8jJ /aWWoa84tj+ZP2WaabH000HwG/QoWnL6pJxPL7Nsea9M9/WlmHVWTXkRbZo4WA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=8e332232a5ac8b11fb1c34c70f48bf586267ffda commit 8e332232a5ac8b11fb1c34c70f48bf586267ffda Author: Hans Petter Selasky AuthorDate: 2022-02-01 15:20:15 +0000 Commit: Hans Petter Selasky CommitDate: 2022-02-01 15:21:17 +0000 mlx5en: Implement one RQT object per channel. These objects will eventually be used to switch TLS RX traffic. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/mlx5/mlx5_en/en.h | 1 + sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 110 +++++++++++++++++++++++++++++++----- 2 files changed, 96 insertions(+), 15 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index c7e15b8968ba..50215defdf60 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -926,6 +926,7 @@ struct mlx5e_channel { struct mlx5e_priv *priv; struct completion completion; int ix; + u32 rqtn; } __aligned(MLX5E_CACHELINE_SIZE); enum mlx5e_traffic_types { diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index eec7c9cc9730..ed0b72084dc7 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2751,17 +2751,14 @@ mlx5e_close_tises(struct mlx5e_priv *priv) } static int -mlx5e_open_rqt(struct mlx5e_priv *priv) +mlx5e_open_default_rqt(struct mlx5e_priv *priv, u32 *prqtn, int sz) { u32 *in; void *rqtc; int inlen; int err; - int sz; int i; - sz = 1 << priv->params.rx_hash_log_tbl_sz; - inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + sizeof(u32) * sz; in = mlx5_vzalloc(inlen); if (in == NULL) @@ -2774,12 +2771,51 @@ mlx5e_open_rqt(struct mlx5e_priv *priv) for (i = 0; i != sz; i++) MLX5_SET(rqtc, rqtc, rq_num[i], priv->drop_rq.rqn); - err = mlx5_core_create_rqt(priv->mdev, in, inlen, &priv->rqtn); + err = mlx5_core_create_rqt(priv->mdev, in, inlen, prqtn); kvfree(in); return (err); } +static int +mlx5e_open_rqts(struct mlx5e_priv *priv) +{ + int err; + int i; + + err = mlx5e_open_default_rqt(priv, &priv->rqtn, + 1 << priv->params.rx_hash_log_tbl_sz); + if (err) + goto err_default; + + for (i = 0; i != priv->mdev->priv.eq_table.num_comp_vectors; i++) { + err = mlx5e_open_default_rqt(priv, &priv->channel[i].rqtn, 1); + if (err) + goto err_channel; + } + return (0); + +err_channel: + while (i--) + mlx5_core_destroy_rqt(priv->mdev, priv->channel[i].rqtn, 0); + + mlx5_core_destroy_rqt(priv->mdev, priv->rqtn, 0); + +err_default: + return (err); +} + +static void +mlx5e_close_rqts(struct mlx5e_priv *priv) +{ + int i; + + for (i = 0; i != priv->mdev->priv.eq_table.num_comp_vectors; i++) + mlx5_core_destroy_rqt(priv->mdev, priv->channel[i].rqtn, 0); + + mlx5_core_destroy_rqt(priv->mdev, priv->rqtn, 0); +} + static int mlx5e_activate_rqt(struct mlx5e_priv *priv) { @@ -2803,9 +2839,11 @@ mlx5e_activate_rqt(struct mlx5e_priv *priv) MLX5_SET(modify_rqt_in, in, bitmask.rqn_list, 1); for (i = 0; i != sz; i++) { - int ix = i; + int ix; #ifdef RSS - ix = rss_get_indirection_to_bucket(ix); + ix = rss_get_indirection_to_bucket(i); +#else + ix = i; #endif /* ensure we don't overflow */ ix %= priv->params.num_channels; @@ -2817,8 +2855,35 @@ mlx5e_activate_rqt(struct mlx5e_priv *priv) } err = mlx5_core_modify_rqt(priv->mdev, priv->rqtn, in, inlen); - kvfree(in); + if (err) + goto err_modify; + + inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + sizeof(u32); + + MLX5_SET(rqtc, rqtc, rqt_actual_size, 1); + for (i = 0; i != priv->mdev->priv.eq_table.num_comp_vectors; i++) { + int ix; +#ifdef RSS + ix = rss_get_indirection_to_bucket(i); +#else + ix = i; +#endif + /* ensure we don't overflow */ + ix %= priv->params.num_channels; + + /* apply receive side scaling stride, if any */ + ix -= ix % (int)priv->params.channels_rsss; + + MLX5_SET(rqtc, rqtc, rq_num[0], priv->channel[ix].rq.rqn); + + err = mlx5_core_modify_rqt(priv->mdev, priv->channel[i].rqtn, in, inlen); + if (err) + goto err_modify; + } + +err_modify: + kvfree(in); return (err); } @@ -2848,8 +2913,23 @@ mlx5e_deactivate_rqt(struct mlx5e_priv *priv) MLX5_SET(rqtc, rqtc, rq_num[i], priv->drop_rq.rqn); err = mlx5_core_modify_rqt(priv->mdev, priv->rqtn, in, inlen); - kvfree(in); + if (err) + goto err_modify; + + inlen = MLX5_ST_SZ_BYTES(modify_rqt_in) + sizeof(u32); + + MLX5_SET(rqtc, rqtc, rqt_actual_size, 1); + for (i = 0; i != priv->mdev->priv.eq_table.num_comp_vectors; i++) { + MLX5_SET(rqtc, rqtc, rq_num[0], priv->drop_rq.rqn); + + err = mlx5_core_modify_rqt(priv->mdev, priv->channel[i].rqtn, in, inlen); + if (err) + goto err_modify; + } + +err_modify: + kvfree(in); return (err); } @@ -4546,16 +4626,16 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) goto err_tls_init; } - err = mlx5e_open_rqt(priv); + err = mlx5e_open_rqts(priv); if (err) { - if_printf(ifp, "%s: mlx5e_open_rqt failed (%d)\n", __func__, err); + if_printf(ifp, "%s: mlx5e_open_rqts failed (%d)\n", __func__, err); goto err_open_drop_rq; } err = mlx5e_open_tirs(priv); if (err) { mlx5_en_err(ifp, "mlx5e_open_tirs() failed, %d\n", err); - goto err_open_rqt; + goto err_open_rqts; } err = mlx5e_open_flow_tables(priv); @@ -4702,8 +4782,8 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) err_open_tirs: mlx5e_close_tirs(priv); -err_open_rqt: - mlx5_core_destroy_rqt(priv->mdev, priv->rqtn, 0); +err_open_rqts: + mlx5e_close_rqts(priv); err_open_drop_rq: mlx5e_close_drop_rq(&priv->drop_rq); @@ -4809,7 +4889,7 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vpriv) mlx5e_close_flow_tables(priv); mlx5e_close_tirs(priv); - mlx5_core_destroy_rqt(priv->mdev, priv->rqtn, 0); + mlx5e_close_rqts(priv); mlx5e_close_drop_rq(&priv->drop_rq); mlx5e_tls_cleanup(priv); mlx5e_rl_cleanup(priv);