Lines Matching defs:ppd
103 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
105 if (pkey_idx < ARRAY_SIZE(ppd->pkeys))
106 return ppd->pkeys[pkey_idx];
298 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
299 struct hfi1_devdata *dd = dd_from_ppd(ppd);
300 u8 port_num = ppd->port;
677 static void set_link_width_enabled(struct hfi1_pportdata *ppd, u32 w)
679 (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_LWID_ENB, w);
682 static void set_link_width_downgrade_enabled(struct hfi1_pportdata *ppd, u32 w)
684 (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_LWID_DG_ENB, w);
687 static void set_link_speed_enabled(struct hfi1_pportdata *ppd, u32 s)
689 (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_SPD_ENB, s);
802 struct hfi1_pportdata *ppd;
821 ppd = dd->pport + (port - 1);
822 ibp = &ppd->ibport_data;
824 if (ppd->vls_supported / 2 > ARRAY_SIZE(pi->neigh_mtu.pvlx_to_mtu) ||
825 ppd->vls_supported > ARRAY_SIZE(dd->vld)) {
830 pi->lid = cpu_to_be32(ppd->lid);
842 pi->sm_trap_qp = cpu_to_be32(ppd->sm_trap_qp);
843 pi->sa_qp = cpu_to_be32(ppd->sa_qp);
845 pi->link_width.enabled = cpu_to_be16(ppd->link_width_enabled);
846 pi->link_width.supported = cpu_to_be16(ppd->link_width_supported);
847 pi->link_width.active = cpu_to_be16(ppd->link_width_active);
850 cpu_to_be16(ppd->link_width_downgrade_supported);
852 cpu_to_be16(ppd->link_width_downgrade_enabled);
854 cpu_to_be16(ppd->link_width_downgrade_tx_active);
856 cpu_to_be16(ppd->link_width_downgrade_rx_active);
858 pi->link_speed.supported = cpu_to_be16(ppd->link_speed_supported);
859 pi->link_speed.active = cpu_to_be16(ppd->link_speed_active);
860 pi->link_speed.enabled = cpu_to_be16(ppd->link_speed_enabled);
862 state = driver_lstate(ppd);
865 ppd->is_sm_config_started = 1;
867 pi->port_phys_conf = (ppd->port_type & 0xf);
869 pi->port_states.ledenable_offlinereason = ppd->neighbor_normal << 4;
871 ppd->is_sm_config_started << 5;
878 is_beaconing_active = !!atomic_read(&ppd->led_override_timer_active);
881 ppd->offline_disabled_reason;
884 (driver_pstate(ppd) << 4) | state;
886 pi->mkeyprotect_lmc = (ibp->rvp.mkeyprot << 6) | ppd->lmc;
889 for (i = 0; i < ppd->vls_supported; i++) {
900 pi->operational_vls = hfi1_get_ib_cfg(ppd, HFI1_IB_CFG_OP_VLS);
902 (ppd->linkinit_reason & OPA_PI_MASK_LINKINIT_REASON);
903 if (ppd->part_enforce & HFI1_PART_ENFORCE_IN)
905 if (ppd->part_enforce & HFI1_PART_ENFORCE_OUT)
912 pi->vl.cap = ppd->vls_supported;
914 pi->vl.arb_high_cap = (u8)hfi1_get_ib_cfg(ppd, HFI1_IB_CFG_VL_HIGH_CAP);
915 pi->vl.arb_low_cap = (u8)hfi1_get_ib_cfg(ppd, HFI1_IB_CFG_VL_LOW_CAP);
923 pi->port_ltp_crc_mode = cpu_to_be16(ppd->port_ltp_crc_mode);
926 ppd->is_active_optimize_enabled ?
951 pi->link_down_reason = ppd->local_link_down_reason.sma;
952 pi->neigh_link_down_reason = ppd->neigh_link_down_reason.sma;
953 pi->port_error_action = cpu_to_be32(ppd->port_error_action);
964 pi->neigh_node_guid = cpu_to_be64(ppd->neighbor_guid);
965 pi->neigh_port_num = ppd->neighbor_port_number;
967 (ppd->neighbor_type & OPA_PI_MASK_NEIGH_NODE_TYPE) |
968 (ppd->mgmt_allowed ? OPA_PI_MASK_NEIGH_MGMT_ALLOWED : 0) |
969 (ppd->neighbor_fm_security ?
1014 struct hfi1_pportdata *ppd = dd->pport + port - 1;
1016 memcpy(pkeys, ppd->pkeys, sizeof(ppd->pkeys));
1192 static int port_states_transition_allowed(struct hfi1_pportdata *ppd,
1195 u32 physical_old = driver_pstate(ppd);
1196 u32 logical_old = driver_lstate(ppd);
1240 static int set_port_states(struct hfi1_pportdata *ppd, struct opa_smp *smp,
1243 struct hfi1_devdata *dd = ppd->dd;
1247 ret = port_states_transition_allowed(ppd, logical_state, phys_state);
1281 set_link_down_reason(ppd, OPA_LINKDOWN_REASON_FM_BOUNCE,
1301 set_link_state(ppd, HLS_DN_OFFLINE);
1302 start_link(ppd);
1304 set_link_state(ppd, link_state);
1307 (ppd->offline_disabled_reason >
1309 ppd->offline_disabled_reason ==
1311 ppd->offline_disabled_reason =
1321 ret = set_link_state(ppd, HLS_UP_ARMED);
1326 if (ppd->neighbor_normal) {
1327 ret = set_link_state(ppd, HLS_UP_ACTIVE);
1358 struct hfi1_pportdata *ppd;
1400 ppd = dd->pport + (port - 1);
1401 ibp = &ppd->ibport_data;
1405 ls_old = driver_lstate(ppd);
1421 } else if (ppd->lid != lid ||
1422 ppd->lmc != (pi->mkeyprotect_lmc & OPA_PI_MASK_LMC)) {
1423 if (ppd->lid != lid)
1424 hfi1_set_uevent_bits(ppd, _HFI1_EVENT_LID_CHANGE_BIT);
1425 if (ppd->lmc != (pi->mkeyprotect_lmc & OPA_PI_MASK_LMC))
1426 hfi1_set_uevent_bits(ppd, _HFI1_EVENT_LMC_CHANGE_BIT);
1427 hfi1_set_lid(ppd, lid, pi->mkeyprotect_lmc & OPA_PI_MASK_LMC);
1435 ppd->guids[HFI1_PORT_GUID_INDEX + 1] =
1444 ppd->linkinit_reason =
1472 ppd->local_link_down_reason.sma = 0;
1473 ppd->local_link_down_reason.latest = 0;
1477 ppd->neigh_link_down_reason.sma = 0;
1478 ppd->neigh_link_down_reason.latest = 0;
1481 ppd->sm_trap_qp = be32_to_cpu(pi->sm_trap_qp);
1482 ppd->sa_qp = be32_to_cpu(pi->sa_qp);
1484 ppd->port_error_action = be32_to_cpu(pi->port_error_action);
1489 set_link_width_enabled(ppd, ppd->link_width_supported);
1490 else if ((lwe & ~ppd->link_width_supported) == 0)
1491 set_link_width_enabled(ppd, lwe);
1499 set_link_width_downgrade_enabled(ppd,
1500 ppd->
1503 } else if ((lwe & ~ppd->link_width_downgrade_supported) == 0) {
1505 if (lwe != ppd->link_width_downgrade_enabled) {
1506 set_link_width_downgrade_enabled(ppd, lwe);
1515 set_link_speed_enabled(ppd, lse);
1523 (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_VL_HIGH_LIMIT,
1526 if (ppd->vls_supported / 2 > ARRAY_SIZE(pi->neigh_mtu.pvlx_to_mtu) ||
1527 ppd->vls_supported > ARRAY_SIZE(dd->vld)) {
1531 for (i = 0; i < ppd->vls_supported; i++) {
1567 set_mtu(ppd);
1572 if (vls > ppd->vls_supported) {
1577 if (hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_OP_VLS,
1600 ppd->port_crc_mode_enabled = port_ltp_to_cap(crc_enabled);
1602 ppd->is_active_optimize_enabled =
1614 ppd->is_sm_config_started = 1;
1616 if (ppd->is_sm_config_started == 0) {
1637 ret = set_port_states(ppd, smp, ls_new, ps_new, local_mad);
1655 apply_link_downgrade_policy(ppd, 0);
1672 struct hfi1_pportdata *ppd;
1680 * If we get here with ppd setup, no need to check
1683 ppd = dd->pport + (port - 1);
1687 for (i = 0; i < ARRAY_SIZE(ppd->pkeys); i++) {
1697 for (i = 0; i < ARRAY_SIZE(ppd->pkeys); i++) {
1699 u16 okey = ppd->pkeys[i];
1708 ppd->pkeys[i] = key;
1713 (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_PKEYS, 0);
1953 struct hfi1_pportdata *ppd;
1969 ppd = dd->pport + (port - 1);
1970 lstate = driver_lstate(ppd);
1993 struct hfi1_pportdata *ppd;
2002 ppd = dd->pport + (port - 1);
2004 fm_get_table(ppd, FM_TBL_SC2VLNT, vp);
2018 struct hfi1_pportdata *ppd;
2029 ppd = dd->pport + (port - 1);
2030 lstate = driver_lstate(ppd);
2036 ppd = dd->pport + (port - 1);
2038 fm_set_table(ppd, FM_TBL_SC2VLNT, vp);
2052 struct hfi1_pportdata *ppd;
2061 ppd = ppd_from_ibp(ibp);
2063 lstate = driver_lstate(ppd);
2066 ppd->is_sm_config_started = 1;
2068 psi->port_states.ledenable_offlinereason = ppd->neighbor_normal << 4;
2070 ppd->is_sm_config_started << 5;
2072 ppd->offline_disabled_reason;
2075 (driver_pstate(ppd) << 4) | (lstate & 0xf);
2077 cpu_to_be16(ppd->link_width_downgrade_tx_active);
2079 cpu_to_be16(ppd->link_width_downgrade_rx_active);
2095 struct hfi1_pportdata *ppd;
2105 ppd = ppd_from_ibp(ibp);
2107 ls_old = driver_lstate(ppd);
2115 ppd->is_sm_config_started = 1;
2117 if (ppd->is_sm_config_started == 0) {
2125 ret = set_port_states(ppd, smp, ls_new, ps_new, local_mad);
2192 struct hfi1_pportdata *ppd;
2201 ppd = dd->pport + (port - 1);
2202 fm_get_table(ppd, FM_TBL_BUFFER_CONTROL, p);
2216 struct hfi1_pportdata *ppd;
2223 ppd = dd->pport + (port - 1);
2225 if (fm_set_table(ppd, FM_TBL_BUFFER_CONTROL, p) < 0) {
2238 struct hfi1_pportdata *ppd = ppd_from_ibp(to_iport(ibdev, port));
2251 fm_get_table(ppd, FM_TBL_VL_LOW_ARB, p);
2254 fm_get_table(ppd, FM_TBL_VL_HIGH_ARB, p);
2257 fm_get_table(ppd, FM_TBL_VL_PREEMPT_ELEMS, p);
2260 fm_get_table(ppd, FM_TBL_VL_PREEMPT_MATRIX, p);
2280 struct hfi1_pportdata *ppd = ppd_from_ibp(to_iport(ibdev, port));
2293 (void)fm_set_table(ppd, FM_TBL_VL_LOW_ARB, p);
2296 (void)fm_set_table(ppd, FM_TBL_VL_HIGH_ARB, p);
2626 static void a0_portstatus(struct hfi1_pportdata *ppd,
2629 if (!is_bx(ppd->dd)) {
2636 read_port_cntr(ppd, C_TX_WAIT_VL,
2678 * @ppd: info of physical Hfi port
2689 * current state at end of function using ppd->prev_link_width and
2690 * ppd->port_vl_xmit_wait_last to port_vl_xmit_wait_curr and link_width.
2692 u64 get_xmit_wait_counters(struct hfi1_pportdata *ppd,
2703 read_port_cntr(ppd, C_TX_WAIT_VL, vl);
2706 read_port_cntr(ppd, C_TX_WAIT, CNTR_INVALID_VL);
2710 ppd->port_vl_xmit_wait_last[vl];
2713 ppd->prev_link_width,
2716 ppd->vl_xmit_flit_cnt[vl] += delta_vl_xmit_wait;
2717 ppd->port_vl_xmit_wait_last[vl] = port_vl_xmit_wait_curr;
2718 ppd->prev_link_width = link_width;
2720 return ppd->vl_xmit_flit_cnt[vl];
2739 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
2766 cpu_to_be64(read_port_cntr(ppd, C_SW_RCV_CSTR_ERR,
2791 tx_link_width(ppd->link_width_downgrade_tx_active);
2792 link_speed = get_link_speed(ppd->link_speed_active);
2794 cpu_to_be64(get_xmit_wait_counters(ppd, link_width,
2801 cpu_to_be64(read_port_cntr(ppd, C_SW_XMIT_DSCD,
2804 cpu_to_be64(read_port_cntr(ppd, C_SW_XMIT_CSTR_ERR,
2828 rsp->link_downed = cpu_to_be32(read_port_cntr(ppd, C_SW_LINK_DOWN,
2853 cpu_to_be64(read_port_cntr(ppd, C_TX_FLIT_VL,
2857 cpu_to_be64(read_port_cntr(ppd, C_TX_PKT_VL,
2864 cpu_to_be64(get_xmit_wait_counters(ppd, link_width,
2877 cpu_to_be64(read_port_cntr(ppd, C_SW_XMIT_DSCD_VL,
2883 a0_portstatus(ppd, rsp);
2896 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
2899 error_counter_summary += read_port_cntr(ppd, C_SW_RCV_CSTR_ERR,
2902 error_counter_summary += read_port_cntr(ppd, C_SW_XMIT_DSCD,
2904 error_counter_summary += read_port_cntr(ppd, C_SW_XMIT_CSTR_ERR,
2920 /* ppd->link_downed is a 32-bit value */
2921 error_counter_summary += read_port_cntr(ppd, C_SW_LINK_DOWN,
2930 static void a0_datacounters(struct hfi1_pportdata *ppd, struct _port_dctrs *rsp)
2932 if (!is_bx(ppd->dd)) {
2939 read_port_cntr(ppd, C_TX_WAIT_VL,
2982 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
3049 tx_link_width(ppd->link_width_downgrade_tx_active);
3050 link_speed = get_link_speed(ppd->link_speed_active);
3052 cpu_to_be64(get_xmit_wait_counters(ppd, link_width,
3073 cpu_to_be64(read_port_cntr(ppd, C_TX_FLIT_VL,
3081 cpu_to_be64(read_port_cntr(ppd, C_TX_PKT_VL,
3093 cpu_to_be64(get_xmit_wait_counters(ppd, link_width,
3117 a0_datacounters(ppd, rsp);
3159 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
3171 rsp->link_downed = cpu_to_be32(read_port_cntr(ppd, C_SW_LINK_DOWN,
3180 cpu_to_be64(read_port_cntr(ppd, C_SW_XMIT_DSCD,
3183 cpu_to_be64(read_port_cntr(ppd, C_SW_XMIT_CSTR_ERR,
3186 cpu_to_be64(read_port_cntr(ppd, C_SW_RCV_CSTR_ERR,
3208 struct hfi1_pportdata *ppd;
3249 ppd = ppd_from_ibp(ibp);
3273 cpu_to_be64(read_port_cntr(ppd, C_SW_XMIT_DSCD_VL,
3477 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
3513 write_port_cntr(ppd, C_TX_WAIT, CNTR_INVALID_VL, 0);
3514 ppd->port_vl_xmit_wait_last[C_VL_COUNT] = 0;
3515 ppd->vl_xmit_flit_cnt[C_VL_COUNT] = 0;
3537 write_port_cntr(ppd, C_SW_RCV_CSTR_ERR, CNTR_INVALID_VL, 0);
3541 write_port_cntr(ppd, C_SW_XMIT_DSCD, CNTR_INVALID_VL, 0);
3544 write_port_cntr(ppd, C_SW_XMIT_CSTR_ERR, CNTR_INVALID_VL, 0);
3570 write_port_cntr(ppd, C_SW_LINK_DOWN, CNTR_INVALID_VL, 0);
3577 write_port_cntr(ppd, C_TX_FLIT_VL, idx_from_vl(vl), 0);
3583 write_port_cntr(ppd, C_TX_PKT_VL, idx_from_vl(vl), 0);
3589 write_port_cntr(ppd, C_TX_WAIT_VL, idx_from_vl(vl), 0);
3590 ppd->port_vl_xmit_wait_last[idx_from_vl(vl)] = 0;
3591 ppd->vl_xmit_flit_cnt[idx_from_vl(vl)] = 0;
3611 write_port_cntr(ppd, C_SW_XMIT_DSCD_VL,
3711 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
3719 p->control_table_cap = ppd->cc_max_table_entries;
3736 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
3747 cc_state = get_cc_state(ppd);
3774 * Apply congestion control information stored in the ppd to the
3777 static void apply_cc_state(struct hfi1_pportdata *ppd)
3786 * Hold the lock for updating *and* to prevent ppd information
3789 spin_lock(&ppd->cc_state_lock);
3791 old_cc_state = get_cc_state_protected(ppd);
3794 spin_unlock(&ppd->cc_state_lock);
3801 if (ppd->total_cct_entry)
3802 new_cc_state->cct.ccti_limit = ppd->total_cct_entry - 1;
3806 memcpy(new_cc_state->cct.entries, ppd->ccti_entries,
3807 ppd->total_cct_entry * sizeof(struct ib_cc_table_entry));
3810 new_cc_state->cong_setting.control_map = ppd->cc_sl_control_map;
3811 memcpy(new_cc_state->cong_setting.entries, ppd->congestion_entries,
3814 rcu_assign_pointer(ppd->cc_state, new_cc_state);
3816 spin_unlock(&ppd->cc_state_lock);
3828 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
3838 * Save details from packet into the ppd. Hold the cc_state_lock so
3841 spin_lock(&ppd->cc_state_lock);
3842 ppd->cc_sl_control_map = be32_to_cpu(p->control_map);
3844 entries = ppd->congestion_entries;
3852 spin_unlock(&ppd->cc_state_lock);
3855 apply_cc_state(ppd);
3866 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
3876 spin_lock_irq(&ppd->cc_log_lock);
3881 cpu_to_be16(ppd->threshold_event_counter);
3883 ppd->threshold_cong_event_map,
3890 &ppd->cc_events[ppd->cc_mad_idx++];
3891 if (ppd->cc_mad_idx == OPA_CONG_LOG_ELEMS)
3892 ppd->cc_mad_idx = 0;
3915 memset(ppd->threshold_cong_event_map, 0x0,
3916 sizeof(ppd->threshold_cong_event_map));
3917 ppd->threshold_event_counter = 0;
3919 spin_unlock_irq(&ppd->cc_log_lock);
3934 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
3945 start_block + n_blocks > ppd->cc_max_table_entries) {
3952 cc_state = get_cc_state(ppd);
3985 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
3996 start_block + n_blocks > ppd->cc_max_table_entries) {
4013 * Save details from packet into the ppd. Hold the cc_state_lock so
4016 spin_lock(&ppd->cc_state_lock);
4017 ppd->total_cct_entry = ccti_limit + 1;
4018 entries = ppd->ccti_entries;
4021 spin_unlock(&ppd->cc_state_lock);
4024 apply_cc_state(ppd);
4043 struct hfi1_pportdata *ppd = dd->pport;
4059 is_beaconing_active = !!atomic_read(&ppd->led_override_timer_active);
4382 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
4384 for (i = 0; i < ARRAY_SIZE(ppd->pkeys); ++i)
4385 if (ppd->pkeys[i] == FULL_MGMT_P_KEY)
4398 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
4407 return (in_wc->slid == ppd->lid);
4423 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
4426 if (in_wc->pkey_index >= ARRAY_SIZE(ppd->pkeys))
4429 pkey = ppd->pkeys[in_wc->pkey_index];
4450 ingress_pkey_table_fail(ppd, pkey, in_wc->slid);