The 4 bytes at the end seem to be ethernet padding. By copying the entire buffer two bytes to the right, so that the pointers align, the issue seems to be fixed. However, I am not sure yet why this was needed in the first place.
Packets received from Ethernet Interface getting discarded due to incorrect packet_type (and other issues)
I am getting started with Azure RTOS. I managed to get the threadx working and for netx the netx driver also seems to be *working (I have not been able to do anything meaningful with netx yet).
I am using the netxdriver ATSAME54-XPRO and ported it to SAME70Q21B microcontroller (SAME70-Xplained board). However, even though the board receives the ethernet messages, it discards the messages.
Steps:
- Configure the microcontroller board as DHCP client.
- DHCP client sends DHCP discover message.
- DHCP server replies back with offer.
- The microcontroller board receives the DHCP offer but discards it in the function
_nx_driver_transfer_to_netx
.
I found some issues like:
- In the function
_nx_driver_transfer_to_netx
, thenx_packet_prepend_ptr
member inNX_PACKET *packet_ptr
has address 2 greater than it should be. - The
nx_packet_length
is 4 more than it should be. - The
nx_packet_append_ptr
is 6 more than it should be.
This is causing the packet type to be calculated wrongly and hence getting discarded.
I manually fixed the above 3 parameters for this particular case. With this, the packet is getting identified as IP packet, but then it goes to ip packet handler and finds that the checksum is wrong and discards the packet.
Any ideas on why this is happening and how I can fix it?
Azure RTOS
1 additional answer
Sort by: Most helpful
-
Scott Larson 451 Reputation points
2021-10-14T15:52:40.38+00:00 Does the ethernet controller apply hardware padding to the packet? This is a common feature in ethernet controllers to help with alignment.