Skip to content

Commit 8bcffe9

Browse files
authored
Merge pull request #422 from sy-c/master
v0.45.2
2 parents 7bf9e5f + 7b2e596 commit 8bcffe9

22 files changed

+120
-25
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ The Parameters that affect the configuration of the CRU, their possible values (
211211

212212
`UserLogicEnabled (true | false) [false]`
213213

214+
`DropBadRdhEnabled (true | false) [false]`
215+
214216
To set any of the above parameters the usual template can be followed.
215217

216218
```
@@ -228,7 +230,7 @@ params.setClock(Parameters::Clock::type::Local);
228230
The above parameters will be set for the enabled links, as specified by the `LinkMask` parameter. See the [LinkMask](#linkmask) section
229231
for more info.
230232

231-
Note that for `AllowRejection`, `LinkLoopbackEnabled`, `PonUpstreamEnabled`, `DynamicOffsetEnabled`, `GbtEnabled` and `UserLogicEnabled` it is sufficient to do the following, as they are simply booleans.
233+
Note that for `AllowRejection`, `LinkLoopbackEnabled`, `PonUpstreamEnabled`, `DynamicOffsetEnabled`, `GbtEnabled`, `UserLogicEnabled`, `DropBadRdhEnabled` it is sufficient to do the following, as they are simply booleans.
232234

233235
```
234236
params.setAllowRejection(true);
@@ -269,6 +271,7 @@ dynamicOffsetEnabled
269271
triggerWindowSize
270272
gbtEnabled
271273
UserLogicEnabled
274+
DropBadRdhEnabled
272275
```
273276

274277
The "per link" parameters are

cru_template.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ systemId=0xfd
6262
# Time Frame Length [0-255]
6363
timeFrameLength=255
6464

65+
# Drop packets with bad RDH
66+
dropBadRdhEnabled=false
67+
6568
#############################################
6669
# links
6770
#############################################

cru_template.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"runStatsEnabled": "false",
1717
"userAndCommonLogicEnabled": "false",
1818
"systemId": "0x0",
19-
"timeFrameLength": "256"
19+
"timeFrameLength": "256",
20+
"dropBadRdhEnabled": "false"
2021
},
2122
"links": {
2223
"enabled": "false",

doc/releaseNotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,7 @@ This file describes the main feature changes for released versions of ReadoutCar
7373

7474
## v0.45.1 - 24/01/2024
7575
- o2-roc-list-cards: get NUMA card info from system instead of PDA PciDevice_getNumaNode() function, which reports wrong node for RH8. Fix also applies to field in RocPciDevice internal class.
76+
77+
## v0.45.2 - 29/05/2024
78+
- Updated list of firmwares.
79+
- Added CRU option dropBadRdhEnabled.

include/ReadoutCard/Parameters.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ class Parameters
162162
// Type for the Time Frame Length parameter
163163
using TimeFrameLengthType = uint32_t;
164164

165+
/// Type for the Drop RDH enabled parameter
166+
using DropBadRdhEnabledType = bool;
167+
165168
/// Type for the Time Frame Detection enabled parameter
166169
using TimeFrameDetectionEnabledType = bool;
167170

@@ -477,6 +480,12 @@ class Parameters
477480
/// \return Reference to this object for chaining calls
478481
auto setTimeFrameLength(TimeFrameLengthType value) -> Parameters&;
479482

483+
/// Sets the DropBadRdhEnabled parameter
484+
///
485+
/// \param value The value to set
486+
/// \return Reference to this object for chaining calls
487+
auto setDropBadRdhEnabled(DropBadRdhEnabledType value) -> Parameters&;
488+
480489
/// Sets the TimeFrameDetectionEnabled parameter
481490
///
482491
/// \param value The value to set
@@ -634,6 +643,10 @@ class Parameters
634643
/// \return The value wrapped in an optional if it is present, or an empty optional if it was not
635644
auto getTimeFrameLength() const -> boost::optional<TimeFrameLengthType>;
636645

646+
/// Gets the DropBadRdhEnabled parameter
647+
/// \return The value wrapped in an optional if it is present, or an empty optional if it was not
648+
auto getDropBadRdhEnabled() const -> boost::optional<DropBadRdhEnabledType>;
649+
637650
/// Gets the TimeFrameDetectionEnabled parameter
638651
/// \return The value wrapped in an optional if it is present, or an empty optional if it was not
639652
auto getTimeFrameDetectionEnabled() const -> boost::optional<TimeFrameDetectionEnabledType>;
@@ -817,6 +830,11 @@ class Parameters
817830
/// \return The value
818831
auto getTimeFrameLengthRequired() const -> TimeFrameLengthType;
819832

833+
/// Gets the DropBadRdhEnabled parameter
834+
/// \exception ParameterException The parameter was not present
835+
/// \return The value
836+
auto getDropBadRdhEnabledRequired() const -> DropBadRdhEnabledType;
837+
820838
/// Gets the TimeFrameDetectionEnabled parameter
821839
/// \exception ParameterException The parameter was not present
822840
/// \return The value

src/BarInterfaceBase.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ class BarInterfaceBase : public BarInterface
131131
/// Convenience function for InfoLogger
132132
void log(const std::string& logMessage, ILMessageOption = LogInfoDevel);
133133

134+
/// Get a string descriptor, to be used for logs or exceptions
135+
const std::string &getLoggerPrefix() {
136+
return mLoggerPrefix;
137+
};
138+
134139
private:
135140
/// Inheriting classes must implement this to check whether a given read is safe.
136141
/// If it is not safe, it should throw an UnsafeReadAccess exception

src/CardConfigurator.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ void CardConfigurator::parseConfigUriCru(std::string configUri, Parameters& para
142142
bool userAndCommonLogicEnabled = false;
143143
uint32_t systemId = 0x0;
144144
uint16_t timeFrameLength = 0x100;
145+
bool dropBadRdhEnabled = false;
145146

146147
bool enabled = false;
147148
std::string gbtMux = "ttc";
@@ -198,6 +199,7 @@ void CardConfigurator::parseConfigUriCru(std::string configUri, Parameters& para
198199
systemId = Hex::fromString(parsedString);
199200

200201
timeFrameLength = subtree.get<int>("timeFrameLength");
202+
dropBadRdhEnabled = subtree.get<bool>("dropBadRdhEnabled");
201203

202204
parameters.setClock(clock);
203205
parameters.setDatapathMode(datapathMode);
@@ -216,6 +218,8 @@ void CardConfigurator::parseConfigUriCru(std::string configUri, Parameters& para
216218
parameters.setUserAndCommonLogicEnabled(userAndCommonLogicEnabled);
217219
parameters.setSystemId(systemId);
218220
parameters.setTimeFrameLength(timeFrameLength);
221+
parameters.setDropBadRdhEnabled(dropBadRdhEnabled);
222+
219223
} else if (group == "links") { // Configure all links with default values
220224

221225
enabled = subtree.get<bool>("enabled");

src/CommandLineUtilities/ProgramConfig.cxx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ std::string getStatusReport(Parameters::CardIdType cardId)
116116
std::string userLogic = (reportInfo.userLogicEnabled ? "Enabled" : "Disabled");
117117
std::string runStats = (reportInfo.runStatsEnabled ? "Enabled" : "Disabled");
118118
std::string userAndCommonLogic = (reportInfo.userAndCommonLogicEnabled ? "Enabled" : "Disabled");
119+
std::string dropBadRdh = (reportInfo.dropBadRdhEnabled ? "Enabled" : "Disabled");
119120

120121
table << "-----------------------------" << std::endl;
121122
table << "CRU ID: " << reportInfo.cruId << std::endl;
@@ -130,6 +131,9 @@ std::string getStatusReport(Parameters::CardIdType cardId)
130131
if (reportInfo.runStatsEnabled) {
131132
table << "Run statistics enabled" << std::endl;
132133
}
134+
if (reportInfo.dropBadRdhEnabled) {
135+
table << "Drop packets with bad RDH enabled" << std::endl;
136+
}
133137

134138
Cru::OnuStatus onuStatus = cruBar2->reportOnuStatus(0);
135139

@@ -315,6 +319,9 @@ class ProgramConfig : public Program
315319
options.add_options()("status-report",
316320
po::value<std::string>(&mOptions.statusReport),
317321
"Sets file where to output card status (similar to roc-status). Can be stdout, infologger, or a file name. The file name can be preceded with + for appending the file. Name can contain special escape sequences %t (timestamp) %T (date/time) or %i (card ID). Infologger reports are set with error code 4805.");
322+
options.add_options()("drop-bad-rdh",
323+
po::bool_switch(&mOptions.dropBadRdhEnabled),
324+
"Flag to enable dropping of packets with bad RDH");
318325
Options::addOptionCardId(options);
319326
}
320327

@@ -480,6 +487,7 @@ class ProgramConfig : public Program
480487
params.setTimeFrameDetectionEnabled(!mOptions.timeFrameDetectionDisabled);
481488
params.setSystemId(strtoul(mOptions.systemId.c_str(), NULL, 16));
482489
params.setFeeId(strtoul(mOptions.feeId.c_str(), NULL, 16));
490+
params.setDropBadRdhEnabled(mOptions.dropBadRdhEnabled);
483491

484492
// Generate a configuration file base on the parameters provided
485493
if (mOptions.genConfigFile != "") { //TODO: To be updated for the CRORC
@@ -506,6 +514,7 @@ class ProgramConfig : public Program
506514
//cfgFile << "timeFrameDetectionEnabled=" << std::boolalpha << !mOptions.timeFrameDetectionDisabled << "\n";
507515
cfgFile << "systemId=" << mOptions.systemId << "\n";
508516
cfgFile << "timeFrameLength=" << mOptions.timeFrameLength << "\n";
517+
cfgFile << "dropBadRdhEnabled=" << std::boolalpha << mOptions.dropBadRdhEnabled << "\n";
509518

510519
cfgFile << "[links]\n";
511520
cfgFile << "enabled=false\n";
@@ -589,6 +598,7 @@ class ProgramConfig : public Program
589598
std::string statusReport = ""; // when set, output roc status to file
590599
/*std::string systemId = "0x1ff"; // TODO: Default values that can be used to check if params have been specified
591600
std::string feeId = "0x1f";*/
601+
bool dropBadRdhEnabled = false;
592602
} mOptions;
593603

594604
private:

src/CommandLineUtilities/ProgramStatus.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ class ProgramStatus : public Program
211211
std::string runStats = (reportInfo.runStatsEnabled ? "Enabled" : "Disabled");
212212
std::string userAndCommonLogic = (reportInfo.userAndCommonLogicEnabled ? "Enabled" : "Disabled");
213213
std::string dmaStatus = reportInfo.dmaStatus ? "Enabled" : "Disabled";
214+
std::string dropBadRdh = (reportInfo.dropBadRdhEnabled ? "Enabled" : "Disabled");
214215

215216
/* GENERAL PARAMETERS */
216217
if (mOptions.monitoring) {
@@ -240,6 +241,7 @@ class ProgramStatus : public Program
240241
root.put("userAndCommonLogic", userAndCommonLogic);
241242
root.put("timeFrameLength", reportInfo.timeFrameLength);
242243
root.put("dmaStatus", dmaStatus);
244+
root.put("dropBadRdh", dropBadRdh);
243245
} else {
244246
std::cout << "-----------------------------" << std::endl;
245247
std::cout << "CRU ID: " << reportInfo.cruId << std::endl;
@@ -255,6 +257,9 @@ class ProgramStatus : public Program
255257
std::cout << "Run statistics enabled" << std::endl;
256258
}
257259
std::cout << "DMA: "<< dmaStatus << std::endl;
260+
if (reportInfo.dropBadRdhEnabled) {
261+
std::cout << "Drop packets with bad RDH enabled" << std::endl;
262+
}
258263
}
259264

260265
/* ONU PARAMETERS */

src/Crorc/CrorcBar.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ void CrorcBar::assertLinkUp()
191191
}
192192

193193
if (!checkLinkUp()) {
194-
BOOST_THROW_EXCEPTION(CrorcCheckLinkException() << ErrorInfo::Message("Link was not up"));
194+
BOOST_THROW_EXCEPTION(CrorcCheckLinkException() << ErrorInfo::Message(getLoggerPrefix() + "Link was not up"));
195195
}
196196
}
197197

@@ -238,7 +238,7 @@ bool CrorcBar::getDynamicOffsetEnabled()
238238
void CrorcBar::setTimeFrameLength(uint16_t timeFrameLength)
239239
{
240240
if (timeFrameLength > 256) {
241-
BOOST_THROW_EXCEPTION(Exception() << ErrorInfo::Message("BAD TF LENGTH, should be less or equal to 256") << ErrorInfo::ConfigValue(timeFrameLength));
241+
BOOST_THROW_EXCEPTION(Exception() << ErrorInfo::Message(getLoggerPrefix() + "BAD TF LENGTH, should be less or equal to 256") << ErrorInfo::ConfigValue(timeFrameLength));
242242
}
243243
modifyRegister(Crorc::Registers::CFG_CONTROL_B.index, 0, 11, timeFrameLength);
244244
}
@@ -299,7 +299,7 @@ void CrorcBar::sendDdlCommand(uint32_t address, uint32_t command)
299299
while ((std::chrono::steady_clock::now() < timeOut) && !checkFifoEmpty()) {
300300
}
301301
if (!checkFifoEmpty()) {
302-
BOOST_THROW_EXCEPTION(CrorcCheckLinkException() << ErrorInfo::Message("Link was not up"));
302+
BOOST_THROW_EXCEPTION(CrorcCheckLinkException() << ErrorInfo::Message(getLoggerPrefix() + "Link was not up"));
303303
} else {
304304
readRegister(Crorc::Registers::DDL_STATUS.index);
305305
}

0 commit comments

Comments
 (0)