提交 4eb06882 编写于 作者: D Dennis Dalessandro 提交者: Doug Ledford

staging/rdma/hfi1: Remove ibport and use rdmavt version

Remove most of the ibport members from hfi1 and use the rdmavt version.
Also register the port with rdmavt.
Reviewed-by: NMike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: NHarish Chegondi <harish.chegondi@intel.com>
Signed-off-by: NDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 39db3e66
...@@ -3933,8 +3933,8 @@ static u64 access_sw_cpu_##cntr(const struct cntr_entry *entry, \ ...@@ -3933,8 +3933,8 @@ static u64 access_sw_cpu_##cntr(const struct cntr_entry *entry, \
void *context, int vl, int mode, u64 data) \ void *context, int vl, int mode, u64 data) \
{ \ { \
struct hfi1_pportdata *ppd = (struct hfi1_pportdata *)context; \ struct hfi1_pportdata *ppd = (struct hfi1_pportdata *)context; \
return read_write_cpu(ppd->dd, &ppd->ibport_data.z_ ##cntr, \ return read_write_cpu(ppd->dd, &ppd->ibport_data.rvp.z_ ##cntr, \
ppd->ibport_data.cntr, vl, \ ppd->ibport_data.rvp.cntr, vl, \
mode, data); \ mode, data); \
} }
...@@ -3951,7 +3951,7 @@ static u64 access_ibp_##cntr(const struct cntr_entry *entry, \ ...@@ -3951,7 +3951,7 @@ static u64 access_ibp_##cntr(const struct cntr_entry *entry, \
if (vl != CNTR_INVALID_VL) \ if (vl != CNTR_INVALID_VL) \
return 0; \ return 0; \
\ \
return read_write_sw(ppd->dd, &ppd->ibport_data.n_ ##cntr, \ return read_write_sw(ppd->dd, &ppd->ibport_data.rvp.n_ ##cntr, \
mode, data); \ mode, data); \
} }
...@@ -9239,14 +9239,14 @@ static inline int init_cpu_counters(struct hfi1_devdata *dd) ...@@ -9239,14 +9239,14 @@ static inline int init_cpu_counters(struct hfi1_devdata *dd)
ppd = (struct hfi1_pportdata *)(dd + 1); ppd = (struct hfi1_pportdata *)(dd + 1);
for (i = 0; i < dd->num_pports; i++, ppd++) { for (i = 0; i < dd->num_pports; i++, ppd++) {
ppd->ibport_data.rc_acks = NULL; ppd->ibport_data.rvp.rc_acks = NULL;
ppd->ibport_data.rc_qacks = NULL; ppd->ibport_data.rvp.rc_qacks = NULL;
ppd->ibport_data.rc_acks = alloc_percpu(u64); ppd->ibport_data.rvp.rc_acks = alloc_percpu(u64);
ppd->ibport_data.rc_qacks = alloc_percpu(u64); ppd->ibport_data.rvp.rc_qacks = alloc_percpu(u64);
ppd->ibport_data.rc_delayed_comp = alloc_percpu(u64); ppd->ibport_data.rvp.rc_delayed_comp = alloc_percpu(u64);
if ((ppd->ibport_data.rc_acks == NULL) || if (!ppd->ibport_data.rvp.rc_acks ||
(ppd->ibport_data.rc_delayed_comp == NULL) || !ppd->ibport_data.rvp.rc_delayed_comp ||
(ppd->ibport_data.rc_qacks == NULL)) !ppd->ibport_data.rvp.rc_qacks)
return -ENOMEM; return -ENOMEM;
} }
...@@ -11318,14 +11318,14 @@ static void free_cntrs(struct hfi1_devdata *dd) ...@@ -11318,14 +11318,14 @@ static void free_cntrs(struct hfi1_devdata *dd)
for (i = 0; i < dd->num_pports; i++, ppd++) { for (i = 0; i < dd->num_pports; i++, ppd++) {
kfree(ppd->cntrs); kfree(ppd->cntrs);
kfree(ppd->scntrs); kfree(ppd->scntrs);
free_percpu(ppd->ibport_data.rc_acks); free_percpu(ppd->ibport_data.rvp.rc_acks);
free_percpu(ppd->ibport_data.rc_qacks); free_percpu(ppd->ibport_data.rvp.rc_qacks);
free_percpu(ppd->ibport_data.rc_delayed_comp); free_percpu(ppd->ibport_data.rvp.rc_delayed_comp);
ppd->cntrs = NULL; ppd->cntrs = NULL;
ppd->scntrs = NULL; ppd->scntrs = NULL;
ppd->ibport_data.rc_acks = NULL; ppd->ibport_data.rvp.rc_acks = NULL;
ppd->ibport_data.rc_qacks = NULL; ppd->ibport_data.rvp.rc_qacks = NULL;
ppd->ibport_data.rc_delayed_comp = NULL; ppd->ibport_data.rvp.rc_delayed_comp = NULL;
} }
kfree(dd->portcntrnames); kfree(dd->portcntrnames);
dd->portcntrnames = NULL; dd->portcntrnames = NULL;
......
...@@ -337,7 +337,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd, ...@@ -337,7 +337,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,
/* Check for valid receive state. */ /* Check for valid receive state. */
if (!(ib_hfi1_state_ops[qp->state] & if (!(ib_hfi1_state_ops[qp->state] &
HFI1_PROCESS_RECV_OK)) { HFI1_PROCESS_RECV_OK)) {
ibp->n_pkt_drops++; ibp->rvp.n_pkt_drops++;
} }
switch (qp->ibqp.qp_type) { switch (qp->ibqp.qp_type) {
......
...@@ -1855,10 +1855,10 @@ static inline void hfi1_reset_cpu_counters(struct hfi1_devdata *dd) ...@@ -1855,10 +1855,10 @@ static inline void hfi1_reset_cpu_counters(struct hfi1_devdata *dd)
ppd = (struct hfi1_pportdata *)(dd + 1); ppd = (struct hfi1_pportdata *)(dd + 1);
for (i = 0; i < dd->num_pports; i++, ppd++) { for (i = 0; i < dd->num_pports; i++, ppd++) {
ppd->ibport_data.z_rc_acks = ppd->ibport_data.rvp.z_rc_acks =
get_all_cpu_total(ppd->ibport_data.rc_acks); get_all_cpu_total(ppd->ibport_data.rvp.rc_acks);
ppd->ibport_data.z_rc_qacks = ppd->ibport_data.rvp.z_rc_qacks =
get_all_cpu_total(ppd->ibport_data.rc_qacks); get_all_cpu_total(ppd->ibport_data.rvp.rc_qacks);
} }
} }
......
...@@ -91,7 +91,7 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len) ...@@ -91,7 +91,7 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len)
int pkey_idx; int pkey_idx;
u32 qpn = ppd_from_ibp(ibp)->sm_trap_qp; u32 qpn = ppd_from_ibp(ibp)->sm_trap_qp;
agent = ibp->send_agent; agent = ibp->rvp.send_agent;
if (!agent) if (!agent)
return; return;
...@@ -100,7 +100,8 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len) ...@@ -100,7 +100,8 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len)
return; return;
/* o14-2 */ /* o14-2 */
if (ibp->trap_timeout && time_before(jiffies, ibp->trap_timeout)) if (ibp->rvp.trap_timeout && time_before(jiffies,
ibp->rvp.trap_timeout))
return; return;
pkey_idx = hfi1_lookup_pkey_idx(ibp, LIM_MGMT_P_KEY); pkey_idx = hfi1_lookup_pkey_idx(ibp, LIM_MGMT_P_KEY);
...@@ -121,18 +122,18 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len) ...@@ -121,18 +122,18 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len)
smp->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; smp->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED;
smp->class_version = OPA_SMI_CLASS_VERSION; smp->class_version = OPA_SMI_CLASS_VERSION;
smp->method = IB_MGMT_METHOD_TRAP; smp->method = IB_MGMT_METHOD_TRAP;
ibp->tid++; ibp->rvp.tid++;
smp->tid = cpu_to_be64(ibp->tid); smp->tid = cpu_to_be64(ibp->rvp.tid);
smp->attr_id = IB_SMP_ATTR_NOTICE; smp->attr_id = IB_SMP_ATTR_NOTICE;
/* o14-1: smp->mkey = 0; */ /* o14-1: smp->mkey = 0; */
memcpy(smp->route.lid.data, data, len); memcpy(smp->route.lid.data, data, len);
spin_lock_irqsave(&ibp->lock, flags); spin_lock_irqsave(&ibp->rvp.lock, flags);
if (!ibp->sm_ah) { if (!ibp->sm_ah) {
if (ibp->sm_lid != be16_to_cpu(IB_LID_PERMISSIVE)) { if (ibp->rvp.sm_lid != be16_to_cpu(IB_LID_PERMISSIVE)) {
struct ib_ah *ah; struct ib_ah *ah;
ah = hfi1_create_qp0_ah(ibp, ibp->sm_lid); ah = hfi1_create_qp0_ah(ibp, ibp->rvp.sm_lid);
if (IS_ERR(ah)) if (IS_ERR(ah))
ret = PTR_ERR(ah); ret = PTR_ERR(ah);
else { else {
...@@ -146,17 +147,17 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len) ...@@ -146,17 +147,17 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len)
send_buf->ah = &ibp->sm_ah->ibah; send_buf->ah = &ibp->sm_ah->ibah;
ret = 0; ret = 0;
} }
spin_unlock_irqrestore(&ibp->lock, flags); spin_unlock_irqrestore(&ibp->rvp.lock, flags);
if (!ret) if (!ret)
ret = ib_post_send_mad(send_buf, NULL); ret = ib_post_send_mad(send_buf, NULL);
if (!ret) { if (!ret) {
/* 4.096 usec. */ /* 4.096 usec. */
timeout = (4096 * (1UL << ibp->subnet_timeout)) / 1000; timeout = (4096 * (1UL << ibp->rvp.subnet_timeout)) / 1000;
ibp->trap_timeout = jiffies + usecs_to_jiffies(timeout); ibp->rvp.trap_timeout = jiffies + usecs_to_jiffies(timeout);
} else { } else {
ib_free_send_mad(send_buf); ib_free_send_mad(send_buf);
ibp->trap_timeout = 0; ibp->rvp.trap_timeout = 0;
} }
} }
...@@ -174,10 +175,10 @@ void hfi1_bad_pqkey(struct hfi1_ibport *ibp, __be16 trap_num, u32 key, u32 sl, ...@@ -174,10 +175,10 @@ void hfi1_bad_pqkey(struct hfi1_ibport *ibp, __be16 trap_num, u32 key, u32 sl,
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
if (trap_num == OPA_TRAP_BAD_P_KEY) if (trap_num == OPA_TRAP_BAD_P_KEY)
ibp->pkey_violations++; ibp->rvp.pkey_violations++;
else else
ibp->qkey_violations++; ibp->rvp.qkey_violations++;
ibp->n_pkt_drops++; ibp->rvp.n_pkt_drops++;
/* Send violation trap */ /* Send violation trap */
data.generic_type = IB_NOTICE_TYPE_SECURITY; data.generic_type = IB_NOTICE_TYPE_SECURITY;
...@@ -245,7 +246,7 @@ void hfi1_cap_mask_chg(struct hfi1_ibport *ibp) ...@@ -245,7 +246,7 @@ void hfi1_cap_mask_chg(struct hfi1_ibport *ibp)
data.trap_num = OPA_TRAP_CHANGE_CAPABILITY; data.trap_num = OPA_TRAP_CHANGE_CAPABILITY;
data.issuer_lid = cpu_to_be32(lid); data.issuer_lid = cpu_to_be32(lid);
data.ntc_144.lid = data.issuer_lid; data.ntc_144.lid = data.issuer_lid;
data.ntc_144.new_cap_mask = cpu_to_be32(ibp->port_cap_flags); data.ntc_144.new_cap_mask = cpu_to_be32(ibp->rvp.port_cap_flags);
send_trap(ibp, &data, sizeof(data)); send_trap(ibp, &data, sizeof(data));
} }
...@@ -407,37 +408,38 @@ static int check_mkey(struct hfi1_ibport *ibp, struct ib_mad_hdr *mad, ...@@ -407,37 +408,38 @@ static int check_mkey(struct hfi1_ibport *ibp, struct ib_mad_hdr *mad,
int ret = 0; int ret = 0;
/* Is the mkey in the process of expiring? */ /* Is the mkey in the process of expiring? */
if (ibp->mkey_lease_timeout && if (ibp->rvp.mkey_lease_timeout &&
time_after_eq(jiffies, ibp->mkey_lease_timeout)) { time_after_eq(jiffies, ibp->rvp.mkey_lease_timeout)) {
/* Clear timeout and mkey protection field. */ /* Clear timeout and mkey protection field. */
ibp->mkey_lease_timeout = 0; ibp->rvp.mkey_lease_timeout = 0;
ibp->mkeyprot = 0; ibp->rvp.mkeyprot = 0;
} }
if ((mad_flags & IB_MAD_IGNORE_MKEY) || ibp->mkey == 0 || if ((mad_flags & IB_MAD_IGNORE_MKEY) || ibp->rvp.mkey == 0 ||
ibp->mkey == mkey) ibp->rvp.mkey == mkey)
valid_mkey = 1; valid_mkey = 1;
/* Unset lease timeout on any valid Get/Set/TrapRepress */ /* Unset lease timeout on any valid Get/Set/TrapRepress */
if (valid_mkey && ibp->mkey_lease_timeout && if (valid_mkey && ibp->rvp.mkey_lease_timeout &&
(mad->method == IB_MGMT_METHOD_GET || (mad->method == IB_MGMT_METHOD_GET ||
mad->method == IB_MGMT_METHOD_SET || mad->method == IB_MGMT_METHOD_SET ||
mad->method == IB_MGMT_METHOD_TRAP_REPRESS)) mad->method == IB_MGMT_METHOD_TRAP_REPRESS))
ibp->mkey_lease_timeout = 0; ibp->rvp.mkey_lease_timeout = 0;
if (!valid_mkey) { if (!valid_mkey) {
switch (mad->method) { switch (mad->method) {
case IB_MGMT_METHOD_GET: case IB_MGMT_METHOD_GET:
/* Bad mkey not a violation below level 2 */ /* Bad mkey not a violation below level 2 */
if (ibp->mkeyprot < 2) if (ibp->rvp.mkeyprot < 2)
break; break;
case IB_MGMT_METHOD_SET: case IB_MGMT_METHOD_SET:
case IB_MGMT_METHOD_TRAP_REPRESS: case IB_MGMT_METHOD_TRAP_REPRESS:
if (ibp->mkey_violations != 0xFFFF) if (ibp->rvp.mkey_violations != 0xFFFF)
++ibp->mkey_violations; ++ibp->rvp.mkey_violations;
if (!ibp->mkey_lease_timeout && ibp->mkey_lease_period) if (!ibp->rvp.mkey_lease_timeout &&
ibp->mkey_lease_timeout = jiffies + ibp->rvp.mkey_lease_period)
ibp->mkey_lease_period * HZ; ibp->rvp.mkey_lease_timeout = jiffies +
ibp->rvp.mkey_lease_period * HZ;
/* Generate a trap notice. */ /* Generate a trap notice. */
bad_mkey(ibp, mad, mkey, dr_slid, return_path, bad_mkey(ibp, mad, mkey, dr_slid, return_path,
hop_cnt); hop_cnt);
...@@ -548,14 +550,14 @@ static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, ...@@ -548,14 +550,14 @@ static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
/* Only return the mkey if the protection field allows it. */ /* Only return the mkey if the protection field allows it. */
if (!(smp->method == IB_MGMT_METHOD_GET && if (!(smp->method == IB_MGMT_METHOD_GET &&
ibp->mkey != smp->mkey && ibp->rvp.mkey != smp->mkey &&
ibp->mkeyprot == 1)) ibp->rvp.mkeyprot == 1))
pi->mkey = ibp->mkey; pi->mkey = ibp->rvp.mkey;
pi->subnet_prefix = ibp->gid_prefix; pi->subnet_prefix = ibp->rvp.gid_prefix;
pi->sm_lid = cpu_to_be32(ibp->sm_lid); pi->sm_lid = cpu_to_be32(ibp->rvp.sm_lid);
pi->ib_cap_mask = cpu_to_be32(ibp->port_cap_flags); pi->ib_cap_mask = cpu_to_be32(ibp->rvp.port_cap_flags);
pi->mkey_lease_period = cpu_to_be16(ibp->mkey_lease_period); pi->mkey_lease_period = cpu_to_be16(ibp->rvp.mkey_lease_period);
pi->sm_trap_qp = cpu_to_be32(ppd->sm_trap_qp); pi->sm_trap_qp = cpu_to_be32(ppd->sm_trap_qp);
pi->sa_qp = cpu_to_be32(ppd->sa_qp); pi->sa_qp = cpu_to_be32(ppd->sa_qp);
...@@ -599,7 +601,7 @@ static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, ...@@ -599,7 +601,7 @@ static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
pi->port_states.portphysstate_portstate = pi->port_states.portphysstate_portstate =
(hfi1_ibphys_portstate(ppd) << 4) | state; (hfi1_ibphys_portstate(ppd) << 4) | state;
pi->mkeyprotect_lmc = (ibp->mkeyprot << 6) | ppd->lmc; pi->mkeyprotect_lmc = (ibp->rvp.mkeyprot << 6) | ppd->lmc;
memset(pi->neigh_mtu.pvlx_to_mtu, 0, sizeof(pi->neigh_mtu.pvlx_to_mtu)); memset(pi->neigh_mtu.pvlx_to_mtu, 0, sizeof(pi->neigh_mtu.pvlx_to_mtu));
for (i = 0; i < ppd->vls_supported; i++) { for (i = 0; i < ppd->vls_supported; i++) {
...@@ -612,7 +614,7 @@ static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, ...@@ -612,7 +614,7 @@ static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
/* don't forget VL 15 */ /* don't forget VL 15 */
mtu = mtu_to_enum(dd->vld[15].mtu, 2048); mtu = mtu_to_enum(dd->vld[15].mtu, 2048);
pi->neigh_mtu.pvlx_to_mtu[15/2] |= mtu; pi->neigh_mtu.pvlx_to_mtu[15/2] |= mtu;
pi->smsl = ibp->sm_sl & OPA_PI_MASK_SMSL; pi->smsl = ibp->rvp.sm_sl & OPA_PI_MASK_SMSL;
pi->operational_vls = hfi1_get_ib_cfg(ppd, HFI1_IB_CFG_OP_VLS); pi->operational_vls = hfi1_get_ib_cfg(ppd, HFI1_IB_CFG_OP_VLS);
pi->partenforce_filterraw |= pi->partenforce_filterraw |=
(ppd->linkinit_reason & OPA_PI_MASK_LINKINIT_REASON); (ppd->linkinit_reason & OPA_PI_MASK_LINKINIT_REASON);
...@@ -620,17 +622,17 @@ static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, ...@@ -620,17 +622,17 @@ static int __subn_get_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
pi->partenforce_filterraw |= OPA_PI_MASK_PARTITION_ENFORCE_IN; pi->partenforce_filterraw |= OPA_PI_MASK_PARTITION_ENFORCE_IN;
if (ppd->part_enforce & HFI1_PART_ENFORCE_OUT) if (ppd->part_enforce & HFI1_PART_ENFORCE_OUT)
pi->partenforce_filterraw |= OPA_PI_MASK_PARTITION_ENFORCE_OUT; pi->partenforce_filterraw |= OPA_PI_MASK_PARTITION_ENFORCE_OUT;
pi->mkey_violations = cpu_to_be16(ibp->mkey_violations); pi->mkey_violations = cpu_to_be16(ibp->rvp.mkey_violations);
/* P_KeyViolations are counted by hardware. */ /* P_KeyViolations are counted by hardware. */
pi->pkey_violations = cpu_to_be16(ibp->pkey_violations); pi->pkey_violations = cpu_to_be16(ibp->rvp.pkey_violations);
pi->qkey_violations = cpu_to_be16(ibp->qkey_violations); pi->qkey_violations = cpu_to_be16(ibp->rvp.qkey_violations);
pi->vl.cap = ppd->vls_supported; pi->vl.cap = ppd->vls_supported;
pi->vl.high_limit = cpu_to_be16(ibp->vl_high_limit); pi->vl.high_limit = cpu_to_be16(ibp->rvp.vl_high_limit);
pi->vl.arb_high_cap = (u8)hfi1_get_ib_cfg(ppd, HFI1_IB_CFG_VL_HIGH_CAP); pi->vl.arb_high_cap = (u8)hfi1_get_ib_cfg(ppd, HFI1_IB_CFG_VL_HIGH_CAP);
pi->vl.arb_low_cap = (u8)hfi1_get_ib_cfg(ppd, HFI1_IB_CFG_VL_LOW_CAP); pi->vl.arb_low_cap = (u8)hfi1_get_ib_cfg(ppd, HFI1_IB_CFG_VL_LOW_CAP);
pi->clientrereg_subnettimeout = ibp->subnet_timeout; pi->clientrereg_subnettimeout = ibp->rvp.subnet_timeout;
pi->port_link_mode = cpu_to_be16(OPA_PORT_LINK_MODE_OPA << 10 | pi->port_link_mode = cpu_to_be16(OPA_PORT_LINK_MODE_OPA << 10 |
OPA_PORT_LINK_MODE_OPA << 5 | OPA_PORT_LINK_MODE_OPA << 5 |
...@@ -1091,9 +1093,9 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, ...@@ -1091,9 +1093,9 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
ls_old = driver_lstate(ppd); ls_old = driver_lstate(ppd);
ibp->mkey = pi->mkey; ibp->rvp.mkey = pi->mkey;
ibp->gid_prefix = pi->subnet_prefix; ibp->rvp.gid_prefix = pi->subnet_prefix;
ibp->mkey_lease_period = be16_to_cpu(pi->mkey_lease_period); ibp->rvp.mkey_lease_period = be16_to_cpu(pi->mkey_lease_period);
/* Must be a valid unicast LID address. */ /* Must be a valid unicast LID address. */
if ((lid == 0 && ls_old > IB_PORT_INIT) || if ((lid == 0 && ls_old > IB_PORT_INIT) ||
...@@ -1133,20 +1135,20 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, ...@@ -1133,20 +1135,20 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
smlid >= be16_to_cpu(IB_MULTICAST_LID_BASE)) { smlid >= be16_to_cpu(IB_MULTICAST_LID_BASE)) {
smp->status |= IB_SMP_INVALID_FIELD; smp->status |= IB_SMP_INVALID_FIELD;
pr_warn("SubnSet(OPA_PortInfo) smlid invalid 0x%x\n", smlid); pr_warn("SubnSet(OPA_PortInfo) smlid invalid 0x%x\n", smlid);
} else if (smlid != ibp->sm_lid || msl != ibp->sm_sl) { } else if (smlid != ibp->rvp.sm_lid || msl != ibp->rvp.sm_sl) {
pr_warn("SubnSet(OPA_PortInfo) smlid 0x%x\n", smlid); pr_warn("SubnSet(OPA_PortInfo) smlid 0x%x\n", smlid);
spin_lock_irqsave(&ibp->lock, flags); spin_lock_irqsave(&ibp->rvp.lock, flags);
if (ibp->sm_ah) { if (ibp->sm_ah) {
if (smlid != ibp->sm_lid) if (smlid != ibp->rvp.sm_lid)
ibp->sm_ah->attr.dlid = smlid; ibp->sm_ah->attr.dlid = smlid;
if (msl != ibp->sm_sl) if (msl != ibp->rvp.sm_sl)
ibp->sm_ah->attr.sl = msl; ibp->sm_ah->attr.sl = msl;
} }
spin_unlock_irqrestore(&ibp->lock, flags); spin_unlock_irqrestore(&ibp->rvp.lock, flags);
if (smlid != ibp->sm_lid) if (smlid != ibp->rvp.sm_lid)
ibp->sm_lid = smlid; ibp->rvp.sm_lid = smlid;
if (msl != ibp->sm_sl) if (msl != ibp->rvp.sm_sl)
ibp->sm_sl = msl; ibp->rvp.sm_sl = msl;
event.event = IB_EVENT_SM_CHANGE; event.event = IB_EVENT_SM_CHANGE;
ib_dispatch_event(&event); ib_dispatch_event(&event);
} }
...@@ -1198,10 +1200,11 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, ...@@ -1198,10 +1200,11 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
smp->status |= IB_SMP_INVALID_FIELD; smp->status |= IB_SMP_INVALID_FIELD;
} }
ibp->mkeyprot = (pi->mkeyprotect_lmc & OPA_PI_MASK_MKEY_PROT_BIT) >> 6; ibp->rvp.mkeyprot =
ibp->vl_high_limit = be16_to_cpu(pi->vl.high_limit) & 0xFF; (pi->mkeyprotect_lmc & OPA_PI_MASK_MKEY_PROT_BIT) >> 6;
ibp->rvp.vl_high_limit = be16_to_cpu(pi->vl.high_limit) & 0xFF;
(void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_VL_HIGH_LIMIT, (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_VL_HIGH_LIMIT,
ibp->vl_high_limit); ibp->rvp.vl_high_limit);
if (ppd->vls_supported/2 > ARRAY_SIZE(pi->neigh_mtu.pvlx_to_mtu) || if (ppd->vls_supported/2 > ARRAY_SIZE(pi->neigh_mtu.pvlx_to_mtu) ||
ppd->vls_supported > ARRAY_SIZE(dd->vld)) { ppd->vls_supported > ARRAY_SIZE(dd->vld)) {
...@@ -1260,15 +1263,15 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, ...@@ -1260,15 +1263,15 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
} }
if (pi->mkey_violations == 0) if (pi->mkey_violations == 0)
ibp->mkey_violations = 0; ibp->rvp.mkey_violations = 0;
if (pi->pkey_violations == 0) if (pi->pkey_violations == 0)
ibp->pkey_violations = 0; ibp->rvp.pkey_violations = 0;
if (pi->qkey_violations == 0) if (pi->qkey_violations == 0)
ibp->qkey_violations = 0; ibp->rvp.qkey_violations = 0;
ibp->subnet_timeout = ibp->rvp.subnet_timeout =
pi->clientrereg_subnettimeout & OPA_PI_MASK_SUBNET_TIMEOUT; pi->clientrereg_subnettimeout & OPA_PI_MASK_SUBNET_TIMEOUT;
crc_enabled = be16_to_cpu(pi->port_ltp_crc_mode); crc_enabled = be16_to_cpu(pi->port_ltp_crc_mode);
...@@ -3532,9 +3535,9 @@ static int subn_get_opa_sma(__be16 attr_id, struct opa_smp *smp, u32 am, ...@@ -3532,9 +3535,9 @@ static int subn_get_opa_sma(__be16 attr_id, struct opa_smp *smp, u32 am,
resp_len); resp_len);
break; break;
case IB_SMP_ATTR_SM_INFO: case IB_SMP_ATTR_SM_INFO:
if (ibp->port_cap_flags & IB_PORT_SM_DISABLED) if (ibp->rvp.port_cap_flags & IB_PORT_SM_DISABLED)
return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED; return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED;
if (ibp->port_cap_flags & IB_PORT_SM) if (ibp->rvp.port_cap_flags & IB_PORT_SM)
return IB_MAD_RESULT_SUCCESS; return IB_MAD_RESULT_SUCCESS;
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default:
...@@ -3602,9 +3605,9 @@ static int subn_set_opa_sma(__be16 attr_id, struct opa_smp *smp, u32 am, ...@@ -3602,9 +3605,9 @@ static int subn_set_opa_sma(__be16 attr_id, struct opa_smp *smp, u32 am,
resp_len); resp_len);
break; break;
case IB_SMP_ATTR_SM_INFO: case IB_SMP_ATTR_SM_INFO:
if (ibp->port_cap_flags & IB_PORT_SM_DISABLED) if (ibp->rvp.port_cap_flags & IB_PORT_SM_DISABLED)
return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED; return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED;
if (ibp->port_cap_flags & IB_PORT_SM) if (ibp->rvp.port_cap_flags & IB_PORT_SM)
return IB_MAD_RESULT_SUCCESS; return IB_MAD_RESULT_SUCCESS;
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default:
...@@ -4180,7 +4183,7 @@ int hfi1_create_agents(struct hfi1_ibdev *dev) ...@@ -4180,7 +4183,7 @@ int hfi1_create_agents(struct hfi1_ibdev *dev)
goto err; goto err;
} }
ibp->send_agent = agent; ibp->rvp.send_agent = agent;
} }
return 0; return 0;
...@@ -4188,9 +4191,9 @@ int hfi1_create_agents(struct hfi1_ibdev *dev) ...@@ -4188,9 +4191,9 @@ int hfi1_create_agents(struct hfi1_ibdev *dev)
err: err:
for (p = 0; p < dd->num_pports; p++) { for (p = 0; p < dd->num_pports; p++) {
ibp = &dd->pport[p].ibport_data; ibp = &dd->pport[p].ibport_data;
if (ibp->send_agent) { if (ibp->rvp.send_agent) {
agent = ibp->send_agent; agent = ibp->rvp.send_agent;
ibp->send_agent = NULL; ibp->rvp.send_agent = NULL;
ib_unregister_mad_agent(agent); ib_unregister_mad_agent(agent);
} }
} }
...@@ -4207,9 +4210,9 @@ void hfi1_free_agents(struct hfi1_ibdev *dev) ...@@ -4207,9 +4210,9 @@ void hfi1_free_agents(struct hfi1_ibdev *dev)
for (p = 0; p < dd->num_pports; p++) { for (p = 0; p < dd->num_pports; p++) {
ibp = &dd->pport[p].ibport_data; ibp = &dd->pport[p].ibport_data;
if (ibp->send_agent) { if (ibp->rvp.send_agent) {
agent = ibp->send_agent; agent = ibp->rvp.send_agent;
ibp->send_agent = NULL; ibp->rvp.send_agent = NULL;
ib_unregister_mad_agent(agent); ib_unregister_mad_agent(agent);
} }
if (ibp->sm_ah) { if (ibp->sm_ah) {
......
...@@ -238,7 +238,7 @@ static void insert_qp(struct hfi1_ibdev *dev, struct rvt_qp *qp) ...@@ -238,7 +238,7 @@ static void insert_qp(struct hfi1_ibdev *dev, struct rvt_qp *qp)
spin_lock_irqsave(&dev->qp_dev->qpt_lock, flags); spin_lock_irqsave(&dev->qp_dev->qpt_lock, flags);
if (qp->ibqp.qp_num <= 1) { if (qp->ibqp.qp_num <= 1) {
rcu_assign_pointer(ibp->qp[qp->ibqp.qp_num], qp); rcu_assign_pointer(ibp->rvp.qp[qp->ibqp.qp_num], qp);
} else { } else {
u32 n = qpn_hash(dev->qp_dev, qp->ibqp.qp_num); u32 n = qpn_hash(dev->qp_dev, qp->ibqp.qp_num);
...@@ -263,12 +263,13 @@ static void remove_qp(struct hfi1_ibdev *dev, struct rvt_qp *qp) ...@@ -263,12 +263,13 @@ static void remove_qp(struct hfi1_ibdev *dev, struct rvt_qp *qp)
spin_lock_irqsave(&dev->qp_dev->qpt_lock, flags); spin_lock_irqsave(&dev->qp_dev->qpt_lock, flags);
if (rcu_dereference_protected(ibp->qp[0], if (rcu_dereference_protected(ibp->rvp.qp[0],
lockdep_is_held(
&dev->qp_dev->qpt_lock)) == qp) {
RCU_INIT_POINTER(ibp->rvp.qp[0], NULL);
} else if (rcu_dereference_protected(ibp->rvp.qp[1],
lockdep_is_held(&dev->qp_dev->qpt_lock)) == qp) { lockdep_is_held(&dev->qp_dev->qpt_lock)) == qp) {
RCU_INIT_POINTER(ibp->qp[0], NULL); RCU_INIT_POINTER(ibp->rvp.qp[1], NULL);
} else if (rcu_dereference_protected(ibp->qp[1],
lockdep_is_held(&dev->qp_dev->qpt_lock)) == qp) {
RCU_INIT_POINTER(ibp->qp[1], NULL);
} else { } else {
struct rvt_qp *q; struct rvt_qp *q;
struct rvt_qp __rcu **qpp; struct rvt_qp __rcu **qpp;
...@@ -317,9 +318,9 @@ static unsigned free_all_qps(struct hfi1_devdata *dd) ...@@ -317,9 +318,9 @@ static unsigned free_all_qps(struct hfi1_devdata *dd)
if (!hfi1_mcast_tree_empty(ibp)) if (!hfi1_mcast_tree_empty(ibp))
qp_inuse++; qp_inuse++;
rcu_read_lock(); rcu_read_lock();
if (rcu_dereference(ibp->qp[0])) if (rcu_dereference(ibp->rvp.qp[0]))
qp_inuse++; qp_inuse++;
if (rcu_dereference(ibp->qp[1])) if (rcu_dereference(ibp->rvp.qp[1]))
qp_inuse++; qp_inuse++;
rcu_read_unlock(); rcu_read_unlock();
} }
...@@ -1467,7 +1468,7 @@ static int iowait_sleep( ...@@ -1467,7 +1468,7 @@ static int iowait_sleep(
struct hfi1_ibport *ibp = struct hfi1_ibport *ibp =
to_iport(qp->ibqp.device, qp->port_num); to_iport(qp->ibqp.device, qp->port_num);
ibp->n_dmawait++; ibp->rvp.n_dmawait++;
qp->s_flags |= HFI1_S_WAIT_DMA_DESC; qp->s_flags |= HFI1_S_WAIT_DMA_DESC;
list_add_tail(&priv->s_iowait.list, &sde->dmawait); list_add_tail(&priv->s_iowait.list, &sde->dmawait);
trace_hfi1_qpsleep(qp, HFI1_S_WAIT_DMA_DESC); trace_hfi1_qpsleep(qp, HFI1_S_WAIT_DMA_DESC);
...@@ -1636,9 +1637,9 @@ int qp_iter_next(struct qp_iter *iter) ...@@ -1636,9 +1637,9 @@ int qp_iter_next(struct qp_iter *iter)
ibp = &ppd->ibport_data; ibp = &ppd->ibport_data;
if (!(n & 1)) if (!(n & 1))
qp = rcu_dereference(ibp->qp[0]); qp = rcu_dereference(ibp->rvp.qp[0]);
else else
qp = rcu_dereference(ibp->qp[1]); qp = rcu_dereference(ibp->rvp.qp[1]);
} else { } else {
qp = rcu_dereference( qp = rcu_dereference(
dev->qp_dev->qp_table[ dev->qp_dev->qp_table[
......
...@@ -104,7 +104,7 @@ static inline struct rvt_qp *hfi1_lookup_qpn(struct hfi1_ibport *ibp, ...@@ -104,7 +104,7 @@ static inline struct rvt_qp *hfi1_lookup_qpn(struct hfi1_ibport *ibp,
struct rvt_qp *qp = NULL; struct rvt_qp *qp = NULL;
if (unlikely(qpn <= 1)) { if (unlikely(qpn <= 1)) {
qp = rcu_dereference(ibp->qp[qpn]); qp = rcu_dereference(ibp->rvp.qp[qpn]);
} else { } else {
struct hfi1_ibdev *dev = &ppd_from_ibp(ibp)->dd->verbs_dev; struct hfi1_ibdev *dev = &ppd_from_ibp(ibp)->dd->verbs_dev;
u32 n = qpn_hash(dev->qp_dev, qpn); u32 n = qpn_hash(dev->qp_dev, qpn);
......
...@@ -772,7 +772,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp, ...@@ -772,7 +772,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp,
return; return;
queue_ack: queue_ack:
this_cpu_inc(*ibp->rc_qacks); this_cpu_inc(*ibp->rvp.rc_qacks);
spin_lock_irqsave(&qp->s_lock, flags); spin_lock_irqsave(&qp->s_lock, flags);
qp->s_flags |= HFI1_S_ACK_PENDING | HFI1_S_RESP_PENDING; qp->s_flags |= HFI1_S_ACK_PENDING | HFI1_S_RESP_PENDING;
qp->s_nak_state = qp->r_nak_state; qp->s_nak_state = qp->r_nak_state;
...@@ -900,9 +900,9 @@ static void restart_rc(struct rvt_qp *qp, u32 psn, int wait) ...@@ -900,9 +900,9 @@ static void restart_rc(struct rvt_qp *qp, u32 psn, int wait)
ibp = to_iport(qp->ibqp.device, qp->port_num); ibp = to_iport(qp->ibqp.device, qp->port_num);
if (wqe->wr.opcode == IB_WR_RDMA_READ) if (wqe->wr.opcode == IB_WR_RDMA_READ)
ibp->n_rc_resends++; ibp->rvp.n_rc_resends++;
else else
ibp->n_rc_resends += delta_psn(qp->s_psn, psn); ibp->rvp.n_rc_resends += delta_psn(qp->s_psn, psn);
qp->s_flags &= ~(HFI1_S_WAIT_FENCE | HFI1_S_WAIT_RDMAR | qp->s_flags &= ~(HFI1_S_WAIT_FENCE | HFI1_S_WAIT_RDMAR |
HFI1_S_WAIT_SSN_CREDIT | HFI1_S_WAIT_PSN | HFI1_S_WAIT_SSN_CREDIT | HFI1_S_WAIT_PSN |
...@@ -925,7 +925,7 @@ static void rc_timeout(unsigned long arg) ...@@ -925,7 +925,7 @@ static void rc_timeout(unsigned long arg)
spin_lock(&qp->s_lock); spin_lock(&qp->s_lock);
if (qp->s_flags & HFI1_S_TIMER) { if (qp->s_flags & HFI1_S_TIMER) {
ibp = to_iport(qp->ibqp.device, qp->port_num); ibp = to_iport(qp->ibqp.device, qp->port_num);
ibp->n_rc_timeouts++; ibp->rvp.n_rc_timeouts++;
qp->s_flags &= ~HFI1_S_TIMER; qp->s_flags &= ~HFI1_S_TIMER;
del_timer(&qp->s_timer); del_timer(&qp->s_timer);
trace_hfi1_rc_timeout(qp, qp->s_last_psn + 1); trace_hfi1_rc_timeout(qp, qp->s_last_psn + 1);
...@@ -1104,7 +1104,7 @@ static struct rvt_swqe *do_rc_completion(struct rvt_qp *qp, ...@@ -1104,7 +1104,7 @@ static struct rvt_swqe *do_rc_completion(struct rvt_qp *qp,
} else { } else {
struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
this_cpu_inc(*ibp->rc_delayed_comp); this_cpu_inc(*ibp->rvp.rc_delayed_comp);
/* /*
* If send progress not running attempt to progress * If send progress not running attempt to progress
* SDMA queue. * SDMA queue.
...@@ -1263,7 +1263,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode, ...@@ -1263,7 +1263,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
switch (aeth >> 29) { switch (aeth >> 29) {
case 0: /* ACK */ case 0: /* ACK */
this_cpu_inc(*ibp->rc_acks); this_cpu_inc(*ibp->rvp.rc_acks);
if (qp->s_acked != qp->s_tail) { if (qp->s_acked != qp->s_tail) {
/* /*
* We are expecting more ACKs so * We are expecting more ACKs so
...@@ -1292,7 +1292,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode, ...@@ -1292,7 +1292,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
goto bail; goto bail;
case 1: /* RNR NAK */ case 1: /* RNR NAK */
ibp->n_rnr_naks++; ibp->rvp.n_rnr_naks++;
if (qp->s_acked == qp->s_tail) if (qp->s_acked == qp->s_tail)
goto bail; goto bail;
if (qp->s_flags & HFI1_S_WAIT_RNR) if (qp->s_flags & HFI1_S_WAIT_RNR)
...@@ -1307,7 +1307,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode, ...@@ -1307,7 +1307,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
/* The last valid PSN is the previous PSN. */ /* The last valid PSN is the previous PSN. */
update_last_psn(qp, psn - 1); update_last_psn(qp, psn - 1);
ibp->n_rc_resends += delta_psn(qp->s_psn, psn); ibp->rvp.n_rc_resends += delta_psn(qp->s_psn, psn);
reset_psn(qp, psn); reset_psn(qp, psn);
...@@ -1328,7 +1328,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode, ...@@ -1328,7 +1328,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
switch ((aeth >> HFI1_AETH_CREDIT_SHIFT) & switch ((aeth >> HFI1_AETH_CREDIT_SHIFT) &
HFI1_AETH_CREDIT_MASK) { HFI1_AETH_CREDIT_MASK) {
case 0: /* PSN sequence error */ case 0: /* PSN sequence error */
ibp->n_seq_naks++; ibp->rvp.n_seq_naks++;
/* /*
* Back up to the responder's expected PSN. * Back up to the responder's expected PSN.
* Note that we might get a NAK in the middle of an * Note that we might get a NAK in the middle of an
...@@ -1341,17 +1341,17 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode, ...@@ -1341,17 +1341,17 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
case 1: /* Invalid Request */ case 1: /* Invalid Request */
status = IB_WC_REM_INV_REQ_ERR; status = IB_WC_REM_INV_REQ_ERR;
ibp->n_other_naks++; ibp->rvp.n_other_naks++;
goto class_b; goto class_b;
case 2: /* Remote Access Error */ case 2: /* Remote Access Error */
status = IB_WC_REM_ACCESS_ERR; status = IB_WC_REM_ACCESS_ERR;
ibp->n_other_naks++; ibp->rvp.n_other_naks++;
goto class_b; goto class_b;
case 3: /* Remote Operation Error */ case 3: /* Remote Operation Error */
status = IB_WC_REM_OP_ERR; status = IB_WC_REM_OP_ERR;
ibp->n_other_naks++; ibp->rvp.n_other_naks++;
class_b: class_b:
if (qp->s_last == qp->s_acked) { if (qp->s_last == qp->s_acked) {
hfi1_send_complete(qp, wqe, status); hfi1_send_complete(qp, wqe, status);
...@@ -1402,7 +1402,7 @@ static void rdma_seq_err(struct rvt_qp *qp, struct hfi1_ibport *ibp, u32 psn, ...@@ -1402,7 +1402,7 @@ static void rdma_seq_err(struct rvt_qp *qp, struct hfi1_ibport *ibp, u32 psn,
wqe = do_rc_completion(qp, wqe, ibp); wqe = do_rc_completion(qp, wqe, ibp);
} }
ibp->n_rdma_seq++; ibp->rvp.n_rdma_seq++;
qp->r_flags |= HFI1_R_RDMAR_SEQ; qp->r_flags |= HFI1_R_RDMAR_SEQ;
restart_rc(qp, qp->s_last_psn + 1, 0); restart_rc(qp, qp->s_last_psn + 1, 0);
if (list_empty(&qp->rspwait)) { if (list_empty(&qp->rspwait)) {
...@@ -1665,7 +1665,7 @@ static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data, ...@@ -1665,7 +1665,7 @@ static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data,
* Don't queue the NAK if we already sent one. * Don't queue the NAK if we already sent one.
*/ */
if (!qp->r_nak_state) { if (!qp->r_nak_state) {
ibp->n_rc_seqnak++; ibp->rvp.n_rc_seqnak++;
qp->r_nak_state = IB_NAK_PSN_ERROR; qp->r_nak_state = IB_NAK_PSN_ERROR;
/* Use the expected PSN. */ /* Use the expected PSN. */
qp->r_ack_psn = qp->r_psn; qp->r_ack_psn = qp->r_psn;
...@@ -1697,7 +1697,7 @@ static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data, ...@@ -1697,7 +1697,7 @@ static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data,
*/ */
e = NULL; e = NULL;
old_req = 1; old_req = 1;
ibp->n_rc_dupreq++; ibp->rvp.n_rc_dupreq++;
spin_lock_irqsave(&qp->s_lock, flags); spin_lock_irqsave(&qp->s_lock, flags);
...@@ -2433,7 +2433,7 @@ void hfi1_rc_hdrerr( ...@@ -2433,7 +2433,7 @@ void hfi1_rc_hdrerr(
if (opcode < IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST) { if (opcode < IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST) {
diff = delta_psn(psn, qp->r_psn); diff = delta_psn(psn, qp->r_psn);
if (!qp->r_nak_state && diff >= 0) { if (!qp->r_nak_state && diff >= 0) {
ibp->n_rc_seqnak++; ibp->rvp.n_rc_seqnak++;
qp->r_nak_state = IB_NAK_PSN_ERROR; qp->r_nak_state = IB_NAK_PSN_ERROR;
/* Use the expected PSN. */ /* Use the expected PSN. */
qp->r_ack_psn = qp->r_psn; qp->r_ack_psn = qp->r_psn;
......
...@@ -279,7 +279,8 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct hfi1_ib_header *hdr, ...@@ -279,7 +279,8 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct hfi1_ib_header *hdr,
if (!(qp->alt_ah_attr.ah_flags & IB_AH_GRH)) if (!(qp->alt_ah_attr.ah_flags & IB_AH_GRH))
goto err; goto err;
guid = get_sguid(ibp, qp->alt_ah_attr.grh.sgid_index); guid = get_sguid(ibp, qp->alt_ah_attr.grh.sgid_index);
if (!gid_ok(&hdr->u.l.grh.dgid, ibp->gid_prefix, guid)) if (!gid_ok(&hdr->u.l.grh.dgid, ibp->rvp.gid_prefix,
guid))
goto err; goto err;
if (!gid_ok(&hdr->u.l.grh.sgid, if (!gid_ok(&hdr->u.l.grh.sgid,
qp->alt_ah_attr.grh.dgid.global.subnet_prefix, qp->alt_ah_attr.grh.dgid.global.subnet_prefix,
...@@ -312,7 +313,8 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct hfi1_ib_header *hdr, ...@@ -312,7 +313,8 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct hfi1_ib_header *hdr,
goto err; goto err;
guid = get_sguid(ibp, guid = get_sguid(ibp,
qp->remote_ah_attr.grh.sgid_index); qp->remote_ah_attr.grh.sgid_index);
if (!gid_ok(&hdr->u.l.grh.dgid, ibp->gid_prefix, guid)) if (!gid_ok(&hdr->u.l.grh.dgid, ibp->rvp.gid_prefix,
guid))
goto err; goto err;
if (!gid_ok(&hdr->u.l.grh.sgid, if (!gid_ok(&hdr->u.l.grh.sgid,
qp->remote_ah_attr.grh.dgid.global.subnet_prefix, qp->remote_ah_attr.grh.dgid.global.subnet_prefix,
...@@ -413,7 +415,7 @@ static void ruc_loopback(struct rvt_qp *sqp) ...@@ -413,7 +415,7 @@ static void ruc_loopback(struct rvt_qp *sqp)
if (!qp || !(ib_hfi1_state_ops[qp->state] & HFI1_PROCESS_RECV_OK) || if (!qp || !(ib_hfi1_state_ops[qp->state] & HFI1_PROCESS_RECV_OK) ||
qp->ibqp.qp_type != sqp->ibqp.qp_type) { qp->ibqp.qp_type != sqp->ibqp.qp_type) {
ibp->n_pkt_drops++; ibp->rvp.n_pkt_drops++;
/* /*
* For RC, the requester would timeout and retry so * For RC, the requester would timeout and retry so
* shortcut the timeouts and just signal too many retries. * shortcut the timeouts and just signal too many retries.
...@@ -569,7 +571,7 @@ static void ruc_loopback(struct rvt_qp *sqp) ...@@ -569,7 +571,7 @@ static void ruc_loopback(struct rvt_qp *sqp)
send_comp: send_comp:
spin_lock_irqsave(&sqp->s_lock, flags); spin_lock_irqsave(&sqp->s_lock, flags);
ibp->n_loop_pkts++; ibp->rvp.n_loop_pkts++;
flush_send: flush_send:
sqp->s_rnr_retry = sqp->s_rnr_retry_cnt; sqp->s_rnr_retry = sqp->s_rnr_retry_cnt;
hfi1_send_complete(sqp, wqe, send_status); hfi1_send_complete(sqp, wqe, send_status);
...@@ -579,7 +581,7 @@ static void ruc_loopback(struct rvt_qp *sqp) ...@@ -579,7 +581,7 @@ static void ruc_loopback(struct rvt_qp *sqp)
/* Handle RNR NAK */ /* Handle RNR NAK */
if (qp->ibqp.qp_type == IB_QPT_UC) if (qp->ibqp.qp_type == IB_QPT_UC)
goto send_comp; goto send_comp;
ibp->n_rnr_naks++; ibp->rvp.n_rnr_naks++;
/* /*
* Note: we don't need the s_lock held since the BUSY flag * Note: we don't need the s_lock held since the BUSY flag
* makes this single threaded. * makes this single threaded.
...@@ -665,7 +667,7 @@ u32 hfi1_make_grh(struct hfi1_ibport *ibp, struct ib_grh *hdr, ...@@ -665,7 +667,7 @@ u32 hfi1_make_grh(struct hfi1_ibport *ibp, struct ib_grh *hdr,
hdr->next_hdr = IB_GRH_NEXT_HDR; hdr->next_hdr = IB_GRH_NEXT_HDR;
hdr->hop_limit = grh->hop_limit; hdr->hop_limit = grh->hop_limit;
/* The SGID is 32-bit aligned. */ /* The SGID is 32-bit aligned. */
hdr->sgid.global.subnet_prefix = ibp->gid_prefix; hdr->sgid.global.subnet_prefix = ibp->rvp.gid_prefix;
hdr->sgid.global.interface_id = hdr->sgid.global.interface_id =
grh->sgid_index && grh->sgid_index < ARRAY_SIZE(ibp->guids) ? grh->sgid_index && grh->sgid_index < ARRAY_SIZE(ibp->guids) ?
ibp->guids[grh->sgid_index - 1] : ibp->guids[grh->sgid_index - 1] :
......
...@@ -579,7 +579,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) ...@@ -579,7 +579,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)
set_bit(HFI1_R_REWIND_SGE, &qp->r_aflags); set_bit(HFI1_R_REWIND_SGE, &qp->r_aflags);
qp->r_sge.num_sge = 0; qp->r_sge.num_sge = 0;
drop: drop:
ibp->n_pkt_drops++; ibp->rvp.n_pkt_drops++;
return; return;
op_err: op_err:
......
...@@ -82,7 +82,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) ...@@ -82,7 +82,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)
qp = hfi1_lookup_qpn(ibp, swqe->ud_wr.remote_qpn); qp = hfi1_lookup_qpn(ibp, swqe->ud_wr.remote_qpn);
if (!qp) { if (!qp) {
ibp->n_pkt_drops++; ibp->rvp.n_pkt_drops++;
rcu_read_unlock(); rcu_read_unlock();
return; return;
} }
...@@ -94,7 +94,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) ...@@ -94,7 +94,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)
if (dqptype != sqptype || if (dqptype != sqptype ||
!(ib_hfi1_state_ops[qp->state] & HFI1_PROCESS_RECV_OK)) { !(ib_hfi1_state_ops[qp->state] & HFI1_PROCESS_RECV_OK)) {
ibp->n_pkt_drops++; ibp->rvp.n_pkt_drops++;
goto drop; goto drop;
} }
...@@ -173,14 +173,14 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) ...@@ -173,14 +173,14 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)
} }
if (!ret) { if (!ret) {
if (qp->ibqp.qp_num == 0) if (qp->ibqp.qp_num == 0)
ibp->n_vl15_dropped++; ibp->rvp.n_vl15_dropped++;
goto bail_unlock; goto bail_unlock;
} }
} }
/* Silently drop packets which are too big. */ /* Silently drop packets which are too big. */
if (unlikely(wc.byte_len > qp->r_len)) { if (unlikely(wc.byte_len > qp->r_len)) {
qp->r_flags |= HFI1_R_REUSE_SGE; qp->r_flags |= HFI1_R_REUSE_SGE;
ibp->n_pkt_drops++; ibp->rvp.n_pkt_drops++;
goto bail_unlock; goto bail_unlock;
} }
...@@ -249,7 +249,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) ...@@ -249,7 +249,7 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)
/* Signal completion event if the solicited bit is set. */ /* Signal completion event if the solicited bit is set. */
hfi1_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, hfi1_cq_enter(to_icq(qp->ibqp.recv_cq), &wc,
swqe->wr.send_flags & IB_SEND_SOLICITED); swqe->wr.send_flags & IB_SEND_SOLICITED);
ibp->n_loop_pkts++; ibp->rvp.n_loop_pkts++;
bail_unlock: bail_unlock:
spin_unlock_irqrestore(&qp->r_lock, flags); spin_unlock_irqrestore(&qp->r_lock, flags);
drop: drop:
...@@ -608,7 +608,7 @@ static int opa_smp_check(struct hfi1_ibport *ibp, u16 pkey, u8 sc5, ...@@ -608,7 +608,7 @@ static int opa_smp_check(struct hfi1_ibport *ibp, u16 pkey, u8 sc5,
case IB_MGMT_METHOD_TRAP: case IB_MGMT_METHOD_TRAP:
case IB_MGMT_METHOD_GET_RESP: case IB_MGMT_METHOD_GET_RESP:
case IB_MGMT_METHOD_REPORT_RESP: case IB_MGMT_METHOD_REPORT_RESP:
if (ibp->port_cap_flags & IB_PORT_SM) if (ibp->rvp.port_cap_flags & IB_PORT_SM)
return 0; return 0;
if (pkey == FULL_MGMT_P_KEY) { if (pkey == FULL_MGMT_P_KEY) {
smp->status |= IB_SMP_UNSUP_METHOD; smp->status |= IB_SMP_UNSUP_METHOD;
...@@ -824,7 +824,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) ...@@ -824,7 +824,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)
} }
if (!ret) { if (!ret) {
if (qp->ibqp.qp_num == 0) if (qp->ibqp.qp_num == 0)
ibp->n_vl15_dropped++; ibp->rvp.n_vl15_dropped++;
return; return;
} }
} }
...@@ -884,5 +884,5 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) ...@@ -884,5 +884,5 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)
return; return;
drop: drop:
ibp->n_pkt_drops++; ibp->rvp.n_pkt_drops++;
} }
...@@ -593,7 +593,7 @@ static inline int qp_ok(int opcode, struct hfi1_packet *packet) ...@@ -593,7 +593,7 @@ static inline int qp_ok(int opcode, struct hfi1_packet *packet)
return 1; return 1;
dropit: dropit:
ibp = &packet->rcd->ppd->ibport_data; ibp = &packet->rcd->ppd->ibport_data;
ibp->n_pkt_drops++; ibp->rvp.n_pkt_drops++;
return 0; return 0;
} }
...@@ -683,7 +683,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet) ...@@ -683,7 +683,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)
return; return;
drop: drop:
ibp->n_pkt_drops++; ibp->rvp.n_pkt_drops++;
} }
/* /*
...@@ -1465,17 +1465,17 @@ static int query_port(struct ib_device *ibdev, u8 port, ...@@ -1465,17 +1465,17 @@ static int query_port(struct ib_device *ibdev, u8 port,
memset(props, 0, sizeof(*props)); memset(props, 0, sizeof(*props));
props->lid = lid ? lid : 0; props->lid = lid ? lid : 0;
props->lmc = ppd->lmc; props->lmc = ppd->lmc;
props->sm_lid = ibp->sm_lid; props->sm_lid = ibp->rvp.sm_lid;
props->sm_sl = ibp->sm_sl; props->sm_sl = ibp->rvp.sm_sl;
/* OPA logical states match IB logical states */ /* OPA logical states match IB logical states */
props->state = driver_lstate(ppd); props->state = driver_lstate(ppd);
props->phys_state = hfi1_ibphys_portstate(ppd); props->phys_state = hfi1_ibphys_portstate(ppd);
props->port_cap_flags = ibp->port_cap_flags; props->port_cap_flags = ibp->rvp.port_cap_flags;
props->gid_tbl_len = HFI1_GUIDS_PER_PORT; props->gid_tbl_len = HFI1_GUIDS_PER_PORT;
props->max_msg_sz = 0x80000000; props->max_msg_sz = 0x80000000;
props->pkey_tbl_len = hfi1_get_npkeys(dd); props->pkey_tbl_len = hfi1_get_npkeys(dd);
props->bad_pkey_cntr = ibp->pkey_violations; props->bad_pkey_cntr = ibp->rvp.pkey_violations;
props->qkey_viol_cntr = ibp->qkey_violations; props->qkey_viol_cntr = ibp->rvp.qkey_violations;
props->active_width = (u8)opa_width_to_ib(ppd->link_width_active); props->active_width = (u8)opa_width_to_ib(ppd->link_width_active);
/* see rate_show() in ib core/sysfs.c */ /* see rate_show() in ib core/sysfs.c */
props->active_speed = (u8)opa_speed_to_ib(ppd->link_speed_active); props->active_speed = (u8)opa_speed_to_ib(ppd->link_speed_active);
...@@ -1494,7 +1494,7 @@ static int query_port(struct ib_device *ibdev, u8 port, ...@@ -1494,7 +1494,7 @@ static int query_port(struct ib_device *ibdev, u8 port,
4096 : hfi1_max_mtu), IB_MTU_4096); 4096 : hfi1_max_mtu), IB_MTU_4096);
props->active_mtu = !valid_ib_mtu(ppd->ibmtu) ? props->max_mtu : props->active_mtu = !valid_ib_mtu(ppd->ibmtu) ? props->max_mtu :
mtu_to_enum(ppd->ibmtu, IB_MTU_2048); mtu_to_enum(ppd->ibmtu, IB_MTU_2048);
props->subnet_timeout = ibp->subnet_timeout; props->subnet_timeout = ibp->rvp.subnet_timeout;
return 0; return 0;
} }
...@@ -1565,8 +1565,8 @@ static int modify_port(struct ib_device *ibdev, u8 port, ...@@ -1565,8 +1565,8 @@ static int modify_port(struct ib_device *ibdev, u8 port,
struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
int ret = 0; int ret = 0;
ibp->port_cap_flags |= props->set_port_cap_mask; ibp->rvp.port_cap_flags |= props->set_port_cap_mask;
ibp->port_cap_flags &= ~props->clr_port_cap_mask; ibp->rvp.port_cap_flags &= ~props->clr_port_cap_mask;
if (props->set_port_cap_mask || props->clr_port_cap_mask) if (props->set_port_cap_mask || props->clr_port_cap_mask)
hfi1_cap_mask_chg(ibp); hfi1_cap_mask_chg(ibp);
if (port_modify_mask & IB_PORT_SHUTDOWN) { if (port_modify_mask & IB_PORT_SHUTDOWN) {
...@@ -1575,7 +1575,7 @@ static int modify_port(struct ib_device *ibdev, u8 port, ...@@ -1575,7 +1575,7 @@ static int modify_port(struct ib_device *ibdev, u8 port,
ret = set_link_state(ppd, HLS_DN_DOWNDEF); ret = set_link_state(ppd, HLS_DN_DOWNDEF);
} }
if (port_modify_mask & IB_PORT_RESET_QKEY_CNTR) if (port_modify_mask & IB_PORT_RESET_QKEY_CNTR)
ibp->qkey_violations = 0; ibp->rvp.qkey_violations = 0;
return ret; return ret;
} }
...@@ -1591,7 +1591,7 @@ static int query_gid(struct ib_device *ibdev, u8 port, ...@@ -1591,7 +1591,7 @@ static int query_gid(struct ib_device *ibdev, u8 port,
struct hfi1_ibport *ibp = to_iport(ibdev, port); struct hfi1_ibport *ibp = to_iport(ibdev, port);
struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
gid->global.subnet_prefix = ibp->gid_prefix; gid->global.subnet_prefix = ibp->rvp.gid_prefix;
if (index == 0) if (index == 0)
gid->global.interface_id = cpu_to_be64(ppd->guid); gid->global.interface_id = cpu_to_be64(ppd->guid);
else if (index < HFI1_GUIDS_PER_PORT) else if (index < HFI1_GUIDS_PER_PORT)
...@@ -1663,7 +1663,7 @@ struct ib_ah *hfi1_create_qp0_ah(struct hfi1_ibport *ibp, u16 dlid) ...@@ -1663,7 +1663,7 @@ struct ib_ah *hfi1_create_qp0_ah(struct hfi1_ibport *ibp, u16 dlid)
attr.dlid = dlid; attr.dlid = dlid;
attr.port_num = ppd_from_ibp(ibp)->port; attr.port_num = ppd_from_ibp(ibp)->port;
rcu_read_lock(); rcu_read_lock();
qp0 = rcu_dereference(ibp->qp[0]); qp0 = rcu_dereference(ibp->rvp.qp[0]);
if (qp0) if (qp0)
ah = ib_create_ah(qp0->ibqp.pd, &attr); ah = ib_create_ah(qp0->ibqp.pd, &attr);
rcu_read_unlock(); rcu_read_unlock();
...@@ -1738,21 +1738,21 @@ static void init_ibport(struct hfi1_pportdata *ppd) ...@@ -1738,21 +1738,21 @@ static void init_ibport(struct hfi1_pportdata *ppd)
ibp->sc_to_sl[i] = i; ibp->sc_to_sl[i] = i;
} }
spin_lock_init(&ibp->lock); spin_lock_init(&ibp->rvp.lock);
/* Set the prefix to the default value (see ch. 4.1.1) */ /* Set the prefix to the default value (see ch. 4.1.1) */
ibp->gid_prefix = IB_DEFAULT_GID_PREFIX; ibp->rvp.gid_prefix = IB_DEFAULT_GID_PREFIX;
ibp->sm_lid = 0; 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 */
ibp->port_cap_flags = IB_PORT_AUTO_MIGR_SUP | ibp->rvp.port_cap_flags = IB_PORT_AUTO_MIGR_SUP |
IB_PORT_CAP_MASK_NOTICE_SUP; IB_PORT_CAP_MASK_NOTICE_SUP;
ibp->pma_counter_select[0] = IB_PMA_PORT_XMIT_DATA; ibp->rvp.pma_counter_select[0] = IB_PMA_PORT_XMIT_DATA;
ibp->pma_counter_select[1] = IB_PMA_PORT_RCV_DATA; ibp->rvp.pma_counter_select[1] = IB_PMA_PORT_RCV_DATA;
ibp->pma_counter_select[2] = IB_PMA_PORT_XMIT_PKTS; ibp->rvp.pma_counter_select[2] = IB_PMA_PORT_XMIT_PKTS;
ibp->pma_counter_select[3] = IB_PMA_PORT_RCV_PKTS; ibp->rvp.pma_counter_select[3] = IB_PMA_PORT_RCV_PKTS;
ibp->pma_counter_select[4] = IB_PMA_PORT_XMIT_WAIT; ibp->rvp.pma_counter_select[4] = IB_PMA_PORT_XMIT_WAIT;
RCU_INIT_POINTER(ibp->qp[0], NULL); RCU_INIT_POINTER(ibp->rvp.qp[0], NULL);
RCU_INIT_POINTER(ibp->qp[1], NULL); RCU_INIT_POINTER(ibp->rvp.qp[1], NULL);
} }
static void verbs_txreq_kmem_cache_ctor(void *obj) static void verbs_txreq_kmem_cache_ctor(void *obj)
...@@ -1926,6 +1926,15 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ...@@ -1926,6 +1926,15 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)
dd->verbs_dev.rdi.flags = (RVT_FLAG_QP_INIT_DRIVER | dd->verbs_dev.rdi.flags = (RVT_FLAG_QP_INIT_DRIVER |
RVT_FLAG_CQ_INIT_DRIVER); RVT_FLAG_CQ_INIT_DRIVER);
dd->verbs_dev.rdi.dparms.lkey_table_size = hfi1_lkey_table_size; dd->verbs_dev.rdi.dparms.lkey_table_size = hfi1_lkey_table_size;
dd->verbs_dev.rdi.dparms.nports = dd->num_pports;
dd->verbs_dev.rdi.dparms.npkeys = hfi1_get_npkeys(dd);
ppd = dd->pport;
for (i = 0; i < dd->num_pports; i++, ppd++)
rvt_init_port(&dd->verbs_dev.rdi,
&ppd->ibport_data.rvp,
i,
ppd->pkeys);
ret = rvt_register_device(&dd->verbs_dev.rdi); ret = rvt_register_device(&dd->verbs_dev.rdi);
if (ret) if (ret)
...@@ -2003,7 +2012,7 @@ void hfi1_cnp_rcv(struct hfi1_packet *packet) ...@@ -2003,7 +2012,7 @@ void hfi1_cnp_rcv(struct hfi1_packet *packet)
svc_type = IB_CC_SVCTYPE_UD; svc_type = IB_CC_SVCTYPE_UD;
break; break;
default: default:
ibp->n_pkt_drops++; ibp->rvp.n_pkt_drops++;
return; return;
} }
......
...@@ -412,62 +412,17 @@ static inline void inc_opstats( ...@@ -412,62 +412,17 @@ static inline void inc_opstats(
struct hfi1_ibport { struct hfi1_ibport {
struct rvt_qp __rcu *qp[2]; struct rvt_qp __rcu *qp[2];
struct ib_mad_agent *send_agent; /* agent for SMI (traps) */ struct rvt_ibport rvp;
struct rvt_ah *sm_ah; struct rvt_ah *sm_ah;
struct rvt_ah *smi_ah; struct rvt_ah *smi_ah;
struct rb_root mcast_tree;
spinlock_t lock; /* protect changes in this struct */
/* non-zero when timer is set */
unsigned long mkey_lease_timeout;
unsigned long trap_timeout;
__be64 gid_prefix; /* in network order */
__be64 mkey;
__be64 guids[HFI1_GUIDS_PER_PORT - 1]; /* writable GUIDs */ __be64 guids[HFI1_GUIDS_PER_PORT - 1]; /* writable GUIDs */
u64 tid; /* TID for traps */
u64 n_rc_resends;
u64 n_seq_naks;
u64 n_rdma_seq;
u64 n_rnr_naks;
u64 n_other_naks;
u64 n_loop_pkts;
u64 n_pkt_drops;
u64 n_vl15_dropped;
u64 n_rc_timeouts;
u64 n_dmawait;
u64 n_unaligned;
u64 n_rc_dupreq;
u64 n_rc_seqnak;
/* Hot-path per CPU counters to avoid cacheline trading to update */
u64 z_rc_acks;
u64 z_rc_qacks;
u64 z_rc_delayed_comp;
u64 __percpu *rc_acks;
u64 __percpu *rc_qacks;
u64 __percpu *rc_delayed_comp;
u32 port_cap_flags;
u32 pma_sample_start;
u32 pma_sample_interval;
__be16 pma_counter_select[5];
u16 pma_tag;
u16 pkey_violations;
u16 qkey_violations;
u16 mkey_violations;
u16 mkey_lease_period;
u16 sm_lid;
u16 repress_traps;
u8 sm_sl;
u8 mkeyprot;
u8 subnet_timeout;
u8 vl_high_limit;
/* the first 16 entries are sl_to_vl for !OPA */ /* the first 16 entries are sl_to_vl for !OPA */
u8 sl_to_sc[32]; u8 sl_to_sc[32];
u8 sc_to_sl[32]; u8 sc_to_sl[32];
}; };
struct hfi1_qp_ibdev; struct hfi1_qp_ibdev;
struct hfi1_ibdev { struct hfi1_ibdev {
struct rvt_dev_info rdi; /* Must be first */ struct rvt_dev_info rdi; /* Must be first */
......
...@@ -131,8 +131,8 @@ struct hfi1_mcast *hfi1_mcast_find(struct hfi1_ibport *ibp, union ib_gid *mgid) ...@@ -131,8 +131,8 @@ struct hfi1_mcast *hfi1_mcast_find(struct hfi1_ibport *ibp, union ib_gid *mgid)
unsigned long flags; unsigned long flags;
struct hfi1_mcast *mcast; struct hfi1_mcast *mcast;
spin_lock_irqsave(&ibp->lock, flags); spin_lock_irqsave(&ibp->rvp.lock, flags);
n = ibp->mcast_tree.rb_node; n = ibp->rvp.mcast_tree.rb_node;
while (n) { while (n) {
int ret; int ret;
...@@ -146,11 +146,11 @@ struct hfi1_mcast *hfi1_mcast_find(struct hfi1_ibport *ibp, union ib_gid *mgid) ...@@ -146,11 +146,11 @@ struct hfi1_mcast *hfi1_mcast_find(struct hfi1_ibport *ibp, union ib_gid *mgid)
n = n->rb_right; n = n->rb_right;
else { else {
atomic_inc(&mcast->refcount); atomic_inc(&mcast->refcount);
spin_unlock_irqrestore(&ibp->lock, flags); spin_unlock_irqrestore(&ibp->rvp.lock, flags);
goto bail; goto bail;
} }
} }
spin_unlock_irqrestore(&ibp->lock, flags); spin_unlock_irqrestore(&ibp->rvp.lock, flags);
mcast = NULL; mcast = NULL;
...@@ -170,11 +170,11 @@ struct hfi1_mcast *hfi1_mcast_find(struct hfi1_ibport *ibp, union ib_gid *mgid) ...@@ -170,11 +170,11 @@ struct hfi1_mcast *hfi1_mcast_find(struct hfi1_ibport *ibp, union ib_gid *mgid)
static int mcast_add(struct hfi1_ibdev *dev, struct hfi1_ibport *ibp, static int mcast_add(struct hfi1_ibdev *dev, struct hfi1_ibport *ibp,
struct hfi1_mcast *mcast, struct hfi1_mcast_qp *mqp) struct hfi1_mcast *mcast, struct hfi1_mcast_qp *mqp)
{ {
struct rb_node **n = &ibp->mcast_tree.rb_node; struct rb_node **n = &ibp->rvp.mcast_tree.rb_node;
struct rb_node *pn = NULL; struct rb_node *pn = NULL;
int ret; int ret;
spin_lock_irq(&ibp->lock); spin_lock_irq(&ibp->rvp.lock);
while (*n) { while (*n) {
struct hfi1_mcast *tmcast; struct hfi1_mcast *tmcast;
...@@ -229,12 +229,12 @@ static int mcast_add(struct hfi1_ibdev *dev, struct hfi1_ibport *ibp, ...@@ -229,12 +229,12 @@ static int mcast_add(struct hfi1_ibdev *dev, struct hfi1_ibport *ibp,
atomic_inc(&mcast->refcount); atomic_inc(&mcast->refcount);
rb_link_node(&mcast->rb_node, pn, n); rb_link_node(&mcast->rb_node, pn, n);
rb_insert_color(&mcast->rb_node, &ibp->mcast_tree); rb_insert_color(&mcast->rb_node, &ibp->rvp.mcast_tree);
ret = 0; ret = 0;
bail: bail:
spin_unlock_irq(&ibp->lock); spin_unlock_irq(&ibp->rvp.lock);
return ret; return ret;
} }
...@@ -313,13 +313,13 @@ int hfi1_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) ...@@ -313,13 +313,13 @@ int hfi1_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
goto bail; goto bail;
} }
spin_lock_irq(&ibp->lock); spin_lock_irq(&ibp->rvp.lock);
/* Find the GID in the mcast table. */ /* Find the GID in the mcast table. */
n = ibp->mcast_tree.rb_node; n = ibp->rvp.mcast_tree.rb_node;
while (1) { while (1) {
if (n == NULL) { if (n == NULL) {
spin_unlock_irq(&ibp->lock); spin_unlock_irq(&ibp->rvp.lock);
ret = -EINVAL; ret = -EINVAL;
goto bail; goto bail;
} }
...@@ -348,13 +348,13 @@ int hfi1_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) ...@@ -348,13 +348,13 @@ int hfi1_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
/* If this was the last attached QP, remove the GID too. */ /* If this was the last attached QP, remove the GID too. */
if (list_empty(&mcast->qp_list)) { if (list_empty(&mcast->qp_list)) {
rb_erase(&mcast->rb_node, &ibp->mcast_tree); rb_erase(&mcast->rb_node, &ibp->rvp.mcast_tree);
last = 1; last = 1;
} }
break; break;
} }
spin_unlock_irq(&ibp->lock); spin_unlock_irq(&ibp->rvp.lock);
if (p) { if (p) {
/* /*
...@@ -381,5 +381,5 @@ int hfi1_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) ...@@ -381,5 +381,5 @@ int hfi1_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
int hfi1_mcast_tree_empty(struct hfi1_ibport *ibp) int hfi1_mcast_tree_empty(struct hfi1_ibport *ibp)
{ {
return ibp->mcast_tree.rb_node == NULL; return !ibp->rvp.mcast_tree.rb_node;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册