Skip to content

Commit ee23198

Browse files
committed
[alf] s/serial/cruSequence/g
1 parent 82fd6fa commit ee23198

File tree

11 files changed

+27
-29
lines changed

11 files changed

+27
-29
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ DIM_DNS_NODE=thedimdns.cern.ch
2020
`
2121

2222
### o2-alf-client
23-
o2-alf-client is the binary of an ALF client used solely for testing purposes. On top of the DIM Nameserver it expects the hostname of the node hosting the ALF server, the card's serial and the link number as command-line arguments. Different arguments to test different types of services are available.
23+
o2-alf-client is the binary of an ALF client used solely for testing purposes. On top of the DIM Nameserver it expects the hostname of the node hosting the ALF server, the CRU's sequence number and the link number as command-line arguments. Different arguments to test different types of services are available.
2424

2525
`
26-
o2-alf-client --dim-dns-node thedimdns.cern.ch --alf-id thealfserver --serial 0 --link 4
26+
o2-alf-client --dim-dns-node thedimdns.cern.ch --alf-id thealfserver --cru-sequence 0 --link 4
2727
`
2828

2929
## Services
3030

31-
Service names are identified by the server's hostname, the card's serial number and the link, as follows:
31+
Service names are identified by the server's hostname, the card's sequence number (as reported during ALF's startup) and the link, as follows:
3232

3333
`
34-
ALF_[hostname]/SERIAL_[serial_number]/LINK_[link]/[service_name]
34+
ALF_[hostname]/CRU_[cru_sequence_number]/LINK_[link]/[service_name]
3535
`
3636

3737
### DIM RPC services

apps/Alf.cxx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Alf : public AliceO2::Common::Program
8787
AlfServer alfServer = AlfServer();
8888

8989
std::vector<roc::CardDescriptor> cardsFound = roc::findCards();
90-
int fakeSerial = 0;
90+
int cruSequence = -1;
9191
for (auto const& card : cardsFound) {
9292
std::vector<AlfLink> links;
9393

@@ -105,14 +105,12 @@ class Alf : public AliceO2::Common::Program
105105
}
106106
}
107107

108-
//auto serialMaybe = card.serialNumber.get();
109-
//int serial = serialMaybe ? serialMaybe : fakeSerial++;
110-
int serial = fakeSerial++;
108+
cruSequence++;
111109

112-
getLogger() << "Card #" << serial << " : " << card.pciAddress << endm;
110+
getLogger() << "CRU #" << cruSequence << " : " << card.pciAddress << endm;
113111
bar2 = roc::ChannelFactory().getBar(card.pciAddress, 2);
114112
for (int linkId = 0; linkId < CRU_NUM_LINKS; linkId++) {
115-
links.push_back({ alfId, serial, linkId, bar2 });
113+
links.push_back({ alfId, cruSequence, linkId, bar2 });
116114
}
117115

118116
} else {
@@ -121,7 +119,7 @@ class Alf : public AliceO2::Common::Program
121119

122120
if (isVerbose()) {
123121
for (auto const& link : links) {
124-
getLogger() << link.alfId << " " << link.serial << " " << link.linkId << endm;
122+
getLogger() << link.alfId << " " << link.cruSequence << " " << link.linkId << endm;
125123
}
126124
}
127125

apps/AlfClient.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ class AlfClient : public AliceO2::Common::Program
5353
options.add_options()("dim-dns-node",
5454
po::value<std::string>(&mOptions.dimDnsNode)->default_value(""),
5555
"The DIM DNS node to connect to if the env var is not set");
56-
options.add_options()("serial",
57-
po::value<int>(&mOptions.serial),
58-
"CRU serial number");
56+
options.add_options()("cru-sequence",
57+
po::value<int>(&mOptions.cruSequence),
58+
"CRU sequence number");
5959
options.add_options()("link",
6060
po::value<int>(&mOptions.link),
6161
"Link number");
@@ -106,9 +106,9 @@ class AlfClient : public AliceO2::Common::Program
106106
std::string alfId = mOptions.alfId;
107107
boost::to_upper(alfId);
108108

109-
getLogger() << "Starting the DIM Client using ALF ID=" << alfId << ", serial=" << mOptions.serial << " and link=" << mOptions.link << endm;
109+
getLogger() << "Starting the DIM Client using ALF ID=" << alfId << ", cru #=" << mOptions.cruSequence << " and link=" << mOptions.link << endm;
110110

111-
AlfLink link = AlfLink{ alfId, mOptions.serial, mOptions.link, nullptr };
111+
AlfLink link = AlfLink{ alfId, mOptions.cruSequence, mOptions.link, nullptr };
112112

113113
ServiceNames names(link);
114114
Alf::RegisterReadRpc registerReadRpc(names.registerRead());
@@ -188,7 +188,7 @@ class AlfClient : public AliceO2::Common::Program
188188
private:
189189
struct OptionsStruct {
190190
std::string dimDnsNode = "";
191-
int serial = -1;
191+
int cruSequence = -1;
192192
int link = -1;
193193
std::string alfId = "";
194194
bool ic = false;

src/AlfServer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ void AlfServer::makeRpcServers(std::vector<AlfLink> links)
299299
ServiceNames names(link);
300300

301301
// Start the RPC Servers
302-
auto& servers = mRpcServers[link.serial][link.linkId];
302+
auto& servers = mRpcServers[link.cruSequence][link.linkId];
303303
std::shared_ptr<roc::BarInterface> bar2 = link.bar2;
304304

305305
if (link.linkId == 0) { // Register Read / Write services are per card; register them as soon as possible

src/AlfServer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class AlfServer
5555
static std::vector<std::pair<Swt::SwtData, Swt::Operation>> parseStringToSwtPairs(std::vector<std::string> stringPairs);
5656
static std::vector<std::pair<Ic::IcData, Ic::Operation>> parseStringToIcPairs(std::vector<std::string> stringPairs);
5757

58-
/// serial -> link -> vector of RPC servers
58+
/// cruSequence -> link -> vector of RPC servers
5959
std::map<int, std::map<int, std::vector<std::unique_ptr<StringRpcServer>>>> mRpcServers;
6060
};
6161

src/Common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static constexpr auto CHANNEL_BUSY_TIMEOUT = std::chrono::milliseconds(10);
3333

3434
struct AlfLink {
3535
std::string alfId;
36-
int serial;
36+
int cruSequence;
3737
int linkId;
3838
std::shared_ptr<roc::BarInterface> bar2;
3939
};

src/DimServices/ServiceNames.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ DEFLINKSERVICENAME(icGbtI2cWrite, "IC_GBT_I2C_WRITE")
4343

4444
std::string ServiceNames::formatLink(std::string name) const
4545
{
46-
return ((boost::format("ALF_%1%/SERIAL_%2%/LINK_%3%/%4%") % mAlfId % mSerial % mLink % name)).str();
46+
return ((boost::format("ALF_%1%/CRU_%2%/LINK_%3%/%4%") % mAlfId % mCruSequence % mLink % name)).str();
4747
}
4848

4949
std::string ServiceNames::format(std::string name) const
5050
{
51-
return ((boost::format("ALF_%1%/SERIAL_%2%/%3%") % mAlfId % mSerial % name)).str();
51+
return ((boost::format("ALF_%1%/CRU_%2%/%3%") % mAlfId % mCruSequence % name)).str();
5252
}
5353

5454
} // namespace Alf

src/DimServices/ServiceNames.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ServiceNames
2929
{
3030
public:
3131
ServiceNames(AlfLink link)
32-
: mAlfId(link.alfId), mSerial(link.serial), mLink(link.linkId)
32+
: mAlfId(link.alfId), mCruSequence(link.cruSequence), mLink(link.linkId)
3333
{
3434
}
3535

@@ -44,7 +44,7 @@ class ServiceNames
4444
std::string formatLink(std::string name) const;
4545
std::string format(std::string name) const;
4646
std::string mAlfId;
47-
const int mSerial;
47+
const int mCruSequence;
4848
const int mLink;
4949
};
5050

src/Ic/Ic.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ std::string Ic::writeSequence(std::vector<std::pair<IcData, Operation>> ops)
166166
} catch (const SwtException& e) {
167167
// If an IC error occurs, we stop executing the sequence of commands and return the results as far as we got them, plus
168168
// the error message.
169-
std::string meaningfulMessage = (boost::format("ic_regs::IC_SEQUENCE address=0x%08x data=0x%08x serial=%d link=%d, error='%s'") % icData.address % icData.data % mLink.serial % mLink.linkId % e.what()).str();
169+
std::string meaningfulMessage = (boost::format("ic_regs::IC_SEQUENCE address=0x%08x data=0x%08x cruSequence=%d link=%d, error='%s'") % icData.address % icData.data % mLink.cruSequence % mLink.linkId % e.what()).str();
170170
getErrorLogger() << meaningfulMessage << endm;
171171
resultBuffer << meaningfulMessage;
172172
BOOST_THROW_EXCEPTION(IcException() << ErrorInfo::Message(resultBuffer.str()));

src/Sca/Sca.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ std::string Sca::writeSequence(const std::vector<CommandData>& commands)
244244
} catch (const ScaException& e) {
245245
// If an SCA error occurs, we stop executing the sequence of commands and return the results as far as we got
246246
// them, plus the error message.
247-
std::string meaningfulMessage = (boost::format("SCA_SEQUENCE cmd=0x%08x data=0x%08x serial=%d link=%d error='%s'") % commandData.command % commandData.data % mLink.serial % mLink.linkId % e.what()).str();
247+
std::string meaningfulMessage = (boost::format("SCA_SEQUENCE cmd=0x%08x data=0x%08x cruSequence=%d link=%d error='%s'") % commandData.command % commandData.data % mLink.cruSequence % mLink.linkId % e.what()).str();
248248
getErrorLogger() << meaningfulMessage << endm;
249249
resultBuffer << meaningfulMessage;
250250
BOOST_THROW_EXCEPTION(ScaException() << ErrorInfo::Message(resultBuffer.str()));

0 commit comments

Comments
 (0)