Dev/fix udp headerwriting (#1656)
Build and Deploy on local RHEL9 / build (push) Successful in 2m5s
Build on RHEL9 docker image / build (push) Successful in 4m37s
Build and Deploy on local RHEL8 / build (push) Successful in 4m53s
Build on RHEL8 docker image / build (push) Successful in 5m20s
Run Simulator Tests on local RHEL9 / build (push) Failing after 8m31s
Run Simulator Tests on local RHEL8 / build (push) Failing after 10m21s

* force writing of udp header aligned and in order, fixed xilinx ctb crash on p rx_hostname

* force writing of udp header aligned and in order for all detectors

* update versions

* move udp header writing to bus_w

* compile servers

---------

Co-authored-by: Martin Mueller <martin.mueller@psi.ch>
This commit is contained in:
Martin Muellerandmuelle_m1 authored and GitHub committed 2026-11-04 16:10:17 +01:00
1 parent 8619578081
commit fce5a4cbc7
15 files changed
+84 -20

No files matched your search

@@ -2158,8 +2158,9 @@ int configureMAC() {
// start addr
uint32_t addr = RXR_ENDPOINT_START_REG;
// get struct memory
udp_header *udp = (udp_header *)(Blackfin_getBaseAddress() + addr / 2);
// build udp header
udp_header header;
udp_header *udp = &header;
memset(udp, 0, sizeof(udp_header));
// mac addresses
@@ -2191,6 +2192,13 @@ int configureMAC() {
calcChecksum(udp);
// force FPGA writes to be aligned and in order
uint32_t words[sizeof(udp_header) / sizeof(uint32_t)];
memcpy(words, udp, sizeof(udp_header));
for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) {
bus_w(addr + i * 2, words[i]);
}
cleanFifos(); // FIXME: resetPerpheral() for ctb?
resetPeripheral();
LOG(logINFO, ("Waiting for %d s for mac to be up\n",
@@ -2052,9 +2052,9 @@ void setupHeader(int iRxEntry, int vetoInterface, uint32_t destip,
iRxEntry += RXR_ENDPOINTS_MAX;
}
addr += (iRxEntry * RXR_ENDPOINT_OFST);
// get struct memory
udp_header *udp =
(udp_header *)(Nios_getBaseAddress() + addr / (sizeof(u_int32_t)));
// build udp header
udp_header header;
udp_header *udp = &header;
memset(udp, 0, sizeof(udp_header));
// mac addresses
@@ -2085,6 +2085,14 @@ void setupHeader(int iRxEntry, int vetoInterface, uint32_t destip,
// total length is redefined in firmware
calcChecksum(udp);
// force FPGA writes to be aligned and in order
uint32_t words[sizeof(udp_header) / sizeof(uint32_t)];
memcpy(words, udp, sizeof(udp_header));
for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) {
bus_w(addr + i * sizeof(uint32_t), words[i]);
}
if (iRxEntry < numUdpDestinations) {
LOG(logINFO, ("\tIP checksum : 0x%lx\n\n", udp->ip_checksum));
}
@@ -1870,8 +1870,9 @@ void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
: RXR_ENDPOINT_OUTER_START_REG);
// calculate rxr endpoint offset
addr += (iRxEntry * RXR_ENDPOINT_OFST);
// get struct memory
udp_header *udp = (udp_header *)(Blackfin_getBaseAddress() + addr / 2);
// build udp header
udp_header header;
udp_header *udp = &header;
memset(udp, 0, sizeof(udp_header));
// mac addresses
@@ -1902,6 +1903,14 @@ void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
// total length is redefined in firmware
calcChecksum(udp);
// force FPGA writes to be aligned and in order
uint32_t words[sizeof(udp_header) / sizeof(uint32_t)];
memcpy(words, udp, sizeof(udp_header));
for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) {
bus_w(addr + i * 2, words[i]);
}
if (iRxEntry < numUdpDestinations) {
LOG(logINFO, ("\tIP checksum : 0x%lx\n\n", udp->ip_checksum));
}
@@ -1203,8 +1203,9 @@ void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
: RXR_ENDPOINT_OUTER_START_REG);
// calculate rxr endpoint offset
addr += (iRxEntry * RXR_ENDPOINT_OFST);
// get struct memory
udp_header *udp = (udp_header *)(Blackfin_getBaseAddress() + addr / 2);
// build udp header
udp_header header;
udp_header *udp = &header;
memset(udp, 0, sizeof(udp_header));
// mac addresses
@@ -1235,6 +1236,14 @@ void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
// total length is redefined in firmware
calcChecksum(udp);
// force FPGA writes to be aligned and in order
uint32_t words[sizeof(udp_header) / sizeof(uint32_t)];
memcpy(words, udp, sizeof(udp_header));
for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) {
bus_w(addr + i * 2, words[i]);
}
if (iRxEntry < numUdpDestinations) {
LOG(logINFO, ("\tIP checksum : 0x%lx\n\n", udp->ip_checksum));
}
@@ -2225,9 +2225,9 @@ int configureMAC() {
uint32_t addr = BASE_UDP_RAM;
// calculate rxr endpoint offset
addr += (iRxEntry * RXR_ENDPOINT_OFST); // TODO: is there round robin
// get struct memory
udp_header *udp =
(udp_header *)(Nios_getBaseAddress() + addr / (sizeof(u_int32_t)));
// build udp header
udp_header header;
udp_header *udp = &header;
memset(udp, 0, sizeof(udp_header));
// mac addresses
@@ -2258,6 +2258,14 @@ int configureMAC() {
// total length is redefined in firmware
calcChecksum(udp);
// force FPGA writes to be aligned and in order
uint32_t words[sizeof(udp_header) / sizeof(uint32_t)];
memcpy(words, udp, sizeof(udp_header));
for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) {
bus_w(addr + i * sizeof(uint32_t), words[i]);
}
if (iRxEntry < numUdpDestinations) {
LOG(logINFO, ("\tIP checksum : 0x%lx\n\n", udp->ip_checksum));
}
@@ -6,8 +6,10 @@
#include <sys/types.h>
void bus_w(u_int32_t offset, u_int32_t data);
void bus_w_csp1(u_int32_t offset, u_int32_t data);
void bus_w_csp2(u_int32_t offset, u_int32_t data);
u_int32_t bus_r(u_int32_t offset);
u_int32_t bus_r_csp1(u_int32_t offset);
u_int32_t bus_r_csp2(u_int32_t offset);
uint64_t getU64BitReg(int aLSB, int aMSB);
void setU64BitReg(uint64_t value, int aLSB, int aMSB);
@@ -28,6 +28,18 @@ void bus_w(u_int32_t offset, u_int32_t data) {
*ptr1 = data;
}
void bus_w_csp1(u_int32_t offset, u_int32_t data) {
volatile u_int32_t *ptr1;
ptr1 = (u_int32_t *)(csp1base + offset / (sizeof(u_int32_t)));
*ptr1 = data;
}
u_int32_t bus_r_csp1(u_int32_t offset) {
volatile u_int32_t *ptr1;
ptr1 = (u_int32_t *)(csp1base + offset / (sizeof(u_int32_t)));
return *ptr1;
}
u_int32_t bus_r(u_int32_t offset) {
volatile u_int32_t *ptr1;
ptr1 = (u_int32_t *)(csp0base + offset / (sizeof(u_int32_t)));
@@ -1502,8 +1502,9 @@ int configureMAC() {
}
#endif
// get struct memory
udp_header *udp = (udp_header *)(Arm_getUDPBaseAddress());
// build udp header
udp_header header;
udp_header *udp = &header;
memset(udp, 0, sizeof(udp_header));
// mac addresses
@@ -1535,6 +1536,13 @@ int configureMAC() {
calcChecksum(udp);
// force FPGA writes to be aligned and in order
uint32_t words[sizeof(udp_header) / sizeof(uint32_t)];
memcpy(words, udp, sizeof(udp_header));
for (size_t i = 0; i != sizeof(words) / sizeof(words[0]); ++i) {
bus_w_csp1(i * sizeof(uint32_t), words[i]);
}
return OK;
}
+6 -6
View File
@@ -3,11 +3,11 @@
/** API versions */
#define APILIB "0.0.0 0x250909"
#define APIRECEIVER "0.0.0 0x250822"
#define APICTB "0.0.0 0x261028"
#define APIGOTTHARD2 "0.0.0 0x261028"
#define APIMOENCH "0.0.0 0x261028"
#define APICTB "0.0.0 0x261103"
#define APIGOTTHARD2 "0.0.0 0x261103"
#define APIMOENCH "0.0.0 0x261103"
#define APIEIGER "0.0.0 0x261027"
#define APIXILINXCTB "0.0.0 0x261028"
#define APIJUNGFRAU "0.0.0 0x261028"
#define APIMYTHEN3 "0.0.0 0x261028"
#define APIXILINXCTB "0.0.0 0x261103"
#define APIJUNGFRAU "0.0.0 0x261103"
#define APIMYTHEN3 "0.0.0 0x261103"
#define APIMATTERHORN "0.0.0 0x260529"