diff --git a/MAC/APL/PIC/RSPDriver/src/CDOWrite.cc b/MAC/APL/PIC/RSPDriver/src/CDOWrite.cc index d474fd6b64f569c0852b3504f89a3c2dba5a3550..7c8eb8682245d4655af868aabd5e888952b7933d 100644 --- a/MAC/APL/PIC/RSPDriver/src/CDOWrite.cc +++ b/MAC/APL/PIC/RSPDriver/src/CDOWrite.cc @@ -66,19 +66,8 @@ uint32 CDOWrite::string2ip(const char* ipstring) return result; } -void CDOWrite::setup_udpip_header() +void CDOWrite::setup_udpip_header(uint32 l_srcip, uint32 l_dstip) { - uint32 l_srcip; - uint32 l_dstip; - - char dstip[64]; - char srcip[64]; - snprintf(srcip, 64, "RSPDriver.SRC_IP_ADDR_%d", getBoardId()); - snprintf(dstip, 64, "RSPDriver.DST_IP_ADDR_%d", getBoardId()); - - l_srcip = string2ip(GET_CONFIG_STRING(srcip)); - l_dstip = string2ip(GET_CONFIG_STRING(dstip)); - uint32 payload_size = EPA_CEP_OUTPUT_HEADER_SIZE + (GET_CONFIG("RSPDriver.CDO_N_BLOCKS", i) * (MEPHeader::N_PHASEPOL * GET_CONFIG("RSPDriver.CDO_N_BEAMLETS", i)) @@ -151,11 +140,11 @@ void CDOWrite::sendrequest() { // skip update if the CDO settings have not been modified if (RTC::RegisterState::WRITE != Cache::getInstance().getState().cdo().get(getBoardId() * getNumIndices() + getCurrentIndex())) - { - Cache::getInstance().getState().cdo().unmodified(getBoardId() * getNumIndices() + getCurrentIndex()); - setContinue(true); - return; - } + { + Cache::getInstance().getState().cdo().unmodified(getBoardId() * getNumIndices() + getCurrentIndex()); + setContinue(true); + return; + } switch (getCurrentIndex()) { @@ -186,19 +175,32 @@ void CDOWrite::sendrequest() cdo.nof_beamlets = GET_CONFIG("RSPDriver.CDO_N_BEAMLETS", i); if (output_lane >= 0) { - cdo.control.enable = 1; - cdo.control.lane = output_lane; - char srcmac[64]; snprintf(srcmac, 64, GET_CONFIG_STRING("RSPDriver.CDO_SRCMAC_FORMAT"), - GET_CONFIG("RS.STATION_ID", i), getBoardId()); - char dstmac[64]; snprintf(dstmac, 64, "RSPDriver.DST_MAC_ADDR_%d", getBoardId()); + + // parse source and destination MAC- and IP-addresses + char srcmacfmt[64], srcmac[64], dstmac[64], dstip[64], srcip[64]; + uint32 l_srcip, l_dstip; + + snprintf(srcmacfmt, 64, "RSPDriver.LANE_%d_SRCMAC", output_lane); + snprintf(srcmac, 64, srcmacfmt, GET_CONFIG("RS.STATION_ID", i)); + snprintf(dstmac, 64, "RSPDriver.LANE_%d_DSTMAC", output_lane); + snprintf(srcip, 64, "RSPDriver.LANE_%d_SRCIP", output_lane); + snprintf(dstip, 64, "RSPDriver.LANE_%d_DSTIP", output_lane); + l_srcip = string2ip(GET_CONFIG_STRING(srcip)); + l_dstip = string2ip(GET_CONFIG_STRING(dstip)); + + LOG_INFO(formatString("CDO: lane=%d, src=[%s,%s], dst=[%d,%d]", + output_lane, srcmac, srcip, dstmac, dstip)); + + // settings + cdo.control.enable = 1; + cdo.control.lane = output_lane; + + // set source and destination MAC address string2mac(srcmac, cdo.src_mac); string2mac(GET_CONFIG_STRING(dstmac), cdo.dst_mac); - LOG_INFO_STR("SRC_MAC lane=" << output_lane << " rspboard=" << getBoardId() - << " srcmac=" << srcmac << " dstmac=" << GET_CONFIG_STRING(dstmac)); - // setup UDP/IP header - setup_udpip_header(); + setup_udpip_header(l_srcip, l_dstip); } else { cdo.control.enable = 0; diff --git a/MAC/APL/PIC/RSPDriver/src/CDOWrite.h b/MAC/APL/PIC/RSPDriver/src/CDOWrite.h index 8e336f31c60f4054a0315b556380cc0ae8df95c0..c33d776957637670c4cbd674e0a2cb5c9acee471 100644 --- a/MAC/APL/PIC/RSPDriver/src/CDOWrite.h +++ b/MAC/APL/PIC/RSPDriver/src/CDOWrite.h @@ -78,7 +78,7 @@ namespace LOFAR { /** * Setup an appropriate UDP/IP header */ - void setup_udpip_header(); + void setup_udpip_header(uint32 l_srcip, uint32 l_dstip); /** * Compute the 16-bit 1-complements checksum for the IP header. diff --git a/MAC/APL/PIC/RSPDriver/src/RSPDriver.conf.in b/MAC/APL/PIC/RSPDriver/src/RSPDriver.conf.in index 1b4b88b88fca0dbf98a5131136f8e1b57568835e..3d6c9da90d54706ba488ac2c6ce25bb47ad5624b 100644 --- a/MAC/APL/PIC/RSPDriver/src/RSPDriver.conf.in +++ b/MAC/APL/PIC/RSPDriver/src/RSPDriver.conf.in @@ -38,7 +38,7 @@ RSPDriver.PPS_DELAY=0 RSPDriver.PPS_TRIGGER=1 # -# Specify MAC addresses of the RSP boards explicitly +# Specify the MAC addresses of the control port (MAC) of RSP boards # RSPDriver.MAC_ADDR_0=10:FA:00:00:11:00 RSPDriver.MAC_ADDR_1=10:FA:00:00:12:00 @@ -66,39 +66,80 @@ RSPDriver.MAC_ADDR_22=10:FA:00:00:16:00 RSPDriver.MAC_ADDR_23=10:FA:00:00:17:00 # -# Serdes lane settings. +# CEP Output settings (CDO) for the four lanes # -# Define the end of the four SERDES rings. The boards -# not defined as end of the lane will pass on their -# cross-correlation or beamlet data to the neighbour board. +# Each station has up to four output lanes, corresponding +# to the four (logical) SERDES lanes that connect all the +# RSP boards in a station in a ring. # -# This also defines which RSP board will output data from which -# lane on its CDO port (CDO = CEP Data Output). +# LANE_x_BLET_OUT, LANE_x_XLET_OUT +# -------------------------------- +# These settings determine which RSP board outputs beamlets (BLET) +# and crosslets (XLET) of lane x on the CEP output port. Currently +# (and this probably won't be changed) the BLET and XLET setting must +# be identical per lane, e.g. if LANE_0_BLET_OUT is X, then +# LANE_0_XLET_OUT must also be X. This setting controls the setting +# of the RAD register. The RSP board immediately following +# the output board will ignore input data thus creating a route from +# first to last board the latter being the output board. # # Complete beamforming and cross-correlation data and statistics -# will be available on the last RSP board in a ring. -# All other boards in the ring will produce partial -# data and statistics. -# -# Assuming the index of the last RSP board is N, then -# the ring starts at RSP board (N - 1) % N_RSPBOARDS +# will be available only on the last RSP board in a ring (the output board). +# All other boards in the ring will produce partial data and statistics. # # Note: the specified RSP board index will be taken # modulo N_RSPBOARDS to prevent out of range indices. # -# Setting IGNORE_REMOTE_DATA to 1 will force all boards -# to ignore remote data. This can be used to check -# for difference between operation with data from SERDES -# ring and without. +# LANE_x_SRCMAC, LANE_x_SRCIP, LANE_x_DSTMAC, LANE_x_DSTIP +# -------------------------------------------------------- +# Output of RSP boards is packaged in UDP/IP packets. These +# packets need a source MAC- and IP-address and a destination +# MAC- and IP-address. +# +# The RSP board that outputs lane x will use the MAC- and IP- +# addresses specified here. Note that changing the output +# lane of beamlet LANE_x_BLET_OUT to a different +# RSP board will move these addresses to the new RSP board. +# Only RSP boards that are assigned output of one of the four +# lanes will produce ethernet packets and use these MAC- and +# IP-addresses. # RSPDriver.LANE_0_BLET_OUT=0 -RSPDriver.LANE_1_BLET_OUT=1 -RSPDriver.LANE_2_BLET_OUT=2 -RSPDriver.LANE_3_BLET_OUT=3 RSPDriver.LANE_0_XLET_OUT=0 +RSPDriver.LANE_0_SRCMAC=10:fa:00:%02x:00:01 +RSPDriver.LANE_0_SRCIP=10.10.0.1 +RSPDriver.LANE_0_DSTMAC=00:E0:81:34:93:3B +RSPDriver.LANE_0_DSTIP=10.170.0.1 + +RSPDriver.LANE_1_BLET_OUT=1 RSPDriver.LANE_1_XLET_OUT=1 +RSPDriver.LANE_1_SRCMAC=10:fa:00:%02x:00:02 +RSPDriver.LANE_1_SRCIP=10.10.0.2 +RSPDriver.LANE_1_DSTMAC=00:E0:81:34:93:3B +RSPDriver.LANE_1_DSTIP=10.170.0.2 + +RSPDriver.LANE_2_BLET_OUT=2 RSPDriver.LANE_2_XLET_OUT=2 +RSPDriver.LANE_2_SRCMAC=10:fa:00:%02x:00:03 +RSPDriver.LANE_2_SRCIP=10.10.0.3 +RSPDriver.LANE_2_DSTMAC=00:E0:81:31:B0:E1 +RSPDriver.LANE_2_DSTIP=10.170.0.3 + +RSPDriver.LANE_3_BLET_OUT=3 RSPDriver.LANE_3_XLET_OUT=3 +RSPDriver.LANE_3_SRCMAC=10:fa:00:%02x:00:04 +RSPDriver.LANE_3_SRCIP=10.10.0.4 +RSPDriver.LANE_3_DSTMAC=00:E0:81:31:B2:F5 +RSPDriver.LANE_3_DSTIP=10.170.0.4 + +# +# IGNORE_REMOTE_DATA +# ------------------ +# Setting IGNORE_REMOTE_DATA to 1 will force all boards +# to ignore remote data. This can be used to check +# for difference between operation with data from SERDES +# ring and without. +# RSPDriver.IGNORE_REMOTE_DATA=0 # @@ -109,87 +150,10 @@ RSPDriver.IGNORE_REMOTE_DATA=0 # CDO_ENABLE=(0|1) : when 0 disable output on all RSP boards # CDO_N_BLOCKS=(N) : Set number of blocks of N_BEAMLETS beamlets per output Ethernet frame # CDO_N_BEAMLETS=(N) : Set number of beamlets to output in each block -# CDO_SRCMAC_FORMAT : Template for the src mac address of the boards that output data to CEP -# First %02x will be replaced by station id, second by RSP board index, -# e.g. Station 14, RSP board 3 will be: 10:FA:00:0E:03:01 # RSPDriver.CDO_ENABLE=1 RSPDriver.CDO_N_BLOCKS=16 RSPDriver.CDO_N_BEAMLETS=40 -RSPDriver.CDO_SRCMAC_FORMAT=10:FA:00:%02x:01:%02x - -# -# Destination MAC addresses configuration -# for output RSP boards -# Must match with MAC addresses of CEP input nodes -# -# Uncomment only the lines for the specific station -# on which the configuration file is used. -# - -# FTS-1 -#RSPDriver.DST_MAC_ADDR_0=00:E0:81:31:DE:8A -#RSPDriver.DST_MAC_ADDR_1=00:E0:81:31:DF:D4 - -# CS01: -#RSPDriver.DST_MAC_ADDR_0=00:E0:81:34:8C:D1 -#RSPDriver.DST_MAC_ADDR_1=00:E0:81:34:8C:D1 -#RSPDriver.DST_MAC_ADDR_2=00:E0:81:34:9B:87 -#RSPDriver.DST_MAC_ADDR_3=00:E0:81:31:B3:27 - -# CS08: -#RSPDriver.DST_MAC_ADDR_0=00:E0:81:31:DE:8B -#RSPDriver.DST_MAC_ADDR_1=00:E0:81:31:DE:8B -#RSPDriver.DST_MAC_ADDR_2=00:E0:81:29:20:37 -#RSPDriver.DST_MAC_ADDR_3=00:E0:81:31:DE:9B - -# CS16: -#RSPDriver.DST_MAC_ADDR_0=00:E0:81:31:DF:D5 -#RSPDriver.DST_MAC_ADDR_1=00:E0:81:31:DF:D5 -#RSPDriver.DST_MAC_ADDR_2=00:E0:81:34:92:11 -#RSPDriver.DST_MAC_ADDR_3=00:E0:81:31:B2:15 - -# CS10: -RSPDriver.DST_MAC_ADDR_0=00:E0:81:34:93:3B -RSPDriver.DST_MAC_ADDR_1=00:E0:81:34:93:3B -RSPDriver.DST_MAC_ADDR_2=00:E0:81:31:B0:E1 -RSPDriver.DST_MAC_ADDR_3=00:E0:81:31:B2:F5 - -# -# EOF Destination MAC address configuration -# - -# -# Source IP address in UDP header for each RSP board -# -RSPDriver.SRC_IP_ADDR_0=10.10.0.1 -RSPDriver.SRC_IP_ADDR_1=10.10.0.2 -RSPDriver.SRC_IP_ADDR_2=10.10.0.3 -RSPDriver.SRC_IP_ADDR_3=10.10.0.4 -RSPDriver.SRC_IP_ADDR_4=10.10.0.5 -RSPDriver.SRC_IP_ADDR_5=10.10.0.6 -RSPDriver.SRC_IP_ADDR_6=10.10.0.7 -RSPDriver.SRC_IP_ADDR_7=10.10.0.8 -RSPDriver.SRC_IP_ADDR_8=10.10.0.9 -RSPDriver.SRC_IP_ADDR_9=10.10.0.10 -RSPDriver.SRC_IP_ADDR_10=10.10.0.11 -RSPDriver.SRC_IP_ADDR_11=10.10.0.12 - -# -# Destination IP adress in UDP header for each RSP board -# -RSPDriver.DST_IP_ADDR_0=10.170.0.1 -RSPDriver.DST_IP_ADDR_1=10.170.0.2 -RSPDriver.DST_IP_ADDR_2=10.170.0.3 -RSPDriver.DST_IP_ADDR_3=10.170.0.4 -RSPDriver.DST_IP_ADDR_4=10.170.0.5 -RSPDriver.DST_IP_ADDR_5=10.170.0.6 -RSPDriver.DST_IP_ADDR_6=10.170.0.7 -RSPDriver.DST_IP_ADDR_7=10.170.0.8 -RSPDriver.DST_IP_ADDR_8=10.170.0.9 -RSPDriver.DST_IP_ADDR_9=10.170.0.10 -RSPDriver.DST_IP_ADDR_10=10.170.0.11 -RSPDriver.DST_IP_ADDR_11=10.170.0.12 # # Specify the absolute backplane index of the first