@@ -220,6 +220,15 @@ TEST_CASE("ethernet recv_pkt", "[ethernet_l2]")
220220
221221 TEST_ESP_OK (esp_eth_update_input_path (eth_handle , l2_packet_txrx_test_cb , & s_recv_info ));
222222
223+ TEST_ESP_OK (esp_eth_start (eth_handle )); // start Ethernet driver state machine
224+
225+ EventBits_t bits = 0 ;
226+ bits = xEventGroupWaitBits (eth_event_state_group , ETH_CONNECT_BIT , true, true, pdMS_TO_TICKS (WAIT_FOR_CONN_TMO_MS ));
227+ TEST_ASSERT ((bits & ETH_CONNECT_BIT ) == ETH_CONNECT_BIT );
228+ // if DUT is connected in network with switch: even if link is indicated up, it may take some time the switch
229+ // starts switching the associated port (e.g. it runs RSTP at first)
230+ poke_and_wait (eth_handle , NULL , 0 , NULL , eth_event_rx_group );
231+
223232 // ---------------------------------------
224233 printf ("Enable receive all multicast\n" );
225234 // ---------------------------------------
@@ -231,18 +240,9 @@ TEST_CASE("ethernet recv_pkt", "[ethernet_l2]")
231240 s_recv_info .brdcast_rx_cnt = 0 ;
232241 bool all_multicast = true;
233242 TEST_ESP_OK (esp_eth_ioctl (eth_handle , ETH_CMD_S_ALL_MULTICAST , & all_multicast ));
234-
235- TEST_ESP_OK (esp_eth_start (eth_handle )); // start Ethernet driver state machine
236-
237- EventBits_t bits = 0 ;
238- bits = xEventGroupWaitBits (eth_event_state_group , ETH_CONNECT_BIT , true, true, pdMS_TO_TICKS (WAIT_FOR_CONN_TMO_MS ));
239- TEST_ASSERT ((bits & ETH_CONNECT_BIT ) == ETH_CONNECT_BIT );
240- // if DUT is connected in network with switch: even if link is indicated up, it may take some time the switch
241- // starts switching the associated port (e.g. it runs RSTP at first)
242- poke_and_wait (eth_handle , NULL , 0 , NULL , eth_event_rx_group );
243-
244243 bits = 0 ;
245244 xEventGroupClearBits (eth_event_rx_group , ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT );
245+ printf ("Filter configured\n" );
246246 bits = xEventGroupWaitBits (eth_event_rx_group , ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT ,
247247 true, true, pdMS_TO_TICKS (1000 ));
248248 printf ("bits = 0x%" PRIu32 "\n" , (uint32_t )bits & (ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT ));
@@ -270,11 +270,9 @@ TEST_CASE("ethernet recv_pkt", "[ethernet_l2]")
270270 s_recv_info .brdcast_rx_cnt = 0 ;
271271 all_multicast = false;
272272 TEST_ESP_OK (esp_eth_ioctl (eth_handle , ETH_CMD_S_ALL_MULTICAST , & all_multicast ));
273- // send POKE to indicate that the DUT reconfigured the filter
274- poke_and_wait (eth_handle , NULL , 0 , NULL , eth_event_rx_group );
275-
276273 bits = 0 ;
277274 xEventGroupClearBits (eth_event_rx_group , ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT );
275+ printf ("Filter configured\n" );
278276 bits = xEventGroupWaitBits (eth_event_rx_group , ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT ,
279277 true, true, pdMS_TO_TICKS (1000 ));
280278 printf ("bits = 0x%" PRIu32 "\n" , (uint32_t )bits & (ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT ));
@@ -297,10 +295,9 @@ TEST_CASE("ethernet recv_pkt", "[ethernet_l2]")
297295 TEST_ESP_OK (esp_eth_ioctl (eth_handle , ETH_CMD_ADD_MAC_FILTER , multicast_addr_ip4 ));
298296 uint8_t multicast_addr_ip6 [ETH_ADDR_LEN ] = {0x33 , 0x33 , 0x00 , 0x00 , 0x00 , 0x00 };
299297 TEST_ESP_OK (esp_eth_ioctl (eth_handle , ETH_CMD_ADD_MAC_FILTER , multicast_addr_ip6 ));
300- // send POKE to indicate that the DUT reconfigured the filter
301- poke_and_wait (eth_handle , NULL , 0 , NULL , eth_event_rx_group );
302298 bits = 0 ;
303299 xEventGroupClearBits (eth_event_rx_group , ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT );
300+ printf ("Filter configured\n" );
304301 bits = xEventGroupWaitBits (eth_event_rx_group , ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT ,
305302 true, true, pdMS_TO_TICKS (1000 ));
306303 printf ("bits = 0x%" PRIu32 "\n" , (uint32_t )bits & (ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT ));
@@ -319,10 +316,9 @@ TEST_CASE("ethernet recv_pkt", "[ethernet_l2]")
319316 s_recv_info .multicast_rx_cnt = 0 ;
320317 s_recv_info .brdcast_rx_cnt = 0 ;
321318 TEST_ESP_OK (esp_eth_ioctl (eth_handle , ETH_CMD_DEL_MAC_FILTER , multicast_addr_ip4 ));
322- // send POKE to indicate that the DUT reconfigured the filter
323- poke_and_wait (eth_handle , NULL , 0 , NULL , eth_event_rx_group );
324319 bits = 0 ;
325320 xEventGroupClearBits (eth_event_rx_group , ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT );
321+ printf ("Filter configured\n" );
326322 bits = xEventGroupWaitBits (eth_event_rx_group , ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT ,
327323 true, true, pdMS_TO_TICKS (1000 ));
328324 printf ("bits = 0x%" PRIu32 "\n" , (uint32_t )bits & (ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT ));
@@ -355,10 +351,9 @@ TEST_CASE("ethernet recv_pkt", "[ethernet_l2]")
355351#else
356352 TEST_ESP_OK (esp_eth_ioctl (eth_handle , ETH_CMD_DEL_MAC_FILTER , multicast_addr_ip6 ));
357353#endif
358- // send POKE to indicate that the DUT reconfigured the filter
359- poke_and_wait (eth_handle , NULL , 0 , NULL , eth_event_rx_group );
360354 bits = 0 ;
361355 xEventGroupClearBits (eth_event_rx_group , ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT );
356+ printf ("Filter configured\n" );
362357 bits = xEventGroupWaitBits (eth_event_rx_group , ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT ,
363358 true, true, pdMS_TO_TICKS (1000 ));
364359 printf ("bits = 0x%" PRIu32 "\n" , (uint32_t )bits & (ETH_BROADCAST_RECV_BIT | ETH_MULTICAST_RECV_BIT | ETH_UNICAST_RECV_BIT ));
0 commit comments