Lines Matching refs:ppd
325 struct qib_pportdata *ppd = dd->pport + pidx; in subn_get_guidinfo() local
326 struct qib_ibport *ibp = &ppd->ibport_data; in subn_get_guidinfo()
327 __be64 g = ppd->guid; in subn_get_guidinfo()
345 static void set_link_width_enabled(struct qib_pportdata *ppd, u32 w) in set_link_width_enabled() argument
347 (void) ppd->dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LWID_ENB, w); in set_link_width_enabled()
350 static void set_link_speed_enabled(struct qib_pportdata *ppd, u32 s) in set_link_speed_enabled() argument
352 (void) ppd->dd->f_set_ib_cfg(ppd, QIB_IB_CFG_SPD_ENB, s); in set_link_speed_enabled()
355 static int get_overrunthreshold(struct qib_pportdata *ppd) in get_overrunthreshold() argument
357 return ppd->dd->f_get_ib_cfg(ppd, QIB_IB_CFG_OVERRUN_THRESH); in get_overrunthreshold()
367 static int set_overrunthreshold(struct qib_pportdata *ppd, unsigned n) in set_overrunthreshold() argument
369 (void) ppd->dd->f_set_ib_cfg(ppd, QIB_IB_CFG_OVERRUN_THRESH, in set_overrunthreshold()
374 static int get_phyerrthreshold(struct qib_pportdata *ppd) in get_phyerrthreshold() argument
376 return ppd->dd->f_get_ib_cfg(ppd, QIB_IB_CFG_PHYERR_THRESH); in get_phyerrthreshold()
386 static int set_phyerrthreshold(struct qib_pportdata *ppd, unsigned n) in set_phyerrthreshold() argument
388 (void) ppd->dd->f_set_ib_cfg(ppd, QIB_IB_CFG_PHYERR_THRESH, in set_phyerrthreshold()
399 static int get_linkdowndefaultstate(struct qib_pportdata *ppd) in get_linkdowndefaultstate() argument
401 return ppd->dd->f_get_ib_cfg(ppd, QIB_IB_CFG_LINKDEFAULT) == in get_linkdowndefaultstate()
455 struct qib_pportdata *ppd; in subn_get_portinfo() local
483 ppd = dd->pport + (port_num - 1); in subn_get_portinfo()
484 ibp = &ppd->ibport_data; in subn_get_portinfo()
495 pip->lid = cpu_to_be16(ppd->lid); in subn_get_portinfo()
501 pip->link_width_enabled = ppd->link_width_enabled; in subn_get_portinfo()
502 pip->link_width_supported = ppd->link_width_supported; in subn_get_portinfo()
503 pip->link_width_active = ppd->link_width_active; in subn_get_portinfo()
504 state = dd->f_iblink_state(ppd->lastibcstat); in subn_get_portinfo()
505 pip->linkspeed_portstate = ppd->link_speed_supported << 4 | state; in subn_get_portinfo()
508 (dd->f_ibphys_portstate(ppd->lastibcstat) << 4) | in subn_get_portinfo()
509 (get_linkdowndefaultstate(ppd) ? 1 : 2); in subn_get_portinfo()
510 pip->mkeyprot_resv_lmc = (ibp->mkeyprot << 6) | ppd->lmc; in subn_get_portinfo()
511 pip->linkspeedactive_enabled = (ppd->link_speed_active << 4) | in subn_get_portinfo()
512 ppd->link_speed_enabled; in subn_get_portinfo()
513 switch (ppd->ibmtu) { in subn_get_portinfo()
532 pip->vlcap_inittype = ppd->vls_supported << 4; /* InitType = 0 */ in subn_get_portinfo()
535 dd->f_get_ib_cfg(ppd, QIB_IB_CFG_VL_HIGH_CAP); in subn_get_portinfo()
537 dd->f_get_ib_cfg(ppd, QIB_IB_CFG_VL_LOW_CAP); in subn_get_portinfo()
543 dd->f_get_ib_cfg(ppd, QIB_IB_CFG_OP_VLS) << 4; in subn_get_portinfo()
554 (get_phyerrthreshold(ppd) << 4) | in subn_get_portinfo()
555 get_overrunthreshold(ppd); in subn_get_portinfo()
560 v = dd->f_get_ib_cfg(ppd, QIB_IB_CFG_LINKLATENCY); in subn_get_portinfo()
580 struct qib_pportdata *ppd = dd->pport + port - 1; in get_pkeys() local
586 struct qib_ctxtdata *rcd = dd->rcd[ppd->hw_pidx]; in get_pkeys()
628 struct qib_pportdata *ppd = dd->pport + pidx; in subn_set_guidinfo() local
629 struct qib_ibport *ibp = &ppd->ibport_data; in subn_set_guidinfo()
656 struct qib_pportdata *ppd; in subn_set_portinfo() local
682 ppd = dd->pport + (port_num - 1); in subn_set_portinfo()
683 ibp = &ppd->ibport_data; in subn_set_portinfo()
695 else if (ppd->lid != lid || ppd->lmc != (pip->mkeyprot_resv_lmc & 7)) { in subn_set_portinfo()
696 if (ppd->lid != lid) in subn_set_portinfo()
697 qib_set_uevent_bits(ppd, _QIB_EVENT_LID_CHANGE_BIT); in subn_set_portinfo()
698 if (ppd->lmc != (pip->mkeyprot_resv_lmc & 7)) in subn_set_portinfo()
699 qib_set_uevent_bits(ppd, _QIB_EVENT_LMC_CHANGE_BIT); in subn_set_portinfo()
700 qib_set_lid(ppd, lid, pip->mkeyprot_resv_lmc & 7); in subn_set_portinfo()
731 set_link_width_enabled(ppd, ppd->link_width_supported); in subn_set_portinfo()
732 else if (lwe >= 16 || (lwe & ~ppd->link_width_supported)) in subn_set_portinfo()
734 else if (lwe != ppd->link_width_enabled) in subn_set_portinfo()
735 set_link_width_enabled(ppd, lwe); in subn_set_portinfo()
746 set_link_speed_enabled(ppd, in subn_set_portinfo()
747 ppd->link_speed_supported); in subn_set_portinfo()
748 else if (lse >= 8 || (lse & ~ppd->link_speed_supported)) in subn_set_portinfo()
750 else if (lse != ppd->link_speed_enabled) in subn_set_portinfo()
751 set_link_speed_enabled(ppd, lse); in subn_set_portinfo()
759 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LINKDEFAULT, in subn_set_portinfo()
763 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LINKDEFAULT, in subn_set_portinfo()
772 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_VL_HIGH_LIMIT, in subn_set_portinfo()
779 qib_set_mtu(ppd, mtu); in subn_set_portinfo()
784 if (vls > ppd->vls_supported) in subn_set_portinfo()
787 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_OP_VLS, vls); in subn_set_portinfo()
800 if (set_phyerrthreshold(ppd, (ore >> 4) & 0xF)) in subn_set_portinfo()
803 if (set_overrunthreshold(ppd, (ore & 0xF))) in subn_set_portinfo()
841 spin_lock_irqsave(&ppd->lflags_lock, flags); in subn_set_portinfo()
842 ppd->lflags &= ~QIBL_LINKV; in subn_set_portinfo()
843 spin_unlock_irqrestore(&ppd->lflags_lock, flags); in subn_set_portinfo()
844 qib_set_linkstate(ppd, lstate); in subn_set_portinfo()
853 qib_wait_linkstate(ppd, QIBL_LINKV, 10); in subn_set_portinfo()
856 qib_set_linkstate(ppd, QIB_IB_LINKARM); in subn_set_portinfo()
859 qib_set_linkstate(ppd, QIB_IB_LINKACTIVE); in subn_set_portinfo()
893 static int rm_pkey(struct qib_pportdata *ppd, u16 key) in rm_pkey() argument
898 for (i = 0; i < ARRAY_SIZE(ppd->pkeys); i++) { in rm_pkey()
899 if (ppd->pkeys[i] != key) in rm_pkey()
901 if (atomic_dec_and_test(&ppd->pkeyrefs[i])) { in rm_pkey()
902 ppd->pkeys[i] = 0; in rm_pkey()
923 static int add_pkey(struct qib_pportdata *ppd, u16 key) in add_pkey() argument
936 for (i = 0; i < ARRAY_SIZE(ppd->pkeys); i++) { in add_pkey()
937 if (!ppd->pkeys[i]) { in add_pkey()
942 if (ppd->pkeys[i] == key) { in add_pkey()
943 if (atomic_inc_return(&ppd->pkeyrefs[i]) > 1) { in add_pkey()
948 atomic_dec(&ppd->pkeyrefs[i]); in add_pkey()
956 if ((ppd->pkeys[i] & 0x7FFF) == lkey) { in add_pkey()
965 for (i = 0; i < ARRAY_SIZE(ppd->pkeys); i++) { in add_pkey()
966 if (!ppd->pkeys[i] && in add_pkey()
967 atomic_inc_return(&ppd->pkeyrefs[i]) == 1) { in add_pkey()
969 ppd->pkeys[i] = key; in add_pkey()
988 struct qib_pportdata *ppd; in set_pkeys() local
999 ppd = dd->pport + (port - 1); in set_pkeys()
1000 rcd = dd->rcd[ppd->hw_pidx]; in set_pkeys()
1013 changed |= rm_pkey(ppd, okey); in set_pkeys()
1015 int ret = add_pkey(ppd, key); in set_pkeys()
1027 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_PKEYS, 0); in set_pkeys()
1099 struct qib_pportdata *ppd = ppd_from_ibp(to_iport(ibdev, port)); in subn_get_vl_arb() local
1103 if (ppd->vls_supported == IB_VL_VL0) in subn_get_vl_arb()
1106 (void) ppd->dd->f_get_ib_table(ppd, QIB_IB_TBL_VL_LOW_ARB, in subn_get_vl_arb()
1109 (void) ppd->dd->f_get_ib_table(ppd, QIB_IB_TBL_VL_HIGH_ARB, in subn_get_vl_arb()
1121 struct qib_pportdata *ppd = ppd_from_ibp(to_iport(ibdev, port)); in subn_set_vl_arb() local
1123 if (ppd->vls_supported == IB_VL_VL0) in subn_set_vl_arb()
1126 (void) ppd->dd->f_set_ib_table(ppd, QIB_IB_TBL_VL_LOW_ARB, in subn_set_vl_arb()
1129 (void) ppd->dd->f_set_ib_table(ppd, QIB_IB_TBL_VL_HIGH_ARB, in subn_set_vl_arb()
1186 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portsamplescontrol() local
1198 p->tick = dd->f_get_ib_cfg(ppd, QIB_IB_CFG_PMA_TICKS); in pma_get_portsamplescontrol()
1199 p->sample_status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in pma_get_portsamplescontrol()
1224 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_set_portsamplescontrol() local
1238 xmit_flags = ppd->cong_stats.flags; in pma_set_portsamplescontrol()
1239 ppd->cong_stats.flags = IB_PMA_CONG_HW_CONTROL_SAMPLE; in pma_set_portsamplescontrol()
1240 status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in pma_set_portsamplescontrol()
1252 dd->f_set_cntr_sample(ppd, ibp->pma_sample_interval, in pma_set_portsamplescontrol()
1263 static u64 get_counter(struct qib_ibport *ibp, struct qib_pportdata *ppd, in get_counter() argument
1270 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSXMITDATA); in get_counter()
1273 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSRCVDATA); in get_counter()
1276 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSXMITPKTS); in get_counter()
1279 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSRCVPKTS); in get_counter()
1282 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSXMITWAIT); in get_counter()
1292 static u64 xmit_wait_get_value_delta(struct qib_pportdata *ppd) in xmit_wait_get_value_delta() argument
1296 delta = get_counter(&ppd->ibport_data, ppd, in xmit_wait_get_value_delta()
1298 return ppd->cong_stats.counter + delta; in xmit_wait_get_value_delta()
1301 static void cache_hw_sample_counters(struct qib_pportdata *ppd) in cache_hw_sample_counters() argument
1303 struct qib_ibport *ibp = &ppd->ibport_data; in cache_hw_sample_counters()
1305 ppd->cong_stats.counter_cache.psxmitdata = in cache_hw_sample_counters()
1306 get_counter(ibp, ppd, IB_PMA_PORT_XMIT_DATA); in cache_hw_sample_counters()
1307 ppd->cong_stats.counter_cache.psrcvdata = in cache_hw_sample_counters()
1308 get_counter(ibp, ppd, IB_PMA_PORT_RCV_DATA); in cache_hw_sample_counters()
1309 ppd->cong_stats.counter_cache.psxmitpkts = in cache_hw_sample_counters()
1310 get_counter(ibp, ppd, IB_PMA_PORT_XMIT_PKTS); in cache_hw_sample_counters()
1311 ppd->cong_stats.counter_cache.psrcvpkts = in cache_hw_sample_counters()
1312 get_counter(ibp, ppd, IB_PMA_PORT_RCV_PKTS); in cache_hw_sample_counters()
1313 ppd->cong_stats.counter_cache.psxmitwait = in cache_hw_sample_counters()
1314 get_counter(ibp, ppd, IB_PMA_PORT_XMIT_WAIT); in cache_hw_sample_counters()
1317 static u64 get_cache_hw_sample_counters(struct qib_pportdata *ppd, in get_cache_hw_sample_counters() argument
1324 ret = ppd->cong_stats.counter_cache.psxmitdata; in get_cache_hw_sample_counters()
1327 ret = ppd->cong_stats.counter_cache.psrcvdata; in get_cache_hw_sample_counters()
1330 ret = ppd->cong_stats.counter_cache.psxmitpkts; in get_cache_hw_sample_counters()
1333 ret = ppd->cong_stats.counter_cache.psrcvpkts; in get_cache_hw_sample_counters()
1336 ret = ppd->cong_stats.counter_cache.psxmitwait; in get_cache_hw_sample_counters()
1353 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portsamplesresult() local
1361 if (ppd->cong_stats.flags == IB_PMA_CONG_HW_CONTROL_TIMER) in pma_get_portsamplesresult()
1364 status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in pma_get_portsamplesresult()
1367 cache_hw_sample_counters(ppd); in pma_get_portsamplesresult()
1368 ppd->cong_stats.counter = in pma_get_portsamplesresult()
1369 xmit_wait_get_value_delta(ppd); in pma_get_portsamplesresult()
1370 dd->f_set_cntr_sample(ppd, in pma_get_portsamplesresult()
1372 ppd->cong_stats.flags = IB_PMA_CONG_HW_CONTROL_TIMER; in pma_get_portsamplesresult()
1378 ppd, ibp->pma_counter_select[i])); in pma_get_portsamplesresult()
1392 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portsamplesresult_ext() local
1401 if (ppd->cong_stats.flags == IB_PMA_CONG_HW_CONTROL_TIMER) in pma_get_portsamplesresult_ext()
1404 status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in pma_get_portsamplesresult_ext()
1409 cache_hw_sample_counters(ppd); in pma_get_portsamplesresult_ext()
1410 ppd->cong_stats.counter = in pma_get_portsamplesresult_ext()
1411 xmit_wait_get_value_delta(ppd); in pma_get_portsamplesresult_ext()
1412 dd->f_set_cntr_sample(ppd, in pma_get_portsamplesresult_ext()
1414 ppd->cong_stats.flags = IB_PMA_CONG_HW_CONTROL_TIMER; in pma_get_portsamplesresult_ext()
1420 ppd, ibp->pma_counter_select[i])); in pma_get_portsamplesresult_ext()
1432 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portcounters() local
1436 qib_get_counters(ppd, &cntrs); in pma_get_portcounters()
1532 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portcounters_cong() local
1533 struct qib_devdata *dd = dd_from_ppd(ppd); in pma_get_portcounters_cong()
1547 qib_get_counters(ppd, &cntrs); in pma_get_portcounters_cong()
1548 spin_lock_irqsave(&ppd->ibport_data.lock, flags); in pma_get_portcounters_cong()
1549 xmit_wait_counter = xmit_wait_get_value_delta(ppd); in pma_get_portcounters_cong()
1550 spin_unlock_irqrestore(&ppd->ibport_data.lock, flags); in pma_get_portcounters_cong()
1660 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portcounters_ext() local
1673 qib_snapshot_counters(ppd, &swords, &rwords, &spkts, &rpkts, &xwait); in pma_get_portcounters_ext()
1707 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_set_portcounters() local
1714 qib_get_counters(ppd, &cntrs); in pma_set_portcounters()
1768 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_set_portcounters_cong() local
1769 struct qib_devdata *dd = dd_from_ppd(ppd); in pma_set_portcounters_cong()
1775 qib_get_counters(ppd, &cntrs); in pma_set_portcounters_cong()
1780 spin_lock_irqsave(&ppd->ibport_data.lock, flags); in pma_set_portcounters_cong()
1781 ppd->cong_stats.counter = 0; in pma_set_portcounters_cong()
1782 dd->f_set_cntr_sample(ppd, QIB_CONG_TIMER_PSINTERVAL, in pma_set_portcounters_cong()
1784 spin_unlock_irqrestore(&ppd->ibport_data.lock, flags); in pma_set_portcounters_cong()
1821 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_set_portcounters_ext() local
1825 qib_snapshot_counters(ppd, &swords, &rwords, &spkts, &rpkts, &xwait); in pma_set_portcounters_ext()
1862 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in process_subn() local
1992 ppd->dd->f_set_ib_cfg(ppd, QIB_IB_CFG_PORT, in process_subn()
2117 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
2139 spin_lock(&ppd->cc_shadow_lock); in cc_get_congestion_setting()
2141 entries = ppd->congestion_entries_shadow->entries; in cc_get_congestion_setting()
2143 ppd->congestion_entries_shadow->port_control); in cc_get_congestion_setting()
2145 ppd->congestion_entries_shadow->control_map); in cc_get_congestion_setting()
2153 spin_unlock(&ppd->cc_shadow_lock); in cc_get_congestion_setting()
2164 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_get_congestion_control_table() local
2177 spin_lock(&ppd->cc_shadow_lock); in cc_get_congestion_control_table()
2180 (ppd->ccti_entries_shadow->ccti_last_entry + 1)/IB_CCT_ENTRIES; in cc_get_congestion_control_table()
2184 spin_unlock(&ppd->cc_shadow_lock); in cc_get_congestion_control_table()
2196 entries = &ppd->ccti_entries_shadow-> in cc_get_congestion_control_table()
2203 spin_unlock(&ppd->cc_shadow_lock); in cc_get_congestion_control_table()
2217 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_set_congestion_setting() local
2220 ppd->cc_sl_control_map = be16_to_cpu(p->control_map); in cc_set_congestion_setting()
2223 ppd->congestion_entries[i].ccti_increase = in cc_set_congestion_setting()
2226 ppd->congestion_entries[i].ccti_timer = in cc_set_congestion_setting()
2229 ppd->congestion_entries[i].trigger_threshold = in cc_set_congestion_setting()
2232 ppd->congestion_entries[i].ccti_min = in cc_set_congestion_setting()
2245 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_set_congestion_control_table() local
2259 ppd->total_cct_entry = 0; in cc_set_congestion_control_table()
2264 ppd->total_cct_entry += (cct_entry + 1); in cc_set_congestion_control_table()
2266 if (ppd->total_cct_entry > ppd->cc_supported_table_entries) in cc_set_congestion_control_table()
2269 ppd->ccti_limit = be16_to_cpu(p->ccti_limit); in cc_set_congestion_control_table()
2271 entries = ppd->ccti_entries + (IB_CCT_ENTRIES * cct_block_index); in cc_set_congestion_control_table()
2276 spin_lock(&ppd->cc_shadow_lock); in cc_set_congestion_control_table()
2278 ppd->ccti_entries_shadow->ccti_last_entry = ppd->total_cct_entry - 1; in cc_set_congestion_control_table()
2279 memcpy(ppd->ccti_entries_shadow->entries, ppd->ccti_entries, in cc_set_congestion_control_table()
2280 (ppd->total_cct_entry * sizeof(struct ib_cc_table_entry))); in cc_set_congestion_control_table()
2282 ppd->congestion_entries_shadow->port_control = IB_CC_CCS_PC_SL_BASED; in cc_set_congestion_control_table()
2283 ppd->congestion_entries_shadow->control_map = ppd->cc_sl_control_map; in cc_set_congestion_control_table()
2284 memcpy(ppd->congestion_entries_shadow->entries, ppd->congestion_entries, in cc_set_congestion_control_table()
2287 spin_unlock(&ppd->cc_shadow_lock); in cc_set_congestion_control_table()
2408 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in qib_process_mad() local
2421 if (!ppd->congestion_entries_shadow || in qib_process_mad()
2445 struct qib_pportdata *ppd = (struct qib_pportdata *)opaque; in xmit_wait_timer_func() local
2446 struct qib_devdata *dd = dd_from_ppd(ppd); in xmit_wait_timer_func()
2450 spin_lock_irqsave(&ppd->ibport_data.lock, flags); in xmit_wait_timer_func()
2451 if (ppd->cong_stats.flags == IB_PMA_CONG_HW_CONTROL_SAMPLE) { in xmit_wait_timer_func()
2452 status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in xmit_wait_timer_func()
2455 cache_hw_sample_counters(ppd); in xmit_wait_timer_func()
2456 ppd->cong_stats.flags = IB_PMA_CONG_HW_CONTROL_TIMER; in xmit_wait_timer_func()
2460 ppd->cong_stats.counter = xmit_wait_get_value_delta(ppd); in xmit_wait_timer_func()
2461 dd->f_set_cntr_sample(ppd, QIB_CONG_TIMER_PSINTERVAL, 0x0); in xmit_wait_timer_func()
2463 spin_unlock_irqrestore(&ppd->ibport_data.lock, flags); in xmit_wait_timer_func()
2464 mod_timer(&ppd->cong_stats.timer, jiffies + HZ); in xmit_wait_timer_func()