Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 24 Jan 2016 02:45:06 +0000 (18:45 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 24 Jan 2016 02:45:06 +0000 (18:45 -0800)
Pull rdma updates from Doug Ledford:
 "Initial roundup of 4.5 merge window patches

   - Remove usage of ib_query_device and instead store attributes in
     ib_device struct

   - Move iopoll out of block and into lib, rename to irqpoll, and use
     in several places in the rdma stack as our new completion queue
     polling library mechanism.  Update the other block drivers that
     already used iopoll to use the new mechanism too.

   - Replace the per-entry GID table locks with a single GID table lock

   - IPoIB multicast cleanup

   - Cleanups to the IB MR facility

   - Add support for 64bit extended IB counters

   - Fix for netlink oops while parsing RDMA nl messages

   - RoCEv2 support for the core IB code

   - mlx4 RoCEv2 support

   - mlx5 RoCEv2 support

   - Cross Channel support for mlx5

   - Timestamp support for mlx5

   - Atomic support for mlx5

   - Raw QP support for mlx5

   - MAINTAINERS update for mlx4/mlx5

   - Misc ocrdma, qib, nes, usNIC, cxgb3, cxgb4, mlx4, mlx5 updates

   - Add support for remote invalidate to the iSER driver (pushed
     through the RDMA tree due to dependencies, acknowledged by nab)

   - Update to NFSoRDMA (pushed through the RDMA tree due to
     dependencies, acknowledged by Bruce)"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (169 commits)
  IB/mlx5: Unify CQ create flags check
  IB/mlx5: Expose Raw Packet QP to user space consumers
  {IB, net}/mlx5: Move the modify QP operation table to mlx5_ib
  IB/mlx5: Support setting Ethernet priority for Raw Packet QPs
  IB/mlx5: Add Raw Packet QP query functionality
  IB/mlx5: Add create and destroy functionality for Raw Packet QP
  IB/mlx5: Refactor mlx5_ib_qp to accommodate other QP types
  IB/mlx5: Allocate a Transport Domain for each ucontext
  net/mlx5_core: Warn on unsupported events of QP/RQ/SQ
  net/mlx5_core: Add RQ and SQ event handling
  net/mlx5_core: Export transport objects
  IB/mlx5: Expose CQE version to user-space
  IB/mlx5: Add CQE version 1 support to user QPs and SRQs
  IB/mlx5: Fix data validation in mlx5_ib_alloc_ucontext
  IB/sa: Fix netlink local service GFP crash
  IB/srpt: Remove redundant wc array
  IB/qib: Improve ipoib UD performance
  IB/mlx4: Advertise RoCE v2 support
  IB/mlx4: Create and use another QP1 for RoCEv2
  IB/mlx4: Enable send of RoCE QP1 packets with IP/UDP headers
  ...

39 files changed:
1  2 
MAINTAINERS
block/Makefile
drivers/infiniband/core/cma.c
drivers/infiniband/hw/cxgb4/cm.c
drivers/infiniband/hw/mlx4/srq.c
drivers/infiniband/hw/mlx5/cq.c
drivers/infiniband/hw/mlx5/main.c
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/ulp/isert/ib_isert.c
drivers/infiniband/ulp/srpt/ib_srpt.c
drivers/infiniband/ulp/srpt/ib_srpt.h
drivers/net/ethernet/mellanox/mlx4/fw.c
drivers/net/ethernet/mellanox/mlx4/mlx4.h
drivers/net/ethernet/mellanox/mlx4/port.c
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/eq.c
drivers/net/ethernet/mellanox/mlx5/core/main.c
drivers/net/ethernet/mellanox/mlx5/core/vport.c
drivers/scsi/Kconfig
drivers/scsi/ipr.c
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
drivers/staging/rdma/amso1100/c2_provider.c
drivers/staging/rdma/ehca/ehca_main.c
drivers/staging/rdma/ehca/ehca_mrmw.c
drivers/staging/rdma/hfi1/verbs.c
drivers/staging/rdma/hfi1/verbs.h
include/linux/interrupt.h
include/linux/mlx5/device.h
include/linux/mlx5/driver.h
include/linux/mlx5/mlx5_ifc.h
include/linux/mlx5/vport.h
lib/Kconfig
lib/Makefile
net/sunrpc/xprtrdma/frwr_ops.c
net/sunrpc/xprtrdma/transport.c
net/sunrpc/xprtrdma/verbs.c
net/sunrpc/xprtrdma/xprt_rdma.h
tools/lib/traceevent/event-parse.c

diff --cc MAINTAINERS
Simple merge
diff --cc block/Makefile
@@@ -5,10 -5,10 +5,10 @@@
  obj-$(CONFIG_BLOCK) := bio.o elevator.o blk-core.o blk-tag.o blk-sysfs.o \
                        blk-flush.o blk-settings.o blk-ioc.o blk-map.o \
                        blk-exec.o blk-merge.o blk-softirq.o blk-timeout.o \
-                       blk-iopoll.o blk-lib.o blk-mq.o blk-mq-tag.o \
+                       blk-lib.o blk-mq.o blk-mq-tag.o \
                        blk-mq-sysfs.o blk-mq-cpu.o blk-mq-cpumap.o ioctl.o \
                        genhd.o scsi_ioctl.o partition-generic.o ioprio.o \
 -                      partitions/
 +                      badblocks.o partitions/
  
  obj-$(CONFIG_BOUNCE)  += bounce.o
  obj-$(CONFIG_BLK_DEV_BSG)     += bsg.o
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1893,24 -1819,21 +2273,30 @@@ static void *mlx5_ib_add(struct mlx5_co
                        (1ull << IB_USER_VERBS_CMD_CLOSE_XRCD);
        }
  
-       if (mlx5_ib_port_link_layer(&dev->ib_dev) ==
++      if (mlx5_ib_port_link_layer(&dev->ib_dev, 1) ==
 +          IB_LINK_LAYER_ETHERNET) {
 +              dev->ib_dev.create_flow = mlx5_ib_create_flow;
 +              dev->ib_dev.destroy_flow = mlx5_ib_destroy_flow;
 +              dev->ib_dev.uverbs_ex_cmd_mask |=
 +                      (1ull << IB_USER_VERBS_EX_CMD_CREATE_FLOW) |
 +                      (1ull << IB_USER_VERBS_EX_CMD_DESTROY_FLOW);
 +      }
        err = init_node_data(dev);
        if (err)
                goto err_dealloc;
  
 +      mutex_init(&dev->flow_db.lock);
        mutex_init(&dev->cap_mask_mutex);
  
+       if (ll == IB_LINK_LAYER_ETHERNET) {
+               err = mlx5_enable_roce(dev);
+               if (err)
+                       goto err_dealloc;
+       }
        err = create_dev_resources(&dev->devr);
        if (err)
-               goto err_dealloc;
+               goto err_disable_roce;
  
        err = mlx5_ib_odp_init_one(dev);
        if (err)
Simple merge
@@@ -364,11 -344,11 +344,11 @@@ isert_create_device_ib_res(struct isert
                device->unreg_rdma_mem = isert_unmap_cmd;
        }
  
-       ret = isert_alloc_comps(device, dev_attr);
+       ret = isert_alloc_comps(device);
        if (ret)
 -              return ret;
 +              goto out;
  
-       device->pd = ib_alloc_pd(device->ib_device);
+       device->pd = ib_alloc_pd(ib_dev);
        if (IS_ERR(device->pd)) {
                ret = PTR_ERR(device->pd);
                isert_err("failed to allocate pd, device %p, ret=%d\n",
Simple merge
Simple merge
@@@ -55,59 -53,12 +55,59 @@@ static int _mlx5_query_vport_state(stru
        if (err)
                mlx5_core_warn(mdev, "MLX5_CMD_OP_QUERY_VPORT_STATE failed\n");
  
 +      return err;
 +}
 +
 +u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport)
 +{
 +      u32 out[MLX5_ST_SZ_DW(query_vport_state_out)] = {0};
 +
 +      _mlx5_query_vport_state(mdev, opmod, vport, out, sizeof(out));
 +
        return MLX5_GET(query_vport_state_out, out, state);
  }
 -EXPORT_SYMBOL(mlx5_query_vport_state);
 +EXPORT_SYMBOL_GPL(mlx5_query_vport_state);
 +
 +u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport)
 +{
 +      u32 out[MLX5_ST_SZ_DW(query_vport_state_out)] = {0};
 +
 +      _mlx5_query_vport_state(mdev, opmod, vport, out, sizeof(out));
 +
 +      return MLX5_GET(query_vport_state_out, out, admin_state);
 +}
- EXPORT_SYMBOL(mlx5_query_vport_admin_state);
++EXPORT_SYMBOL_GPL(mlx5_query_vport_admin_state);
  
 -static int mlx5_query_nic_vport_context(struct mlx5_core_dev *mdev, u32 *out,
 -                                      int outlen)
 +int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
 +                                u16 vport, u8 state)
 +{
 +      u32 in[MLX5_ST_SZ_DW(modify_vport_state_in)];
 +      u32 out[MLX5_ST_SZ_DW(modify_vport_state_out)];
 +      int err;
 +
 +      memset(in, 0, sizeof(in));
 +
 +      MLX5_SET(modify_vport_state_in, in, opcode,
 +               MLX5_CMD_OP_MODIFY_VPORT_STATE);
 +      MLX5_SET(modify_vport_state_in, in, op_mod, opmod);
 +      MLX5_SET(modify_vport_state_in, in, vport_number, vport);
 +
 +      if (vport)
 +              MLX5_SET(modify_vport_state_in, in, other_vport, 1);
 +
 +      MLX5_SET(modify_vport_state_in, in, admin_state, state);
 +
 +      err = mlx5_cmd_exec_check_status(mdev, in, sizeof(in), out,
 +                                       sizeof(out));
 +      if (err)
 +              mlx5_core_warn(mdev, "MLX5_CMD_OP_MODIFY_VPORT_STATE failed\n");
 +
 +      return err;
 +}
- EXPORT_SYMBOL(mlx5_modify_vport_admin_state);
++EXPORT_SYMBOL_GPL(mlx5_modify_vport_admin_state);
 +
 +static int mlx5_query_nic_vport_context(struct mlx5_core_dev *mdev, u16 vport,
 +                                      u32 *out, int outlen)
  {
        u32 in[MLX5_ST_SZ_DW(query_nic_vport_context_in)];
  
@@@ -150,286 -95,76 +150,345 @@@ int mlx5_query_nic_vport_mac_address(st
        out_addr = MLX5_ADDR_OF(query_nic_vport_context_out, out,
                                nic_vport_context.permanent_address);
  
 -      err = mlx5_query_nic_vport_context(mdev, out, outlen);
 +      err = mlx5_query_nic_vport_context(mdev, vport, out, outlen);
-       if (err)
-               goto out;
-       ether_addr_copy(addr, &out_addr[2]);
+       if (!err)
+               ether_addr_copy(addr, &out_addr[2]);
  
- out:
        kvfree(out);
- EXPORT_SYMBOL(mlx5_modify_nic_vport_mac_address);
 +      return err;
 +}
 +EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_mac_address);
 +
 +int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *mdev,
 +                                    u16 vport, u8 *addr)
 +{
 +      void *in;
 +      int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in);
 +      int err;
 +      void *nic_vport_ctx;
 +      u8 *perm_mac;
 +
 +      in = mlx5_vzalloc(inlen);
 +      if (!in) {
 +              mlx5_core_warn(mdev, "failed to allocate inbox\n");
 +              return -ENOMEM;
 +      }
 +
 +      MLX5_SET(modify_nic_vport_context_in, in,
 +               field_select.permanent_address, 1);
 +      MLX5_SET(modify_nic_vport_context_in, in, vport_number, vport);
 +
 +      if (vport)
 +              MLX5_SET(modify_nic_vport_context_in, in, other_vport, 1);
 +
 +      nic_vport_ctx = MLX5_ADDR_OF(modify_nic_vport_context_in,
 +                                   in, nic_vport_context);
 +      perm_mac = MLX5_ADDR_OF(nic_vport_context, nic_vport_ctx,
 +                              permanent_address);
 +
 +      ether_addr_copy(&perm_mac[2], addr);
 +
 +      err = mlx5_modify_nic_vport_context(mdev, in, inlen);
 +
 +      kvfree(in);
 +
 +      return err;
 +}
++EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_mac_address);
 +
 +int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev,
 +                                u32 vport,
 +                                enum mlx5_list_type list_type,
 +                                u8 addr_list[][ETH_ALEN],
 +                                int *list_size)
 +{
 +      u32 in[MLX5_ST_SZ_DW(query_nic_vport_context_in)];
 +      void *nic_vport_ctx;
 +      int max_list_size;
 +      int req_list_size;
 +      int out_sz;
 +      void *out;
 +      int err;
 +      int i;
 +
 +      req_list_size = *list_size;
 +
 +      max_list_size = list_type == MLX5_NVPRT_LIST_TYPE_UC ?
 +              1 << MLX5_CAP_GEN(dev, log_max_current_uc_list) :
 +              1 << MLX5_CAP_GEN(dev, log_max_current_mc_list);
 +
 +      if (req_list_size > max_list_size) {
 +              mlx5_core_warn(dev, "Requested list size (%d) > (%d) max_list_size\n",
 +                             req_list_size, max_list_size);
 +              req_list_size = max_list_size;
 +      }
 +
 +      out_sz = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in) +
 +                      req_list_size * MLX5_ST_SZ_BYTES(mac_address_layout);
 +
 +      memset(in, 0, sizeof(in));
 +      out = kzalloc(out_sz, GFP_KERNEL);
 +      if (!out)
 +              return -ENOMEM;
 +
 +      MLX5_SET(query_nic_vport_context_in, in, opcode,
 +               MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT);
 +      MLX5_SET(query_nic_vport_context_in, in, allowed_list_type, list_type);
 +      MLX5_SET(query_nic_vport_context_in, in, vport_number, vport);
 +
 +      if (vport)
 +              MLX5_SET(query_nic_vport_context_in, in, other_vport, 1);
 +
 +      err = mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, out_sz);
 +      if (err)
 +              goto out;
 +
 +      nic_vport_ctx = MLX5_ADDR_OF(query_nic_vport_context_out, out,
 +                                   nic_vport_context);
 +      req_list_size = MLX5_GET(nic_vport_context, nic_vport_ctx,
 +                               allowed_list_size);
 +
 +      *list_size = req_list_size;
 +      for (i = 0; i < req_list_size; i++) {
 +              u8 *mac_addr = MLX5_ADDR_OF(nic_vport_context,
 +                                      nic_vport_ctx,
 +                                      current_uc_mac_address[i]) + 2;
 +              ether_addr_copy(addr_list[i], mac_addr);
 +      }
 +out:
 +      kfree(out);
 +      return err;
 +}
 +EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_mac_list);
 +
 +int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev,
 +                                 enum mlx5_list_type list_type,
 +                                 u8 addr_list[][ETH_ALEN],
 +                                 int list_size)
 +{
 +      u32 out[MLX5_ST_SZ_DW(modify_nic_vport_context_out)];
 +      void *nic_vport_ctx;
 +      int max_list_size;
 +      int in_sz;
 +      void *in;
 +      int err;
 +      int i;
 +
 +      max_list_size = list_type == MLX5_NVPRT_LIST_TYPE_UC ?
 +               1 << MLX5_CAP_GEN(dev, log_max_current_uc_list) :
 +               1 << MLX5_CAP_GEN(dev, log_max_current_mc_list);
 +
 +      if (list_size > max_list_size)
 +              return -ENOSPC;
 +
 +      in_sz = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in) +
 +              list_size * MLX5_ST_SZ_BYTES(mac_address_layout);
 +
 +      memset(out, 0, sizeof(out));
 +      in = kzalloc(in_sz, GFP_KERNEL);
 +      if (!in)
 +              return -ENOMEM;
 +
 +      MLX5_SET(modify_nic_vport_context_in, in, opcode,
 +               MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
 +      MLX5_SET(modify_nic_vport_context_in, in,
 +               field_select.addresses_list, 1);
 +
 +      nic_vport_ctx = MLX5_ADDR_OF(modify_nic_vport_context_in, in,
 +                                   nic_vport_context);
 +
 +      MLX5_SET(nic_vport_context, nic_vport_ctx,
 +               allowed_list_type, list_type);
 +      MLX5_SET(nic_vport_context, nic_vport_ctx,
 +               allowed_list_size, list_size);
 +
 +      for (i = 0; i < list_size; i++) {
 +              u8 *curr_mac = MLX5_ADDR_OF(nic_vport_context,
 +                                          nic_vport_ctx,
 +                                          current_uc_mac_address[i]) + 2;
 +              ether_addr_copy(curr_mac, addr_list[i]);
 +      }
 +
 +      err = mlx5_cmd_exec_check_status(dev, in, in_sz, out, sizeof(out));
 +      kfree(in);
 +      return err;
  }
 -EXPORT_SYMBOL(mlx5_query_nic_vport_mac_address);
 +EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_mac_list);
 +
 +int mlx5_query_nic_vport_vlans(struct mlx5_core_dev *dev,
 +                             u32 vport,
 +                             u16 vlans[],
 +                             int *size)
 +{
 +      u32 in[MLX5_ST_SZ_DW(query_nic_vport_context_in)];
 +      void *nic_vport_ctx;
 +      int req_list_size;
 +      int max_list_size;
 +      int out_sz;
 +      void *out;
 +      int err;
 +      int i;
 +
 +      req_list_size = *size;
 +      max_list_size = 1 << MLX5_CAP_GEN(dev, log_max_vlan_list);
 +      if (req_list_size > max_list_size) {
 +              mlx5_core_warn(dev, "Requested list size (%d) > (%d) max list size\n",
 +                             req_list_size, max_list_size);
 +              req_list_size = max_list_size;
 +      }
 +
 +      out_sz = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in) +
 +                      req_list_size * MLX5_ST_SZ_BYTES(vlan_layout);
 +
 +      memset(in, 0, sizeof(in));
 +      out = kzalloc(out_sz, GFP_KERNEL);
 +      if (!out)
 +              return -ENOMEM;
 +
 +      MLX5_SET(query_nic_vport_context_in, in, opcode,
 +               MLX5_CMD_OP_QUERY_NIC_VPORT_CONTEXT);
 +      MLX5_SET(query_nic_vport_context_in, in, allowed_list_type,
 +               MLX5_NVPRT_LIST_TYPE_VLAN);
 +      MLX5_SET(query_nic_vport_context_in, in, vport_number, vport);
 +
 +      if (vport)
 +              MLX5_SET(query_nic_vport_context_in, in, other_vport, 1);
 +
 +      err = mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, out_sz);
 +      if (err)
 +              goto out;
 +
 +      nic_vport_ctx = MLX5_ADDR_OF(query_nic_vport_context_out, out,
 +                                   nic_vport_context);
 +      req_list_size = MLX5_GET(nic_vport_context, nic_vport_ctx,
 +                               allowed_list_size);
 +
 +      *size = req_list_size;
 +      for (i = 0; i < req_list_size; i++) {
 +              void *vlan_addr = MLX5_ADDR_OF(nic_vport_context,
 +                                             nic_vport_ctx,
 +                                             current_uc_mac_address[i]);
 +              vlans[i] = MLX5_GET(vlan_layout, vlan_addr, vlan);
 +      }
 +out:
 +      kfree(out);
 +      return err;
 +}
 +EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_vlans);
 +
 +int mlx5_modify_nic_vport_vlans(struct mlx5_core_dev *dev,
 +                              u16 vlans[],
 +                              int list_size)
 +{
 +      u32 out[MLX5_ST_SZ_DW(modify_nic_vport_context_out)];
 +      void *nic_vport_ctx;
 +      int max_list_size;
 +      int in_sz;
 +      void *in;
 +      int err;
 +      int i;
 +
 +      max_list_size = 1 << MLX5_CAP_GEN(dev, log_max_vlan_list);
 +
 +      if (list_size > max_list_size)
 +              return -ENOSPC;
 +
 +      in_sz = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in) +
 +              list_size * MLX5_ST_SZ_BYTES(vlan_layout);
 +
 +      memset(out, 0, sizeof(out));
 +      in = kzalloc(in_sz, GFP_KERNEL);
 +      if (!in)
 +              return -ENOMEM;
 +
 +      MLX5_SET(modify_nic_vport_context_in, in, opcode,
 +               MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
 +      MLX5_SET(modify_nic_vport_context_in, in,
 +               field_select.addresses_list, 1);
 +
 +      nic_vport_ctx = MLX5_ADDR_OF(modify_nic_vport_context_in, in,
 +                                   nic_vport_context);
 +
 +      MLX5_SET(nic_vport_context, nic_vport_ctx,
 +               allowed_list_type, MLX5_NVPRT_LIST_TYPE_VLAN);
 +      MLX5_SET(nic_vport_context, nic_vport_ctx,
 +               allowed_list_size, list_size);
 +
 +      for (i = 0; i < list_size; i++) {
 +              void *vlan_addr = MLX5_ADDR_OF(nic_vport_context,
 +                                             nic_vport_ctx,
 +                                             current_uc_mac_address[i]);
 +              MLX5_SET(vlan_layout, vlan_addr, vlan, vlans[i]);
 +      }
 +
 +      err = mlx5_cmd_exec_check_status(dev, in, in_sz, out, sizeof(out));
 +      kfree(in);
 +      return err;
 +}
 +EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_vlans);
  
 -      mlx5_query_nic_vport_context(mdev, out, outlen);
+ int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
+                                          u64 *system_image_guid)
+ {
+       u32 *out;
+       int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
+       out = mlx5_vzalloc(outlen);
+       if (!out)
+               return -ENOMEM;
 -      mlx5_query_nic_vport_context(mdev, out, outlen);
++      mlx5_query_nic_vport_context(mdev, 0, out, outlen);
+       *system_image_guid = MLX5_GET64(query_nic_vport_context_out, out,
+                                       nic_vport_context.system_image_guid);
+       kfree(out);
+       return 0;
+ }
+ EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_system_image_guid);
+ int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid)
+ {
+       u32 *out;
+       int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
+       out = mlx5_vzalloc(outlen);
+       if (!out)
+               return -ENOMEM;
 -      mlx5_query_nic_vport_context(mdev, out, outlen);
++      mlx5_query_nic_vport_context(mdev, 0, out, outlen);
+       *node_guid = MLX5_GET64(query_nic_vport_context_out, out,
+                               nic_vport_context.node_guid);
+       kfree(out);
+       return 0;
+ }
+ EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_node_guid);
+ int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
+                                       u16 *qkey_viol_cntr)
+ {
+       u32 *out;
+       int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
+       out = mlx5_vzalloc(outlen);
+       if (!out)
+               return -ENOMEM;
++      mlx5_query_nic_vport_context(mdev, 0, out, outlen);
+       *qkey_viol_cntr = MLX5_GET(query_nic_vport_context_out, out,
+                                  nic_vport_context.qkey_violation_counter);
+       kfree(out);
+       return 0;
+ }
+ EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_qkey_viol_cntr);
  int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport,
                             u8 port_num, u16  vf_num, u16 gid_index,
                             union ib_gid *gid)
@@@ -689,64 -424,43 +748,105 @@@ int mlx5_query_hca_vport_node_guid(stru
  }
  EXPORT_SYMBOL_GPL(mlx5_query_hca_vport_node_guid);
  
 +int mlx5_query_nic_vport_promisc(struct mlx5_core_dev *mdev,
 +                               u32 vport,
 +                               int *promisc_uc,
 +                               int *promisc_mc,
 +                               int *promisc_all)
 +{
 +      u32 *out;
 +      int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out);
 +      int err;
 +
 +      out = kzalloc(outlen, GFP_KERNEL);
 +      if (!out)
 +              return -ENOMEM;
 +
 +      err = mlx5_query_nic_vport_context(mdev, vport, out, outlen);
 +      if (err)
 +              goto out;
 +
 +      *promisc_uc = MLX5_GET(query_nic_vport_context_out, out,
 +                             nic_vport_context.promisc_uc);
 +      *promisc_mc = MLX5_GET(query_nic_vport_context_out, out,
 +                             nic_vport_context.promisc_mc);
 +      *promisc_all = MLX5_GET(query_nic_vport_context_out, out,
 +                              nic_vport_context.promisc_all);
 +
 +out:
 +      kfree(out);
 +      return err;
 +}
 +EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_promisc);
 +
 +int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev,
 +                                int promisc_uc,
 +                                int promisc_mc,
 +                                int promisc_all)
 +{
 +      void *in;
 +      int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in);
 +      int err;
 +
 +      in = mlx5_vzalloc(inlen);
 +      if (!in) {
 +              mlx5_core_err(mdev, "failed to allocate inbox\n");
 +              return -ENOMEM;
 +      }
 +
 +      MLX5_SET(modify_nic_vport_context_in, in, field_select.promisc, 1);
 +      MLX5_SET(modify_nic_vport_context_in, in,
 +               nic_vport_context.promisc_uc, promisc_uc);
 +      MLX5_SET(modify_nic_vport_context_in, in,
 +               nic_vport_context.promisc_mc, promisc_mc);
 +      MLX5_SET(modify_nic_vport_context_in, in,
 +               nic_vport_context.promisc_all, promisc_all);
 +
 +      err = mlx5_modify_nic_vport_context(mdev, in, inlen);
 +
 +      kvfree(in);
 +
 +      return err;
 +}
 +EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_promisc);
++
+ enum mlx5_vport_roce_state {
+       MLX5_VPORT_ROCE_DISABLED = 0,
+       MLX5_VPORT_ROCE_ENABLED  = 1,
+ };
+ static int mlx5_nic_vport_update_roce_state(struct mlx5_core_dev *mdev,
+                                           enum mlx5_vport_roce_state state)
+ {
+       void *in;
+       int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in);
+       int err;
+       in = mlx5_vzalloc(inlen);
+       if (!in) {
+               mlx5_core_warn(mdev, "failed to allocate inbox\n");
+               return -ENOMEM;
+       }
+       MLX5_SET(modify_nic_vport_context_in, in, field_select.roce_en, 1);
+       MLX5_SET(modify_nic_vport_context_in, in, nic_vport_context.roce_en,
+                state);
+       err = mlx5_modify_nic_vport_context(mdev, in, inlen);
+       kvfree(in);
+       return err;
+ }
+ int mlx5_nic_vport_enable_roce(struct mlx5_core_dev *mdev)
+ {
+       return mlx5_nic_vport_update_roce_state(mdev, MLX5_VPORT_ROCE_ENABLED);
+ }
+ EXPORT_SYMBOL_GPL(mlx5_nic_vport_enable_roce);
+ int mlx5_nic_vport_disable_roce(struct mlx5_core_dev *mdev)
+ {
+       return mlx5_nic_vport_update_roce_state(mdev, MLX5_VPORT_ROCE_DISABLED);
+ }
+ EXPORT_SYMBOL_GPL(mlx5_nic_vport_disable_roce);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -835,24 -795,19 +843,25 @@@ struct mlx5_ifc_cmd_hca_cap_bits 
        u8         reserved_60[0x1b];
        u8         log_max_wq_sz[0x5];
  
 -      u8         reserved_61[0xa0];
 -
 +      u8         nic_vport_change_event[0x1];
 +      u8         reserved_61[0xa];
 +      u8         log_max_vlan_list[0x5];
        u8         reserved_62[0x3];
 +      u8         log_max_current_mc_list[0x5];
 +      u8         reserved_63[0x3];
 +      u8         log_max_current_uc_list[0x5];
 +
 +      u8         reserved_64[0x80];
 +
 +      u8         reserved_65[0x3];
        u8         log_max_l2_table[0x5];
 -      u8         reserved_63[0x8];
 +      u8         reserved_66[0x8];
        u8         log_uar_page_sz[0x10];
  
-       u8         reserved_67[0x40];
 -      u8         reserved_64[0x20];
 -      u8         device_frequency_mhz[0x20];
 -      u8         device_frequency_khz[0x20];
 -      u8         reserved_65[0xa0];
 -
 -      u8         reserved_66[0x1f];
++      u8         reserved_67[0x20];
++      u8         device_frequency_mhz[0x20];
 +      u8         device_frequency_khz[0x20];
 +      u8         reserved_68[0x5f];
        u8         cqe_zip[0x1];
  
        u8         cqe_zip_timeout[0x10];
@@@ -2203,31 -2152,24 +2212,37 @@@ struct mlx5_ifc_nic_vport_context_bits 
        u8         reserved_0[0x1f];
        u8         roce_en[0x1];
  
 -      u8         reserved_1[0x120];
 +      u8         arm_change_event[0x1];
 +      u8         reserved_1[0x1a];
 +      u8         event_on_mtu[0x1];
 +      u8         event_on_promisc_change[0x1];
 +      u8         event_on_vlan_change[0x1];
 +      u8         event_on_mc_address_change[0x1];
 +      u8         event_on_uc_address_change[0x1];
 +
 +      u8         reserved_2[0xf0];
 +
 +      u8         mtu[0x10];
  
-       u8         reserved_3[0x640];
+       u8         system_image_guid[0x40];
+       u8         port_guid[0x40];
+       u8         node_guid[0x40];
 -      u8         reserved_5[0x140];
++      u8         reserved_3[0x140];
+       u8         qkey_violation_counter[0x10];
 -      u8         reserved_6[0x430];
++      u8         reserved_4[0x430];
  
 -      u8         reserved_2[0x5];
 +      u8         promisc_uc[0x1];
 +      u8         promisc_mc[0x1];
 +      u8         promisc_all[0x1];
-       u8         reserved_4[0x2];
++      u8         reserved_5[0x2];
        u8         allowed_list_type[0x3];
-       u8         reserved_5[0xc];
 -      u8         reserved_3[0xc];
++      u8         reserved_6[0xc];
        u8         allowed_list_size[0xc];
  
        struct mlx5_ifc_mac_address_layout_bits permanent_address;
  
-       u8         reserved_6[0x20];
 -      u8         reserved_4[0x20];
++      u8         reserved_7[0x20];
  
        u8         current_uc_mac_address[0][0x40];
  };
  #define __MLX5_VPORT_H__
  
  #include <linux/mlx5/driver.h>
 +#include <linux/mlx5/device.h>
  
 -u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod);
 -void mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, u8 *addr);
 +u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport);
 +u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
 +                              u16 vport);
 +int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
 +                                u16 vport, u8 state);
 +int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev,
 +                                   u16 vport, u8 *addr);
 +int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev,
 +                                    u16 vport, u8 *addr);
+ int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
+                                          u64 *system_image_guid);
+ int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid);
+ int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
+                                       u16 *qkey_viol_cntr);
  int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport,
                             u8 port_num, u16  vf_num, u16 gid_index,
                             union ib_gid *gid);
@@@ -59,30 -56,8 +64,33 @@@ int mlx5_query_hca_vport_system_image_g
                                           u64 *sys_image_guid);
  int mlx5_query_hca_vport_node_guid(struct mlx5_core_dev *dev,
                                   u64 *node_guid);
 +int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev,
 +                                u32 vport,
 +                                enum mlx5_list_type list_type,
 +                                u8 addr_list[][ETH_ALEN],
 +                                int *list_size);
 +int mlx5_modify_nic_vport_mac_list(struct mlx5_core_dev *dev,
 +                                 enum mlx5_list_type list_type,
 +                                 u8 addr_list[][ETH_ALEN],
 +                                 int list_size);
 +int mlx5_query_nic_vport_promisc(struct mlx5_core_dev *mdev,
 +                               u32 vport,
 +                               int *promisc_uc,
 +                               int *promisc_mc,
 +                               int *promisc_all);
 +int mlx5_modify_nic_vport_promisc(struct mlx5_core_dev *mdev,
 +                                int promisc_uc,
 +                                int promisc_mc,
 +                                int promisc_all);
 +int mlx5_query_nic_vport_vlans(struct mlx5_core_dev *dev,
 +                             u32 vport,
 +                             u16 vlans[],
 +                             int *size);
 +int mlx5_modify_nic_vport_vlans(struct mlx5_core_dev *dev,
 +                              u16 vlans[],
 +                              int list_size);
  
+ int mlx5_nic_vport_enable_roce(struct mlx5_core_dev *mdev);
+ int mlx5_nic_vport_disable_roce(struct mlx5_core_dev *mdev);
  #endif /* __MLX5_VPORT_H__ */
diff --cc lib/Kconfig
Simple merge
diff --cc lib/Makefile
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge