diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_station.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_station.vhd index 7455fcaf62c5127110fd4ff974b0c1d6a6187b3d..6234987aa5efd080aaa8b0481fd33a2736658f3e 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_station.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_station.vhd @@ -1042,13 +1042,14 @@ BEGIN --------------- u_nw_10GbE_beamlet_output: ENTITY nw_10GbE_lib.nw_10GbE GENERIC MAP ( - g_sim => g_sim, - g_sim_level => 1, - g_nof_macs => c_nof_10GbE_beamlet_output, - g_direction => "TX_RX", - g_tx_fifo_fill => c_fifo_tx_fill_beamlet_output, - g_tx_fifo_size => c_fifo_tx_size_beamlet_output, - g_ip_hdr_field_arr => c_sdp_cep_hdr_field_arr + g_sim => g_sim, + g_sim_level => 1, + g_nof_macs => c_nof_10GbE_beamlet_output, + g_direction => "TX_RX", + g_tx_fifo_fill => c_fifo_tx_fill_beamlet_output, + g_tx_fifo_size => c_fifo_tx_size_beamlet_output, + g_ip_hdr_field_arr => c_sdp_cep_hdr_field_arr, + g_xon_backpressure => TRUE ) PORT MAP ( diff --git a/libraries/io/nw_10GbE/src/vhdl/nw_10GbE.vhd b/libraries/io/nw_10GbE/src/vhdl/nw_10GbE.vhd index 2df5755b77df0eb5972e90bcb37344756cd6b1a9..b35b0ad82280486c67c72a9cd83aed33be87f67b 100644 --- a/libraries/io/nw_10GbE/src/vhdl/nw_10GbE.vhd +++ b/libraries/io/nw_10GbE/src/vhdl/nw_10GbE.vhd @@ -52,6 +52,7 @@ ENTITY nw_10GbE IS g_tx_fifo_size : NATURAL := 256; -- 2 * 32b * 256 = 2 M9K (DP interface has 64b data, so at least 2 M9K needed) g_rx_fifo_size : NATURAL := 256; -- 2 * 32b * 256 = 2 M9K (DP interface has 64b data, so at least 2 M9K needed) g_word_alignment_padding : BOOLEAN := FALSE; + g_xon_backpressure : BOOLEAN := FALSE; g_arp_period_s : NATURAL := 30; g_ip_hdr_field_arr : t_common_field_arr ); @@ -232,7 +233,8 @@ BEGIN g_tx_fifo_fill => g_tx_fifo_fill, g_tx_fifo_size => g_tx_fifo_size, g_rx_fifo_size => g_rx_fifo_size, - g_word_alignment_padding => g_word_alignment_padding + g_word_alignment_padding => g_word_alignment_padding, + g_xon_backpressure => g_xon_backpressure ) PORT MAP ( -- Transceiver PLL reference clock diff --git a/libraries/io/tr_10GbE/src/vhdl/tr_10GbE.vhd b/libraries/io/tr_10GbE/src/vhdl/tr_10GbE.vhd index df979c50d6399d4f9b3b0b1ea33b536025b8cf28..d5e130e9bf982dd06a567a56b7df96ce6f3b95ff 100644 --- a/libraries/io/tr_10GbE/src/vhdl/tr_10GbE.vhd +++ b/libraries/io/tr_10GbE/src/vhdl/tr_10GbE.vhd @@ -45,6 +45,10 @@ -- -- to avoid that the packet transmission will get a gap that will abort it. -- The average DP data rate depends on dp_clk and on the DP data valid. +-- +-- g_xon_backpressure can be enabled to set xon = 0 when the TX fill fifo is +-- full. This also makes use of an extra fifo of size g_tx_fifo_size to +-- buffer the last incoming frame when xon = 0 to prevent corrupting the frame. -- LIBRARY IEEE, common_lib, dp_lib, diag_lib, technology_lib, tech_mac_10g_lib, tech_eth_10g_lib, tr_xaui_lib; @@ -72,7 +76,8 @@ ENTITY tr_10GbE IS g_tx_fifo_fill : NATURAL := 10; -- Release tx packet only when sufficiently data is available, g_tx_fifo_size : NATURAL := 256; -- 2 * 32b * 256 = 2 M9K (DP interface has 64b data, so at least 2 M9K needed) g_rx_fifo_size : NATURAL := 256; -- 2 * 32b * 256 = 2 M9K (DP interface has 64b data, so at least 2 M9K needed) - g_word_alignment_padding : BOOLEAN := FALSE + g_word_alignment_padding : BOOLEAN := FALSE; + g_xon_backpressure : BOOLEAN := FALSE ); PORT ( -- Transceiver PLL reference clock @@ -146,11 +151,12 @@ ARCHITECTURE str OF tr_10GbE IS SIGNAL eth_rx_clk_arr : STD_LOGIC_VECTOR(g_nof_macs-1 DOWNTO 0); SIGNAL eth_rx_rst_arr : STD_LOGIC_VECTOR(g_nof_macs-1 DOWNTO 0); - SIGNAL dp_fifo_dc_tx_src_out_arr : t_dp_sosi_arr(g_nof_macs-1 DOWNTO 0); - SIGNAL dp_fifo_dc_tx_src_in_arr : t_dp_siso_arr(g_nof_macs-1 DOWNTO 0); + SIGNAL dp_fifo_sc_tx_src_out_arr : t_dp_sosi_arr(g_nof_macs-1 DOWNTO 0); + SIGNAL dp_fifo_sc_tx_src_in_arr : t_dp_siso_arr(g_nof_macs-1 DOWNTO 0); SIGNAL dp_fifo_fill_tx_src_out_arr : t_dp_sosi_arr(g_nof_macs-1 DOWNTO 0); SIGNAL dp_fifo_fill_tx_src_in_arr : t_dp_siso_arr(g_nof_macs-1 DOWNTO 0); + SIGNAL dp_fifo_fill_tx_snk_out_arr : t_dp_siso_arr(g_nof_macs-1 DOWNTO 0); SIGNAL mac_10g_src_out_arr : t_dp_sosi_arr(g_nof_macs-1 DOWNTO 0); SIGNAL mac_10g_src_in_arr : t_dp_siso_arr(g_nof_macs-1 DOWNTO 0); @@ -227,7 +233,48 @@ BEGIN eth_rx_clk_arr => eth_rx_clk_arr, eth_rx_rst_arr => eth_rx_rst_arr ); - + + --------------------------------------------------------------------------------------- + -- TX FIFO for buffering last packet when xon = 0 to prevent corrupt frames. + --------------------------------------------------------------------------------------- + gen_xon_backpressure : IF g_xon_backpressure GENERATE + gen_dp_fifo_sc_tx : FOR i IN 0 TO g_nof_macs-1 GENERATE + u_dp_fifo_sc_tx : ENTITY dp_lib.dp_fifo_sc + GENERIC MAP ( + g_technology => g_technology, + g_data_w => c_xgmii_data_w, + g_empty_w => c_tech_mac_10g_empty_w, + g_use_empty => TRUE, + g_fifo_size => g_tx_fifo_size + ) + PORT MAP ( + rst => dp_rst, + clk => dp_clk, + + snk_out => snk_out_arr(i), + snk_in => snk_in_arr(i), + + src_in => dp_fifo_sc_tx_src_in_arr(i), + src_out => dp_fifo_sc_tx_src_out_arr(i) + ); + END GENERATE; + + -- When MAC receives pause frames, it's ready signal is low for a long time + -- Set xon to (xon AND ready) to enable flushing frames using external dp_xonoff. + p_fifo_sc_tx : PROCESS(dp_fifo_fill_tx_snk_out_arr) + BEGIN + dp_fifo_sc_tx_src_in_arr <= dp_fifo_fill_tx_snk_out_arr; + FOR i IN 0 TO g_nof_macs-1 LOOP + dp_fifo_sc_tx_src_in_arr(i).xon <= dp_fifo_fill_tx_snk_out_arr(i).xon AND dp_fifo_fill_tx_snk_out_arr(i).ready; + END LOOP; + END PROCESS; + END GENERATE; + + gen_no_xon_backpressure : IF NOT g_xon_backpressure GENERATE + dp_fifo_sc_tx_src_out_arr <= snk_in_arr; + snk_out_arr <= dp_fifo_fill_tx_snk_out_arr; + END GENERATE; + --------------------------------------------------------------------------------------- -- TX: FIFO: dp_clk -> tx_clk and with fill level/eop trigger so we can deliver packets to the MAC fast enough --------------------------------------------------------------------------------------- @@ -248,19 +295,17 @@ BEGIN rd_rst => eth_tx_rst_arr(i), rd_clk => eth_tx_clk_arr(i), - snk_out => snk_out_arr(i), - snk_in => snk_in_arr(i), + snk_out => dp_fifo_fill_tx_snk_out_arr(i), + snk_in => dp_fifo_sc_tx_src_out_arr(i), src_in => dp_fifo_fill_tx_src_in_arr(i), src_out => dp_fifo_fill_tx_src_out_arr(i) ); END GENERATE; - --------------------------------------------------------------------------------------- -- ETH MAC + PHY --------------------------------------------------------------------------------------- - u_tech_eth_10g : ENTITY tech_eth_10g_lib.tech_eth_10g GENERIC MAP ( g_technology => g_technology,