ethernet: limit rx buf num when flow ctrl enable.

This commit is contained in:
shangke 2017-01-19 16:45:30 +08:00
parent 7eb570b039
commit 2ea4d7fd02
2 changed files with 10 additions and 2 deletions

View file

@ -6,17 +6,18 @@ menuconfig ETHERNET
config DMA_RX_BUF_NUM
int "Number of DMA RX buffers"
range 1 10
range 3 20
default 10
depends on ETHERNET
help
Number of DMA receive buffers. Each buffer is 1600 bytes.
Buffers are allocated statically.
Larger number of buffers increases throughput.
If enable flow ctrl, the num must be above 9 .
config DMA_TX_BUF_NUM
int "Number of DMA RX buffers"
range 1 10
range 3 20
default 10
depends on ETHERNET
help

View file

@ -216,7 +216,14 @@ static void emac_set_user_config_data(eth_config_t *config )
emac_config.emac_phy_check_init = config->phy_check_init;
emac_config.emac_phy_get_speed_mode = config->phy_get_speed_mode;
emac_config.emac_phy_get_duplex_mode = config->phy_get_duplex_mode;
#if DMA_RX_BUF_NUM > 9
emac_config.emac_flow_ctrl_enable = config->flow_ctrl_enable;
#else
if(config->flow_ctrl_enable == true) {
ESP_LOGE(TAG, "eth flow ctrl init err!!! Please run make menuconfig and make sure DMA_RX_BUF_NUM > 9 .");
}
emac_config.emac_flow_ctrl_enable = false;
#endif
emac_config.emac_phy_get_partner_pause_enable = config->phy_get_partner_pause_enable;
}