| 1244 | } |
| 1245 | |
| 1246 | static int |
| 1247 | test_status_interrupt(void) |
| 1248 | { |
| 1249 | int member_count; |
| 1250 | uint16_t members[RTE_MAX_ETHPORTS]; |
| 1251 | |
| 1252 | /* initialized bonding device with T members */ |
| 1253 | TEST_ASSERT_SUCCESS(initialize_bonding_device_with_members( |
| 1254 | BONDING_MODE_ROUND_ROBIN, 1, |
| 1255 | TEST_STATUS_INTERRUPT_MEMBER_COUNT, 1), |
| 1256 | "Failed to initialise bonding device"); |
| 1257 | |
| 1258 | test_lsc_interrupt_count = 0; |
| 1259 | |
| 1260 | /* register link status change interrupt callback */ |
| 1261 | rte_eth_dev_callback_register(test_params->bonding_port_id, |
| 1262 | RTE_ETH_EVENT_INTR_LSC, test_bonding_lsc_event_callback, |
| 1263 | &test_params->bonding_port_id); |
| 1264 | |
| 1265 | member_count = rte_eth_bond_active_members_get(test_params->bonding_port_id, |
| 1266 | members, RTE_MAX_ETHPORTS); |
| 1267 | |
| 1268 | TEST_ASSERT_EQUAL(member_count, TEST_STATUS_INTERRUPT_MEMBER_COUNT, |
| 1269 | "Number of active members (%d) is not as expected (%d)", |
| 1270 | member_count, TEST_STATUS_INTERRUPT_MEMBER_COUNT); |
| 1271 | |
| 1272 | /* Bring all 4 members link status to down and test that we have received a |
| 1273 | * lsc interrupts */ |
| 1274 | virtual_ethdev_simulate_link_status_interrupt( |
| 1275 | test_params->member_port_ids[0], 0); |
| 1276 | virtual_ethdev_simulate_link_status_interrupt( |
| 1277 | test_params->member_port_ids[1], 0); |
| 1278 | virtual_ethdev_simulate_link_status_interrupt( |
| 1279 | test_params->member_port_ids[2], 0); |
| 1280 | |
| 1281 | TEST_ASSERT_EQUAL(test_lsc_interrupt_count, 0, |
| 1282 | "Received a link status change interrupt unexpectedly"); |
| 1283 | |
| 1284 | virtual_ethdev_simulate_link_status_interrupt( |
| 1285 | test_params->member_port_ids[3], 0); |
| 1286 | |
| 1287 | TEST_ASSERT(lsc_timeout(TEST_LSC_WAIT_TIMEOUT_US) == 0, |
| 1288 | "timed out waiting for interrupt"); |
| 1289 | |
| 1290 | TEST_ASSERT(test_lsc_interrupt_count > 0, |
| 1291 | "Did not receive link status change interrupt"); |
| 1292 | |
| 1293 | member_count = rte_eth_bond_active_members_get(test_params->bonding_port_id, |
| 1294 | members, RTE_MAX_ETHPORTS); |
| 1295 | |
| 1296 | TEST_ASSERT_EQUAL(member_count, 0, |
| 1297 | "Number of active members (%d) is not as expected (%d)", |
| 1298 | member_count, 0); |
| 1299 | |
| 1300 | /* bring one member port up so link status will change */ |
| 1301 | test_lsc_interrupt_count = 0; |
| 1302 | |
| 1303 | virtual_ethdev_simulate_link_status_interrupt( |
nothing calls this directly
no test coverage detected