Skip to content

Commit

Permalink
cpu/stm32/periph_eth: fix typo in initialization code
Browse files Browse the repository at this point in the history
A single character type resulted in way fewer TX descriptors being
available than allocated. Not only resulted this in wasting memory,
but also when more iolist chunks than descriptors are send, the

```C
    assert(iolist_count(iolist) <= ETH_TX_DESCRIPTOR_COUNT);
```

does not trigger. As a result, old TX descriptors are being overwritten
in this case.

(cherry picked from commit 82fbe08)
  • Loading branch information
Marian Buschsieweke committed Aug 9, 2022
1 parent 4908149 commit 8aefb7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cpu/stm32/periph/eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static void _init_dma_descriptors(void)
for (i = 0; i < ETH_TX_DESCRIPTOR_COUNT - 1; i++) {
tx_desc[i].desc_next = &tx_desc[i + 1];
}
tx_desc[ETH_RX_DESCRIPTOR_COUNT - 1].desc_next = &tx_desc[0];
tx_desc[ETH_TX_DESCRIPTOR_COUNT - 1].desc_next = &tx_desc[0];

rx_curr = &rx_desc[0];
tx_curr = &tx_desc[0];
Expand Down

0 comments on commit 8aefb7e

Please sign in to comment.