IB/core,rdmavt,hfi1,opa-vnic: Send OPA cap_mask3 in trap

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>
This commit is contained in:
Vishwanathapura, Niranjana 2017-06-01 17:04:02 -07:00 committed by Doug Ledford
parent bb7dde8784
commit cb49366f36
7 changed files with 44 additions and 11 deletions

View 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));

View 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;

View 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;

View 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);

View 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);
}

View 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 {

View 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];