Lines Matching refs:ppd

326 		struct qib_pportdata *ppd = dd->pport + pidx;  in subn_get_guidinfo()  local
327 struct qib_ibport *ibp = &ppd->ibport_data; in subn_get_guidinfo()
328 __be64 g = ppd->guid; in subn_get_guidinfo()
346 static void set_link_width_enabled(struct qib_pportdata *ppd, u32 w) in set_link_width_enabled() argument
348 (void) ppd->dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LWID_ENB, w); in set_link_width_enabled()
351 static void set_link_speed_enabled(struct qib_pportdata *ppd, u32 s) in set_link_speed_enabled() argument
353 (void) ppd->dd->f_set_ib_cfg(ppd, QIB_IB_CFG_SPD_ENB, s); in set_link_speed_enabled()
356 static int get_overrunthreshold(struct qib_pportdata *ppd) in get_overrunthreshold() argument
358 return ppd->dd->f_get_ib_cfg(ppd, QIB_IB_CFG_OVERRUN_THRESH); in get_overrunthreshold()
368 static int set_overrunthreshold(struct qib_pportdata *ppd, unsigned n) in set_overrunthreshold() argument
370 (void) ppd->dd->f_set_ib_cfg(ppd, QIB_IB_CFG_OVERRUN_THRESH, in set_overrunthreshold()
375 static int get_phyerrthreshold(struct qib_pportdata *ppd) in get_phyerrthreshold() argument
377 return ppd->dd->f_get_ib_cfg(ppd, QIB_IB_CFG_PHYERR_THRESH); in get_phyerrthreshold()
387 static int set_phyerrthreshold(struct qib_pportdata *ppd, unsigned n) in set_phyerrthreshold() argument
389 (void) ppd->dd->f_set_ib_cfg(ppd, QIB_IB_CFG_PHYERR_THRESH, in set_phyerrthreshold()
400 static int get_linkdowndefaultstate(struct qib_pportdata *ppd) in get_linkdowndefaultstate() argument
402 return ppd->dd->f_get_ib_cfg(ppd, QIB_IB_CFG_LINKDEFAULT) == in get_linkdowndefaultstate()
458 struct qib_pportdata *ppd; in subn_get_portinfo() local
486 ppd = dd->pport + (port_num - 1); in subn_get_portinfo()
487 ibp = &ppd->ibport_data; in subn_get_portinfo()
498 pip->lid = cpu_to_be16(ppd->lid); in subn_get_portinfo()
504 pip->link_width_enabled = ppd->link_width_enabled; in subn_get_portinfo()
505 pip->link_width_supported = ppd->link_width_supported; in subn_get_portinfo()
506 pip->link_width_active = ppd->link_width_active; in subn_get_portinfo()
507 state = dd->f_iblink_state(ppd->lastibcstat); in subn_get_portinfo()
508 pip->linkspeed_portstate = ppd->link_speed_supported << 4 | state; in subn_get_portinfo()
511 (dd->f_ibphys_portstate(ppd->lastibcstat) << 4) | in subn_get_portinfo()
512 (get_linkdowndefaultstate(ppd) ? 1 : 2); in subn_get_portinfo()
513 pip->mkeyprot_resv_lmc = (ibp->rvp.mkeyprot << 6) | ppd->lmc; in subn_get_portinfo()
514 pip->linkspeedactive_enabled = (ppd->link_speed_active << 4) | in subn_get_portinfo()
515 ppd->link_speed_enabled; in subn_get_portinfo()
516 switch (ppd->ibmtu) { in subn_get_portinfo()
535 pip->vlcap_inittype = ppd->vls_supported << 4; /* InitType = 0 */ in subn_get_portinfo()
538 dd->f_get_ib_cfg(ppd, QIB_IB_CFG_VL_HIGH_CAP); in subn_get_portinfo()
540 dd->f_get_ib_cfg(ppd, QIB_IB_CFG_VL_LOW_CAP); in subn_get_portinfo()
546 dd->f_get_ib_cfg(ppd, QIB_IB_CFG_OP_VLS) << 4; in subn_get_portinfo()
557 (get_phyerrthreshold(ppd) << 4) | in subn_get_portinfo()
558 get_overrunthreshold(ppd); in subn_get_portinfo()
563 v = dd->f_get_ib_cfg(ppd, QIB_IB_CFG_LINKLATENCY); in subn_get_portinfo()
583 struct qib_pportdata *ppd = dd->pport + port - 1; in get_pkeys() local
589 struct qib_ctxtdata *rcd = dd->rcd[ppd->hw_pidx]; in get_pkeys()
631 struct qib_pportdata *ppd = dd->pport + pidx; in subn_set_guidinfo() local
632 struct qib_ibport *ibp = &ppd->ibport_data; in subn_set_guidinfo()
659 struct qib_pportdata *ppd; in subn_set_portinfo() local
685 ppd = dd->pport + (port_num - 1); in subn_set_portinfo()
686 ibp = &ppd->ibport_data; in subn_set_portinfo()
698 else if (ppd->lid != lid || ppd->lmc != (pip->mkeyprot_resv_lmc & 7)) { in subn_set_portinfo()
699 if (ppd->lid != lid) in subn_set_portinfo()
700 qib_set_uevent_bits(ppd, _QIB_EVENT_LID_CHANGE_BIT); in subn_set_portinfo()
701 if (ppd->lmc != (pip->mkeyprot_resv_lmc & 7)) in subn_set_portinfo()
702 qib_set_uevent_bits(ppd, _QIB_EVENT_LMC_CHANGE_BIT); in subn_set_portinfo()
703 qib_set_lid(ppd, lid, pip->mkeyprot_resv_lmc & 7); in subn_set_portinfo()
735 set_link_width_enabled(ppd, ppd->link_width_supported); in subn_set_portinfo()
736 else if (lwe >= 16 || (lwe & ~ppd->link_width_supported)) in subn_set_portinfo()
738 else if (lwe != ppd->link_width_enabled) in subn_set_portinfo()
739 set_link_width_enabled(ppd, lwe); in subn_set_portinfo()
750 set_link_speed_enabled(ppd, in subn_set_portinfo()
751 ppd->link_speed_supported); in subn_set_portinfo()
752 else if (lse >= 8 || (lse & ~ppd->link_speed_supported)) in subn_set_portinfo()
754 else if (lse != ppd->link_speed_enabled) in subn_set_portinfo()
755 set_link_speed_enabled(ppd, lse); in subn_set_portinfo()
763 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LINKDEFAULT, in subn_set_portinfo()
767 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LINKDEFAULT, in subn_set_portinfo()
776 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_VL_HIGH_LIMIT, in subn_set_portinfo()
783 qib_set_mtu(ppd, mtu); in subn_set_portinfo()
788 if (vls > ppd->vls_supported) in subn_set_portinfo()
791 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_OP_VLS, vls); in subn_set_portinfo()
804 if (set_phyerrthreshold(ppd, (ore >> 4) & 0xF)) in subn_set_portinfo()
807 if (set_overrunthreshold(ppd, (ore & 0xF))) in subn_set_portinfo()
845 spin_lock_irqsave(&ppd->lflags_lock, flags); in subn_set_portinfo()
846 ppd->lflags &= ~QIBL_LINKV; in subn_set_portinfo()
847 spin_unlock_irqrestore(&ppd->lflags_lock, flags); in subn_set_portinfo()
848 qib_set_linkstate(ppd, lstate); in subn_set_portinfo()
857 qib_wait_linkstate(ppd, QIBL_LINKV, 10); in subn_set_portinfo()
860 qib_set_linkstate(ppd, QIB_IB_LINKARM); in subn_set_portinfo()
863 qib_set_linkstate(ppd, QIB_IB_LINKACTIVE); in subn_set_portinfo()
895 static int rm_pkey(struct qib_pportdata *ppd, u16 key) in rm_pkey() argument
900 for (i = 0; i < ARRAY_SIZE(ppd->pkeys); i++) { in rm_pkey()
901 if (ppd->pkeys[i] != key) in rm_pkey()
903 if (atomic_dec_and_test(&ppd->pkeyrefs[i])) { in rm_pkey()
904 ppd->pkeys[i] = 0; in rm_pkey()
925 static int add_pkey(struct qib_pportdata *ppd, u16 key) in add_pkey() argument
938 for (i = 0; i < ARRAY_SIZE(ppd->pkeys); i++) { in add_pkey()
939 if (!ppd->pkeys[i]) { in add_pkey()
944 if (ppd->pkeys[i] == key) { in add_pkey()
945 if (atomic_inc_return(&ppd->pkeyrefs[i]) > 1) { in add_pkey()
950 atomic_dec(&ppd->pkeyrefs[i]); in add_pkey()
958 if ((ppd->pkeys[i] & 0x7FFF) == lkey) { in add_pkey()
967 for (i = 0; i < ARRAY_SIZE(ppd->pkeys); i++) { in add_pkey()
968 if (!ppd->pkeys[i] && in add_pkey()
969 atomic_inc_return(&ppd->pkeyrefs[i]) == 1) { in add_pkey()
971 ppd->pkeys[i] = key; in add_pkey()
990 struct qib_pportdata *ppd; in set_pkeys() local
1001 ppd = dd->pport + (port - 1); in set_pkeys()
1002 rcd = dd->rcd[ppd->hw_pidx]; in set_pkeys()
1015 changed |= rm_pkey(ppd, okey); in set_pkeys()
1017 int ret = add_pkey(ppd, key); in set_pkeys()
1029 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_PKEYS, 0); in set_pkeys()
1101 struct qib_pportdata *ppd = ppd_from_ibp(to_iport(ibdev, port)); in subn_get_vl_arb() local
1105 if (ppd->vls_supported == IB_VL_VL0) in subn_get_vl_arb()
1108 (void) ppd->dd->f_get_ib_table(ppd, QIB_IB_TBL_VL_LOW_ARB, in subn_get_vl_arb()
1111 (void) ppd->dd->f_get_ib_table(ppd, QIB_IB_TBL_VL_HIGH_ARB, in subn_get_vl_arb()
1123 struct qib_pportdata *ppd = ppd_from_ibp(to_iport(ibdev, port)); in subn_set_vl_arb() local
1125 if (ppd->vls_supported == IB_VL_VL0) in subn_set_vl_arb()
1128 (void) ppd->dd->f_set_ib_table(ppd, QIB_IB_TBL_VL_LOW_ARB, in subn_set_vl_arb()
1131 (void) ppd->dd->f_set_ib_table(ppd, QIB_IB_TBL_VL_HIGH_ARB, in subn_set_vl_arb()
1190 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portsamplescontrol() local
1202 p->tick = dd->f_get_ib_cfg(ppd, QIB_IB_CFG_PMA_TICKS); in pma_get_portsamplescontrol()
1203 p->sample_status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in pma_get_portsamplescontrol()
1228 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_set_portsamplescontrol() local
1242 xmit_flags = ppd->cong_stats.flags; in pma_set_portsamplescontrol()
1243 ppd->cong_stats.flags = IB_PMA_CONG_HW_CONTROL_SAMPLE; in pma_set_portsamplescontrol()
1244 status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in pma_set_portsamplescontrol()
1256 dd->f_set_cntr_sample(ppd, ibp->rvp.pma_sample_interval, in pma_set_portsamplescontrol()
1267 static u64 get_counter(struct qib_ibport *ibp, struct qib_pportdata *ppd, in get_counter() argument
1274 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSXMITDATA); in get_counter()
1277 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSRCVDATA); in get_counter()
1280 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSXMITPKTS); in get_counter()
1283 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSRCVPKTS); in get_counter()
1286 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSXMITWAIT); in get_counter()
1296 static u64 xmit_wait_get_value_delta(struct qib_pportdata *ppd) in xmit_wait_get_value_delta() argument
1300 delta = get_counter(&ppd->ibport_data, ppd, in xmit_wait_get_value_delta()
1302 return ppd->cong_stats.counter + delta; in xmit_wait_get_value_delta()
1305 static void cache_hw_sample_counters(struct qib_pportdata *ppd) in cache_hw_sample_counters() argument
1307 struct qib_ibport *ibp = &ppd->ibport_data; in cache_hw_sample_counters()
1309 ppd->cong_stats.counter_cache.psxmitdata = in cache_hw_sample_counters()
1310 get_counter(ibp, ppd, IB_PMA_PORT_XMIT_DATA); in cache_hw_sample_counters()
1311 ppd->cong_stats.counter_cache.psrcvdata = in cache_hw_sample_counters()
1312 get_counter(ibp, ppd, IB_PMA_PORT_RCV_DATA); in cache_hw_sample_counters()
1313 ppd->cong_stats.counter_cache.psxmitpkts = in cache_hw_sample_counters()
1314 get_counter(ibp, ppd, IB_PMA_PORT_XMIT_PKTS); in cache_hw_sample_counters()
1315 ppd->cong_stats.counter_cache.psrcvpkts = in cache_hw_sample_counters()
1316 get_counter(ibp, ppd, IB_PMA_PORT_RCV_PKTS); in cache_hw_sample_counters()
1317 ppd->cong_stats.counter_cache.psxmitwait = in cache_hw_sample_counters()
1318 get_counter(ibp, ppd, IB_PMA_PORT_XMIT_WAIT); in cache_hw_sample_counters()
1321 static u64 get_cache_hw_sample_counters(struct qib_pportdata *ppd, in get_cache_hw_sample_counters() argument
1328 ret = ppd->cong_stats.counter_cache.psxmitdata; in get_cache_hw_sample_counters()
1331 ret = ppd->cong_stats.counter_cache.psrcvdata; in get_cache_hw_sample_counters()
1334 ret = ppd->cong_stats.counter_cache.psxmitpkts; in get_cache_hw_sample_counters()
1337 ret = ppd->cong_stats.counter_cache.psrcvpkts; in get_cache_hw_sample_counters()
1340 ret = ppd->cong_stats.counter_cache.psxmitwait; in get_cache_hw_sample_counters()
1357 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portsamplesresult() local
1365 if (ppd->cong_stats.flags == IB_PMA_CONG_HW_CONTROL_TIMER) in pma_get_portsamplesresult()
1368 status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in pma_get_portsamplesresult()
1371 cache_hw_sample_counters(ppd); in pma_get_portsamplesresult()
1372 ppd->cong_stats.counter = in pma_get_portsamplesresult()
1373 xmit_wait_get_value_delta(ppd); in pma_get_portsamplesresult()
1374 dd->f_set_cntr_sample(ppd, in pma_get_portsamplesresult()
1376 ppd->cong_stats.flags = IB_PMA_CONG_HW_CONTROL_TIMER; in pma_get_portsamplesresult()
1382 ppd, ibp->rvp.pma_counter_select[i])); in pma_get_portsamplesresult()
1396 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portsamplesresult_ext() local
1405 if (ppd->cong_stats.flags == IB_PMA_CONG_HW_CONTROL_TIMER) in pma_get_portsamplesresult_ext()
1408 status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in pma_get_portsamplesresult_ext()
1413 cache_hw_sample_counters(ppd); in pma_get_portsamplesresult_ext()
1414 ppd->cong_stats.counter = in pma_get_portsamplesresult_ext()
1415 xmit_wait_get_value_delta(ppd); in pma_get_portsamplesresult_ext()
1416 dd->f_set_cntr_sample(ppd, in pma_get_portsamplesresult_ext()
1418 ppd->cong_stats.flags = IB_PMA_CONG_HW_CONTROL_TIMER; in pma_get_portsamplesresult_ext()
1424 ppd, ibp->rvp.pma_counter_select[i])); in pma_get_portsamplesresult_ext()
1436 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portcounters() local
1440 qib_get_counters(ppd, &cntrs); in pma_get_portcounters()
1536 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portcounters_cong() local
1537 struct qib_devdata *dd = dd_from_ppd(ppd); in pma_get_portcounters_cong()
1551 qib_get_counters(ppd, &cntrs); in pma_get_portcounters_cong()
1552 spin_lock_irqsave(&ppd->ibport_data.rvp.lock, flags); in pma_get_portcounters_cong()
1553 xmit_wait_counter = xmit_wait_get_value_delta(ppd); in pma_get_portcounters_cong()
1554 spin_unlock_irqrestore(&ppd->ibport_data.rvp.lock, flags); in pma_get_portcounters_cong()
1664 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portcounters_ext() local
1677 qib_snapshot_counters(ppd, &swords, &rwords, &spkts, &rpkts, &xwait); in pma_get_portcounters_ext()
1711 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_set_portcounters() local
1718 qib_get_counters(ppd, &cntrs); in pma_set_portcounters()
1772 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_set_portcounters_cong() local
1773 struct qib_devdata *dd = dd_from_ppd(ppd); in pma_set_portcounters_cong()
1779 qib_get_counters(ppd, &cntrs); in pma_set_portcounters_cong()
1784 spin_lock_irqsave(&ppd->ibport_data.rvp.lock, flags); in pma_set_portcounters_cong()
1785 ppd->cong_stats.counter = 0; in pma_set_portcounters_cong()
1786 dd->f_set_cntr_sample(ppd, QIB_CONG_TIMER_PSINTERVAL, in pma_set_portcounters_cong()
1788 spin_unlock_irqrestore(&ppd->ibport_data.rvp.lock, flags); in pma_set_portcounters_cong()
1825 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_set_portcounters_ext() local
1829 qib_snapshot_counters(ppd, &swords, &rwords, &spkts, &rpkts, &xwait); in pma_set_portcounters_ext()
1866 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in process_subn() local
1996 ppd->dd->f_set_ib_cfg(ppd, QIB_IB_CFG_PORT, in process_subn()
2119 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_get_congestion_info() local
2122 p->control_table_cap = ppd->cc_max_table_entries; in cc_get_congestion_info()
2134 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_get_congestion_setting() local
2137 spin_lock(&ppd->cc_shadow_lock); in cc_get_congestion_setting()
2139 entries = ppd->congestion_entries_shadow->entries; in cc_get_congestion_setting()
2141 ppd->congestion_entries_shadow->port_control); in cc_get_congestion_setting()
2143 ppd->congestion_entries_shadow->control_map); in cc_get_congestion_setting()
2151 spin_unlock(&ppd->cc_shadow_lock); in cc_get_congestion_setting()
2162 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_get_congestion_control_table() local
2173 spin_lock(&ppd->cc_shadow_lock); in cc_get_congestion_control_table()
2176 (ppd->ccti_entries_shadow->ccti_last_entry + 1)/IB_CCT_ENTRIES; in cc_get_congestion_control_table()
2180 spin_unlock(&ppd->cc_shadow_lock); in cc_get_congestion_control_table()
2192 entries = &ppd->ccti_entries_shadow-> in cc_get_congestion_control_table()
2199 spin_unlock(&ppd->cc_shadow_lock); in cc_get_congestion_control_table()
2213 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_set_congestion_setting() local
2216 ppd->cc_sl_control_map = be16_to_cpu(p->control_map); in cc_set_congestion_setting()
2219 ppd->congestion_entries[i].ccti_increase = in cc_set_congestion_setting()
2222 ppd->congestion_entries[i].ccti_timer = in cc_set_congestion_setting()
2225 ppd->congestion_entries[i].trigger_threshold = in cc_set_congestion_setting()
2228 ppd->congestion_entries[i].ccti_min = in cc_set_congestion_setting()
2241 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_set_congestion_control_table() local
2255 ppd->total_cct_entry = 0; in cc_set_congestion_control_table()
2260 ppd->total_cct_entry += (cct_entry + 1); in cc_set_congestion_control_table()
2262 if (ppd->total_cct_entry > ppd->cc_supported_table_entries) in cc_set_congestion_control_table()
2265 ppd->ccti_limit = be16_to_cpu(p->ccti_limit); in cc_set_congestion_control_table()
2267 entries = ppd->ccti_entries + (IB_CCT_ENTRIES * cct_block_index); in cc_set_congestion_control_table()
2272 spin_lock(&ppd->cc_shadow_lock); in cc_set_congestion_control_table()
2274 ppd->ccti_entries_shadow->ccti_last_entry = ppd->total_cct_entry - 1; in cc_set_congestion_control_table()
2275 memcpy(ppd->ccti_entries_shadow->entries, ppd->ccti_entries, in cc_set_congestion_control_table()
2276 (ppd->total_cct_entry * sizeof(struct ib_cc_table_entry))); in cc_set_congestion_control_table()
2278 ppd->congestion_entries_shadow->port_control = IB_CC_CCS_PC_SL_BASED; in cc_set_congestion_control_table()
2279 ppd->congestion_entries_shadow->control_map = ppd->cc_sl_control_map; in cc_set_congestion_control_table()
2280 memcpy(ppd->congestion_entries_shadow->entries, ppd->congestion_entries, in cc_set_congestion_control_table()
2283 spin_unlock(&ppd->cc_shadow_lock); in cc_set_congestion_control_table()
2370 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in qib_process_mad() local
2383 if (!ppd->congestion_entries_shadow || in qib_process_mad()
2401 struct qib_pportdata *ppd = from_timer(ppd, t, cong_stats.timer); in xmit_wait_timer_func() local
2402 struct qib_devdata *dd = dd_from_ppd(ppd); in xmit_wait_timer_func()
2406 spin_lock_irqsave(&ppd->ibport_data.rvp.lock, flags); in xmit_wait_timer_func()
2407 if (ppd->cong_stats.flags == IB_PMA_CONG_HW_CONTROL_SAMPLE) { in xmit_wait_timer_func()
2408 status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in xmit_wait_timer_func()
2411 cache_hw_sample_counters(ppd); in xmit_wait_timer_func()
2412 ppd->cong_stats.flags = IB_PMA_CONG_HW_CONTROL_TIMER; in xmit_wait_timer_func()
2416 ppd->cong_stats.counter = xmit_wait_get_value_delta(ppd); in xmit_wait_timer_func()
2417 dd->f_set_cntr_sample(ppd, QIB_CONG_TIMER_PSINTERVAL, 0x0); in xmit_wait_timer_func()
2419 spin_unlock_irqrestore(&ppd->ibport_data.rvp.lock, flags); in xmit_wait_timer_func()
2420 mod_timer(&ppd->cong_stats.timer, jiffies + HZ); in xmit_wait_timer_func()