mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 18:40:42 +02:00
Merge pull request #411 from slsdetectorgroup/numudp
num udp interfaces in shm
This commit is contained in:
commit
83d76267f9
@ -876,7 +876,7 @@ Result<std::string> Detector::getScanErrorMessage(Positions pos) const {
|
|||||||
|
|
||||||
Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
|
Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
|
||||||
// also called by vetostream (for gotthard2)
|
// also called by vetostream (for gotthard2)
|
||||||
return pimpl->getNumberofUDPInterfaces(pos);
|
return pimpl->Parallel(&Module::getNumberofUDPInterfacesFromShm, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
|
void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
|
||||||
@ -1744,7 +1744,7 @@ Result<defs::streamingInterface> Detector::getVetoStream(Positions pos) const {
|
|||||||
// 3gbe
|
// 3gbe
|
||||||
auto r3 = pimpl->Parallel(&Module::getVetoStream, pos);
|
auto r3 = pimpl->Parallel(&Module::getVetoStream, pos);
|
||||||
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
||||||
auto r10 = pimpl->getNumberofUDPInterfaces(pos);
|
auto r10 = getNumberofUDPInterfaces(pos);
|
||||||
|
|
||||||
Result<defs::streamingInterface> res(r3.size());
|
Result<defs::streamingInterface> res(r3.size());
|
||||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||||
@ -1766,7 +1766,7 @@ void Detector::setVetoStream(defs::streamingInterface interface,
|
|||||||
pimpl->Parallel(&Module::setVetoStream, pos, LOW_LATENCY_LINK);
|
pimpl->Parallel(&Module::setVetoStream, pos, LOW_LATENCY_LINK);
|
||||||
|
|
||||||
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
||||||
int old_numinterfaces = pimpl->getNumberofUDPInterfaces(pos).tsquash(
|
int old_numinterfaces = getNumberofUDPInterfaces(pos).tsquash(
|
||||||
"retrieved inconsistent number of udp interfaces");
|
"retrieved inconsistent number of udp interfaces");
|
||||||
int numinterfaces =
|
int numinterfaces =
|
||||||
(((interface & defs::streamingInterface::ETHERNET_10GB) ==
|
(((interface & defs::streamingInterface::ETHERNET_10GB) ==
|
||||||
@ -2356,7 +2356,7 @@ Result<ns> Detector::getMeasurementTime(Positions pos) const {
|
|||||||
std::string Detector::getUserDetails() const { return pimpl->getUserDetails(); }
|
std::string Detector::getUserDetails() const { return pimpl->getUserDetails(); }
|
||||||
|
|
||||||
std::vector<int> Detector::getPortNumbers(int start_port) {
|
std::vector<int> Detector::getPortNumbers(int start_port) {
|
||||||
int num_sockets_per_detector = pimpl->getNumberofUDPInterfaces({}).tsquash(
|
int num_sockets_per_detector = getNumberofUDPInterfaces({}).tsquash(
|
||||||
"Number of UDP Interfaces is not consistent among modules");
|
"Number of UDP Interfaces is not consistent among modules");
|
||||||
std::vector<int> res;
|
std::vector<int> res;
|
||||||
res.reserve(size());
|
res.reserve(size());
|
||||||
|
@ -245,15 +245,6 @@ void DetectorImpl::setHostname(const std::vector<std::string> &name) {
|
|||||||
addModule(hostname);
|
addModule(hostname);
|
||||||
}
|
}
|
||||||
updateDetectorSize();
|
updateDetectorSize();
|
||||||
|
|
||||||
// update zmq port (especially for eiger)
|
|
||||||
int numInterfaces = modules[0]->getNumberofUDPInterfaces();
|
|
||||||
if (numInterfaces == 2) {
|
|
||||||
for (size_t i = 0; i < modules.size(); ++i) {
|
|
||||||
modules[i]->setClientStreamingPort(DEFAULT_ZMQ_CL_PORTNO +
|
|
||||||
i * numInterfaces);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::addModule(const std::string &hostname) {
|
void DetectorImpl::addModule(const std::string &hostname) {
|
||||||
@ -295,11 +286,20 @@ void DetectorImpl::addModule(const std::string &hostname) {
|
|||||||
modules[pos]->setControlPort(port);
|
modules[pos]->setControlPort(port);
|
||||||
modules[pos]->setStopPort(port + 1);
|
modules[pos]->setStopPort(port + 1);
|
||||||
modules[pos]->setHostname(host, shm()->initialChecks);
|
modules[pos]->setHostname(host, shm()->initialChecks);
|
||||||
|
|
||||||
// module type updated by now
|
// module type updated by now
|
||||||
shm()->detType = Parallel(&Module::getDetectorType, {})
|
shm()->detType = Parallel(&Module::getDetectorType, {})
|
||||||
.tsquash("Inconsistent detector types.");
|
.tsquash("Inconsistent detector types.");
|
||||||
// for moench and ctb
|
// for moench and ctb
|
||||||
modules[pos]->updateNumberOfChannels();
|
modules[pos]->updateNumberOfChannels();
|
||||||
|
|
||||||
|
// for eiger, jungfrau, gotthard2
|
||||||
|
modules[pos]->updateNumberofUDPInterfaces();
|
||||||
|
|
||||||
|
// update zmq port in case numudpinterfaces changed
|
||||||
|
int numInterfaces = modules[pos]->getNumberofUDPInterfacesFromShm();
|
||||||
|
modules[pos]->setClientStreamingPort(DEFAULT_ZMQ_CL_PORTNO +
|
||||||
|
pos * numInterfaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::updateDetectorSize() {
|
void DetectorImpl::updateDetectorSize() {
|
||||||
@ -1368,10 +1368,6 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
sls::Result<int> DetectorImpl::getNumberofUDPInterfaces(Positions pos) const {
|
|
||||||
return Parallel(&Module::getNumberofUDPInterfaces, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
sls::Result<int> DetectorImpl::getDefaultDac(defs::dacIndex index,
|
sls::Result<int> DetectorImpl::getDefaultDac(defs::dacIndex index,
|
||||||
defs::detectorSettings sett,
|
defs::detectorSettings sett,
|
||||||
Positions pos) {
|
Positions pos) {
|
||||||
|
@ -291,7 +291,6 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
std::vector<char> readProgrammingFile(const std::string &fname);
|
std::vector<char> readProgrammingFile(const std::string &fname);
|
||||||
|
|
||||||
sls::Result<int> getNumberofUDPInterfaces(Positions pos) const;
|
|
||||||
void setNumberofUDPInterfaces(int n, Positions pos);
|
void setNumberofUDPInterfaces(int n, Positions pos);
|
||||||
sls::Result<int> getDefaultDac(defs::dacIndex index,
|
sls::Result<int> getDefaultDac(defs::dacIndex index,
|
||||||
defs::detectorSettings sett,
|
defs::detectorSettings sett,
|
||||||
|
@ -976,9 +976,8 @@ int Module::getNumberofUDPInterfacesFromShm() const {
|
|||||||
return shm()->numUDPInterfaces;
|
return shm()->numUDPInterfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getNumberofUDPInterfaces() const {
|
void Module::updateNumberofUDPInterfaces() {
|
||||||
shm()->numUDPInterfaces = sendToDetector<int>(F_GET_NUM_INTERFACES);
|
shm()->numUDPInterfaces = sendToDetector<int>(F_GET_NUM_INTERFACES);
|
||||||
return shm()->numUDPInterfaces;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setNumberofUDPInterfaces(int n) {
|
void Module::setNumberofUDPInterfaces(int n) {
|
||||||
@ -1186,7 +1185,7 @@ std::string Module::printReceiverConfiguration() {
|
|||||||
<< getReceiverHostname();
|
<< getReceiverHostname();
|
||||||
|
|
||||||
if (shm()->detType == JUNGFRAU) {
|
if (shm()->detType == JUNGFRAU) {
|
||||||
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfaces()
|
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfacesFromShm()
|
||||||
<< "\nSelected Interface:\t" << getSelectedUDPInterface();
|
<< "\nSelected Interface:\t" << getSelectedUDPInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3219,10 +3218,10 @@ void Module::initializeModuleStructure(detectorType type) {
|
|||||||
sls::strcpy_safe(shm()->rxHostname, "none");
|
sls::strcpy_safe(shm()->rxHostname, "none");
|
||||||
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
|
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
|
||||||
shm()->useReceiverFlag = false;
|
shm()->useReceiverFlag = false;
|
||||||
|
shm()->numUDPInterfaces = 1;
|
||||||
shm()->zmqport =
|
shm()->zmqport =
|
||||||
DEFAULT_ZMQ_CL_PORTNO + moduleIndex * shm()->numUDPInterfaces;
|
DEFAULT_ZMQ_CL_PORTNO + moduleIndex * shm()->numUDPInterfaces;
|
||||||
shm()->zmqip = IpAddr{};
|
shm()->zmqip = IpAddr{};
|
||||||
shm()->numUDPInterfaces = 1;
|
|
||||||
shm()->stoppedFlag = false;
|
shm()->stoppedFlag = false;
|
||||||
|
|
||||||
// get the Module parameters based on type
|
// get the Module parameters based on type
|
||||||
|
@ -219,7 +219,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
* *
|
* *
|
||||||
* ************************************************/
|
* ************************************************/
|
||||||
int getNumberofUDPInterfacesFromShm() const;
|
int getNumberofUDPInterfacesFromShm() const;
|
||||||
int getNumberofUDPInterfaces() const;
|
void updateNumberofUDPInterfaces();
|
||||||
void setNumberofUDPInterfaces(int n);
|
void setNumberofUDPInterfaces(int n);
|
||||||
int getSelectedUDPInterface() const;
|
int getSelectedUDPInterface() const;
|
||||||
void selectUDPInterface(int n);
|
void selectUDPInterface(int n);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user