]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
IB/core,rdmavt,hfi1,opa-vnic: Send OPA cap_mask3 in trap
authorVishwanathapura, Niranjana <niranjana.vishwanathapura@intel.com>
Fri, 2 Jun 2017 00:04:02 +0000 (17:04 -0700)
committerDoug Ledford <dledford@redhat.com>
Tue, 27 Jun 2017 20:58:12 +0000 (16:58 -0400)
Provide the ability for IB clients to modify the OPA specific
capability mask and include this mask in the subsequent trap data.

Reviewed-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: Michael N. Henry <michael.n.henry@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/mad.c
drivers/infiniband/hw/hfi1/mad.h
drivers/infiniband/hw/hfi1/verbs.c
drivers/infiniband/sw/rdmavt/vt.c
drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c
include/rdma/ib_verbs.h
include/rdma/rdma_vt.h

index 5977673a52d4b7477fa315396b6d43418ca2ceb4..70831ad621b06f5dbfc2a3754ef507c03eb52434 100644 (file)
@@ -260,6 +260,7 @@ void hfi1_cap_mask_chg(struct rvt_dev_info *rdi, u8 port_num)
        data.issuer_lid = cpu_to_be32(lid);
        data.ntc_144.lid = data.issuer_lid;
        data.ntc_144.new_cap_mask = cpu_to_be32(ibp->rvp.port_cap_flags);
+       data.ntc_144.cap_mask3 = cpu_to_be16(ibp->rvp.port_cap3_flags);
 
        send_trap(ibp, &data, sizeof(data));
 }
@@ -704,11 +705,7 @@ static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
        buffer_units |= (dd->vl15_init << 11) & OPA_PI_MASK_BUF_UNIT_VL15_INIT;
        pi->buffer_units = cpu_to_be32(buffer_units);
 
-       pi->opa_cap_mask = cpu_to_be16(OPA_CAP_MASK3_IsSharedSpaceSupported |
-                                      OPA_CAP_MASK3_IsEthOnFabricSupported);
-       /* Driver does not support mcast/collective configuration */
-       pi->opa_cap_mask &=
-               cpu_to_be16(~OPA_CAP_MASK3_IsAddrRangeConfigSupported);
+       pi->opa_cap_mask = cpu_to_be16(ibp->rvp.port_cap3_flags);
        pi->collectivemask_multicastmask = ((HFI1_COLLECTIVE_NR & 0x7)
                                            << 3 | (HFI1_MCAST_NR & 0x7));
 
index 5aa3fd1be6538e6b37842c3cd734dedaf18f8dc0..a4e2506bd5ca92753b4ff0dbb50666336637072f 100644 (file)
@@ -115,7 +115,7 @@ struct opa_mad_notice_attr {
                        __be32  lid;            /* LID where change occurred */
                        __be32  new_cap_mask;   /* new capability mask */
                        __be16  reserved2;
-                       __be16  cap_mask;
+                       __be16  cap_mask3;
                        __be16  change_flags;   /* low 4 bits only */
                } __packed ntc_144;
 
index af54d3f4696aa2cc70ec29e67c3a1116e88c709c..2d7759f0c6b48767e506b7acdcf1186fa77b1eb5 100644 (file)
@@ -1537,9 +1537,13 @@ static void init_ibport(struct hfi1_pportdata *ppd)
        /* Set the prefix to the default value (see ch. 4.1.1) */
        ibp->rvp.gid_prefix = IB_DEFAULT_GID_PREFIX;
        ibp->rvp.sm_lid = 0;
-       /* Below should only set bits defined in OPA PortInfo.CapabilityMask */
+       /*
+        * Below should only set bits defined in OPA PortInfo.CapabilityMask
+        * and PortInfo.CapabilityMask3
+        */
        ibp->rvp.port_cap_flags = IB_PORT_AUTO_MIGR_SUP |
                IB_PORT_CAP_MASK_NOTICE_SUP;
+       ibp->rvp.port_cap3_flags = OPA_CAP_MASK3_IsSharedSpaceSupported;
        ibp->rvp.pma_counter_select[0] = IB_PMA_PORT_XMIT_DATA;
        ibp->rvp.pma_counter_select[1] = IB_PMA_PORT_RCV_DATA;
        ibp->rvp.pma_counter_select[2] = IB_PMA_PORT_XMIT_PKTS;
index 0d7c6bb551d924ea76a05c512bc966c40ceb56dc..64bdd442078a13b32a77a03e04c8a87724de275f 100644 (file)
@@ -202,8 +202,13 @@ static int rvt_modify_port(struct ib_device *ibdev, u8 port_num,
                return -EINVAL;
 
        rvp = rdi->ports[port_index];
-       rvp->port_cap_flags |= props->set_port_cap_mask;
-       rvp->port_cap_flags &= ~props->clr_port_cap_mask;
+       if (port_modify_mask & IB_PORT_OPA_MASK_CHG) {
+               rvp->port_cap3_flags |= props->set_port_cap_mask;
+               rvp->port_cap3_flags &= ~props->clr_port_cap_mask;
+       } else {
+               rvp->port_cap_flags |= props->set_port_cap_mask;
+               rvp->port_cap_flags &= ~props->clr_port_cap_mask;
+       }
 
        if (props->set_port_cap_mask || props->clr_port_cap_mask)
                rdi->driver_f.cap_mask_chg(rdi, port_num);
index 875694f9a7f91c354a9162c84c10aeb84bbb6260..32cdd7a35415eb8e3517f8ce5b6ee72b94f70331 100644 (file)
@@ -52,7 +52,9 @@
 
 #include <linux/module.h>
 #include <rdma/ib_addr.h>
-#include <rdma/ib_smi.h>
+#include <rdma/ib_verbs.h>
+#include <rdma/opa_smi.h>
+#include <rdma/opa_port_info.h>
 
 #include "opa_vnic_internal.h"
 
@@ -979,6 +981,27 @@ static int vema_register(struct opa_vnic_ctrl_port *cport)
        return 0;
 }
 
+/**
+ * opa_vnic_ctrl_config_dev -- This function sends a trap to the EM
+ * by way of ib_modify_port to indicate support for ethernet on the
+ * fabric.
+ * @cport: pointer to control port
+ * @en: enable or disable ethernet on fabric support
+ */
+static void opa_vnic_ctrl_config_dev(struct opa_vnic_ctrl_port *cport, bool en)
+{
+       struct ib_port_modify pm = { 0 };
+       int i;
+
+       if (en)
+               pm.set_port_cap_mask = OPA_CAP_MASK3_IsEthOnFabricSupported;
+       else
+               pm.clr_port_cap_mask = OPA_CAP_MASK3_IsEthOnFabricSupported;
+
+       for (i = 1; i <= cport->num_ports; i++)
+               ib_modify_port(cport->ibdev, i, IB_PORT_OPA_MASK_CHG, &pm);
+}
+
 /**
  * opa_vnic_vema_add_one -- Handle new ib device
  * @device: ib device pointer
@@ -1007,6 +1030,7 @@ static void opa_vnic_vema_add_one(struct ib_device *device)
                c_info("VNIC client initialized\n");
 
        ib_set_client_data(device, &opa_vnic_client, cport);
+       opa_vnic_ctrl_config_dev(cport, true);
 }
 
 /**
@@ -1025,6 +1049,7 @@ static void opa_vnic_vema_rem_one(struct ib_device *device,
                return;
 
        c_info("removing VNIC client\n");
+       opa_vnic_ctrl_config_dev(cport, false);
        vema_unregister(cport);
        kfree(cport);
 }
index 8f1ce4e27bbd9f1ea5b435574b51047b1d9d1a3b..9d4d2a74c95e1639ffb64fab86b2dee5021dc21c 100644 (file)
@@ -577,7 +577,8 @@ struct ib_device_modify {
 enum ib_port_modify_flags {
        IB_PORT_SHUTDOWN                = 1,
        IB_PORT_INIT_TYPE               = (1<<2),
-       IB_PORT_RESET_QKEY_CNTR         = (1<<3)
+       IB_PORT_RESET_QKEY_CNTR         = (1<<3),
+       IB_PORT_OPA_MASK_CHG            = (1<<4)
 };
 
 struct ib_port_modify {
index d0b9f91e5f4dd26a8af49562f30ca36cd514f315..0f18ffd98dd75130fc0468f3e4035430f87b0223 100644 (file)
@@ -75,6 +75,7 @@ struct rvt_ibport {
        __be64 mkey;
        u64 tid;
        u32 port_cap_flags;
+       u16 port_cap3_flags;
        u32 pma_sample_start;
        u32 pma_sample_interval;
        __be16 pma_counter_select[5];