| 573 | } |
| 574 | |
| 575 | static int |
| 576 | test_setup(void) |
| 577 | { |
| 578 | unsigned n; |
| 579 | int retval; |
| 580 | int port_id; |
| 581 | char name[256]; |
| 582 | struct member_conf *port; |
| 583 | struct rte_ether_addr mac_addr = { .addr_bytes = {0} }; |
| 584 | |
| 585 | if (test_params.mbuf_pool == NULL) { |
| 586 | |
| 587 | test_params.mbuf_pool = rte_pktmbuf_pool_create( |
| 588 | "RSS_MBUF_POOL", NUM_MBUFS * MEMBER_COUNT, |
| 589 | MBUF_CACHE_SIZE, 0, MBUF_SIZE, rte_socket_id()); |
| 590 | |
| 591 | TEST_ASSERT(test_params.mbuf_pool != NULL, |
| 592 | "rte_pktmbuf_pool_create failed\n"); |
| 593 | } |
| 594 | |
| 595 | /* Create / initialize ring eth devs. */ |
| 596 | FOR_EACH_PORT(n, port) { |
| 597 | port = &test_params.member_ports[n]; |
| 598 | |
| 599 | port_id = rte_eth_dev_count_avail(); |
| 600 | snprintf(name, sizeof(name), MEMBER_DEV_NAME_FMT, port_id); |
| 601 | |
| 602 | retval = rte_vdev_init(name, "size=64,copy=0"); |
| 603 | TEST_ASSERT_SUCCESS(retval, "Failed to create null device '%s'\n", |
| 604 | name); |
| 605 | |
| 606 | port->port_id = port_id; |
| 607 | |
| 608 | port->rss_conf.rss_key = port->rss_key; |
| 609 | port->rss_conf.rss_key_len = 40; |
| 610 | |
| 611 | retval = configure_ethdev(port->port_id, &default_pmd_conf, 0); |
| 612 | TEST_ASSERT_SUCCESS(retval, "Failed to configure virtual ethdev %s\n", |
| 613 | name); |
| 614 | |
| 615 | /* assign a non-zero MAC */ |
| 616 | mac_addr.addr_bytes[5] = 0x10 + port->port_id; |
| 617 | rte_eth_dev_default_mac_addr_set(port->port_id, &mac_addr); |
| 618 | |
| 619 | retval = rte_eth_dev_info_get(port->port_id, &port->dev_info); |
| 620 | TEST_ASSERT((retval == 0), |
| 621 | "Error during getting device (port %u) info: %s\n", |
| 622 | test_params.bond_port_id, strerror(-retval)); |
| 623 | } |
| 624 | |
| 625 | if (test_params.bond_port_id == INVALID_PORT_ID) { |
| 626 | retval = rte_eth_bond_create(BONDING_DEV_NAME, 0, rte_socket_id()); |
| 627 | |
| 628 | TEST_ASSERT(retval >= 0, "Failed to create bonding ethdev %s", |
| 629 | BONDING_DEV_NAME); |
| 630 | |
| 631 | test_params.bond_port_id = retval; |
| 632 |
nothing calls this directly
no test coverage detected