eth: dont warn nego timeout if link is down

pull/7497/head
morris 2021-06-17 13:40:26 +08:00
rodzic c47ad5d22f
commit ab0c5fed25
7 zmienionych plików z 43 dodań i 12 usunięć

Wyświetl plik

@ -195,6 +195,11 @@ static esp_err_t dm9051_reset_hw(esp_eth_phy_t *phy)
return ESP_OK;
}
/**
* @note This function is responsible for restarting a new auto-negotiation,
* the result of negotiation won't be relected to uppler layers.
* Instead, the negotiation result is fetched by linker timer, see `dm9051_get_link()`
*/
static esp_err_t dm9051_negotiate(esp_eth_phy_t *phy)
{
esp_err_t ret = ESP_OK;
@ -222,7 +227,7 @@ static esp_err_t dm9051_negotiate(esp_eth_phy_t *phy)
break;
}
}
if (to >= dm9051->autonego_timeout_ms / 100) {
if ((to >= dm9051->autonego_timeout_ms / 100) && (dm9051->link_status == ETH_LINK_UP)) {
ESP_LOGW(TAG, "Ethernet PHY auto negotiation timeout");
}
return ESP_OK;

Wyświetl plik

@ -189,6 +189,11 @@ static esp_err_t dp83848_reset_hw(esp_eth_phy_t *phy)
return ESP_OK;
}
/**
* @note This function is responsible for restarting a new auto-negotiation,
* the result of negotiation won't be relected to uppler layers.
* Instead, the negotiation result is fetched by linker timer, see `dp83848_get_link()`
*/
static esp_err_t dp83848_negotiate(esp_eth_phy_t *phy)
{
esp_err_t ret = ESP_OK;
@ -216,8 +221,7 @@ static esp_err_t dp83848_negotiate(esp_eth_phy_t *phy)
break;
}
}
/* Auto negotiation failed, maybe no network cable plugged in, so output a warning */
if (to >= dp83848->autonego_timeout_ms / 100) {
if ((to >= dp83848->autonego_timeout_ms / 100) && (dp83848->link_status == ETH_LINK_UP)) {
ESP_LOGW(TAG, "auto negotiation timeout");
}
return ESP_OK;

Wyświetl plik

@ -230,6 +230,11 @@ static esp_err_t ip101_reset_hw(esp_eth_phy_t *phy)
return ESP_OK;
}
/**
* @note This function is responsible for restarting a new auto-negotiation,
* the result of negotiation won't be relected to uppler layers.
* Instead, the negotiation result is fetched by linker timer, see `ip101_get_link()`
*/
static esp_err_t ip101_negotiate(esp_eth_phy_t *phy)
{
esp_err_t ret = ESP_OK;
@ -255,8 +260,7 @@ static esp_err_t ip101_negotiate(esp_eth_phy_t *phy)
break;
}
}
/* Auto negotiation failed, maybe no network cable plugged in, so output a warning */
if (to >= ip101->autonego_timeout_ms / 100) {
if ((to >= ip101->autonego_timeout_ms / 100) && (ip101->link_status == ETH_LINK_UP)) {
ESP_LOGW(TAG, "auto negotiation timeout");
}
return ESP_OK;

Wyświetl plik

@ -208,6 +208,11 @@ static esp_err_t ksz80xx_reset_hw(esp_eth_phy_t *phy)
return ESP_OK;
}
/**
* @note This function is responsible for restarting a new auto-negotiation,
* the result of negotiation won't be relected to uppler layers.
* Instead, the negotiation result is fetched by linker timer, see `ksz80xx_get_link()`
*/
static esp_err_t ksz80xx_negotiate(esp_eth_phy_t *phy)
{
esp_err_t ret = ESP_OK;
@ -233,8 +238,7 @@ static esp_err_t ksz80xx_negotiate(esp_eth_phy_t *phy)
break;
}
}
/* Auto negotiation failed, maybe no network cable plugged in, so output a warning */
if (to >= ksz80xx->autonego_timeout_ms / 100) {
if ((to >= ksz80xx->autonego_timeout_ms / 100) && (ksz80xx->link_status == ETH_LINK_UP)) {
ESP_LOGW(TAG, "auto negotiation timeout");
}
return ESP_OK;

Wyświetl plik

@ -160,6 +160,11 @@ err:
return ret;
}
/**
* @note This function is responsible for restarting a new auto-negotiation,
* the result of negotiation won't be relected to uppler layers.
* Instead, the negotiation result is fetched by linker timer, see `phy_ksz8851_get_link()`
*/
static esp_err_t phy_ksz8851_negotiate(esp_eth_phy_t *phy)
{
esp_err_t ret = ESP_OK;
@ -181,8 +186,8 @@ static esp_err_t phy_ksz8851_negotiate(esp_eth_phy_t *phy)
break;
}
}
if (to >= ksz8851->autonego_timeout_ms / 100) {
ESP_LOGW(TAG, "Ethernet PHY auto negotiation timeout");
if ((to >= ksz8851->autonego_timeout_ms / 100) && (ksz8851->link_status == ETH_LINK_UP)) {
ESP_LOGW(TAG, "auto negotiation timeout");
}
ESP_GOTO_ON_ERROR(eth->phy_reg_write(eth, ksz8851->addr, KSZ8851_P1CR, control), err, TAG, "P1CR write failed");

Wyświetl plik

@ -343,6 +343,11 @@ static esp_err_t lan87xx_reset_hw(esp_eth_phy_t *phy)
return ESP_OK;
}
/**
* @note This function is responsible for restarting a new auto-negotiation,
* the result of negotiation won't be relected to uppler layers.
* Instead, the negotiation result is fetched by linker timer, see `lan87xx_get_link()`
*/
static esp_err_t lan87xx_negotiate(esp_eth_phy_t *phy)
{
esp_err_t ret = ESP_OK;
@ -371,7 +376,7 @@ static esp_err_t lan87xx_negotiate(esp_eth_phy_t *phy)
}
}
/* Auto negotiation failed, maybe no network cable plugged in, so output a warning */
if (to >= lan87xx->autonego_timeout_ms / 100) {
if (to >= lan87xx->autonego_timeout_ms / 100 && (lan87xx->link_status == ETH_LINK_UP)) {
ESP_LOGW(TAG, "auto negotiation timeout");
}
return ESP_OK;

Wyświetl plik

@ -183,6 +183,11 @@ static esp_err_t rtl8201_reset_hw(esp_eth_phy_t *phy)
return ESP_OK;
}
/**
* @note This function is responsible for restarting a new auto-negotiation,
* the result of negotiation won't be relected to uppler layers.
* Instead, the negotiation result is fetched by linker timer, see `rtl8201_get_link()`
*/
static esp_err_t rtl8201_negotiate(esp_eth_phy_t *phy)
{
esp_err_t ret = ESP_OK;
@ -208,8 +213,7 @@ static esp_err_t rtl8201_negotiate(esp_eth_phy_t *phy)
break;
}
}
/* Auto negotiation failed, maybe no network cable plugged in, so output a warning */
if (to >= rtl8201->autonego_timeout_ms / 100) {
if ((to >= rtl8201->autonego_timeout_ms / 100) && (rtl8201->link_status == ETH_LINK_UP)) {
ESP_LOGW(TAG, "auto negotiation timeout");
}
return ESP_OK;