forked from espressif/esp-idf
Merge branch 'feature/extend_eth_test_targets' into 'master'
CI tests for all supported Ethernet tests Closes IDF-5704 See merge request espressif/esp-idf!24468
This commit is contained in:
@@ -225,13 +225,3 @@ build:integration_test:
|
|||||||
"labels:nvs_coverage": # host_test
|
"labels:nvs_coverage": # host_test
|
||||||
labels:
|
labels:
|
||||||
- nvs_coverage
|
- nvs_coverage
|
||||||
|
|
||||||
"labels-protected:lan8720": # UT # FIXME: IDFCI-1176 temporary run this on master/release or with label
|
|
||||||
labels:
|
|
||||||
- lan8720
|
|
||||||
included_in:
|
|
||||||
- build:unit_test
|
|
||||||
- build:unit_test-esp32
|
|
||||||
- build:target_test
|
|
||||||
- build:component_ut
|
|
||||||
- build:component_ut-esp32
|
|
||||||
|
@@ -605,9 +605,6 @@
|
|||||||
.if-label-integration_test_wifi: &if-label-integration_test_wifi
|
.if-label-integration_test_wifi: &if-label-integration_test_wifi
|
||||||
if: '$BOT_LABEL_INTEGRATION_TEST_WIFI || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*integration_test_wifi(?:,[^,\n\r]+)*$/i'
|
if: '$BOT_LABEL_INTEGRATION_TEST_WIFI || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*integration_test_wifi(?:,[^,\n\r]+)*$/i'
|
||||||
|
|
||||||
.if-label-lan8720: &if-label-lan8720
|
|
||||||
if: '$BOT_LABEL_LAN8720 || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*lan8720(?:,[^,\n\r]+)*$/i'
|
|
||||||
|
|
||||||
.if-label-macos: &if-label-macos
|
.if-label-macos: &if-label-macos
|
||||||
if: '$BOT_LABEL_MACOS || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*macos(?:,[^,\n\r]+)*$/i'
|
if: '$BOT_LABEL_MACOS || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*macos(?:,[^,\n\r]+)*$/i'
|
||||||
|
|
||||||
@@ -693,7 +690,6 @@
|
|||||||
- <<: *if-label-component_ut_esp32p4
|
- <<: *if-label-component_ut_esp32p4
|
||||||
- <<: *if-label-component_ut_esp32s2
|
- <<: *if-label-component_ut_esp32s2
|
||||||
- <<: *if-label-component_ut_esp32s3
|
- <<: *if-label-component_ut_esp32s3
|
||||||
- <<: *if-label-lan8720
|
|
||||||
- <<: *if-label-target_test
|
- <<: *if-label-target_test
|
||||||
- <<: *if-label-unit_test
|
- <<: *if-label-unit_test
|
||||||
- <<: *if-label-unit_test_esp32
|
- <<: *if-label-unit_test_esp32
|
||||||
@@ -741,7 +737,6 @@
|
|||||||
- <<: *if-label-build
|
- <<: *if-label-build
|
||||||
- <<: *if-label-component_ut
|
- <<: *if-label-component_ut
|
||||||
- <<: *if-label-component_ut_esp32
|
- <<: *if-label-component_ut_esp32
|
||||||
- <<: *if-label-lan8720
|
|
||||||
- <<: *if-label-target_test
|
- <<: *if-label-target_test
|
||||||
- <<: *if-label-unit_test
|
- <<: *if-label-unit_test
|
||||||
- <<: *if-label-unit_test_esp32
|
- <<: *if-label-unit_test_esp32
|
||||||
@@ -1640,7 +1635,6 @@
|
|||||||
- <<: *if-label-integration_test
|
- <<: *if-label-integration_test
|
||||||
- <<: *if-label-integration_test_ble
|
- <<: *if-label-integration_test_ble
|
||||||
- <<: *if-label-integration_test_wifi
|
- <<: *if-label-integration_test_wifi
|
||||||
- <<: *if-label-lan8720
|
|
||||||
- <<: *if-label-target_test
|
- <<: *if-label-target_test
|
||||||
- <<: *if-label-unit_test
|
- <<: *if-label-unit_test
|
||||||
- <<: *if-label-unit_test_esp32
|
- <<: *if-label-unit_test_esp32
|
||||||
@@ -1718,7 +1712,6 @@
|
|||||||
when: never
|
when: never
|
||||||
- <<: *if-protected
|
- <<: *if-protected
|
||||||
- <<: *if-label-build
|
- <<: *if-label-build
|
||||||
- <<: *if-label-lan8720
|
|
||||||
- <<: *if-label-target_test
|
- <<: *if-label-target_test
|
||||||
- <<: *if-label-unit_test
|
- <<: *if-label-unit_test
|
||||||
- <<: *if-label-unit_test_esp32
|
- <<: *if-label-unit_test_esp32
|
||||||
@@ -1752,7 +1745,6 @@
|
|||||||
when: never
|
when: never
|
||||||
- <<: *if-protected
|
- <<: *if-protected
|
||||||
- <<: *if-label-build
|
- <<: *if-label-build
|
||||||
- <<: *if-label-lan8720
|
|
||||||
- <<: *if-label-target_test
|
- <<: *if-label-target_test
|
||||||
- <<: *if-label-unit_test
|
- <<: *if-label-unit_test
|
||||||
- <<: *if-label-unit_test_esp32
|
- <<: *if-label-unit_test_esp32
|
||||||
@@ -1955,13 +1947,6 @@
|
|||||||
- <<: *if-dev-push
|
- <<: *if-dev-push
|
||||||
changes: *patterns-unit_test-sdio
|
changes: *patterns-unit_test-sdio
|
||||||
|
|
||||||
.rules:labels-protected:lan8720:
|
|
||||||
rules:
|
|
||||||
- <<: *if-revert-branch
|
|
||||||
when: never
|
|
||||||
- <<: *if-protected
|
|
||||||
- <<: *if-label-lan8720
|
|
||||||
|
|
||||||
.rules:labels:nvs_coverage:
|
.rules:labels:nvs_coverage:
|
||||||
rules:
|
rules:
|
||||||
- <<: *if-revert-branch
|
- <<: *if-revert-branch
|
||||||
|
@@ -670,10 +670,51 @@ pytest_components_esp32_ip101:
|
|||||||
pytest_components_esp32_lan8720:
|
pytest_components_esp32_lan8720:
|
||||||
extends:
|
extends:
|
||||||
- .pytest_components_dir_template
|
- .pytest_components_dir_template
|
||||||
- .rules:labels-protected:lan8720 # FIXME: IDFCI-1176
|
|
||||||
needs:
|
needs:
|
||||||
- build_pytest_components_esp32
|
- build_pytest_components_esp32
|
||||||
tags: [ esp32, lan8720 ]
|
tags: [ esp32, eth_lan8720 ]
|
||||||
|
|
||||||
|
pytest_components_esp32_rtl8201:
|
||||||
|
extends:
|
||||||
|
- .pytest_components_dir_template
|
||||||
|
needs:
|
||||||
|
- build_pytest_components_esp32
|
||||||
|
tags: [ esp32, eth_rtl8201 ]
|
||||||
|
|
||||||
|
pytest_components_esp32_w5500:
|
||||||
|
extends:
|
||||||
|
- .pytest_components_dir_template
|
||||||
|
needs:
|
||||||
|
- build_pytest_components_esp32
|
||||||
|
tags: [ esp32, eth_w5500 ]
|
||||||
|
|
||||||
|
pytest_components_esp32_ksz8851snl:
|
||||||
|
extends:
|
||||||
|
- .pytest_components_dir_template
|
||||||
|
needs:
|
||||||
|
- build_pytest_components_esp32
|
||||||
|
tags: [ esp32, eth_ksz8851snl ]
|
||||||
|
|
||||||
|
pytest_components_esp32_dm9051:
|
||||||
|
extends:
|
||||||
|
- .pytest_components_dir_template
|
||||||
|
needs:
|
||||||
|
- build_pytest_components_esp32
|
||||||
|
tags: [ esp32, eth_dm9051 ]
|
||||||
|
|
||||||
|
pytest_components_esp32_ksz8041:
|
||||||
|
extends:
|
||||||
|
- .pytest_components_dir_template
|
||||||
|
needs:
|
||||||
|
- build_pytest_components_esp32
|
||||||
|
tags: [ esp32, eth_ksz8041 ]
|
||||||
|
|
||||||
|
pytest_components_esp32_dp83848:
|
||||||
|
extends:
|
||||||
|
- .pytest_components_dir_template
|
||||||
|
needs:
|
||||||
|
- build_pytest_components_esp32
|
||||||
|
tags: [ esp32, eth_dp83848 ]
|
||||||
|
|
||||||
pytest_components_esp32_ethernet:
|
pytest_components_esp32_ethernet:
|
||||||
extends:
|
extends:
|
||||||
|
@@ -634,7 +634,6 @@ esp_eth_mac_t *esp_eth_mac_new_esp32(const eth_esp32_emac_config_t *esp32_config
|
|||||||
emac->smi_mdio_gpio_num = esp32_config->smi_mdio_gpio_num;
|
emac->smi_mdio_gpio_num = esp32_config->smi_mdio_gpio_num;
|
||||||
emac->flow_control_high_water_mark = FLOW_CONTROL_HIGH_WATER_MARK;
|
emac->flow_control_high_water_mark = FLOW_CONTROL_HIGH_WATER_MARK;
|
||||||
emac->flow_control_low_water_mark = FLOW_CONTROL_LOW_WATER_MARK;
|
emac->flow_control_low_water_mark = FLOW_CONTROL_LOW_WATER_MARK;
|
||||||
emac->use_apll = false;
|
|
||||||
emac->parent.set_mediator = emac_esp32_set_mediator;
|
emac->parent.set_mediator = emac_esp32_set_mediator;
|
||||||
emac->parent.init = emac_esp32_init;
|
emac->parent.init = emac_esp32_init;
|
||||||
emac->parent.deinit = emac_esp32_deinit;
|
emac->parent.deinit = emac_esp32_deinit;
|
||||||
|
@@ -298,7 +298,7 @@ static esp_err_t init_set_defaults(emac_ksz8851snl_t *emac)
|
|||||||
ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXDTTR, RXDTTR_INIT_VALUE), err, TAG, "RXDTTR write failed");
|
ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXDTTR, RXDTTR_INIT_VALUE), err, TAG, "RXDTTR write failed");
|
||||||
ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXDBCTR, RXDBCTR_INIT_VALUE), err, TAG, "RXDBCTR write failed");
|
ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXDBCTR, RXDBCTR_INIT_VALUE), err, TAG, "RXDBCTR write failed");
|
||||||
ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXCR1,
|
ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXCR1,
|
||||||
RXCR1_RXUDPFCC | RXCR1_RXTCPFCC | RXCR1_RXIPFCC | RXCR1_RXPAFMA | RXCR1_RXFCE | RXCR1_RXBE | RXCR1_RXUE | RXCR1_RXME), err, TAG, "RXCR1 write failed");
|
RXCR1_RXUDPFCC | RXCR1_RXTCPFCC | RXCR1_RXIPFCC | RXCR1_RXPAFMA | RXCR1_RXFCE | RXCR1_RXUE | RXCR1_RXME | RXCR1_RXMAFMA | RXCR1_RXAE), err, TAG, "RXCR1 write failed");
|
||||||
ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXCR2,
|
ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXCR2,
|
||||||
(4 << RXCR2_SRDBL_SHIFT) | RXCR2_IUFFP | RXCR2_RXIUFCEZ | RXCR2_UDPLFE | RXCR2_RXICMPFCC), err, TAG, "RXCR2 write failed");
|
(4 << RXCR2_SRDBL_SHIFT) | RXCR2_IUFFP | RXCR2_RXIUFCEZ | RXCR2_UDPLFE | RXCR2_RXICMPFCC), err, TAG, "RXCR2 write failed");
|
||||||
ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXQCR, RXQCR_RXFCTE | RXQCR_ADRFE), err, TAG, "RXQCR write failed");
|
ESP_GOTO_ON_ERROR(ksz8851_set_bits(emac, KSZ8851_RXQCR, RXQCR_RXFCTE | RXQCR_ADRFE), err, TAG, "RXQCR write failed");
|
||||||
@@ -650,13 +650,13 @@ static esp_err_t emac_ksz8851_set_promiscuous(esp_eth_mac_t *mac, bool enable)
|
|||||||
if (enable) {
|
if (enable) {
|
||||||
// NOTE(v.chistyakov): set promiscuous mode
|
// NOTE(v.chistyakov): set promiscuous mode
|
||||||
ESP_LOGD(TAG, "setting promiscuous mode");
|
ESP_LOGD(TAG, "setting promiscuous mode");
|
||||||
rxcr1 |= RXCR1_RXINVF | RXCR1_RXAE;
|
rxcr1 |= RXCR1_RXAE | RXCR1_RXINVF;
|
||||||
rxcr1 &= ~(RXCR1_RXPAFMA | RXCR1_RXMAFMA);
|
rxcr1 &= ~(RXCR1_RXPAFMA | RXCR1_RXMAFMA);
|
||||||
} else {
|
} else {
|
||||||
// NOTE(v.chistyakov): set hash perfect (default)
|
// NOTE(v.chistyakov): set hash perfect (default)
|
||||||
ESP_LOGD(TAG, "setting hash perfect mode");
|
ESP_LOGD(TAG, "setting perfect with multicast passed");
|
||||||
rxcr1 |= RXCR1_RXPAFMA;
|
rxcr1 |= RXCR1_RXAE| RXCR1_RXPAFMA | RXCR1_RXMAFMA;
|
||||||
rxcr1 &= ~(RXCR1_RXINVF | RXCR1_RXAE | RXCR1_RXMAFMA);
|
rxcr1 &= ~RXCR1_RXINVF;
|
||||||
}
|
}
|
||||||
ESP_GOTO_ON_ERROR(ksz8851_write_reg(emac, KSZ8851_RXCR1, rxcr1), err, TAG, "RXCR1 write failed");
|
ESP_GOTO_ON_ERROR(ksz8851_write_reg(emac, KSZ8851_RXCR1, rxcr1), err, TAG, "RXCR1 write failed");
|
||||||
err:
|
err:
|
||||||
|
@@ -384,16 +384,18 @@ esp_err_t esp_eth_phy_802_3_detect_phy_addr(esp_eth_mediator_t *eth, int *detect
|
|||||||
}
|
}
|
||||||
int addr_try = 0;
|
int addr_try = 0;
|
||||||
uint32_t reg_value = 0;
|
uint32_t reg_value = 0;
|
||||||
for (; addr_try < 32; addr_try++) {
|
for (int i = 0; i < 3; i++){
|
||||||
eth->phy_reg_read(eth, addr_try, ETH_PHY_IDR1_REG_ADDR, ®_value);
|
for (addr_try = 0; addr_try < 32; addr_try++) {
|
||||||
if (reg_value != 0xFFFF && reg_value != 0x00) {
|
eth->phy_reg_read(eth, addr_try, ETH_PHY_IDR1_REG_ADDR, ®_value);
|
||||||
*detected_addr = addr_try;
|
if (reg_value != 0xFFFF && reg_value != 0x00) {
|
||||||
break;
|
*detected_addr = addr_try;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (addr_try < 32) {
|
||||||
|
ESP_LOGD(TAG, "Found PHY address: %d", addr_try);
|
||||||
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (addr_try < 32) {
|
|
||||||
ESP_LOGD(TAG, "Found PHY address: %d", addr_try);
|
|
||||||
return ESP_OK;
|
|
||||||
}
|
}
|
||||||
ESP_LOGE(TAG, "No PHY device detected");
|
ESP_LOGE(TAG, "No PHY device detected");
|
||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
|
@@ -95,7 +95,7 @@ static esp_err_t dm9051_update_link_duplex_speed(phy_dm9051_t *dm9051)
|
|||||||
eth_duplex_t duplex = ETH_DUPLEX_HALF;
|
eth_duplex_t duplex = ETH_DUPLEX_HALF;
|
||||||
uint32_t peer_pause_ability = false;
|
uint32_t peer_pause_ability = false;
|
||||||
bmsr_reg_t bmsr;
|
bmsr_reg_t bmsr;
|
||||||
dscsr_reg_t dscsr;
|
bmcr_reg_t bmcr;
|
||||||
anlpar_reg_t anlpar;
|
anlpar_reg_t anlpar;
|
||||||
// BMSR is a latch low register
|
// BMSR is a latch low register
|
||||||
// after power up, the first latched value must be 0, which means down
|
// after power up, the first latched value must be 0, which means down
|
||||||
@@ -108,17 +108,9 @@ static esp_err_t dm9051_update_link_duplex_speed(phy_dm9051_t *dm9051)
|
|||||||
if (dm9051->phy_802_3.link_status != link) {
|
if (dm9051->phy_802_3.link_status != link) {
|
||||||
/* when link up, read negotiation result */
|
/* when link up, read negotiation result */
|
||||||
if (link == ETH_LINK_UP) {
|
if (link == ETH_LINK_UP) {
|
||||||
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_DSCSR_REG_ADDR, &(dscsr.val)), err, TAG, "read DSCSR failed");
|
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)), err, TAG, "read BMCR failed");
|
||||||
if (dscsr.fdx100 || dscsr.hdx100) {
|
speed = bmcr.speed_select == 1 ? ETH_SPEED_100M : ETH_SPEED_10M;
|
||||||
speed = ETH_SPEED_100M;
|
duplex = bmcr.duplex_mode == 1 ? ETH_DUPLEX_FULL : ETH_DUPLEX_HALF;
|
||||||
} else {
|
|
||||||
speed = ETH_SPEED_10M;
|
|
||||||
}
|
|
||||||
if (dscsr.fdx100 || dscsr.fdx10) {
|
|
||||||
duplex = ETH_DUPLEX_FULL;
|
|
||||||
} else {
|
|
||||||
duplex = ETH_DUPLEX_HALF;
|
|
||||||
}
|
|
||||||
ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_SPEED, (void *)speed), err, TAG, "change speed failed");
|
ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_SPEED, (void *)speed), err, TAG, "change speed failed");
|
||||||
ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_DUPLEX, (void *)duplex), err, TAG, "change duplex failed");
|
ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_DUPLEX, (void *)duplex), err, TAG, "change duplex failed");
|
||||||
/* if we're in duplex mode, and peer has the flow control ability */
|
/* if we're in duplex mode, and peer has the flow control ability */
|
||||||
@@ -231,7 +223,9 @@ static esp_err_t dm9051_set_speed(esp_eth_phy_t *phy, eth_speed_t speed)
|
|||||||
/* Check if loopback is enabled, and if so, can it work with proposed speed or not */
|
/* Check if loopback is enabled, and if so, can it work with proposed speed or not */
|
||||||
bmcr_reg_t bmcr;
|
bmcr_reg_t bmcr;
|
||||||
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, phy_802_3->addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)), err, TAG, "read BMCR failed");
|
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, phy_802_3->addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)), err, TAG, "read BMCR failed");
|
||||||
ESP_GOTO_ON_FALSE(bmcr.en_loopback & (speed == ETH_SPEED_100M), ESP_ERR_INVALID_STATE, err, TAG, "Speed must be 100M for loopback operation");
|
if (bmcr.en_loopback) {
|
||||||
|
ESP_GOTO_ON_FALSE(speed == ETH_SPEED_100M, ESP_ERR_INVALID_STATE, err, TAG, "Speed must be 100M for loopback operation");
|
||||||
|
}
|
||||||
|
|
||||||
return esp_eth_phy_802_3_set_speed(phy_802_3, speed);
|
return esp_eth_phy_802_3_set_speed(phy_802_3, speed);
|
||||||
err:
|
err:
|
||||||
|
@@ -186,7 +186,9 @@ static esp_err_t ksz80xx_set_speed(esp_eth_phy_t *phy, eth_speed_t speed)
|
|||||||
/* Check if loopback is enabled, and if so, can it work with proposed speed or not */
|
/* Check if loopback is enabled, and if so, can it work with proposed speed or not */
|
||||||
bmcr_reg_t bmcr;
|
bmcr_reg_t bmcr;
|
||||||
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, phy_802_3->addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)), err, TAG, "read BMCR failed");
|
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, phy_802_3->addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)), err, TAG, "read BMCR failed");
|
||||||
ESP_GOTO_ON_FALSE(bmcr.en_loopback & (speed == ETH_SPEED_100M), ESP_ERR_INVALID_STATE, err, TAG, "Speed must be 100M for loopback operation");
|
if (bmcr.en_loopback) {
|
||||||
|
ESP_GOTO_ON_FALSE(speed == ETH_SPEED_100M, ESP_ERR_INVALID_STATE, err, TAG, "Speed must be 100M for loopback operation");
|
||||||
|
}
|
||||||
|
|
||||||
return esp_eth_phy_802_3_set_speed(phy_802_3, speed);
|
return esp_eth_phy_802_3_set_speed(phy_802_3, speed);
|
||||||
err:
|
err:
|
||||||
|
@@ -4,3 +4,5 @@ components/esp_eth/test_apps:
|
|||||||
enable:
|
enable:
|
||||||
- if: IDF_TARGET == "esp32"
|
- if: IDF_TARGET == "esp32"
|
||||||
reason: only test on esp32
|
reason: only test on esp32
|
||||||
|
depends_components:
|
||||||
|
- esp_eth
|
||||||
|
@@ -76,7 +76,7 @@ menu "esp_eth TEST_APPS Configuration"
|
|||||||
config TARGET_SPI_CLOCK_MHZ
|
config TARGET_SPI_CLOCK_MHZ
|
||||||
int "SPI clock speed (MHz)"
|
int "SPI clock speed (MHz)"
|
||||||
range 5 80
|
range 5 80
|
||||||
default 12
|
default 20
|
||||||
help
|
help
|
||||||
Set the clock speed (MHz) of SPI interface.
|
Set the clock speed (MHz) of SPI interface.
|
||||||
|
|
||||||
|
@@ -243,7 +243,18 @@ TEST_CASE("ethernet recv_pkt", "[ethernet_l2]")
|
|||||||
|
|
||||||
TEST_CASE("ethernet start/stop stress test under heavy traffic", "[ethernet_l2]")
|
TEST_CASE("ethernet start/stop stress test under heavy traffic", "[ethernet_l2]")
|
||||||
{
|
{
|
||||||
|
// *** SPI Ethernet modules deviation ***
|
||||||
|
// Rationale: The SPI bus is bottleneck when reading received frames from the module. The Rx Task would
|
||||||
|
// occupy all the resources under heavy Rx traffic and it would not be possible to access
|
||||||
|
// the Ethernet module to stop it. Therfore, the Rx task priority is set lower than "test" task
|
||||||
|
// to be able to be preempted.
|
||||||
|
#if CONFIG_TARGET_USE_SPI_ETHERNET
|
||||||
|
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
||||||
|
mac_config.rx_task_prio = uxTaskPriorityGet(NULL) - 1;
|
||||||
|
esp_eth_mac_t *mac = mac_init(NULL, &mac_config);
|
||||||
|
#else
|
||||||
esp_eth_mac_t *mac = mac_init(NULL, NULL);
|
esp_eth_mac_t *mac = mac_init(NULL, NULL);
|
||||||
|
#endif // CONFIG_TARGET_USE_SPI_ETHERNET
|
||||||
TEST_ASSERT_NOT_NULL(mac);
|
TEST_ASSERT_NOT_NULL(mac);
|
||||||
esp_eth_phy_t *phy = phy_init(NULL);
|
esp_eth_phy_t *phy = phy_init(NULL);
|
||||||
TEST_ASSERT_NOT_NULL(phy);
|
TEST_ASSERT_NOT_NULL(phy);
|
||||||
@@ -292,8 +303,13 @@ TEST_CASE("ethernet start/stop stress test under heavy traffic", "[ethernet_l2]"
|
|||||||
// this also serves as main PASS/FAIL criteria
|
// this also serves as main PASS/FAIL criteria
|
||||||
poke_and_wait(eth_handle, &tx_i, sizeof(tx_i), eth_event_rx_group);
|
poke_and_wait(eth_handle, &tx_i, sizeof(tx_i), eth_event_rx_group);
|
||||||
|
|
||||||
// generate heavy Tx traffic
|
// *** SPI Ethernet modules deviation ***
|
||||||
|
// Rationale: Transmit errors are expected only for internal EMAC since it is possible to try to queue more
|
||||||
|
// data than it is able to process at a time.
|
||||||
|
#if !CONFIG_TARGET_USE_SPI_ETHERNET
|
||||||
printf("Note: transmit errors are expected...\n");
|
printf("Note: transmit errors are expected...\n");
|
||||||
|
#endif
|
||||||
|
// generate heavy Tx traffic
|
||||||
for (int j = 0; j < 150; j++) {
|
for (int j = 0; j < 150; j++) {
|
||||||
// return value is not checked on purpose since it is expected that it may fail time to time because
|
// return value is not checked on purpose since it is expected that it may fail time to time because
|
||||||
// we may try to queue more packets than hardware is able to handle
|
// we may try to queue more packets than hardware is able to handle
|
||||||
|
@@ -9,7 +9,7 @@ from multiprocessing import Pipe, Process, connection
|
|||||||
from typing import Iterator
|
from typing import Iterator
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from pytest_embedded import Dut
|
from pytest_embedded_idf import IdfDut
|
||||||
from scapy.all import Ether, raw
|
from scapy.all import Ether, raw
|
||||||
|
|
||||||
ETH_TYPE = 0x3300
|
ETH_TYPE = 0x3300
|
||||||
@@ -24,6 +24,7 @@ class EthTestIntf(object):
|
|||||||
def find_target_if(self, my_if: str = '') -> None:
|
def find_target_if(self, my_if: str = '') -> None:
|
||||||
# try to determine which interface to use
|
# try to determine which interface to use
|
||||||
netifs = os.listdir('/sys/class/net/')
|
netifs = os.listdir('/sys/class/net/')
|
||||||
|
netifs.sort(reverse=True)
|
||||||
logging.info('detected interfaces: %s', str(netifs))
|
logging.info('detected interfaces: %s', str(netifs))
|
||||||
|
|
||||||
for netif in netifs:
|
for netif in netifs:
|
||||||
@@ -100,25 +101,15 @@ class EthTestIntf(object):
|
|||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
def ethernet_test(dut: Dut) -> None:
|
def ethernet_test(dut: IdfDut) -> None:
|
||||||
dut.expect_exact('Press ENTER to see the list of tests')
|
dut.run_all_single_board_cases(group='ethernet', timeout=980)
|
||||||
dut.write('\n')
|
|
||||||
|
|
||||||
dut.expect_exact('Enter test for running.')
|
|
||||||
dut.write('[ethernet]')
|
|
||||||
dut.expect_unity_test_output(timeout=980)
|
|
||||||
|
|
||||||
|
|
||||||
def ethernet_int_emac_hal_test(dut: Dut) -> None:
|
def ethernet_int_emac_hal_test(dut: IdfDut) -> None:
|
||||||
dut.expect_exact('Press ENTER to see the list of tests')
|
dut.run_all_single_board_cases(group='emac_hal')
|
||||||
dut.write('\n')
|
|
||||||
|
|
||||||
dut.expect_exact('Enter test for running.')
|
|
||||||
dut.write('[emac_hal]')
|
|
||||||
dut.expect_unity_test_output()
|
|
||||||
|
|
||||||
|
|
||||||
def ethernet_l2_test(dut: Dut) -> None:
|
def ethernet_l2_test(dut: IdfDut) -> None:
|
||||||
target_if = EthTestIntf(ETH_TYPE)
|
target_if = EthTestIntf(ETH_TYPE)
|
||||||
|
|
||||||
dut.expect_exact('Press ENTER to see the list of tests')
|
dut.expect_exact('Press ENTER to see the list of tests')
|
||||||
@@ -159,7 +150,7 @@ def ethernet_l2_test(dut: Dut) -> None:
|
|||||||
# (there might be slight delay due to the RSTP execution)
|
# (there might be slight delay due to the RSTP execution)
|
||||||
target_if.recv_resp_poke(mac=dut_mac)
|
target_if.recv_resp_poke(mac=dut_mac)
|
||||||
target_if.send_eth_packet('ff:ff:ff:ff:ff:ff') # broadcast frame
|
target_if.send_eth_packet('ff:ff:ff:ff:ff:ff') # broadcast frame
|
||||||
target_if.send_eth_packet('01:00:00:00:00:00') # multicast frame
|
target_if.send_eth_packet('01:00:5e:00:00:00') # IPv4 multicast frame (some SPI Eth modules filter multicast other than IP)
|
||||||
target_if.send_eth_packet(mac=dut_mac) # unicast frame
|
target_if.send_eth_packet(mac=dut_mac) # unicast frame
|
||||||
dut.expect_unity_test_output(extra_before=res.group(1))
|
dut.expect_unity_test_output(extra_before=res.group(1))
|
||||||
|
|
||||||
@@ -189,6 +180,7 @@ def ethernet_l2_test(dut: Dut) -> None:
|
|||||||
dut.expect_unity_test_output(extra_before=res.group(1))
|
dut.expect_unity_test_output(extra_before=res.group(1))
|
||||||
|
|
||||||
|
|
||||||
|
# ----------- IP101 -----------
|
||||||
@pytest.mark.esp32
|
@pytest.mark.esp32
|
||||||
@pytest.mark.ethernet
|
@pytest.mark.ethernet
|
||||||
@pytest.mark.parametrize('config', [
|
@pytest.mark.parametrize('config', [
|
||||||
@@ -197,7 +189,7 @@ def ethernet_l2_test(dut: Dut) -> None:
|
|||||||
'single_core_ip101'
|
'single_core_ip101'
|
||||||
], indirect=True)
|
], indirect=True)
|
||||||
@pytest.mark.flaky(reruns=3, reruns_delay=5)
|
@pytest.mark.flaky(reruns=3, reruns_delay=5)
|
||||||
def test_esp_ethernet(dut: Dut) -> None:
|
def test_esp_ethernet(dut: IdfDut) -> None:
|
||||||
ethernet_test(dut)
|
ethernet_test(dut)
|
||||||
|
|
||||||
|
|
||||||
@@ -206,7 +198,7 @@ def test_esp_ethernet(dut: Dut) -> None:
|
|||||||
@pytest.mark.parametrize('config', [
|
@pytest.mark.parametrize('config', [
|
||||||
'default_ip101',
|
'default_ip101',
|
||||||
], indirect=True)
|
], indirect=True)
|
||||||
def test_esp_emac_hal(dut: Dut) -> None:
|
def test_esp_emac_hal(dut: IdfDut) -> None:
|
||||||
ethernet_int_emac_hal_test(dut)
|
ethernet_int_emac_hal_test(dut)
|
||||||
|
|
||||||
|
|
||||||
@@ -215,14 +207,89 @@ def test_esp_emac_hal(dut: Dut) -> None:
|
|||||||
@pytest.mark.parametrize('config', [
|
@pytest.mark.parametrize('config', [
|
||||||
'default_ip101',
|
'default_ip101',
|
||||||
], indirect=True)
|
], indirect=True)
|
||||||
def test_esp_eth_ip101(dut: Dut) -> None:
|
def test_esp_eth_ip101(dut: IdfDut) -> None:
|
||||||
ethernet_l2_test(dut)
|
ethernet_l2_test(dut)
|
||||||
|
|
||||||
|
|
||||||
|
# ----------- LAN8720 -----------
|
||||||
@pytest.mark.esp32
|
@pytest.mark.esp32
|
||||||
@pytest.mark.lan8720
|
@pytest.mark.eth_lan8720
|
||||||
@pytest.mark.parametrize('config', [
|
@pytest.mark.parametrize('config', [
|
||||||
'default_lan8720',
|
'default_lan8720',
|
||||||
], indirect=True)
|
], indirect=True)
|
||||||
def test_esp_eth_lan8720(dut: Dut) -> None:
|
def test_esp_eth_lan8720(dut: IdfDut) -> None:
|
||||||
|
ethernet_test(dut)
|
||||||
|
dut.serial.hard_reset()
|
||||||
|
ethernet_l2_test(dut)
|
||||||
|
|
||||||
|
|
||||||
|
# ----------- RTL8201 -----------
|
||||||
|
@pytest.mark.esp32
|
||||||
|
@pytest.mark.eth_rtl8201
|
||||||
|
@pytest.mark.parametrize('config', [
|
||||||
|
'default_rtl8201',
|
||||||
|
], indirect=True)
|
||||||
|
def test_esp_eth_rtl8201(dut: IdfDut) -> None:
|
||||||
|
ethernet_test(dut)
|
||||||
|
dut.serial.hard_reset()
|
||||||
|
ethernet_l2_test(dut)
|
||||||
|
|
||||||
|
|
||||||
|
# ----------- KSZ8041 -----------
|
||||||
|
@pytest.mark.esp32
|
||||||
|
@pytest.mark.eth_ksz8041
|
||||||
|
@pytest.mark.parametrize('config', [
|
||||||
|
'default_ksz8041',
|
||||||
|
], indirect=True)
|
||||||
|
def test_esp_eth_ksz8041(dut: IdfDut) -> None:
|
||||||
|
ethernet_test(dut)
|
||||||
|
dut.serial.hard_reset()
|
||||||
|
ethernet_l2_test(dut)
|
||||||
|
|
||||||
|
|
||||||
|
# ----------- DP83848 -----------
|
||||||
|
@pytest.mark.esp32
|
||||||
|
@pytest.mark.eth_dp83848
|
||||||
|
@pytest.mark.parametrize('config', [
|
||||||
|
'default_dp83848',
|
||||||
|
], indirect=True)
|
||||||
|
def test_esp_eth_dp83848(dut: IdfDut) -> None:
|
||||||
|
ethernet_test(dut)
|
||||||
|
dut.serial.hard_reset()
|
||||||
|
ethernet_l2_test(dut)
|
||||||
|
|
||||||
|
|
||||||
|
# ----------- W5500 -----------
|
||||||
|
@pytest.mark.esp32
|
||||||
|
@pytest.mark.eth_w5500
|
||||||
|
@pytest.mark.parametrize('config', [
|
||||||
|
'default_w5500',
|
||||||
|
], indirect=True)
|
||||||
|
def test_esp_eth_w5500(dut: IdfDut) -> None:
|
||||||
|
ethernet_test(dut)
|
||||||
|
dut.serial.hard_reset()
|
||||||
|
ethernet_l2_test(dut)
|
||||||
|
|
||||||
|
|
||||||
|
# ----------- KSZ8851SNL -----------
|
||||||
|
@pytest.mark.esp32
|
||||||
|
@pytest.mark.eth_ksz8851snl
|
||||||
|
@pytest.mark.parametrize('config', [
|
||||||
|
'default_ksz8851snl',
|
||||||
|
], indirect=True)
|
||||||
|
def test_esp_eth_ksz8851snl(dut: IdfDut) -> None:
|
||||||
|
ethernet_test(dut)
|
||||||
|
dut.serial.hard_reset()
|
||||||
|
ethernet_l2_test(dut)
|
||||||
|
|
||||||
|
|
||||||
|
# ----------- DM9051 -----------
|
||||||
|
@pytest.mark.esp32
|
||||||
|
@pytest.mark.eth_dm9051
|
||||||
|
@pytest.mark.parametrize('config', [
|
||||||
|
'default_dm9051',
|
||||||
|
], indirect=True)
|
||||||
|
def test_esp_eth_dm9051(dut: IdfDut) -> None:
|
||||||
|
ethernet_test(dut)
|
||||||
|
dut.serial.hard_reset()
|
||||||
ethernet_l2_test(dut)
|
ethernet_l2_test(dut)
|
||||||
|
@@ -7,3 +7,5 @@ CONFIG_ESP_TASK_WDT=n
|
|||||||
|
|
||||||
CONFIG_TARGET_USE_INTERNAL_ETHERNET=y
|
CONFIG_TARGET_USE_INTERNAL_ETHERNET=y
|
||||||
CONFIG_TARGET_ETH_PHY_DEVICE_DP83848=y
|
CONFIG_TARGET_ETH_PHY_DEVICE_DP83848=y
|
||||||
|
CONFIG_ETH_RMII_CLK_OUTPUT=y
|
||||||
|
CONFIG_ETH_RMII_CLK_OUT_GPIO=17
|
||||||
|
@@ -7,5 +7,3 @@ CONFIG_ESP_TASK_WDT=n
|
|||||||
|
|
||||||
CONFIG_TARGET_USE_INTERNAL_ETHERNET=y
|
CONFIG_TARGET_USE_INTERNAL_ETHERNET=y
|
||||||
CONFIG_TARGET_ETH_PHY_DEVICE_KSZ80XX=y
|
CONFIG_TARGET_ETH_PHY_DEVICE_KSZ80XX=y
|
||||||
CONFIG_ETH_RMII_CLK_OUTPUT=y
|
|
||||||
CONFIG_ETH_RMII_CLK_OUT_GPIO=17
|
|
@@ -43,7 +43,13 @@ ENV_MARKERS = {
|
|||||||
'generic': 'tests should be run on generic runners',
|
'generic': 'tests should be run on generic runners',
|
||||||
'flash_suspend': 'support flash suspend feature',
|
'flash_suspend': 'support flash suspend feature',
|
||||||
'ip101': 'connected via wired 10/100M ethernet',
|
'ip101': 'connected via wired 10/100M ethernet',
|
||||||
'lan8720': 'connected via LAN8720 ethernet transceiver',
|
'eth_lan8720': 'connected via LAN8720 ethernet transceiver',
|
||||||
|
'eth_rtl8201': 'connected via RTL8201 ethernet transceiver',
|
||||||
|
'eth_ksz8041': 'connected via KSZ8041 ethernet transceiver',
|
||||||
|
'eth_dp83848': 'connected via DP83848 ethernet transceiver',
|
||||||
|
'eth_w5500': 'SPI Ethernet module with two W5500',
|
||||||
|
'eth_ksz8851snl': 'SPI Ethernet module with two KSZ8851SNL',
|
||||||
|
'eth_dm9051': 'SPI Ethernet module with two DM9051',
|
||||||
'quad_psram': 'runners with quad psram',
|
'quad_psram': 'runners with quad psram',
|
||||||
'octal_psram': 'runners with octal psram',
|
'octal_psram': 'runners with octal psram',
|
||||||
'usb_host': 'usb host runners',
|
'usb_host': 'usb host runners',
|
||||||
@@ -87,7 +93,6 @@ ENV_MARKERS = {
|
|||||||
'esp32eco3': 'Runner with esp32 eco3 connected',
|
'esp32eco3': 'Runner with esp32 eco3 connected',
|
||||||
'ecdsa_efuse': 'Runner with test ECDSA private keys programmed in efuse',
|
'ecdsa_efuse': 'Runner with test ECDSA private keys programmed in efuse',
|
||||||
'ccs811': 'Runner with CCS811 connected',
|
'ccs811': 'Runner with CCS811 connected',
|
||||||
'eth_w5500': 'SPI Ethernet module with two W5500',
|
|
||||||
'nvs_encr_hmac': 'Runner with test HMAC key programmed in efuse',
|
'nvs_encr_hmac': 'Runner with test HMAC key programmed in efuse',
|
||||||
'i2c_oled': 'Runner with ssd1306 I2C oled connected',
|
'i2c_oled': 'Runner with ssd1306 I2C oled connected',
|
||||||
'httpbin': 'runner for tests that need to access the httpbin service',
|
'httpbin': 'runner for tests that need to access the httpbin service',
|
||||||
|
Reference in New Issue
Block a user