From ed4448155dc0a48a1a667443d29b45aaa7415dcc Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Thu, 27 Oct 2022 10:04:09 +0200
Subject: [PATCH] Add c_eth_tester_eth_packet_len_max.

---
 libraries/io/eth/src/vhdl/eth_tester_pkg.vhd | 48 ++++++++++++--------
 1 file changed, 30 insertions(+), 18 deletions(-)

diff --git a/libraries/io/eth/src/vhdl/eth_tester_pkg.vhd b/libraries/io/eth/src/vhdl/eth_tester_pkg.vhd
index cd6f2f3b13..4c71470bc9 100644
--- a/libraries/io/eth/src/vhdl/eth_tester_pkg.vhd
+++ b/libraries/io/eth/src/vhdl/eth_tester_pkg.vhd
@@ -33,27 +33,33 @@ USE common_lib.common_network_layers_pkg.ALL;
 
 PACKAGE eth_tester_pkg is
 
-  CONSTANT c_eth_tester_bg_block_len_max  : NATURAL := c_network_eth_payload_jumbo_max;  -- 9000 octets
+  CONSTANT c_eth_tester_bg_block_len_max   : NATURAL := c_network_eth_payload_jumbo_max;  -- 9000 octets
+  CONSTANT c_eth_tester_rx_block_len_max   : NATURAL := c_network_eth_payload_jumbo_max + c_network_eth_crc_len;  -- 9004 octets
+  CONSTANT c_eth_tester_eth_packet_len_max : NATURAL := c_network_eth_frame_jumbo_max;   -- 9018 octets = 14 header + 9000 + 4 crc
 
   -- hdr_field_sel bit selects where the hdr_field value is set:
-  -- . 0 = data path controlled, value is set in data path, so field_default() is not used.
-  -- . 1 = MM controlled, value is set via MM or by the field_default(), so any data path setting in
-  --       eth_tester.vhd is not used.
+  -- . 0 = data path controlled, value is set in data path, so field_default()
+  --       is not used.
+  -- . 1 = MM controlled, value is set via MM or by the field_default(), so any
+  --       data path setting in eth_tester.vhd is not used.
   -- Remarks:
-  -- . For constant values it is convenient to use MM controlled, because then the field_default()
-  --   is used that can be set here in c_eth_tester_hdr_field_arr.
-  -- . For reserved values it is convenient to use MM controlled, because then in future they
-  --   could still be changed via MM without having to recompile the FW.
-  -- . Typically only use data path controlled if the value has to be set dynamically, so dependent
-  --   on the state of the FW.
-  -- . If a data path controlled field is not set in the FW, then it defaults to 0 by declaring
-  --   hdr_fields_in_arr with all 0. Hence e.g. udp_checksum = 0 can be achieve via data path
-  --   and default hdr_fields_in_arr = 0 or via MM controlled and field_default(0).
+  -- . For constant values it is convenient to use MM controlled, because then
+  --   the field_default() is used that can be set here in
+  --   c_eth_tester_hdr_field_arr.
+  -- . For reserved values it is convenient to use MM controlled, because then
+  --   in future they could still be changed via MM without having to recompile
+  --   the FW.
+  -- . Typically only use data path controlled if the value has to be set
+  --   dynamically, so dependent on the state of the FW.
+  -- . If a data path controlled field is not set in the FW, then it defaults
+  --   to 0 by declaring hdr_fields_in_arr with all 0. Hence e.g. udp_checksum
+  --   = 0 can be achieve via data path and default hdr_fields_in_arr = 0 or
+  --   via MM controlled and field_default(0).
   CONSTANT c_eth_tester_nof_hdr_fields    : NATURAL := 1+3+12+4+3;
   CONSTANT c_eth_tester_hdr_field_sel     : STD_LOGIC_VECTOR(c_eth_tester_nof_hdr_fields-1 DOWNTO 0) := "1"&"101"&"111011111001"&"0100"&"100";
 
-  -- Default use destination MAC/IP/UDP = 0, so these have to be MM programmed before
-  -- eth_tester packets can be send.
+  -- Default use destination MAC/IP/UDP = 0, so these have to be MM programmed
+  -- before eth_tester packets can be send.
   CONSTANT c_eth_tester_hdr_field_arr : t_common_field_arr(c_eth_tester_nof_hdr_fields-1 DOWNTO 0) := (
       ( field_name_pad("word_align"                              ), "RW", 16, field_default(0) ),  -- Tx TSE IP will strip these 2 padding bytes
       ( field_name_pad("eth_dst_mac"                             ), "RW", 48, field_default(0) ),  -- c_eth_tester_eth_dst_mac
@@ -87,9 +93,15 @@ PACKAGE eth_tester_pkg is
 
   CONSTANT c_eth_tester_app_hdr_len  : NATURAL :=  12;  -- octets
 
-  CONSTANT c_eth_tester_eth_src_mac_47_16 : STD_LOGIC_VECTOR(31 DOWNTO 0) := x"00228608";  -- 00:22:86:08:pp:qq = UNB_ETH_SRC_MAC_BASE in libraries/unb_osy/unbos_eth.h
-  CONSTANT c_eth_tester_ip_src_addr_31_16 : STD_LOGIC_VECTOR(15 DOWNTO 0) := x"0A63";    -- 10.99.xx.yy = g_base_ip in ctrl_unb2#_board.vhd used in libraries/unb_osy/unbos_eth.c
-  CONSTANT c_eth_tester_udp_src_port_15_8 : STD_LOGIC_VECTOR( 7 DOWNTO 0) := x"E0";  -- TBC, 7:0 = gn_id (= ID[7:0] = backplane[5:0] & node[1:0])
+  -- Destinations:
+  -- . MAC address 00:22:86:08:pp:qq = UNB_ETH_SRC_MAC_BASE in
+  --   libraries/unb_osy/unbos_eth.h, pp = backplane ID, qq = node ID
+  -- . IP address 10.99.xx.yy = g_base_ip in ctrl_unb2#_board.vhd used in
+  --   libraries/unb_osy/unbos_eth.c, xx = backplane ID, yy = node ID + 1
+  -- . UDP port 15:8 = E0, 7:0 = gn_id (= ID[7:0] = backplane[5:0] & node[1:0])
+  CONSTANT c_eth_tester_eth_src_mac_47_16 : STD_LOGIC_VECTOR(31 DOWNTO 0) := x"00228608";
+  CONSTANT c_eth_tester_ip_src_addr_31_16 : STD_LOGIC_VECTOR(15 DOWNTO 0) := x"0A63";
+  CONSTANT c_eth_tester_udp_src_port_15_8 : STD_LOGIC_VECTOR( 7 DOWNTO 0) := x"E0";
 
   TYPE t_eth_tester_app_header IS RECORD
     dp_reserved : STD_LOGIC_VECTOR(30 DOWNTO 0);
-- 
GitLab