Skip to content

Commit

Permalink
drivers: ethernet: adin2111: fix real rx frame size
Browse files Browse the repository at this point in the history
Fix issue related to "generic SPI" mode only, when a packet of
1512 bytes is received, net_pkt_write() fails and thrwos the error:

"Still some length to go 2".

This is due to net_pkt_rx_alloc_with_buffer() allocating a maximum
mtu/size of 1514, and driver is not removing 4 bytes of crc32 from
rx buffer, that comes to be 1516 (2 bytes over buffer limit).

Fix generic SPI rx frame size removing crc32 bytes.

Signed-off-by: Angelo Dureghello <[email protected]>
  • Loading branch information
spectrum70 authored and carlescufi committed Mar 8, 2024
1 parent 0ca8b07 commit 06df4b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/ethernet/eth_adin2111.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ static int adin2111_read_fifo(const struct device *dev, const uint8_t port)

/* burst read must be in multiples of 4 */
padding_len = ((fsize % 4) == 0) ? 0U : (ROUND_UP(fsize, 4U) - fsize);
/* actual frame length is FSIZE - FRAME HEADER */
fsize_real = fsize - ADIN2111_FRAME_HEADER_SIZE;
/* actual frame length is FSIZE - FRAME HEADER - CRC32 */
fsize_real = fsize - (ADIN2111_FRAME_HEADER_SIZE + sizeof(uint32_t));

/* spi header */
*(uint16_t *)cmd_buf = htons((ADIN2111_READ_TXN_CTRL | rx_reg));
Expand Down

0 comments on commit 06df4b5

Please sign in to comment.