赛灵思
直播中

王玉英

7年用户 286经验值
私信 关注
[问答]

千兆以太网模块接口长度问题该怎么解决?

tify;text-indent: 40px;">大家好,
我有一个千兆以太网模块,其接口非常类似于32位的标准axi接口;
即mac_data_in(31:0_,mac_data_ready,mac_data_last,mac_data_valid等。
这是连接到8位的IP / UDP过滤器。它工作得很好,但由于8位与32位差异而没有进行优化。
现在,我已将所有转换为32位。
如果我的数据包长度> 52bytes,它可以很好地工作。
如果我有52bytes或更少,那么我会遇到问题。
它之前使用的是32bit / 8bit连接,因此问题不在于MAC端,而是在新的ip / dup过滤器模块上。
我有针脚指向数据包丢失的区域,但我需要你的帮助找到下面的原因。
让我解释:
1)我计算接收到的数据包的数量,当我到达以太网类型和IP类型时,我开始过滤。
所以你在下面看到,当rx_count是0x00C时,我需要过滤0x080045。
case rx_count是
当x“000c”=>时
--dataval_backup
2)在数据包长度> 52的情况下,它每次都有效

3)当数据包长度以下为原文

Hi All,

I have a gigabit ethernet module with an interface very similar to the standard axi interface in 32bit; i.e. mac_data_in(31:0_, mac_data_ready, mac_data_last, mac_data_valid, etc.

This was connecting to a IP/UDP filter in 8 bit. It worked perfectly, but was not optimised because of the 8bit vs 32bit discrepancies.

Now, I have converted all to 32bit. It works perfectly if I have a packet length > 52bytes. If I have 52bytes or less, then I get problems. It worked before with the 32bit/8bit connection, so the problem is not on the MAC side, but on the new ip/dup filter module.

I have pin pointed the area where the packet gets dropped, but I need your help finding the cause below. Let me explain:

1) I count the number of received packet and when I get to the ethernet type and IP type, I begin filtering.
So what you see below, when rx_count is 0x00C, then I need to filter for 0x080045.


case rx_count is                       when x"000c" =>                          --dataval_backup <= mac_data_in(15 downto 0); --this is part of the ip_hdr                          if mac_data_in(31 downto 8) /= x"080045" then -- ignore pkts that are not type=IP                             next_rx_state <= WAIT_END;                             set_rx_state  <= '1';                             dbg_IPv4_RX                      <= '1';                          end if;                                              when others =>   -- ignore other bytes in eth header2) In the case of packet length > 52 it works every time

3) When packet length is <=52, dbg_IPv4_RX is set to 1 so the packet is dropped.
4) Previous message goes through all right
5) I allow 1 seconds before sending a new packet.
6) Simulation does not show this!!

Any ideas would be apreciated

回帖(18)

刘琨

2019-7-30 07:29:03
经过大量的工作。
我找到了解决方案!
如果有人遇到同样的问题,请现在任何以太网数据包的最小长度为60(不包括CRC)。
因此,这意味着随帧发送的长度的IPv4值不再与实际长度相对应。
我已经为单个IF添加了一个简单的AND检查,并且每个人都像魅力一样。
我发送了超过一百万个随机变量lenth的数据包并全部反弹!
在原帖中查看解决方案

以上来自于谷歌翻译


以下为原文

After a lot of work. I found the solution!!!
 
If ever someone runs into the same problem, please now that the minimum length of any ethernet packet is 60 (not including the CRC). So it means that the IPv4 value of length that is sent with the frame does not correspond to the actual length anymore. I have added a simple AND check to a single IF and everythings works like a charm. 
 
I have sent more than a million packet of random variable lenth and the all bounced back!
View solution in original post
举报

张磊

2019-7-30 07:46:16
一切都很好看。
我等着被告知。为什么你认为这段代码是什么?一想法。
以太网是正常的(8到31)没有(31 downto 8).Endienes。
显而易见的是,如果模拟传递和现实生活失败,你有定时/设置/保持约束,设计是否通过时间,你检查每个警告,比较之类的东西总是假的,因为两边的信号是不同的
长度?

以上来自于谷歌翻译


以下为原文

That all looks fine . I wait to be told otherwise.

Why do you think its in this part of the code ?

One thought. Ethernet is normal (8 to 31) not (31 downto 8).

Endienes.


Obvious thing, if simulation pass's and real life fails, have you timing / set up / hold constraints in place, does the design pass timing, have you checked through every warning , things like comparisons always being false because the signals on either side are different lengths ?
举报

刘琨

2019-7-30 07:58:04
drjohnsmith写道:显而易见的是,如果模拟传递和现实生活失败,你有计时/设置/保持约束,设计是否通过时间,你检查了每个警告,比较之类的东西总是假的,因为任何一个上的信号
方是不同的长度?
我有相同的MAC和IP / UDP模块时钟。
但是,我已经为其他(无关)模块设置了时钟约束和时钟域到时钟域。
这一切都通过了时间,我检查了所有警告。
我想提出更多约束,但我不知道我能添加什么。

以上来自于谷歌翻译


以下为原文

drjohnsmith wrote:

Obvious thing, if simulation pass's and real life fails, have you timing / set up / hold constraints in place, does the design pass timing, have you checked through every warning , things like comparisons always being false because the signals on either side are different lengths ?

I have the same clock for the MAC and IP/UDP module. However, I have setup the clock constraints and clock domain to clock domain for other (unrelated) modules.
 
It all passes timing and I have check all warnings.
 
I would like to put more constraints, but I don't know what I could add.
 
 
举报

刘琨

2019-7-30 08:08:36
drjohnsmith写道:一切都很好看。
我等着被告知。为什么你认为这段代码是什么?一想法。
以太网是正常的(8到31)没有(31 downto 8).Endienes。
1)MAC中的连续性发生了变化。
2)我认为它在代码的这一部分,因为MAC之前工作过,我已经改变了一点。
我知道这是丢弃数据包的地方,但不应该。
(通过Wireshark验证)

以上来自于谷歌翻译


以下为原文

drjohnsmith wrote:
That all looks fine . I wait to be told otherwise.

Why do you think its in this part of the code ?

One thought. Ethernet is normal (8 to 31) not (31 downto 8).

Endienes.

1) The endienness is changed in the MAC.
2) I think its in this part of the code because the MAC worked before and I haved changed it a bit. I and know this is the place where the packet gets dropped, while it should not. (verified with Wireshark)
举报

更多回帖

×
20
完善资料,
赚取积分