@@ -35,7 +35,6 @@ using Link = Cru::Link;
3535
3636CruBar::CruBar (const Parameters& parameters)
3737 : BarInterfaceBase(parameters),
38- mAllowRejection (parameters.getAllowRejection().get_value_or(false )),
3938 mClock (parameters.getClock().get_value_or(Clock::Local)),
4039 mCruId(parameters.getCruId().get_value_or(0x0 )),
4140 mDatapathMode(parameters.getDatapathMode().get_value_or(DatapathMode::Packet)),
@@ -56,6 +55,12 @@ CruBar::CruBar(const Parameters& parameters)
5655 } else { // default to disabled
5756 mLoopback = 0x0 ;
5857 }
58+
59+ if (parameters.getAllowRejection () == true ) {
60+ mAllowRejection = 0x1 ;
61+ } else {
62+ mAllowRejection = 0x0 ;
63+ }
5964}
6065
6166CruBar::CruBar (std::shared_ptr<Pda::PdaBar> bar)
@@ -451,6 +456,7 @@ Cru::ReportInfo CruBar::report()
451456 auto & link = el.second ;
452457 link.datapathMode = datapathWrapper.getDatapathMode (link);
453458 link.enabled = datapathWrapper.getLinkEnabled (link);
459+ link.allowRejection = datapathWrapper.getFlowControl (link.dwrapper );
454460 link.stickyBit = gbt.getStickyBit (link);
455461 link.rxFreq = gbt.getRxClockFrequency (link) / 1e6 ; // Hz -> Mhz
456462 link.txFreq = gbt.getTxClockFrequency (link) / 1e6 ; // Hz -> Mhz
@@ -476,7 +482,7 @@ Cru::ReportInfo CruBar::report()
476482 downstreamData,
477483 ponStatusRegister,
478484 onuAddress,
479- cruId
485+ cruId,
480486 };
481487
482488 return reportInfo;
@@ -493,7 +499,7 @@ void CruBar::reconfigure()
493499 static_cast <uint32_t >(mDownstreamData ) == reportInfo.downstreamData &&
494500 std::equal (mLinkMap .begin (), mLinkMap .end (), reportInfo.linkMap .begin ()) &&
495501 checkPonUpstreamStatusExpected (reportInfo.ponStatusRegister , reportInfo.onuAddress ) &&
496- mCruId == reportInfo.cruId ){
502+ mCruId == reportInfo.cruId ) {
497503 log (" No need to reconfigure further" );
498504 } else {
499505 log (" Reconfiguring" );
@@ -542,20 +548,18 @@ void CruBar::configure()
542548 datapathWrapper.setLinksEnabled (0 , 0x0 );
543549 datapathWrapper.setLinksEnabled (1 , 0x0 );
544550
545- log (" Enabling links and setting datapath mode" );
551+ log (" Enabling links and setting datapath mode and flow control " );
546552 for (auto const & el: mLinkMap ) {
547553 auto & link = el.second ;
548554 if (link.enabled ) {
549555 datapathWrapper.setLinkEnabled (link);
550556 datapathWrapper.setDatapathMode (link, mDatapathMode );
551557 }
558+ datapathWrapper.setFlowControl (link.dwrapper , mAllowRejection ); // Set flow control anyway as it's per dwrapper
552559 }
553560
554- log (" Setting packet arbitration and flow control " );
561+ log (" Setting packet arbitration" );
555562 datapathWrapper.setPacketArbitration (mWrapperCount , 0 );
556- if (mAllowRejection ) {
557- datapathWrapper.setFlowControl (0 , 1 );
558- }
559563
560564 log (" CRU configuration done." );
561565}
@@ -669,6 +673,7 @@ void CruBar::populateLinkMap(std::map<int, Link> &linkMap)
669673 gbt.setMux (el.first , link.gbtMux );
670674
671675 link.datapathMode = mDatapathMode ;
676+ link.allowRejection = mAllowRejection ;
672677 }
673678 }
674679}
0 commit comments