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()
456 struct qib_pportdata *ppd; in subn_get_portinfo() local
484 ppd = dd->pport + (port_num - 1); in subn_get_portinfo()
485 ibp = &ppd->ibport_data; in subn_get_portinfo()
496 pip->lid = cpu_to_be16(ppd->lid); in subn_get_portinfo()
502 pip->link_width_enabled = ppd->link_width_enabled; in subn_get_portinfo()
503 pip->link_width_supported = ppd->link_width_supported; in subn_get_portinfo()
504 pip->link_width_active = ppd->link_width_active; in subn_get_portinfo()
505 state = dd->f_iblink_state(ppd->lastibcstat); in subn_get_portinfo()
506 pip->linkspeed_portstate = ppd->link_speed_supported << 4 | state; in subn_get_portinfo()
509 (dd->f_ibphys_portstate(ppd->lastibcstat) << 4) | in subn_get_portinfo()
510 (get_linkdowndefaultstate(ppd) ? 1 : 2); in subn_get_portinfo()
511 pip->mkeyprot_resv_lmc = (ibp->mkeyprot << 6) | ppd->lmc; in subn_get_portinfo()
512 pip->linkspeedactive_enabled = (ppd->link_speed_active << 4) | in subn_get_portinfo()
513 ppd->link_speed_enabled; in subn_get_portinfo()
514 switch (ppd->ibmtu) { in subn_get_portinfo()
533 pip->vlcap_inittype = ppd->vls_supported << 4; /* InitType = 0 */ in subn_get_portinfo()
536 dd->f_get_ib_cfg(ppd, QIB_IB_CFG_VL_HIGH_CAP); in subn_get_portinfo()
538 dd->f_get_ib_cfg(ppd, QIB_IB_CFG_VL_LOW_CAP); in subn_get_portinfo()
544 dd->f_get_ib_cfg(ppd, QIB_IB_CFG_OP_VLS) << 4; in subn_get_portinfo()
555 (get_phyerrthreshold(ppd) << 4) | in subn_get_portinfo()
556 get_overrunthreshold(ppd); in subn_get_portinfo()
561 v = dd->f_get_ib_cfg(ppd, QIB_IB_CFG_LINKLATENCY); in subn_get_portinfo()
581 struct qib_pportdata *ppd = dd->pport + port - 1; in get_pkeys() local
587 struct qib_ctxtdata *rcd = dd->rcd[ppd->hw_pidx]; in get_pkeys()
629 struct qib_pportdata *ppd = dd->pport + pidx; in subn_set_guidinfo() local
630 struct qib_ibport *ibp = &ppd->ibport_data; in subn_set_guidinfo()
657 struct qib_pportdata *ppd; in subn_set_portinfo() local
683 ppd = dd->pport + (port_num - 1); in subn_set_portinfo()
684 ibp = &ppd->ibport_data; in subn_set_portinfo()
696 else if (ppd->lid != lid || ppd->lmc != (pip->mkeyprot_resv_lmc & 7)) { in subn_set_portinfo()
697 if (ppd->lid != lid) in subn_set_portinfo()
698 qib_set_uevent_bits(ppd, _QIB_EVENT_LID_CHANGE_BIT); in subn_set_portinfo()
699 if (ppd->lmc != (pip->mkeyprot_resv_lmc & 7)) in subn_set_portinfo()
700 qib_set_uevent_bits(ppd, _QIB_EVENT_LMC_CHANGE_BIT); in subn_set_portinfo()
701 qib_set_lid(ppd, lid, pip->mkeyprot_resv_lmc & 7); in subn_set_portinfo()
732 set_link_width_enabled(ppd, ppd->link_width_supported); in subn_set_portinfo()
733 else if (lwe >= 16 || (lwe & ~ppd->link_width_supported)) in subn_set_portinfo()
735 else if (lwe != ppd->link_width_enabled) in subn_set_portinfo()
736 set_link_width_enabled(ppd, lwe); in subn_set_portinfo()
747 set_link_speed_enabled(ppd, in subn_set_portinfo()
748 ppd->link_speed_supported); in subn_set_portinfo()
749 else if (lse >= 8 || (lse & ~ppd->link_speed_supported)) in subn_set_portinfo()
751 else if (lse != ppd->link_speed_enabled) in subn_set_portinfo()
752 set_link_speed_enabled(ppd, lse); in subn_set_portinfo()
760 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LINKDEFAULT, in subn_set_portinfo()
764 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_LINKDEFAULT, in subn_set_portinfo()
773 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_VL_HIGH_LIMIT, in subn_set_portinfo()
780 qib_set_mtu(ppd, mtu); in subn_set_portinfo()
785 if (vls > ppd->vls_supported) in subn_set_portinfo()
788 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_OP_VLS, vls); in subn_set_portinfo()
801 if (set_phyerrthreshold(ppd, (ore >> 4) & 0xF)) in subn_set_portinfo()
804 if (set_overrunthreshold(ppd, (ore & 0xF))) in subn_set_portinfo()
842 spin_lock_irqsave(&ppd->lflags_lock, flags); in subn_set_portinfo()
843 ppd->lflags &= ~QIBL_LINKV; in subn_set_portinfo()
844 spin_unlock_irqrestore(&ppd->lflags_lock, flags); in subn_set_portinfo()
845 qib_set_linkstate(ppd, lstate); in subn_set_portinfo()
854 qib_wait_linkstate(ppd, QIBL_LINKV, 10); in subn_set_portinfo()
857 qib_set_linkstate(ppd, QIB_IB_LINKARM); in subn_set_portinfo()
860 qib_set_linkstate(ppd, QIB_IB_LINKACTIVE); in subn_set_portinfo()
894 static int rm_pkey(struct qib_pportdata *ppd, u16 key) in rm_pkey() argument
899 for (i = 0; i < ARRAY_SIZE(ppd->pkeys); i++) { in rm_pkey()
900 if (ppd->pkeys[i] != key) in rm_pkey()
902 if (atomic_dec_and_test(&ppd->pkeyrefs[i])) { in rm_pkey()
903 ppd->pkeys[i] = 0; in rm_pkey()
924 static int add_pkey(struct qib_pportdata *ppd, u16 key) in add_pkey() argument
937 for (i = 0; i < ARRAY_SIZE(ppd->pkeys); i++) { in add_pkey()
938 if (!ppd->pkeys[i]) { in add_pkey()
943 if (ppd->pkeys[i] == key) { in add_pkey()
944 if (atomic_inc_return(&ppd->pkeyrefs[i]) > 1) { in add_pkey()
949 atomic_dec(&ppd->pkeyrefs[i]); in add_pkey()
957 if ((ppd->pkeys[i] & 0x7FFF) == lkey) { in add_pkey()
966 for (i = 0; i < ARRAY_SIZE(ppd->pkeys); i++) { in add_pkey()
967 if (!ppd->pkeys[i] && in add_pkey()
968 atomic_inc_return(&ppd->pkeyrefs[i]) == 1) { in add_pkey()
970 ppd->pkeys[i] = key; in add_pkey()
989 struct qib_pportdata *ppd; in set_pkeys() local
1000 ppd = dd->pport + (port - 1); in set_pkeys()
1001 rcd = dd->rcd[ppd->hw_pidx]; in set_pkeys()
1014 changed |= rm_pkey(ppd, okey); in set_pkeys()
1016 int ret = add_pkey(ppd, key); in set_pkeys()
1028 (void) dd->f_set_ib_cfg(ppd, QIB_IB_CFG_PKEYS, 0); in set_pkeys()
1100 struct qib_pportdata *ppd = ppd_from_ibp(to_iport(ibdev, port)); in subn_get_vl_arb() local
1104 if (ppd->vls_supported == IB_VL_VL0) in subn_get_vl_arb()
1107 (void) ppd->dd->f_get_ib_table(ppd, QIB_IB_TBL_VL_LOW_ARB, in subn_get_vl_arb()
1110 (void) ppd->dd->f_get_ib_table(ppd, QIB_IB_TBL_VL_HIGH_ARB, in subn_get_vl_arb()
1122 struct qib_pportdata *ppd = ppd_from_ibp(to_iport(ibdev, port)); in subn_set_vl_arb() local
1124 if (ppd->vls_supported == IB_VL_VL0) in subn_set_vl_arb()
1127 (void) ppd->dd->f_set_ib_table(ppd, QIB_IB_TBL_VL_LOW_ARB, in subn_set_vl_arb()
1130 (void) ppd->dd->f_set_ib_table(ppd, QIB_IB_TBL_VL_HIGH_ARB, in subn_set_vl_arb()
1187 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portsamplescontrol() local
1199 p->tick = dd->f_get_ib_cfg(ppd, QIB_IB_CFG_PMA_TICKS); in pma_get_portsamplescontrol()
1200 p->sample_status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in pma_get_portsamplescontrol()
1225 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_set_portsamplescontrol() local
1239 xmit_flags = ppd->cong_stats.flags; in pma_set_portsamplescontrol()
1240 ppd->cong_stats.flags = IB_PMA_CONG_HW_CONTROL_SAMPLE; in pma_set_portsamplescontrol()
1241 status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in pma_set_portsamplescontrol()
1253 dd->f_set_cntr_sample(ppd, ibp->pma_sample_interval, in pma_set_portsamplescontrol()
1264 static u64 get_counter(struct qib_ibport *ibp, struct qib_pportdata *ppd, in get_counter() argument
1271 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSXMITDATA); in get_counter()
1274 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSRCVDATA); in get_counter()
1277 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSXMITPKTS); in get_counter()
1280 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSRCVPKTS); in get_counter()
1283 ret = ppd->dd->f_portcntr(ppd, QIBPORTCNTR_PSXMITWAIT); in get_counter()
1293 static u64 xmit_wait_get_value_delta(struct qib_pportdata *ppd) in xmit_wait_get_value_delta() argument
1297 delta = get_counter(&ppd->ibport_data, ppd, in xmit_wait_get_value_delta()
1299 return ppd->cong_stats.counter + delta; in xmit_wait_get_value_delta()
1302 static void cache_hw_sample_counters(struct qib_pportdata *ppd) in cache_hw_sample_counters() argument
1304 struct qib_ibport *ibp = &ppd->ibport_data; in cache_hw_sample_counters()
1306 ppd->cong_stats.counter_cache.psxmitdata = in cache_hw_sample_counters()
1307 get_counter(ibp, ppd, IB_PMA_PORT_XMIT_DATA); in cache_hw_sample_counters()
1308 ppd->cong_stats.counter_cache.psrcvdata = in cache_hw_sample_counters()
1309 get_counter(ibp, ppd, IB_PMA_PORT_RCV_DATA); in cache_hw_sample_counters()
1310 ppd->cong_stats.counter_cache.psxmitpkts = in cache_hw_sample_counters()
1311 get_counter(ibp, ppd, IB_PMA_PORT_XMIT_PKTS); in cache_hw_sample_counters()
1312 ppd->cong_stats.counter_cache.psrcvpkts = in cache_hw_sample_counters()
1313 get_counter(ibp, ppd, IB_PMA_PORT_RCV_PKTS); in cache_hw_sample_counters()
1314 ppd->cong_stats.counter_cache.psxmitwait = in cache_hw_sample_counters()
1315 get_counter(ibp, ppd, IB_PMA_PORT_XMIT_WAIT); in cache_hw_sample_counters()
1318 static u64 get_cache_hw_sample_counters(struct qib_pportdata *ppd, in get_cache_hw_sample_counters() argument
1325 ret = ppd->cong_stats.counter_cache.psxmitdata; in get_cache_hw_sample_counters()
1328 ret = ppd->cong_stats.counter_cache.psrcvdata; in get_cache_hw_sample_counters()
1331 ret = ppd->cong_stats.counter_cache.psxmitpkts; in get_cache_hw_sample_counters()
1334 ret = ppd->cong_stats.counter_cache.psrcvpkts; in get_cache_hw_sample_counters()
1337 ret = ppd->cong_stats.counter_cache.psxmitwait; in get_cache_hw_sample_counters()
1354 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portsamplesresult() local
1362 if (ppd->cong_stats.flags == IB_PMA_CONG_HW_CONTROL_TIMER) in pma_get_portsamplesresult()
1365 status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in pma_get_portsamplesresult()
1368 cache_hw_sample_counters(ppd); in pma_get_portsamplesresult()
1369 ppd->cong_stats.counter = in pma_get_portsamplesresult()
1370 xmit_wait_get_value_delta(ppd); in pma_get_portsamplesresult()
1371 dd->f_set_cntr_sample(ppd, in pma_get_portsamplesresult()
1373 ppd->cong_stats.flags = IB_PMA_CONG_HW_CONTROL_TIMER; in pma_get_portsamplesresult()
1379 ppd, ibp->pma_counter_select[i])); in pma_get_portsamplesresult()
1393 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portsamplesresult_ext() local
1402 if (ppd->cong_stats.flags == IB_PMA_CONG_HW_CONTROL_TIMER) in pma_get_portsamplesresult_ext()
1405 status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in pma_get_portsamplesresult_ext()
1410 cache_hw_sample_counters(ppd); in pma_get_portsamplesresult_ext()
1411 ppd->cong_stats.counter = in pma_get_portsamplesresult_ext()
1412 xmit_wait_get_value_delta(ppd); in pma_get_portsamplesresult_ext()
1413 dd->f_set_cntr_sample(ppd, in pma_get_portsamplesresult_ext()
1415 ppd->cong_stats.flags = IB_PMA_CONG_HW_CONTROL_TIMER; in pma_get_portsamplesresult_ext()
1421 ppd, ibp->pma_counter_select[i])); in pma_get_portsamplesresult_ext()
1433 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portcounters() local
1437 qib_get_counters(ppd, &cntrs); in pma_get_portcounters()
1533 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portcounters_cong() local
1534 struct qib_devdata *dd = dd_from_ppd(ppd); in pma_get_portcounters_cong()
1548 qib_get_counters(ppd, &cntrs); in pma_get_portcounters_cong()
1549 spin_lock_irqsave(&ppd->ibport_data.lock, flags); in pma_get_portcounters_cong()
1550 xmit_wait_counter = xmit_wait_get_value_delta(ppd); in pma_get_portcounters_cong()
1551 spin_unlock_irqrestore(&ppd->ibport_data.lock, flags); in pma_get_portcounters_cong()
1661 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_get_portcounters_ext() local
1674 qib_snapshot_counters(ppd, &swords, &rwords, &spkts, &rpkts, &xwait); in pma_get_portcounters_ext()
1708 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_set_portcounters() local
1715 qib_get_counters(ppd, &cntrs); in pma_set_portcounters()
1769 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_set_portcounters_cong() local
1770 struct qib_devdata *dd = dd_from_ppd(ppd); in pma_set_portcounters_cong()
1776 qib_get_counters(ppd, &cntrs); in pma_set_portcounters_cong()
1781 spin_lock_irqsave(&ppd->ibport_data.lock, flags); in pma_set_portcounters_cong()
1782 ppd->cong_stats.counter = 0; in pma_set_portcounters_cong()
1783 dd->f_set_cntr_sample(ppd, QIB_CONG_TIMER_PSINTERVAL, in pma_set_portcounters_cong()
1785 spin_unlock_irqrestore(&ppd->ibport_data.lock, flags); in pma_set_portcounters_cong()
1822 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in pma_set_portcounters_ext() local
1826 qib_snapshot_counters(ppd, &swords, &rwords, &spkts, &rpkts, &xwait); in pma_set_portcounters_ext()
1863 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in process_subn() local
1993 ppd->dd->f_set_ib_cfg(ppd, QIB_IB_CFG_PORT, in process_subn()
2118 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_get_congestion_info() local
2123 p->control_table_cap = ppd->cc_max_table_entries; in cc_get_congestion_info()
2135 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_get_congestion_setting() local
2140 spin_lock(&ppd->cc_shadow_lock); in cc_get_congestion_setting()
2142 entries = ppd->congestion_entries_shadow->entries; in cc_get_congestion_setting()
2144 ppd->congestion_entries_shadow->port_control); in cc_get_congestion_setting()
2146 ppd->congestion_entries_shadow->control_map); in cc_get_congestion_setting()
2154 spin_unlock(&ppd->cc_shadow_lock); in cc_get_congestion_setting()
2165 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_get_congestion_control_table() local
2178 spin_lock(&ppd->cc_shadow_lock); in cc_get_congestion_control_table()
2181 (ppd->ccti_entries_shadow->ccti_last_entry + 1)/IB_CCT_ENTRIES; in cc_get_congestion_control_table()
2185 spin_unlock(&ppd->cc_shadow_lock); in cc_get_congestion_control_table()
2197 entries = &ppd->ccti_entries_shadow-> in cc_get_congestion_control_table()
2204 spin_unlock(&ppd->cc_shadow_lock); in cc_get_congestion_control_table()
2218 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_set_congestion_setting() local
2221 ppd->cc_sl_control_map = be16_to_cpu(p->control_map); in cc_set_congestion_setting()
2224 ppd->congestion_entries[i].ccti_increase = in cc_set_congestion_setting()
2227 ppd->congestion_entries[i].ccti_timer = in cc_set_congestion_setting()
2230 ppd->congestion_entries[i].trigger_threshold = in cc_set_congestion_setting()
2233 ppd->congestion_entries[i].ccti_min = in cc_set_congestion_setting()
2246 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in cc_set_congestion_control_table() local
2260 ppd->total_cct_entry = 0; in cc_set_congestion_control_table()
2265 ppd->total_cct_entry += (cct_entry + 1); in cc_set_congestion_control_table()
2267 if (ppd->total_cct_entry > ppd->cc_supported_table_entries) in cc_set_congestion_control_table()
2270 ppd->ccti_limit = be16_to_cpu(p->ccti_limit); in cc_set_congestion_control_table()
2272 entries = ppd->ccti_entries + (IB_CCT_ENTRIES * cct_block_index); in cc_set_congestion_control_table()
2277 spin_lock(&ppd->cc_shadow_lock); in cc_set_congestion_control_table()
2279 ppd->ccti_entries_shadow->ccti_last_entry = ppd->total_cct_entry - 1; in cc_set_congestion_control_table()
2280 memcpy(ppd->ccti_entries_shadow->entries, ppd->ccti_entries, in cc_set_congestion_control_table()
2281 (ppd->total_cct_entry * sizeof(struct ib_cc_table_entry))); in cc_set_congestion_control_table()
2283 ppd->congestion_entries_shadow->port_control = IB_CC_CCS_PC_SL_BASED; in cc_set_congestion_control_table()
2284 ppd->congestion_entries_shadow->control_map = ppd->cc_sl_control_map; in cc_set_congestion_control_table()
2285 memcpy(ppd->congestion_entries_shadow->entries, ppd->congestion_entries, in cc_set_congestion_control_table()
2288 spin_unlock(&ppd->cc_shadow_lock); in cc_set_congestion_control_table()
2411 struct qib_pportdata *ppd = ppd_from_ibp(ibp); in qib_process_mad() local
2430 if (!ppd->congestion_entries_shadow || in qib_process_mad()
2454 struct qib_pportdata *ppd = (struct qib_pportdata *)opaque; in xmit_wait_timer_func() local
2455 struct qib_devdata *dd = dd_from_ppd(ppd); in xmit_wait_timer_func()
2459 spin_lock_irqsave(&ppd->ibport_data.lock, flags); in xmit_wait_timer_func()
2460 if (ppd->cong_stats.flags == IB_PMA_CONG_HW_CONTROL_SAMPLE) { in xmit_wait_timer_func()
2461 status = dd->f_portcntr(ppd, QIBPORTCNTR_PSSTAT); in xmit_wait_timer_func()
2464 cache_hw_sample_counters(ppd); in xmit_wait_timer_func()
2465 ppd->cong_stats.flags = IB_PMA_CONG_HW_CONTROL_TIMER; in xmit_wait_timer_func()
2469 ppd->cong_stats.counter = xmit_wait_get_value_delta(ppd); in xmit_wait_timer_func()
2470 dd->f_set_cntr_sample(ppd, QIB_CONG_TIMER_PSINTERVAL, 0x0); in xmit_wait_timer_func()
2472 spin_unlock_irqrestore(&ppd->ibport_data.lock, flags); in xmit_wait_timer_func()
2473 mod_timer(&ppd->cong_stats.timer, jiffies + HZ); in xmit_wait_timer_func()