From 2ea4d7fd0217f3df266df73da5e2e17df3bec6d8 Mon Sep 17 00:00:00 2001 From: shangke Date: Thu, 19 Jan 2017 16:45:30 +0800 Subject: [PATCH] ethernet: limit rx buf num when flow ctrl enable. --- components/ethernet/Kconfig | 5 +++-- components/ethernet/emac_main.c | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/components/ethernet/Kconfig b/components/ethernet/Kconfig index 663871f2a0..46e86cc60e 100644 --- a/components/ethernet/Kconfig +++ b/components/ethernet/Kconfig @@ -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 diff --git a/components/ethernet/emac_main.c b/components/ethernet/emac_main.c index 067d1a8ed7..853887cfc5 100644 --- a/components/ethernet/emac_main.c +++ b/components/ethernet/emac_main.c @@ -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; }