Forum Discussion
RX Mac segmented interface detailed information
I am using Ftile ethernet hard IP (400G configuration) . I complied the example test design with signal tap to monitor RX mac segmented interface and loaded on MA2700 . The kit is connected to a host with 400G capable NIC in it. I am using ping command and via wireshark I can see that host sends ARP request packet to the kit. As the ARP request packets are sent to the kit, I triggered STP and capture I have attached screenshot.
you can see all data in the capture other than rx_mac data.
rx mac data on clock -1 and 0 are as following
-1 -> E39001000406000801000608AAEB6A17E390FFFFFFFFFFFFD5555555555555FB070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707
0 -> 070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707FDE831AB370000000000000000000000000000000000006501A8C0000000000000C801A8C0AAEB6A17
From wireshark I can see this ARP packet is 60bytes and all the fields matches with what I see in the o_rx_mac_data.
Now I am trying to make sense of Rx mac segmented interface and I have following questions.
- rx mac inframe values are E000h and 000Fh meaning total 7 bits are 1 (logic high) indicating 56 byte packet but from payload is 60 bytes. So how do I equate for remining 4 bytes?
- in user guide o_rx_mac_eop_empty [47:0] signal is explained as "Indicates the number of empty bytes on the RX data signal, starting from the most significant byte (MSB). Valid only on EOP segments." I dont understand this statement completely so please help; as per signal tap waveform clock 0 is where packet ends and the value of bus is 4800h. I am not sure if and how this value can help equates for missing 4 bytes.
- Figure 44. Receiving Data Using the RX MAC Client Interface is little help- and small explanation below it (has typos i think) is not much help. Do you have more details and example for MAC segmented interface which you can share with me so that I can learn exact details on how to use this interface to receive incoming packets from Ftile.
- Using above signaltap screenshot and o_rx_mac_data values for clock -1 and 0; how do i detect sop? how do i use rx mac_sengemented interface to detect eop ? how do i use rx mac_sengemented interface detect exact length of ethernet frame which is being supplied during clock -1 and 0.
4 Replies
- paveetirrasrie_Altera
Frequent Contributor
Hello,
Please allow me to investigate this issue further and I will get back with an update soon.
Regards,
Pavee
- paveetirrasrie_Altera
Frequent Contributor
Hi Ankit,
What you are seeing is actually consistent with a 60-byte ARP frame on the F-Tile 400G RX MAC segmented client interface.
At 400G, o_rx_mac_data[1023:0] is divided into 16 segments, and each segment is 64 bits = 8 bytes. The inframe[15:0] bus gives one bit per 8-byte segment, and o_rx_mac_eop_empty[47:0] provides the empty-byte count for the segment where the packet ends. The documentation also says packets may start on any 8-byte segment, and SOP/EOP are inferred from inframe transitions between adjacent segments and cycles.
In your Signal Tap capture, the inframe values are E000h and 000Fh. That means there are 7 segments total with inframe=1, which corresponds to 7 × 8 = 56 bytes of fully occupied segments.
The remaining 4 bytes come from the EOP segment. This is exactly what o_rx_mac_eop_empty is for. On the last segment of the packet, the empty-byte field tells you how many bytes in that 8-byte segment are unused, counting from the most significant byte side. So if the EOP segment has 4 empty bytes, then only 4 bytes in that final 8-byte segment are valid. Total frame length is therefore:
- 56 + (8 - 4) = 60 bytes.
So the key point is that inframe by itself only tells you which 8-byte segments belong to the frame. It does not by itself give the exact frame length when the last segment is only partially used. You must combine inframe with eop_empty to get the final byte count.
For SOP and EOP detection, the interface is typically interpreted as follows:
- SOP is the first 0 -> 1 transition in inframe when scanning segments in order, including the boundary from the previous cycle.
- EOP is the first 1 -> 0 transition in inframe when scanning segments in order.
- The segment just before that 1 -> 0 transition is the ending segment, and its corresponding eop_empty field tells you how many bytes of that final segment are unused.
For 400G specifically, note that o_rx_mac_eop_empty[47:0] is not a single number for the whole bus. It is 16 separate 3-bit fields, one per 8-byte segment. You need to look at the 3-bit field corresponding to the segment where EOP occurs.
A practical way to calculate the received frame length is:
- count 8 bytes for every full inframe=1 segment before EOP
- identify the EOP segment from the 1 -> 0 transition
- read that segment’s eop_empty value
- add 8 - eop_empty bytes for the last segment
Using that method, your captured ARP request decodes cleanly as a 60-byte Ethernet frame, which matches what you are seeing in Wireshark.
So in short: there is no missing 4-byte discrepancy. Those 4 bytes are the valid part of the final segment, and eop_empty is the signal that tells you that.
Regards,
Pavee
- UserID4331231
Occasional Contributor
Some Follow-up question
I am using 400Gbe configuration, so far my assumption is that in a given cycle there can be either
- 1 sop and 1 eop - i.e complete frame in mac_data
- 1 sop or - i.e frame started and mac_data contains partial data
- 1 eop or - i.e frame ended and mac_data contains partial data
- 1 eop, 1 sop - i.e frame ended and mac_data contains partial previous frame data and a new frame has started can contains partial data
I feel that above scenarios are valid as per waveform given in Figure 44. Receiving Data Using the RX MAC Client Interface. can you confirm if my above assumptions are true or false?
My question are following scenarios valid?
- When rx_mac_valid == 1 can Inframe bits have
- 2 or more SOP
- 2o or more EOP
I am using 400Gbe configuration so 16 inframe bits and 1024 (128 bytes) data bits are there. There can be small (ethernet frames like ARP which are 60 bytes). So theoretically its possible that one RX mac segmented interface cycle could have 2 or more complete frames. But from IP point of view can you tell me if these scenarios are possible or not?
I am finding RX mac segmented interface very complex. lets say if "RX maximum frame size" is set to default value of 1518 bytes. Max RX frame size can not be more than 1518*8 =12,144 bits. Do you have a example verilog code to extract out valid ethernet frames out of RX mac segmented interface? Once frames are extracted out I have my user logic in place to process the frames and use Tx mac interface to send out Tx response frames
- paveetirrasrie_Altera
Frequent Contributor
1. Your four basic scenarios (single SOP, single EOP, both, or neither)
Yes, all four of your scenarios are valid. The F-Tile Ethernet Hard IP RX client interface allows the application to read frame data from the RX MAC segmented when it is received, and packets may start on any 8-byte segment. RX MAC Segmented Client Interface The inframe signal encodes SOP/EOP transitions per segment, so any combination of those four cases can appear in a given cycle.
2. Can there be 2 or more SOPs or 2 or more EOPs in a single cycle?
Yes,
At 400GE you have a 1024-bit (128-byte) data bus with 16 inframe bits, where each segment is 64 bits (8 bytes). RX MAC Segmented Client Interface A minimum-size Ethernet frame (e.g. ARP) is 60 bytes = 7.5 segments, so it fits comfortably within one 128-byte cycle. That means in a single cycle with
o_rx_mac_valid=1you can have:Two or more complete frames (each with its own SOP and EOP transition in the inframe vector)
Two or more SOPs (start of multiple frames)
Two or more EOPs (end of multiple frames)
For multi-segmented interfaces, a new packet may start and the previous packet end within the same cycle. RX MAC Segmented Client Interface At 400G with 16 segments per cycle, this can happen multiple times in the same clock.
3. How SOP and EOP are encoded in o_rx_mac_inframe[15:0]
The
o_rx_mac_inframetransition from 0→1 (between two consecutive segments) indicates a start of packet (SOP); the SOP begins at the segment whereo_rx_mac_inframeis set to 1. When the packet ends,o_rx_mac_eop_emptyis set to the number of unused bytes ino_rx_mac_data. Theo_rx_mac_eop_emptytransition from 1→0 (between two consecutive segments) indicates the end of packet (EOP); the EOP ends in the segment whereo_rx_mac_inframeis set to 0. RX MAC Segmented Client InterfaceSo for 400G: scan
o_rx_mac_inframe[15:0]bit by bit. A 0→1 transition at bit i means segment i is the first segment of a new frame. A 1→0 transition at bit i means segment i-1 was the last segment of the previous frame, ando_rx_mac_eop_empty[(i*3)-1 : (i-1)*3]tells you how many bytes in that last segment are unused. The minimum number of bytes on the last cycle is 1. RX MAC Segmented Client InterfaceAlso note: the interface does not take direct backpressure. RX MAC Segmented Client Interface Your logic must be ready to consume data every cycle.
4. Verilog frame extraction example
I can't share a file, but here is a conceptual Verilog snippet to get you started. This is general guidance, adapt it to your pipeline and timing requirements:
// 400GE: 16 segments, 64 bits each, 3 eop_empty bits per segment // Inputs (registered from IP): // o_rx_mac_valid // o_rx_mac_data [1023:0] // o_rx_mac_inframe [15:0] // o_rx_mac_eop_empty [47:0] // 3 bits per segment // o_rx_mac_fcs_error [15:0] // Detect SOP: bit i is 1 and previous bit (or previous cycle's bit 15) is 0 // Detect EOP: bit i is 0 and previous bit is 1 reg prev_inframe; // bit 15 of inframe from previous valid cycle always @(posedge clk or posedge rst) begin if (rst) begin prev_inframe <= 1'b0; end else if (o_rx_mac_valid) begin prev_inframe <= o_rx_mac_inframe[15]; end end integer seg; always @(posedge clk) begin if (o_rx_mac_valid) begin for (seg = 0; seg < 16; seg = seg + 1) begin // Determine "previous" inframe bit // For seg==0, previous is prev_inframe (last bit of prior cycle) // For seg>0, previous is o_rx_mac_inframe[seg-1] wire prev_bit = (seg == 0) ? prev_inframe : o_rx_mac_inframe[seg-1]; // SOP: transition 0->1 if (!prev_bit && o_rx_mac_inframe[seg]) begin // Segment 'seg' is the first segment of a new frame // Data bytes: o_rx_mac_data[seg*64 +: 64] end // EOP: transition 1->0 if (prev_bit && !o_rx_mac_inframe[seg]) begin // Segment 'seg-1' was the last segment of a frame // (handle seg==0 case: EOP was in segment 15 of prev cycle) // Empty bytes in that last segment: // o_rx_mac_eop_empty[(seg-1)*3 +: 3] (for seg > 0) // FCS error: // o_rx_mac_fcs_error[seg-1] (for seg > 0) end // Mid-frame: inframe[seg]==1 and no transition // Data is valid payload bytes for the current frame end end endKey implementation notes:
You need to track
prev_inframe(the inframe state at the end of the previous valid cycle) to correctly detect SOP/EOP at segment 0 of the current cycle.Multiple SOP/EOP pairs can occur within the same 16-segment cycle — your loop must handle all of them, not just the first.
For each EOP, check
o_rx_mac_fcs_error[seg]to know if the frame is good. Theo_rx_mac_fcs_errorsignal is valid only on EOP segments; a high value indicates the frame had an FCS error, was malformed, was undersized, or was oversized and truncated because the MTU enforcement feature of the RX MAC was enabled. RX MAC Segmented Client InterfaceThe
o_rx_mac_eop_empty[2:0]per segment tells you how many bytes at the MSB end of that 64-bit segment are unused (padding), so valid bytes = 8 − empty_count.Since the interface gives no backpressure, you'll typically want a wide FIFO or buffer behind this logic to absorb bursts.
The 1518-byte MTU you mentioned means a maximum frame spans at most ⌈1518/8⌉ = 190 segments = ~12 cycles at 400G, so your frame reassembly buffer needs to handle that depth. Small frames (60 bytes = 8 segments) can easily pack 2 per cycle, confirming your intuition about multiple SOPs/EOPs.