Merge mlx5-next into rdma for-next
[linux-block.git] / drivers / net / ethernet / mellanox / mlx5 / core / fs_core.c
index 8162252585ad26eff7114e793448b29d5be06696..b0939a18ba2dc3c8dbbee4a33b71fe6ea4a1e13b 100644 (file)
@@ -1381,6 +1381,8 @@ static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
                if ((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT &&
                     d1->vport.num == d2->vport.num &&
                     d1->vport.flags == d2->vport.flags &&
+                    ((d1->vport.flags & MLX5_FLOW_DEST_VPORT_VHCA_ID) ?
+                     (d1->vport.vhca_id == d2->vport.vhca_id) : true) &&
                     ((d1->vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID) ?
                      (d1->vport.reformat_id == d2->vport.reformat_id) : true)) ||
                    (d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE &&
@@ -2282,7 +2284,7 @@ static struct mlx5_flow_root_namespace
                cmds = mlx5_fs_cmd_get_default_ipsec_fpga_cmds(table_type);
 
        /* Create the root namespace */
-       root_ns = kvzalloc(sizeof(*root_ns), GFP_KERNEL);
+       root_ns = kzalloc(sizeof(*root_ns), GFP_KERNEL);
        if (!root_ns)
                return NULL;
 
@@ -2425,6 +2427,7 @@ static void cleanup_egress_acls_root_ns(struct mlx5_core_dev *dev)
                cleanup_root_ns(steering->esw_egress_root_ns[i]);
 
        kfree(steering->esw_egress_root_ns);
+       steering->esw_egress_root_ns = NULL;
 }
 
 static void cleanup_ingress_acls_root_ns(struct mlx5_core_dev *dev)
@@ -2439,6 +2442,7 @@ static void cleanup_ingress_acls_root_ns(struct mlx5_core_dev *dev)
                cleanup_root_ns(steering->esw_ingress_root_ns[i]);
 
        kfree(steering->esw_ingress_root_ns);
+       steering->esw_ingress_root_ns = NULL;
 }
 
 void mlx5_cleanup_fs(struct mlx5_core_dev *dev)
@@ -2472,11 +2476,7 @@ static int init_sniffer_tx_root_ns(struct mlx5_flow_steering *steering)
 
        /* Create single prio */
        prio = fs_create_prio(&steering->sniffer_tx_root_ns->ns, 0, 1);
-       if (IS_ERR(prio)) {
-               cleanup_root_ns(steering->sniffer_tx_root_ns);
-               return PTR_ERR(prio);
-       }
-       return 0;
+       return PTR_ERR_OR_ZERO(prio);
 }
 
 static int init_sniffer_rx_root_ns(struct mlx5_flow_steering *steering)
@@ -2489,11 +2489,7 @@ static int init_sniffer_rx_root_ns(struct mlx5_flow_steering *steering)
 
        /* Create single prio */
        prio = fs_create_prio(&steering->sniffer_rx_root_ns->ns, 0, 1);
-       if (IS_ERR(prio)) {
-               cleanup_root_ns(steering->sniffer_rx_root_ns);
-               return PTR_ERR(prio);
-       }
-       return 0;
+       return PTR_ERR_OR_ZERO(prio);
 }
 
 static int init_rdma_rx_root_ns(struct mlx5_flow_steering *steering)
@@ -2509,11 +2505,7 @@ static int init_rdma_rx_root_ns(struct mlx5_flow_steering *steering)
 
        /* Create single prio */
        prio = fs_create_prio(&steering->rdma_rx_root_ns->ns, 0, 1);
-       if (IS_ERR(prio)) {
-               cleanup_root_ns(steering->rdma_rx_root_ns);
-               return PTR_ERR(prio);
-       }
-       return 0;
+       return PTR_ERR_OR_ZERO(prio);
 }
 static int init_fdb_root_ns(struct mlx5_flow_steering *steering)
 {
@@ -2637,6 +2629,7 @@ cleanup_root_ns:
        for (i--; i >= 0; i--)
                cleanup_root_ns(steering->esw_egress_root_ns[i]);
        kfree(steering->esw_egress_root_ns);
+       steering->esw_egress_root_ns = NULL;
        return err;
 }
 
@@ -2666,6 +2659,7 @@ cleanup_root_ns:
        for (i--; i >= 0; i--)
                cleanup_root_ns(steering->esw_ingress_root_ns[i]);
        kfree(steering->esw_ingress_root_ns);
+       steering->esw_ingress_root_ns = NULL;
        return err;
 }