Lines Matching refs:dd
88 struct ipath_devdata *dd = to_idev(ibdev)->dd; in recv_subn_get_nodeinfo() local
92 if (smp->attr_mod || (dd->ipath_guid == 0)) in recv_subn_get_nodeinfo()
106 nip->node_guid = dd->ipath_guid; in recv_subn_get_nodeinfo()
107 nip->port_guid = dd->ipath_guid; in recv_subn_get_nodeinfo()
108 nip->partition_cap = cpu_to_be16(ipath_get_npkeys(dd)); in recv_subn_get_nodeinfo()
109 nip->device_id = cpu_to_be16(dd->ipath_deviceid); in recv_subn_get_nodeinfo()
110 majrev = dd->ipath_majrev; in recv_subn_get_nodeinfo()
111 minrev = dd->ipath_minrev; in recv_subn_get_nodeinfo()
114 vendor = dd->ipath_vendorid; in recv_subn_get_nodeinfo()
137 __be64 g = to_idev(ibdev)->dd->ipath_guid; in recv_subn_get_guidinfo()
150 static void set_link_width_enabled(struct ipath_devdata *dd, u32 w) in set_link_width_enabled() argument
152 (void) dd->ipath_f_set_ib_cfg(dd, IPATH_IB_CFG_LWID_ENB, w); in set_link_width_enabled()
155 static void set_link_speed_enabled(struct ipath_devdata *dd, u32 s) in set_link_speed_enabled() argument
157 (void) dd->ipath_f_set_ib_cfg(dd, IPATH_IB_CFG_SPD_ENB, s); in set_link_speed_enabled()
160 static int get_overrunthreshold(struct ipath_devdata *dd) in get_overrunthreshold() argument
162 return (dd->ipath_ibcctrl >> in get_overrunthreshold()
174 static int set_overrunthreshold(struct ipath_devdata *dd, unsigned n) in set_overrunthreshold() argument
178 v = (dd->ipath_ibcctrl >> INFINIPATH_IBCC_OVERRUNTHRESHOLD_SHIFT) & in set_overrunthreshold()
181 dd->ipath_ibcctrl &= in set_overrunthreshold()
184 dd->ipath_ibcctrl |= in set_overrunthreshold()
186 ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, in set_overrunthreshold()
187 dd->ipath_ibcctrl); in set_overrunthreshold()
192 static int get_phyerrthreshold(struct ipath_devdata *dd) in get_phyerrthreshold() argument
194 return (dd->ipath_ibcctrl >> in get_phyerrthreshold()
206 static int set_phyerrthreshold(struct ipath_devdata *dd, unsigned n) in set_phyerrthreshold() argument
210 v = (dd->ipath_ibcctrl >> INFINIPATH_IBCC_PHYERRTHRESHOLD_SHIFT) & in set_phyerrthreshold()
213 dd->ipath_ibcctrl &= in set_phyerrthreshold()
216 dd->ipath_ibcctrl |= in set_phyerrthreshold()
218 ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, in set_phyerrthreshold()
219 dd->ipath_ibcctrl); in set_phyerrthreshold()
230 static int get_linkdowndefaultstate(struct ipath_devdata *dd) in get_linkdowndefaultstate() argument
232 return !!(dd->ipath_ibcctrl & INFINIPATH_IBCC_LINKDOWNDEFAULTSTATE); in get_linkdowndefaultstate()
239 struct ipath_devdata *dd; in recv_subn_get_portinfo() local
253 dd = dev->dd; in recv_subn_get_portinfo()
263 lid = dd->ipath_lid; in recv_subn_get_portinfo()
270 pip->link_width_enabled = dd->ipath_link_width_enabled; in recv_subn_get_portinfo()
271 pip->link_width_supported = dd->ipath_link_width_supported; in recv_subn_get_portinfo()
272 pip->link_width_active = dd->ipath_link_width_active; in recv_subn_get_portinfo()
273 pip->linkspeed_portstate = dd->ipath_link_speed_supported << 4; in recv_subn_get_portinfo()
274 ibcstat = dd->ipath_lastibcstat; in recv_subn_get_portinfo()
276 pip->linkspeed_portstate |= ipath_ib_linkstate(dd, ibcstat) + 1; in recv_subn_get_portinfo()
279 (ipath_cvt_physportstate[ibcstat & dd->ibcs_lts_mask] << 4) | in recv_subn_get_portinfo()
280 (get_linkdowndefaultstate(dd) ? 1 : 2); in recv_subn_get_portinfo()
281 pip->mkeyprot_resv_lmc = (dev->mkeyprot << 6) | dd->ipath_lmc; in recv_subn_get_portinfo()
282 pip->linkspeedactive_enabled = (dd->ipath_link_speed_active << 4) | in recv_subn_get_portinfo()
283 dd->ipath_link_speed_enabled; in recv_subn_get_portinfo()
284 switch (dd->ipath_ibmtu) { in recv_subn_get_portinfo()
318 cpu_to_be16((ipath_get_cr_errpkey(dd) - in recv_subn_get_portinfo()
327 (get_phyerrthreshold(dd) << 4) | in recv_subn_get_portinfo()
328 get_overrunthreshold(dd); in recv_subn_get_portinfo()
333 v = dd->ipath_f_get_ib_cfg(dd, IPATH_IB_CFG_LINKLATENCY); in recv_subn_get_portinfo()
350 static int get_pkeys(struct ipath_devdata *dd, u16 * pkeys) in get_pkeys() argument
353 struct ipath_portdata *pd = dd->ipath_pd[0]; in get_pkeys()
372 unsigned i, n = ipath_get_npkeys(dev->dd); in recv_subn_get_pkeytable()
374 get_pkeys(dev->dd, p); in recv_subn_get_pkeytable()
398 static int set_linkdowndefaultstate(struct ipath_devdata *dd, int sleep) in set_linkdowndefaultstate() argument
401 dd->ipath_ibcctrl |= INFINIPATH_IBCC_LINKDOWNDEFAULTSTATE; in set_linkdowndefaultstate()
403 dd->ipath_ibcctrl &= ~INFINIPATH_IBCC_LINKDOWNDEFAULTSTATE; in set_linkdowndefaultstate()
404 ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, in set_linkdowndefaultstate()
405 dd->ipath_ibcctrl); in set_linkdowndefaultstate()
423 struct ipath_devdata *dd; in recv_subn_set_portinfo() local
437 dd = dev->dd; in recv_subn_set_portinfo()
446 if (dd->ipath_lid != lid || in recv_subn_set_portinfo()
447 dd->ipath_lmc != (pip->mkeyprot_resv_lmc & 7)) { in recv_subn_set_portinfo()
451 ipath_set_lid(dd, lid, pip->mkeyprot_resv_lmc & 7); in recv_subn_set_portinfo()
470 lwe = dd->ipath_link_width_supported; in recv_subn_set_portinfo()
471 else if (lwe >= 16 || (lwe & ~dd->ipath_link_width_supported)) in recv_subn_set_portinfo()
473 set_link_width_enabled(dd, lwe); in recv_subn_set_portinfo()
480 lse = dd->ipath_link_speed_supported; in recv_subn_set_portinfo()
481 else if (lse >= 8 || (lse & ~dd->ipath_link_speed_supported)) in recv_subn_set_portinfo()
483 set_link_speed_enabled(dd, lse); in recv_subn_set_portinfo()
491 if (set_linkdowndefaultstate(dd, 1)) in recv_subn_set_portinfo()
495 if (set_linkdowndefaultstate(dd, 0)) in recv_subn_set_portinfo()
527 ipath_set_mtu(dd, mtu); in recv_subn_set_portinfo()
543 dev->z_pkey_violations = ipath_get_cr_errpkey(dd); in recv_subn_set_portinfo()
549 if (set_phyerrthreshold(dd, (ore >> 4) & 0xF)) in recv_subn_set_portinfo()
552 if (set_overrunthreshold(dd, (ore & 0xF))) in recv_subn_set_portinfo()
594 ipath_set_linkstate(dd, lstate); in recv_subn_set_portinfo()
599 ipath_wait_linkstate(dd, IPATH_LINKINIT | IPATH_LINKARMED | in recv_subn_set_portinfo()
603 ipath_set_linkstate(dd, IPATH_IB_LINKARM); in recv_subn_set_portinfo()
606 ipath_set_linkstate(dd, IPATH_IB_LINKACTIVE); in recv_subn_set_portinfo()
636 static int rm_pkey(struct ipath_devdata *dd, u16 key) in rm_pkey() argument
641 for (i = 0; i < ARRAY_SIZE(dd->ipath_pkeys); i++) { in rm_pkey()
642 if (dd->ipath_pkeys[i] != key) in rm_pkey()
644 if (atomic_dec_and_test(&dd->ipath_pkeyrefs[i])) { in rm_pkey()
645 dd->ipath_pkeys[i] = 0; in rm_pkey()
666 static int add_pkey(struct ipath_devdata *dd, u16 key) in add_pkey() argument
679 for (i = 0; i < ARRAY_SIZE(dd->ipath_pkeys); i++) { in add_pkey()
680 if (!dd->ipath_pkeys[i]) { in add_pkey()
685 if (dd->ipath_pkeys[i] == key) { in add_pkey()
686 if (atomic_inc_return(&dd->ipath_pkeyrefs[i]) > 1) { in add_pkey()
691 atomic_dec(&dd->ipath_pkeyrefs[i]); in add_pkey()
699 if ((dd->ipath_pkeys[i] & 0x7FFF) == lkey) { in add_pkey()
708 for (i = 0; i < ARRAY_SIZE(dd->ipath_pkeys); i++) { in add_pkey()
709 if (!dd->ipath_pkeys[i] && in add_pkey()
710 atomic_inc_return(&dd->ipath_pkeyrefs[i]) == 1) { in add_pkey()
713 dd->ipath_pkeys[i] = key; in add_pkey()
729 static int set_pkeys(struct ipath_devdata *dd, u16 *pkeys, u8 port) in set_pkeys() argument
736 pd = dd->ipath_pd[0]; in set_pkeys()
749 changed |= rm_pkey(dd, okey); in set_pkeys()
751 int ret = add_pkey(dd, key); in set_pkeys()
764 pkey = (u64) dd->ipath_pkeys[0] | in set_pkeys()
765 ((u64) dd->ipath_pkeys[1] << 16) | in set_pkeys()
766 ((u64) dd->ipath_pkeys[2] << 32) | in set_pkeys()
767 ((u64) dd->ipath_pkeys[3] << 48); in set_pkeys()
770 ipath_write_kreg(dd, dd->ipath_kregs->kr_partitionkey, in set_pkeys()
774 event.device = &dd->verbs_dev->ibdev; in set_pkeys()
788 unsigned i, n = ipath_get_npkeys(dev->dd); in recv_subn_set_pkeytable()
793 if (startpx != 0 || set_pkeys(dev->dd, q, port) != 0) in recv_subn_set_pkeytable()
840 struct ipath_cregs const *crp = dev->dd->ipath_cregs; in recv_pma_get_portsamplescontrol()
860 p->tick = dev->dd->ipath_link_speed_active - 1; in recv_pma_get_portsamplescontrol()
867 p->sample_status = ipath_read_creg32(dev->dd, crp->cr_psstat); in recv_pma_get_portsamplescontrol()
889 struct ipath_cregs const *crp = dev->dd->ipath_cregs; in recv_pma_set_portsamplescontrol()
903 status = ipath_read_creg32(dev->dd, crp->cr_psstat); in recv_pma_set_portsamplescontrol()
916 ipath_write_creg(dev->dd, crp->cr_psinterval, in recv_pma_set_portsamplescontrol()
918 ipath_write_creg(dev->dd, crp->cr_psstart, in recv_pma_set_portsamplescontrol()
940 ipath_read_creg32(dev->dd, crp->cr_psxmitdatacount) : in get_counter()
945 ipath_read_creg32(dev->dd, crp->cr_psrcvdatacount) : in get_counter()
950 ipath_read_creg32(dev->dd, crp->cr_psxmitpktscount) : in get_counter()
955 ipath_read_creg32(dev->dd, crp->cr_psrcvpktscount) : in get_counter()
960 ipath_read_creg32(dev->dd, crp->cr_psxmitwaitcount) : in get_counter()
976 struct ipath_cregs const *crp = dev->dd->ipath_cregs; in recv_pma_get_portsamplesresult()
983 status = ipath_read_creg32(dev->dd, crp->cr_psstat); in recv_pma_get_portsamplesresult()
1001 struct ipath_cregs const *crp = dev->dd->ipath_cregs; in recv_pma_get_portsamplesresult_ext()
1008 status = ipath_read_creg32(dev->dd, crp->cr_psstat); in recv_pma_get_portsamplesresult_ext()
1031 ipath_get_counters(dev->dd, &cntrs); in recv_pma_get_portcounters()
1130 ipath_snapshot_counters(dev->dd, &swords, &rwords, &spkts, in recv_pma_get_portcounters_ext()
1170 ipath_get_counters(dev->dd, &cntrs); in recv_pma_set_portcounters()
1229 ipath_snapshot_counters(dev->dd, &swords, &rwords, &spkts, in recv_pma_set_portcounters_ext()