Date: Mon, 26 Jul 2021 15:19:37 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: c0d0e85679ab - stable/13 - mlx5en: add mlx5e_add_vxlan_rule_from_db() helper Message-ID: <202107261519.16QFJbTa025604@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c0d0e85679ab47c0efa371044ef9086c78a4f62b commit c0d0e85679ab47c0efa371044ef9086c78a4f62b Author: Konstantin Belousov <konstantinb@nvidia.com> AuthorDate: 2021-04-14 07:08:56 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107261519.16QFJbTa025604>