fpga: lib: Fix small packets stuck in 10 GbE TX
Any packet less than CUT_THROUGH bytes has a high chance of getting stuck in the TX FIFO of the xge_mac_wrapper. In cut-through mode we were waiting for CUT_THROUGH bytes before transmitting the packet. Original-commit: 1938bb951a981f4d3016b796f771b5047fb846a2
This commit is contained in:
@@ -434,20 +434,27 @@ module xge_mac_wrapper #(
|
|||||||
//
|
//
|
||||||
reg cut_through;
|
reg cut_through;
|
||||||
reg cut_wait;
|
reg cut_wait;
|
||||||
|
reg [15:0] cut_idlecount;
|
||||||
|
|
||||||
if (CUT_THROUGH > 0) begin : yes_cut_through
|
if (CUT_THROUGH > 0) begin : yes_cut_through
|
||||||
|
|
||||||
wire cut_start;
|
wire cut_start;
|
||||||
wire cut_end;
|
wire cut_end;
|
||||||
|
|
||||||
assign cut_start = tx_occupied > CUT_THROUGH;
|
// start under 2 conditions
|
||||||
|
// (1) we have more the CUT_THROUGH bytes buffered
|
||||||
|
assign cut_start = tx_occupied > CUT_THROUGH ||
|
||||||
|
// (2) we have kept bytes waiting for too long
|
||||||
|
// The second case happens when less than CUT_THROUGH bytes are pushed
|
||||||
|
(cut_idlecount == 0);
|
||||||
assign cut_end = eth_tx_eof && eth_tx_valid;
|
assign cut_end = eth_tx_eof && eth_tx_valid;
|
||||||
|
|
||||||
// Add SOF
|
// Add SOF
|
||||||
always @(posedge xgmii_clk) begin : cut_through_dff
|
always @(posedge xgmii_clk) begin : cut_through_dff
|
||||||
if (xgmii_reset) begin
|
if (xgmii_reset) begin
|
||||||
cut_through <= 1'b0;
|
cut_through <= 1'b0;
|
||||||
cut_wait <= 1'b0;
|
cut_wait <= 1'b0;
|
||||||
|
cut_idlecount <= CUT_THROUGH+2;
|
||||||
end else begin
|
end else begin
|
||||||
cut_wait <= eth_tx_full;
|
cut_wait <= eth_tx_full;
|
||||||
if (cut_start) begin
|
if (cut_start) begin
|
||||||
@@ -455,6 +462,13 @@ module xge_mac_wrapper #(
|
|||||||
end else if (cut_end) begin
|
end else if (cut_end) begin
|
||||||
cut_through <= 1'b0;
|
cut_through <= 1'b0;
|
||||||
end
|
end
|
||||||
|
if (tx_occupied > 0 && cut_through == 1'b0) begin
|
||||||
|
if (cut_idlecount > 0) begin
|
||||||
|
cut_idlecount <= cut_idlecount-1;
|
||||||
|
end
|
||||||
|
end else begin
|
||||||
|
cut_idlecount <= CUT_THROUGH+2;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end else begin : no_cut_through
|
end else begin : no_cut_through
|
||||||
|
|||||||
Reference in New Issue
Block a user