MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_start_bonding_device

Function test_start_bonding_device

dpdk/app/test/test_link_bonding.c:557–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

555}
556
557static int
558test_start_bonding_device(void)
559{
560 struct rte_eth_link link_status;
561
562 int current_member_count, current_bonding_mode, primary_port;
563 uint16_t members[RTE_MAX_ETHPORTS];
564 int retval;
565
566 /* Add member to bonding device*/
567 TEST_ASSERT_SUCCESS(test_add_member_to_bonding_device(),
568 "Failed to add member to bonding device");
569
570 TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params->bonding_port_id),
571 "Failed to start bonding pmd eth device %d.",
572 test_params->bonding_port_id);
573
574 /*
575 * Change link status of virtual pmd so it will be added to the active
576 * member list of the bonding device.
577 */
578 virtual_ethdev_simulate_link_status_interrupt(
579 test_params->member_port_ids[test_params->bonding_member_count-1], 1);
580
581 current_member_count = rte_eth_bond_members_get(test_params->bonding_port_id,
582 members, RTE_MAX_ETHPORTS);
583 TEST_ASSERT_EQUAL(current_member_count, test_params->bonding_member_count,
584 "Number of members (%d) is not expected value (%d).",
585 current_member_count, test_params->bonding_member_count);
586
587 current_member_count = rte_eth_bond_active_members_get(
588 test_params->bonding_port_id, members, RTE_MAX_ETHPORTS);
589 TEST_ASSERT_EQUAL(current_member_count, test_params->bonding_member_count,
590 "Number of active members (%d) is not expected value (%d).",
591 current_member_count, test_params->bonding_member_count);
592
593 current_bonding_mode = rte_eth_bond_mode_get(test_params->bonding_port_id);
594 TEST_ASSERT_EQUAL(current_bonding_mode, test_params->bonding_mode,
595 "Bonding device mode (%d) is not expected value (%d).\n",
596 current_bonding_mode, test_params->bonding_mode);
597
598 primary_port = rte_eth_bond_primary_get(test_params->bonding_port_id);
599 TEST_ASSERT_EQUAL(primary_port, test_params->member_port_ids[0],
600 "Primary port (%d) is not expected value (%d).",
601 primary_port, test_params->member_port_ids[0]);
602
603 retval = rte_eth_link_get(test_params->bonding_port_id, &link_status);
604 TEST_ASSERT(retval >= 0,
605 "Bonding port (%d) link get failed: %s\n",
606 test_params->bonding_port_id, rte_strerror(-retval));
607 TEST_ASSERT_EQUAL(link_status.link_status, 1,
608 "Bonding port (%d) status (%d) is not expected value (%d).\n",
609 test_params->bonding_port_id, link_status.link_status, 1);
610
611 return 0;
612}
613
614static int

Callers

nothing calls this directly

Calls 9

rte_eth_dev_startFunction · 0.85
rte_eth_bond_members_getFunction · 0.85
rte_eth_bond_mode_getFunction · 0.85
rte_eth_bond_primary_getFunction · 0.85
rte_eth_link_getFunction · 0.85
rte_strerrorFunction · 0.85

Tested by

no test coverage detected