Merge branch 'bugfix/check_nego_timeout_when_link_up' into 'master'

eth_phy: dont warn nego timeout if link is down

Closes IDFGH-5415

See merge request espressif/esp-idf!13997
This commit is contained in:
morris
2021-08-27 13:09:17 +00:00
7 changed files with 43 additions and 12 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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");

View File

@@ -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;

View File

@@ -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;