Lines Matching defs:ibp
52 static void qib_send_trap(struct qib_ibport *ibp, void *data, unsigned len)
61 agent = ibp->send_agent;
66 if (!(ppd_from_ibp(ibp)->lflags & QIBL_LINKACTIVE))
70 if (ibp->trap_timeout && time_before(jiffies, ibp->trap_timeout))
83 ibp->tid++;
84 smp->tid = cpu_to_be64(ibp->tid);
89 spin_lock_irqsave(&ibp->lock, flags);
90 if (!ibp->sm_ah) {
91 if (ibp->sm_lid != be16_to_cpu(IB_LID_PERMISSIVE)) {
96 attr.dlid = ibp->sm_lid;
97 attr.port_num = ppd_from_ibp(ibp)->port;
98 ah = ib_create_ah(ibp->qp0->ibqp.pd, &attr);
103 ibp->sm_ah = to_iah(ah);
109 send_buf->ah = &ibp->sm_ah->ibah;
112 spin_unlock_irqrestore(&ibp->lock, flags);
118 timeout = (4096 * (1UL << ibp->subnet_timeout)) / 1000;
119 ibp->trap_timeout = jiffies + usecs_to_jiffies(timeout);
122 ibp->trap_timeout = 0;
129 void qib_bad_pqkey(struct qib_ibport *ibp, __be16 trap_num, u32 key, u32 sl,
135 ibp->pkey_violations++;
137 ibp->qkey_violations++;
138 ibp->n_pkt_drops++;
145 data.issuer_lid = cpu_to_be16(ppd_from_ibp(ibp)->lid);
154 qib_send_trap(ibp, &data, sizeof data);
160 static void qib_bad_mkey(struct qib_ibport *ibp, struct ib_smp *smp)
169 data.issuer_lid = cpu_to_be16(ppd_from_ibp(ibp)->lid);
193 qib_send_trap(ibp, &data, sizeof data);
199 void qib_cap_mask_chg(struct qib_ibport *ibp)
207 data.issuer_lid = cpu_to_be16(ppd_from_ibp(ibp)->lid);
211 data.details.ntc_144.new_cap_mask = cpu_to_be32(ibp->port_cap_flags);
213 qib_send_trap(ibp, &data, sizeof data);
219 void qib_sys_guid_chg(struct qib_ibport *ibp)
227 data.issuer_lid = cpu_to_be16(ppd_from_ibp(ibp)->lid);
233 qib_send_trap(ibp, &data, sizeof data);
239 void qib_node_desc_chg(struct qib_ibport *ibp)
247 data.issuer_lid = cpu_to_be16(ppd_from_ibp(ibp)->lid);
254 qib_send_trap(ibp, &data, sizeof data);
318 struct qib_ibport *ibp = &ppd->ibport_data;
329 p[i] = ibp->guids[i - 1];
397 static int check_mkey(struct qib_ibport *ibp, struct ib_smp *smp, int mad_flags)
402 if (ibp->mkey_lease_timeout &&
403 time_after_eq(jiffies, ibp->mkey_lease_timeout)) {
405 ibp->mkey_lease_timeout = 0;
406 ibp->mkeyprot = 0;
410 if ((mad_flags & IB_MAD_IGNORE_MKEY) == 0 && ibp->mkey != 0 &&
411 ibp->mkey != smp->mkey &&
414 (smp->method == IB_MGMT_METHOD_GET && ibp->mkeyprot >= 2))) {
415 if (ibp->mkey_violations != 0xFFFF)
416 ++ibp->mkey_violations;
417 if (!ibp->mkey_lease_timeout && ibp->mkey_lease_period)
418 ibp->mkey_lease_timeout = jiffies +
419 ibp->mkey_lease_period * HZ;
421 qib_bad_mkey(ibp, smp);
423 } else if (ibp->mkey_lease_timeout)
424 ibp->mkey_lease_timeout = 0;
434 struct qib_ibport *ibp;
451 ibp = to_iport(ibdev, port_num);
452 ret = check_mkey(ibp, smp, 0);
461 ibp = &ppd->ibport_data;
467 if (smp->method == IB_MGMT_METHOD_SET || ibp->mkey == smp->mkey ||
468 ibp->mkeyprot == 0)
469 pip->mkey = ibp->mkey;
470 pip->gid_prefix = ibp->gid_prefix;
473 pip->sm_lid = cpu_to_be16(ibp->sm_lid);
474 pip->cap_mask = cpu_to_be32(ibp->port_cap_flags);
476 pip->mkey_lease_period = cpu_to_be16(ibp->mkey_lease_period);
487 pip->mkeyprot_resv_lmc = (ibp->mkeyprot << 6) | ppd->lmc;
508 pip->neighbormtu_mastersmsl = (mtu << 4) | ibp->sm_sl;
510 pip->vl_high_limit = ibp->vl_high_limit;
521 pip->mkey_violations = cpu_to_be16(ibp->mkey_violations);
523 pip->pkey_violations = cpu_to_be16(ibp->pkey_violations);
524 pip->qkey_violations = cpu_to_be16(ibp->qkey_violations);
527 pip->clientrereg_resv_subnetto = ibp->subnet_timeout;
534 if (ibp->port_cap_flags & IB_PORT_LINK_LATENCY_SUP) {
606 struct qib_ibport *ibp = &ppd->ibport_data;
611 ibp->guids[i - 1] = p[i];
634 struct qib_ibport *ibp;
660 ibp = &ppd->ibport_data;
664 ibp->mkey = pip->mkey;
665 ibp->gid_prefix = pip->gid_prefix;
666 ibp->mkey_lease_period = be16_to_cpu(pip->mkey_lease_period);
687 if (smlid != ibp->sm_lid || msl != ibp->sm_sl) {
688 spin_lock_irqsave(&ibp->lock, flags);
689 if (ibp->sm_ah) {
690 if (smlid != ibp->sm_lid)
691 ibp->sm_ah->attr.dlid = smlid;
692 if (msl != ibp->sm_sl)
693 ibp->sm_ah->attr.sl = msl;
695 spin_unlock_irqrestore(&ibp->lock, flags);
696 if (smlid != ibp->sm_lid)
697 ibp->sm_lid = smlid;
698 if (msl != ibp->sm_sl)
699 ibp->sm_sl = msl;
744 ibp->mkeyprot = pip->mkeyprot_resv_lmc >> 6;
745 ibp->vl_high_limit = pip->vl_high_limit;
747 ibp->vl_high_limit);
763 ibp->mkey_violations = 0;
766 ibp->pkey_violations = 0;
769 ibp->qkey_violations = 0;
778 ibp->subnet_timeout = pip->clientrereg_resv_subnetto & 0x1F;
1029 struct qib_ibport *ibp = to_iport(ibdev, port);
1035 if (!(ibp->port_cap_flags & IB_PORT_SL_MAP_SUP))
1038 for (i = 0; i < ARRAY_SIZE(ibp->sl_to_vl); i += 2)
1039 *p++ = (ibp->sl_to_vl[i] << 4) | ibp->sl_to_vl[i + 1];
1047 struct qib_ibport *ibp = to_iport(ibdev, port);
1051 if (!(ibp->port_cap_flags & IB_PORT_SL_MAP_SUP)) {
1056 for (i = 0; i < ARRAY_SIZE(ibp->sl_to_vl); i += 2, p++) {
1057 ibp->sl_to_vl[i] = *p >> 4;
1058 ibp->sl_to_vl[i + 1] = *p & 0xF;
1156 struct qib_ibport *ibp = to_iport(ibdev, port);
1157 struct qib_pportdata *ppd = ppd_from_ibp(ibp);
1168 spin_lock_irqsave(&ibp->lock, flags);
1173 p->sample_start = cpu_to_be32(ibp->pma_sample_start);
1174 p->sample_interval = cpu_to_be32(ibp->pma_sample_interval);
1175 p->tag = cpu_to_be16(ibp->pma_tag);
1176 p->counter_select[0] = ibp->pma_counter_select[0];
1177 p->counter_select[1] = ibp->pma_counter_select[1];
1178 p->counter_select[2] = ibp->pma_counter_select[2];
1179 p->counter_select[3] = ibp->pma_counter_select[3];
1180 p->counter_select[4] = ibp->pma_counter_select[4];
1181 spin_unlock_irqrestore(&ibp->lock, flags);
1194 struct qib_ibport *ibp = to_iport(ibdev, port);
1195 struct qib_pportdata *ppd = ppd_from_ibp(ibp);
1206 spin_lock_irqsave(&ibp->lock, flags);
1215 ibp->pma_sample_start = be32_to_cpu(p->sample_start);
1216 ibp->pma_sample_interval = be32_to_cpu(p->sample_interval);
1217 ibp->pma_tag = be16_to_cpu(p->tag);
1218 ibp->pma_counter_select[0] = p->counter_select[0];
1219 ibp->pma_counter_select[1] = p->counter_select[1];
1220 ibp->pma_counter_select[2] = p->counter_select[2];
1221 ibp->pma_counter_select[3] = p->counter_select[3];
1222 ibp->pma_counter_select[4] = p->counter_select[4];
1223 dd->f_set_cntr_sample(ppd, ibp->pma_sample_interval,
1224 ibp->pma_sample_start);
1226 spin_unlock_irqrestore(&ibp->lock, flags);
1234 static u64 get_counter(struct qib_ibport *ibp, struct qib_pportdata *ppd,
1274 struct qib_ibport *ibp = &ppd->ibport_data;
1277 get_counter(ibp, ppd, IB_PMA_PORT_XMIT_DATA);
1279 get_counter(ibp, ppd, IB_PMA_PORT_RCV_DATA);
1281 get_counter(ibp, ppd, IB_PMA_PORT_XMIT_PKTS);
1283 get_counter(ibp, ppd, IB_PMA_PORT_RCV_PKTS);
1285 get_counter(ibp, ppd, IB_PMA_PORT_XMIT_WAIT);
1323 struct qib_ibport *ibp = to_iport(ibdev, port);
1324 struct qib_pportdata *ppd = ppd_from_ibp(ibp);
1330 spin_lock_irqsave(&ibp->lock, flags);
1331 p->tag = cpu_to_be16(ibp->pma_tag);
1346 for (i = 0; i < ARRAY_SIZE(ibp->pma_counter_select); i++)
1349 ppd, ibp->pma_counter_select[i]));
1350 spin_unlock_irqrestore(&ibp->lock, flags);
1362 struct qib_ibport *ibp = to_iport(ibdev, port);
1363 struct qib_pportdata *ppd = ppd_from_ibp(ibp);
1370 spin_lock_irqsave(&ibp->lock, flags);
1371 p->tag = cpu_to_be16(ibp->pma_tag);
1388 for (i = 0; i < ARRAY_SIZE(ibp->pma_counter_select); i++)
1391 ppd, ibp->pma_counter_select[i]));
1392 spin_unlock_irqrestore(&ibp->lock, flags);
1402 struct qib_ibport *ibp = to_iport(ibdev, port);
1403 struct qib_pportdata *ppd = ppd_from_ibp(ibp);
1410 cntrs.symbol_error_counter -= ibp->z_symbol_error_counter;
1412 ibp->z_link_error_recovery_counter;
1413 cntrs.link_downed_counter -= ibp->z_link_downed_counter;
1414 cntrs.port_rcv_errors -= ibp->z_port_rcv_errors;
1415 cntrs.port_rcv_remphys_errors -= ibp->z_port_rcv_remphys_errors;
1416 cntrs.port_xmit_discards -= ibp->z_port_xmit_discards;
1417 cntrs.port_xmit_data -= ibp->z_port_xmit_data;
1418 cntrs.port_rcv_data -= ibp->z_port_rcv_data;
1419 cntrs.port_xmit_packets -= ibp->z_port_xmit_packets;
1420 cntrs.port_rcv_packets -= ibp->z_port_rcv_packets;
1422 ibp->z_local_link_integrity_errors;
1424 ibp->z_excessive_buffer_overrun_errors;
1425 cntrs.vl15_dropped -= ibp->z_vl15_dropped;
1426 cntrs.vl15_dropped += ibp->n_vl15_dropped;
1502 struct qib_ibport *ibp = to_iport(ibdev, port);
1503 struct qib_pportdata *ppd = ppd_from_ibp(ibp);
1524 cntrs.symbol_error_counter -= ibp->z_symbol_error_counter;
1526 ibp->z_link_error_recovery_counter;
1527 cntrs.link_downed_counter -= ibp->z_link_downed_counter;
1528 cntrs.port_rcv_errors -= ibp->z_port_rcv_errors;
1530 ibp->z_port_rcv_remphys_errors;
1531 cntrs.port_xmit_discards -= ibp->z_port_xmit_discards;
1533 ibp->z_local_link_integrity_errors;
1535 ibp->z_excessive_buffer_overrun_errors;
1536 cntrs.vl15_dropped -= ibp->z_vl15_dropped;
1537 cntrs.vl15_dropped += ibp->n_vl15_dropped;
1538 cntrs.port_xmit_data -= ibp->z_port_xmit_data;
1539 cntrs.port_rcv_data -= ibp->z_port_rcv_data;
1540 cntrs.port_xmit_packets -= ibp->z_port_xmit_packets;
1541 cntrs.port_rcv_packets -= ibp->z_port_rcv_packets;
1613 struct qib_ibport *ibp = to_iport(ibdev, port);
1614 struct qib_pportdata *ppd = ppd_from_ibp(ibp);
1629 swords -= ibp->z_port_xmit_data;
1630 rwords -= ibp->z_port_rcv_data;
1631 spkts -= ibp->z_port_xmit_packets;
1632 rpkts -= ibp->z_port_rcv_packets;
1638 p->port_unicast_xmit_packets = cpu_to_be64(ibp->n_unicast_xmit);
1639 p->port_unicast_rcv_packets = cpu_to_be64(ibp->n_unicast_rcv);
1640 p->port_multicast_xmit_packets = cpu_to_be64(ibp->n_multicast_xmit);
1641 p->port_multicast_rcv_packets = cpu_to_be64(ibp->n_multicast_rcv);
1652 struct qib_ibport *ibp = to_iport(ibdev, port);
1653 struct qib_pportdata *ppd = ppd_from_ibp(ibp);
1663 ibp->z_symbol_error_counter = cntrs.symbol_error_counter;
1666 ibp->z_link_error_recovery_counter =
1670 ibp->z_link_downed_counter = cntrs.link_downed_counter;
1673 ibp->z_port_rcv_errors = cntrs.port_rcv_errors;
1676 ibp->z_port_rcv_remphys_errors =
1680 ibp->z_port_xmit_discards = cntrs.port_xmit_discards;
1683 ibp->z_local_link_integrity_errors =
1687 ibp->z_excessive_buffer_overrun_errors =
1691 ibp->n_vl15_dropped = 0;
1692 ibp->z_vl15_dropped = cntrs.vl15_dropped;
1696 ibp->z_port_xmit_data = cntrs.port_xmit_data;
1699 ibp->z_port_rcv_data = cntrs.port_rcv_data;
1702 ibp->z_port_xmit_packets = cntrs.port_xmit_packets;
1705 ibp->z_port_rcv_packets = cntrs.port_rcv_packets;
1713 struct qib_ibport *ibp = to_iport(ibdev, port);
1714 struct qib_pportdata *ppd = ppd_from_ibp(ibp);
1733 ibp->z_port_xmit_data = cntrs.port_xmit_data;
1734 ibp->z_port_rcv_data = cntrs.port_rcv_data;
1735 ibp->z_port_xmit_packets = cntrs.port_xmit_packets;
1736 ibp->z_port_rcv_packets = cntrs.port_rcv_packets;
1739 ibp->z_symbol_error_counter =
1741 ibp->z_link_error_recovery_counter =
1743 ibp->z_link_downed_counter =
1745 ibp->z_port_rcv_errors = cntrs.port_rcv_errors;
1746 ibp->z_port_rcv_remphys_errors =
1748 ibp->z_port_xmit_discards =
1750 ibp->z_local_link_integrity_errors =
1752 ibp->z_excessive_buffer_overrun_errors =
1754 ibp->n_vl15_dropped = 0;
1755 ibp->z_vl15_dropped = cntrs.vl15_dropped;
1766 struct qib_ibport *ibp = to_iport(ibdev, port);
1767 struct qib_pportdata *ppd = ppd_from_ibp(ibp);
1773 ibp->z_port_xmit_data = swords;
1776 ibp->z_port_rcv_data = rwords;
1779 ibp->z_port_xmit_packets = spkts;
1782 ibp->z_port_rcv_packets = rpkts;
1785 ibp->n_unicast_xmit = 0;
1788 ibp->n_unicast_rcv = 0;
1791 ibp->n_multicast_xmit = 0;
1794 ibp->n_multicast_rcv = 0;
1804 struct qib_ibport *ibp = to_iport(ibdev, port);
1805 struct qib_pportdata *ppd = ppd_from_ibp(ibp);
1815 ret = check_mkey(ibp, smp, mad_flags);
1860 if (ibp->port_cap_flags & IB_PORT_SM_DISABLED) {
1865 if (ibp->port_cap_flags & IB_PORT_SM) {
1894 if (ibp->port_cap_flags & IB_PORT_SM_DISABLED) {
1899 if (ibp->port_cap_flags & IB_PORT_SM) {
2110 struct qib_ibport *ibp;
2115 ibp = &dd->pport[p].ibport_data;
2133 ibp->send_agent = agent;
2140 ibp = &dd->pport[p].ibport_data;
2141 if (ibp->send_agent) {
2142 agent = ibp->send_agent;
2143 ibp->send_agent = NULL;
2155 struct qib_ibport *ibp;
2159 ibp = &dd->pport[p].ibport_data;
2160 if (ibp->send_agent) {
2161 agent = ibp->send_agent;
2162 ibp->send_agent = NULL;
2165 if (ibp->sm_ah) {
2166 ib_destroy_ah(&ibp->sm_ah->ibah);
2167 ibp->sm_ah = NULL;