Skip to content

Commit

Permalink
drivers: ethernet: stm32h7 reduce count of tx_buffer_def
Browse files Browse the repository at this point in the history
Reduced the size of tx_buffer_def array to 1 to save
on function stack memory. Here only 1 buffer is
enough to call the transmit function.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
  • Loading branch information
lochej authored and carlescufi committed Sep 3, 2020
1 parent 8e46f09 commit ddcc385
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/ethernet/eth_stm32_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);

#define ETH_DMA_TX_TIMEOUT_MS 20U /* transmit timeout in milliseconds */

/* Only one tx_buffer is sufficient to pass only 1 dma_buffer */
#define ETH_TXBUF_DEF_NB 1U
#else

#define GET_FIRST_DMA_TX_DESC(heth) (heth->TxDesc)
Expand Down Expand Up @@ -210,9 +212,9 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt)
}

#if defined(CONFIG_SOC_SERIES_STM32H7X)
ETH_BufferTypeDef tx_buffer_def[ETH_TXBUFNB];
ETH_BufferTypeDef tx_buffer_def[ETH_TXBUF_DEF_NB];

memset(tx_buffer_def, 0, ETH_TXBUFNB*sizeof(ETH_BufferTypeDef));
memset(tx_buffer_def, 0, ETH_TXBUF_DEF_NB*sizeof(ETH_BufferTypeDef));

tx_buffer_def[cur_tx_desc_idx].buffer = dma_buffer;
tx_buffer_def[cur_tx_desc_idx].len = total_len;
Expand Down

0 comments on commit ddcc385

Please sign in to comment.