From owner-dev-commits-src-all@freebsd.org Mon Jul 26 15:19:38 2021 Return-Path: Delivered-To: dev-commits-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 273CA66E01F; Mon, 26 Jul 2021 15:19: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 4GYNrT6dRhz3JhJ; Mon, 26 Jul 2021 15:19:37 +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 4A1351962A; Mon, 26 Jul 2021 15:19: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 16QFJbYp025605; Mon, 26 Jul 2021 15:19:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16QFJbTa025604; Mon, 26 Jul 2021 15:19:37 GMT (envelope-from git) Date: Mon, 26 Jul 2021 15:19:37 GMT Message-Id: <202107261519.16QFJbTa025604@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c0d0e85679ab - stable/13 - mlx5en: add mlx5e_add_vxlan_rule_from_db() helper MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c0d0e85679ab47c0efa371044ef9086c78a4f62b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:19:38 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c0d0e85679ab47c0efa371044ef9086c78a4f62b commit c0d0e85679ab47c0efa371044ef9086c78a4f62b Author: Konstantin Belousov AuthorDate: 2021-04-14 07:08:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-07-26 13:51:11 +0000 mlx5en: add mlx5e_add_vxlan_rule_from_db() helper (cherry picked from commit 559eaa44d91ad74973612843835a8248b3df7341) --- sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 41 ++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c index 9e10a3728b1d..648dc199157c 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c @@ -1802,11 +1802,34 @@ mlx5e_vxlan_family_to_proto(sa_family_t family, u_int *proto) } static int -mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +mlx5e_add_vxlan_rule_from_db(struct mlx5e_priv *priv, + struct mlx5e_vxlan_db_el *el) { - struct mlx5e_vxlan_db_el *el; u32 *match_criteria; u32 *match_value; + int err; + + match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); + if (match_value == NULL || match_criteria == NULL) { + mlx5_en_err(priv->ifp, "alloc failed\n"); + err = -ENOMEM; + goto add_vxlan_rule_out; + } + + err = mlx5e_add_vxlan_rule_sub(priv, match_criteria, match_value, el); + +add_vxlan_rule_out: + kvfree(match_criteria); + kvfree(match_value); + + return (err); +} + +static int +mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) +{ + struct mlx5e_vxlan_db_el *el; u_int proto; int err; @@ -1821,25 +1844,13 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port) } el = mlx5e_vxlan_alloc_db_el(priv, proto, port); - match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); - match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); - if (match_value == NULL || match_criteria == NULL) { - mlx5_en_err(priv->ifp, "alloc failed\n"); - err = -ENOMEM; - goto add_vxlan_rule_out; - } - - err = mlx5e_add_vxlan_rule_sub(priv, match_criteria, match_value, el); + err = mlx5e_add_vxlan_rule_from_db(priv, el); if (err == 0) { TAILQ_INSERT_TAIL(&priv->vxlan.head, el, link); } else { kvfree(el); } -add_vxlan_rule_out: - kvfree(match_criteria); - kvfree(match_value); - return (err); }