The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=559eaa44d91ad74973612843835a8248b3df7341

commit 559eaa44d91ad74973612843835a8248b3df7341
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2021-04-14 07:08:56 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2021-07-12 09:34:39 +0000

    mlx5en: add mlx5e_add_vxlan_rule_from_db() helper
    
    Reviewed by:    hselasky
    Sponsored by:   Mellanox Technologies/NVidia Networking
    MFC after:      1 week
---
 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);
 }
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to