Merge mlx5-next into rdma for-next
authorJason Gunthorpe <jgg@mellanox.com>
Fri, 5 Jul 2019 13:16:19 +0000 (10:16 -0300)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 5 Jul 2019 13:16:19 +0000 (10:16 -0300)
From git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux

Required for dependencies in the next patches.

* mlx5-next:
  net/mlx5: Add rts2rts_qp_counters_set_id field in hca cap
  net/mlx5: Properly name the generic WQE control field
  net/mlx5: Introduce TLS TX offload hardware bits and structures
  net/mlx5: Refactor mlx5_esw_query_functions for modularity
  net/mlx5: E-Switch prepare functions change handler to be modular
  net/mlx5: Introduce and use mlx5_eswitch_get_total_vports()

1  2 
drivers/infiniband/hw/mlx5/ib_rep.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
include/linux/mlx5/eswitch.h
include/linux/mlx5/qp.h

@@@ -29,7 -29,7 +29,7 @@@ mlx5_ib_set_vport_rep(struct mlx5_core_
  static int
  mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
  {
-       int num_ports = MLX5_TOTAL_VPORTS(dev);
+       int num_ports = mlx5_eswitch_get_total_vports(dev);
        const struct mlx5_ib_profile *profile;
        struct mlx5_ib_dev *ibdev;
        int vport_index;
@@@ -114,15 -114,15 +114,15 @@@ u8 mlx5_ib_eswitch_mode(struct mlx5_esw
  }
  
  struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
 -                                        int vport_index)
 +                                        u16 vport_num)
  {
 -      return mlx5_eswitch_get_proto_dev(esw, vport_index, REP_IB);
 +      return mlx5_eswitch_get_proto_dev(esw, vport_num, REP_IB);
  }
  
  struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
 -                                        int vport_index)
 +                                        u16 vport_num)
  {
 -      return mlx5_eswitch_get_proto_dev(esw, vport_index, REP_ETH);
 +      return mlx5_eswitch_get_proto_dev(esw, vport_num, REP_ETH);
  }
  
  struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw)
        return mlx5_eswitch_uplink_get_proto_dev(esw, REP_IB);
  }
  
 -struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, int vport)
 +struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
 +                                         u16 vport_num)
  {
 -      return mlx5_eswitch_vport_rep(esw, vport);
 +      return mlx5_eswitch_vport_rep(esw, vport_num);
  }
  
  struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
@@@ -1552,7 -1552,7 +1552,7 @@@ static void node_guid_gen_from_mac(u64 
  static void esw_apply_vport_conf(struct mlx5_eswitch *esw,
                                 struct mlx5_vport *vport)
  {
 -      int vport_num = vport->vport;
 +      u16 vport_num = vport->vport;
        int flags;
  
        if (esw->manager_vport == vport_num)
@@@ -1715,14 -1715,34 +1715,34 @@@ static int eswitch_vport_event(struct n
        return NOTIFY_OK;
  }
  
- int mlx5_esw_query_functions(struct mlx5_core_dev *dev, u32 *out, int outlen)
+ /**
+  * mlx5_esw_query_functions - Returns raw output about functions state
+  * @dev:      Pointer to device to query
+  *
+  * mlx5_esw_query_functions() allocates and returns functions changed
+  * raw output memory pointer from device on success. Otherwise returns ERR_PTR.
+  * Caller must free the memory using kvfree() when valid pointer is returned.
+  */
+ const u32 *mlx5_esw_query_functions(struct mlx5_core_dev *dev)
  {
+       int outlen = MLX5_ST_SZ_BYTES(query_esw_functions_out);
        u32 in[MLX5_ST_SZ_DW(query_esw_functions_in)] = {};
+       u32 *out;
+       int err;
+       out = kvzalloc(outlen, GFP_KERNEL);
+       if (!out)
+               return ERR_PTR(-ENOMEM);
  
        MLX5_SET(query_esw_functions_in, in, opcode,
                 MLX5_CMD_OP_QUERY_ESW_FUNCTIONS);
  
-       return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen);
+       err = mlx5_cmd_exec(dev, in, sizeof(in), out, outlen);
+       if (!err)
+               return out;
+       kvfree(out);
+       return ERR_PTR(err);
  }
  
  static void mlx5_eswitch_event_handlers_register(struct mlx5_eswitch *esw)
@@@ -1868,14 -1888,16 +1888,16 @@@ void mlx5_eswitch_disable(struct mlx5_e
  
  int mlx5_eswitch_init(struct mlx5_core_dev *dev)
  {
-       int total_vports = MLX5_TOTAL_VPORTS(dev);
        struct mlx5_eswitch *esw;
        struct mlx5_vport *vport;
+       int total_vports;
        int err, i;
  
        if (!MLX5_VPORT_MANAGER(dev))
                return 0;
  
+       total_vports = mlx5_eswitch_get_total_vports(dev);
        esw_info(dev,
                 "Total vports %d, per vport: max uc(%d) max mc(%d)\n",
                 total_vports,
@@@ -1957,7 -1979,7 +1979,7 @@@ void mlx5_eswitch_cleanup(struct mlx5_e
  
  /* Vport Administration */
  int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
 -                             int vport, u8 mac[ETH_ALEN])
 +                             u16 vport, u8 mac[ETH_ALEN])
  {
        struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
        u64 node_guid;
@@@ -2001,7 -2023,7 +2023,7 @@@ unlock
  }
  
  int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw,
 -                               int vport, int link_state)
 +                               u16 vport, int link_state)
  {
        struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
        int err = 0;
@@@ -2031,7 -2053,7 +2053,7 @@@ unlock
  }
  
  int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,
 -                                int vport, struct ifla_vf_info *ivi)
 +                                u16 vport, struct ifla_vf_info *ivi)
  {
        struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
  
  }
  
  int __mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
 -                                int vport, u16 vlan, u8 qos, u8 set_flags)
 +                                u16 vport, u16 vlan, u8 qos, u8 set_flags)
  {
        struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
        int err = 0;
@@@ -2089,7 -2111,7 +2111,7 @@@ unlock
  }
  
  int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
 -                              int vport, u16 vlan, u8 qos)
 +                              u16 vport, u16 vlan, u8 qos)
  {
        u8 set_flags = 0;
  
  }
  
  int mlx5_eswitch_set_vport_spoofchk(struct mlx5_eswitch *esw,
 -                                  int vport, bool spoofchk)
 +                                  u16 vport, bool spoofchk)
  {
        struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
        bool pschk;
@@@ -2250,7 -2272,7 +2272,7 @@@ out
  }
  
  int mlx5_eswitch_set_vport_trust(struct mlx5_eswitch *esw,
 -                               int vport, bool setting)
 +                               u16 vport, bool setting)
  {
        struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
  
@@@ -2320,7 -2342,7 +2342,7 @@@ static int normalize_vports_min_rate(st
        return 0;
  }
  
 -int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, int vport,
 +int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, u16 vport,
                                u32 max_rate, u32 min_rate)
  {
        struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
@@@ -2410,7 -2432,7 +2432,7 @@@ static int mlx5_eswitch_query_vport_dro
  }
  
  int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,
 -                               int vport_num,
 +                               u16 vport_num,
                                 struct ifla_vf_stats *vf_stats)
  {
        struct mlx5_vport *vport = mlx5_eswitch_get_vport(esw, vport_num);
@@@ -2525,8 -2547,7 +2547,7 @@@ bool mlx5_esw_multipath_prereq(struct m
  
  void mlx5_eswitch_update_num_of_vfs(struct mlx5_eswitch *esw, const int num_vfs)
  {
-       u32 out[MLX5_ST_SZ_DW(query_esw_functions_out)] = {};
-       int err;
+       const u32 *out;
  
        WARN_ON_ONCE(esw->mode != MLX5_ESWITCH_NONE);
  
                return;
        }
  
-       err = mlx5_esw_query_functions(esw->dev, out, sizeof(out));
-       if (!err)
-               esw->esw_funcs.num_vfs = MLX5_GET(query_esw_functions_out, out,
-                                                 host_params_context.host_num_of_vfs);
+       out = mlx5_esw_query_functions(esw->dev);
+       if (IS_ERR(out))
+               return;
+       esw->esw_funcs.num_vfs = MLX5_GET(query_esw_functions_out, out,
+                                         host_params_context.host_num_of_vfs);
+       kvfree(out);
  }
@@@ -256,23 -256,23 +256,23 @@@ void mlx5_eswitch_cleanup(struct mlx5_e
  int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode);
  void mlx5_eswitch_disable(struct mlx5_eswitch *esw);
  int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
 -                             int vport, u8 mac[ETH_ALEN]);
 +                             u16 vport, u8 mac[ETH_ALEN]);
  int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw,
 -                               int vport, int link_state);
 +                               u16 vport, int link_state);
  int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
 -                              int vport, u16 vlan, u8 qos);
 +                              u16 vport, u16 vlan, u8 qos);
  int mlx5_eswitch_set_vport_spoofchk(struct mlx5_eswitch *esw,
 -                                  int vport, bool spoofchk);
 +                                  u16 vport, bool spoofchk);
  int mlx5_eswitch_set_vport_trust(struct mlx5_eswitch *esw,
 -                               int vport_num, bool setting);
 -int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, int vport,
 +                               u16 vport_num, bool setting);
 +int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, u16 vport,
                                u32 max_rate, u32 min_rate);
  int mlx5_eswitch_set_vepa(struct mlx5_eswitch *esw, u8 setting);
  int mlx5_eswitch_get_vepa(struct mlx5_eswitch *esw, u8 *setting);
  int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,
 -                                int vport, struct ifla_vf_info *ivi);
 +                                u16 vport, struct ifla_vf_info *ivi);
  int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,
 -                               int vport,
 +                               u16 vport,
                                 struct ifla_vf_stats *vf_stats);
  void mlx5_eswitch_del_send_to_vport_rule(struct mlx5_flow_handle *rule);
  
@@@ -311,7 -311,7 +311,7 @@@ u3
  mlx5_eswitch_get_chain_range(struct mlx5_eswitch *esw);
  
  struct mlx5_flow_handle *
 -mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, int vport,
 +mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, u16 vport,
                                  struct mlx5_flow_destination *dest);
  
  enum {
@@@ -383,7 -383,7 +383,7 @@@ int mlx5_eswitch_add_vlan_action(struc
  int mlx5_eswitch_del_vlan_action(struct mlx5_eswitch *esw,
                                 struct mlx5_esw_flow_attr *attr);
  int __mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
 -                                int vport, u16 vlan, u8 qos, u8 set_flags);
 +                                u16 vport, u16 vlan, u8 qos, u8 set_flags);
  
  static inline bool mlx5_eswitch_vlan_actions_supported(struct mlx5_core_dev *dev,
                                                       u8 vlan_depth)
@@@ -403,7 -403,7 +403,7 @@@ bool mlx5_esw_lag_prereq(struct mlx5_co
  bool mlx5_esw_multipath_prereq(struct mlx5_core_dev *dev0,
                               struct mlx5_core_dev *dev1);
  
int mlx5_esw_query_functions(struct mlx5_core_dev *dev, u32 *out, int outlen);
const u32 *mlx5_esw_query_functions(struct mlx5_core_dev *dev);
  
  #define MLX5_DEBUG_ESWITCH_MASK BIT(3)
  
@@@ -467,7 -467,7 +467,7 @@@ static inline int mlx5_eswitch_vport_nu
        return vport_num;
  }
  
 -static inline int mlx5_eswitch_index_to_vport_num(struct mlx5_eswitch *esw,
 +static inline u16 mlx5_eswitch_index_to_vport_num(struct mlx5_eswitch *esw,
                                                  int index)
  {
        if (index == mlx5_eswitch_ecpf_idx(esw) &&
@@@ -560,10 -560,9 +560,9 @@@ static inline int  mlx5_eswitch_enable(
  static inline void mlx5_eswitch_disable(struct mlx5_eswitch *esw) {}
  static inline bool mlx5_esw_lag_prereq(struct mlx5_core_dev *dev0, struct mlx5_core_dev *dev1) { return true; }
  static inline bool mlx5_eswitch_is_funcs_handler(struct mlx5_core_dev *dev) { return false; }
- static inline int
- mlx5_esw_query_functions(struct mlx5_core_dev *dev, u32 *out, int outlen)
+ static inline const u32 *mlx5_esw_query_functions(struct mlx5_core_dev *dev)
  {
-       return -EOPNOTSUPP;
+       return ERR_PTR(-EOPNOTSUPP);
  }
  
  static inline void mlx5_eswitch_update_num_of_vfs(struct mlx5_eswitch *esw, const int num_vfs) {}
@@@ -56,7 -56,7 +56,7 @@@
  static struct mlx5_eswitch_rep *mlx5_eswitch_get_rep(struct mlx5_eswitch *esw,
                                                     u16 vport_num)
  {
 -      u16 idx = mlx5_eswitch_vport_num_to_index(esw, vport_num);
 +      int idx = mlx5_eswitch_vport_num_to_index(esw, vport_num);
  
        WARN_ON(idx > esw->total_vports - 1);
        return &esw->offloads.vport_reps[idx];
@@@ -530,8 -530,7 +530,8 @@@ out
  }
  
  struct mlx5_flow_handle *
 -mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, int vport, u32 sqn)
 +mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, u16 vport,
 +                                  u32 sqn)
  {
        struct mlx5_flow_act flow_act = {0};
        struct mlx5_flow_destination dest = {};
@@@ -1307,7 -1306,7 +1307,7 @@@ static void esw_destroy_vport_rx_group(
  }
  
  struct mlx5_flow_handle *
 -mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, int vport,
 +mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, u16 vport,
                                  struct mlx5_flow_destination *dest)
  {
        struct mlx5_flow_act flow_act = {0};
@@@ -1395,7 -1394,7 +1395,7 @@@ void esw_offloads_cleanup_reps(struct m
  
  int esw_offloads_init_reps(struct mlx5_eswitch *esw)
  {
-       int total_vports = MLX5_TOTAL_VPORTS(esw->dev);
+       int total_vports = esw->total_vports;
        struct mlx5_core_dev *dev = esw->dev;
        struct mlx5_eswitch_rep *rep;
        u8 hw_id[ETH_ALEN], rep_type;
@@@ -2047,38 -2046,48 +2047,48 @@@ static void esw_offloads_steering_clean
        esw_destroy_offloads_acl_tables(esw);
  }
  
- static void esw_functions_changed_event_handler(struct work_struct *work)
+ static void
+ esw_vfs_changed_event_handler(struct mlx5_eswitch *esw, const u32 *out)
  {
-       u32 out[MLX5_ST_SZ_DW(query_esw_functions_out)] = {};
-       struct mlx5_host_work *host_work;
-       struct mlx5_eswitch *esw;
        bool host_pf_disabled;
-       u16 num_vfs = 0;
-       int err;
+       u16 new_num_vfs;
  
-       host_work = container_of(work, struct mlx5_host_work, work);
-       esw = host_work->esw;
-       err = mlx5_esw_query_functions(esw->dev, out, sizeof(out));
-       num_vfs = MLX5_GET(query_esw_functions_out, out,
-                          host_params_context.host_num_of_vfs);
+       new_num_vfs = MLX5_GET(query_esw_functions_out, out,
+                              host_params_context.host_num_of_vfs);
        host_pf_disabled = MLX5_GET(query_esw_functions_out, out,
                                    host_params_context.host_pf_disabled);
-       if (err || host_pf_disabled || num_vfs == esw->esw_funcs.num_vfs)
-               goto out;
+       if (new_num_vfs == esw->esw_funcs.num_vfs || host_pf_disabled)
+               return;
  
        /* Number of VFs can only change from "0 to x" or "x to 0". */
        if (esw->esw_funcs.num_vfs > 0) {
                esw_offloads_unload_vf_reps(esw, esw->esw_funcs.num_vfs);
        } else {
-               err = esw_offloads_load_vf_reps(esw, num_vfs);
+               int err;
  
+               err = esw_offloads_load_vf_reps(esw, new_num_vfs);
                if (err)
-                       goto out;
+                       return;
        }
+       esw->esw_funcs.num_vfs = new_num_vfs;
+ }
  
-       esw->esw_funcs.num_vfs = num_vfs;
+ static void esw_functions_changed_event_handler(struct work_struct *work)
+ {
+       struct mlx5_host_work *host_work;
+       struct mlx5_eswitch *esw;
+       const u32 *out;
+       host_work = container_of(work, struct mlx5_host_work, work);
+       esw = host_work->esw;
+       out = mlx5_esw_query_functions(esw->dev);
+       if (IS_ERR(out))
+               goto out;
  
+       esw_vfs_changed_event_handler(esw, out);
+       kvfree(out);
  out:
        kfree(host_work);
  }
@@@ -2506,7 -2515,7 +2516,7 @@@ void *mlx5_eswitch_get_uplink_priv(stru
  }
  
  void *mlx5_eswitch_get_proto_dev(struct mlx5_eswitch *esw,
 -                               int vport,
 +                               u16 vport,
                                 u8 rep_type)
  {
        struct mlx5_eswitch_rep *rep;
@@@ -2527,7 -2536,7 +2537,7 @@@ void *mlx5_eswitch_uplink_get_proto_dev
  EXPORT_SYMBOL(mlx5_eswitch_uplink_get_proto_dev);
  
  struct mlx5_eswitch_rep *mlx5_eswitch_vport_rep(struct mlx5_eswitch *esw,
 -                                              int vport)
 +                                              u16 vport)
  {
        return mlx5_eswitch_get_rep(esw, vport);
  }
@@@ -1381,8 -1381,6 +1381,8 @@@ static bool mlx5_flow_dests_cmp(struct 
                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 &&
@@@ -2092,7 -2090,7 +2092,7 @@@ struct mlx5_flow_namespace *mlx5_get_fl
  {
        struct mlx5_flow_steering *steering = dev->priv.steering;
  
-       if (!steering || vport >= MLX5_TOTAL_VPORTS(dev))
+       if (!steering || vport >= mlx5_eswitch_get_total_vports(dev))
                return NULL;
  
        switch (type) {
@@@ -2284,7 -2282,7 +2284,7 @@@ static struct mlx5_flow_root_namespac
                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;
  
@@@ -2423,11 -2421,10 +2423,11 @@@ static void cleanup_egress_acls_root_ns
        if (!steering->esw_egress_root_ns)
                return;
  
-       for (i = 0; i < MLX5_TOTAL_VPORTS(dev); i++)
+       for (i = 0; i < mlx5_eswitch_get_total_vports(dev); i++)
                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)
        if (!steering->esw_ingress_root_ns)
                return;
  
-       for (i = 0; i < MLX5_TOTAL_VPORTS(dev); i++)
+       for (i = 0; i < mlx5_eswitch_get_total_vports(dev); i++)
                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)
@@@ -2476,7 -2472,11 +2476,7 @@@ static int init_sniffer_tx_root_ns(stru
  
        /* 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)
  
        /* 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)
  
        /* 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)
  {
@@@ -2606,16 -2614,18 +2606,18 @@@ static int init_ingress_acl_root_ns(str
  static int init_egress_acls_root_ns(struct mlx5_core_dev *dev)
  {
        struct mlx5_flow_steering *steering = dev->priv.steering;
+       int total_vports = mlx5_eswitch_get_total_vports(dev);
        int err;
        int i;
  
-       steering->esw_egress_root_ns = kcalloc(MLX5_TOTAL_VPORTS(dev),
-                                              sizeof(*steering->esw_egress_root_ns),
-                                              GFP_KERNEL);
+       steering->esw_egress_root_ns =
+                       kcalloc(total_vports,
+                               sizeof(*steering->esw_egress_root_ns),
+                               GFP_KERNEL);
        if (!steering->esw_egress_root_ns)
                return -ENOMEM;
  
-       for (i = 0; i < MLX5_TOTAL_VPORTS(dev); i++) {
+       for (i = 0; i < total_vports; i++) {
                err = init_egress_acl_root_ns(steering, i);
                if (err)
                        goto cleanup_root_ns;
@@@ -2627,23 -2637,24 +2629,25 @@@ 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;
  }
  
  static int init_ingress_acls_root_ns(struct mlx5_core_dev *dev)
  {
        struct mlx5_flow_steering *steering = dev->priv.steering;
+       int total_vports = mlx5_eswitch_get_total_vports(dev);
        int err;
        int i;
  
-       steering->esw_ingress_root_ns = kcalloc(MLX5_TOTAL_VPORTS(dev),
-                                               sizeof(*steering->esw_ingress_root_ns),
-                                               GFP_KERNEL);
+       steering->esw_ingress_root_ns =
+                       kcalloc(total_vports,
+                               sizeof(*steering->esw_ingress_root_ns),
+                               GFP_KERNEL);
        if (!steering->esw_ingress_root_ns)
                return -ENOMEM;
  
-       for (i = 0; i < MLX5_TOTAL_VPORTS(dev); i++) {
+       for (i = 0; i < total_vports; i++) {
                err = init_ingress_acl_root_ns(steering, i);
                if (err)
                        goto cleanup_root_ns;
@@@ -2655,7 -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;
  }
  
@@@ -56,16 -56,18 +56,18 @@@ void mlx5_eswitch_register_vport_reps(s
                                      u8 rep_type);
  void mlx5_eswitch_unregister_vport_reps(struct mlx5_eswitch *esw, u8 rep_type);
  void *mlx5_eswitch_get_proto_dev(struct mlx5_eswitch *esw,
 -                               int vport,
 +                               u16 vport_num,
                                 u8 rep_type);
  struct mlx5_eswitch_rep *mlx5_eswitch_vport_rep(struct mlx5_eswitch *esw,
 -                                              int vport);
 +                                              u16 vport_num);
  void *mlx5_eswitch_uplink_get_proto_dev(struct mlx5_eswitch *esw, u8 rep_type);
  u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw);
  struct mlx5_flow_handle *
  mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw,
 -                                  int vport, u32 sqn);
 +                                  u16 vport_num, u32 sqn);
  
+ u16 mlx5_eswitch_get_total_vports(const struct mlx5_core_dev *dev);
  #ifdef CONFIG_MLX5_ESWITCH
  enum devlink_eswitch_encap_mode
  mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev);
@@@ -93,4 -95,5 +95,5 @@@ mlx5_eswitch_get_vport_metadata_for_mat
        return 0;
  };
  #endif /* CONFIG_MLX5_ESWITCH */
  #endif
diff --combined include/linux/mlx5/qp.h
@@@ -37,8 -37,7 +37,8 @@@
  #include <linux/mlx5/driver.h>
  
  #define MLX5_INVALID_LKEY     0x100
 -#define MLX5_SIG_WQE_SIZE     (MLX5_SEND_WQE_BB * 5)
 +/* UMR (3 WQE_BB's) + SIG (3 WQE_BB's) + PSV (mem) + PSV (wire) */
 +#define MLX5_SIG_WQE_SIZE     (MLX5_SEND_WQE_BB * 8)
  #define MLX5_DIF_SIZE         8
  #define MLX5_STRIDE_BLOCK_OP  0x400
  #define MLX5_CPY_GRD_MASK     0xc0
@@@ -203,7 -202,12 +203,12 @@@ struct mlx5_wqe_ctrl_seg 
        u8                      signature;
        u8                      rsvd[2];
        u8                      fm_ce_se;
-       __be32                  imm;
+       union {
+               __be32          general_id;
+               __be32          imm;
+               __be32          umr_mkey;
+               __be32          tisn;
+       };
  };
  
  #define MLX5_WQE_CTRL_DS_MASK 0x3f