git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vhost: fix async callbacks return type
[dpdk.git]
/
app
/
test
/
test_link_bonding_mode4.c
diff --git
a/app/test/test_link_bonding_mode4.c
b/app/test/test_link_bonding_mode4.c
index
de23dd9
..
2c835fa
100644
(file)
--- a/
app/test/test_link_bonding_mode4.c
+++ b/
app/test/test_link_bonding_mode4.c
@@
-108,7
+108,7
@@
static struct link_bonding_unittest_params test_params = {
static struct rte_eth_conf default_pmd_conf = {
.rxmode = {
.mq_mode = ETH_MQ_RX_NONE,
static struct rte_eth_conf default_pmd_conf = {
.rxmode = {
.mq_mode = ETH_MQ_RX_NONE,
- .max_rx_pkt_len = ETHER_MAX_LEN,
+ .max_rx_pkt_len =
RTE_
ETHER_MAX_LEN,
.split_hdr_size = 0,
},
.txmode = {
.split_hdr_size = 0,
},
.txmode = {
@@
-225,6
+225,7
@@
static int
add_slave(struct slave_conf *slave, uint8_t start)
{
struct rte_ether_addr addr, addr_check;
add_slave(struct slave_conf *slave, uint8_t start)
{
struct rte_ether_addr addr, addr_check;
+ int retval;
/* Some sanity check */
RTE_VERIFY(test_params.slave_ports <= slave &&
/* Some sanity check */
RTE_VERIFY(test_params.slave_ports <= slave &&
@@
-232,8
+233,8
@@
add_slave(struct slave_conf *slave, uint8_t start)
RTE_VERIFY(slave->bonded == 0);
RTE_VERIFY(slave->port_id != INVALID_PORT_ID);
RTE_VERIFY(slave->bonded == 0);
RTE_VERIFY(slave->port_id != INVALID_PORT_ID);
- ether_addr_copy(&slave_mac_default, &addr);
- addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id;
+
rte_
ether_addr_copy(&slave_mac_default, &addr);
+ addr.addr_bytes[
RTE_
ETHER_ADDR_LEN - 1] = slave->port_id;
rte_eth_dev_mac_addr_remove(slave->port_id, &addr);
rte_eth_dev_mac_addr_remove(slave->port_id, &addr);
@@
-252,8
+253,10
@@
add_slave(struct slave_conf *slave, uint8_t start)
"Failed to start slave %u", slave->port_id);
}
"Failed to start slave %u", slave->port_id);
}
- rte_eth_macaddr_get(slave->port_id, &addr_check);
- TEST_ASSERT_EQUAL(is_same_ether_addr(&addr, &addr_check), 1,
+ retval = rte_eth_macaddr_get(slave->port_id, &addr_check);
+ TEST_ASSERT_SUCCESS(retval, "Failed to get slave mac address: %s",
+ strerror(-retval));
+ TEST_ASSERT_EQUAL(rte_is_same_ether_addr(&addr, &addr_check), 1,
"Slave MAC address is not as expected");
RTE_VERIFY(slave->lacp_parnter_state == 0);
"Slave MAC address is not as expected");
RTE_VERIFY(slave->lacp_parnter_state == 0);
@@
-299,7
+302,7
@@
lacp_recv_cb(uint16_t slave_id, struct rte_mbuf *lacp_pkt)
RTE_VERIFY(lacp_pkt != NULL);
hdr = rte_pktmbuf_mtod(lacp_pkt, struct rte_ether_hdr *);
RTE_VERIFY(lacp_pkt != NULL);
hdr = rte_pktmbuf_mtod(lacp_pkt, struct rte_ether_hdr *);
- RTE_VERIFY(hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_SLOW));
+ RTE_VERIFY(hdr->ether_type == rte_cpu_to_be_16(
RTE_
ETHER_TYPE_SLOW));
slow_hdr = rte_pktmbuf_mtod(lacp_pkt, struct slow_protocol_frame *);
RTE_VERIFY(slow_hdr->slow_protocol.subtype == SLOW_SUBTYPE_LACP);
slow_hdr = rte_pktmbuf_mtod(lacp_pkt, struct slow_protocol_frame *);
RTE_VERIFY(slow_hdr->slow_protocol.subtype == SLOW_SUBTYPE_LACP);
@@
-312,6
+315,7
@@
static int
initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm)
{
uint8_t i;
initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm)
{
uint8_t i;
+ int ret;
RTE_VERIFY(test_params.bonded_port_id != INVALID_PORT_ID);
RTE_VERIFY(test_params.bonded_port_id != INVALID_PORT_ID);
@@
-323,7
+327,10
@@
initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm)
/* Reset mode 4 configuration */
rte_eth_bond_8023ad_setup(test_params.bonded_port_id, NULL);
/* Reset mode 4 configuration */
rte_eth_bond_8023ad_setup(test_params.bonded_port_id, NULL);
- rte_eth_promiscuous_disable(test_params.bonded_port_id);
+ ret = rte_eth_promiscuous_disable(test_params.bonded_port_id);
+ TEST_ASSERT_SUCCESS(ret,
+ "Failed disable promiscuous mode for port %d: %s",
+ test_params.bonded_port_id, rte_strerror(-ret));
if (external_sm) {
struct rte_eth_bond_8023ad_conf conf;
if (external_sm) {
struct rte_eth_bond_8023ad_conf conf;
@@
-348,7
+355,9
@@
remove_slaves_and_stop_bonded_device(void)
uint16_t slaves[RTE_MAX_ETHPORTS];
uint16_t i;
uint16_t slaves[RTE_MAX_ETHPORTS];
uint16_t i;
- rte_eth_dev_stop(test_params.bonded_port_id);
+ TEST_ASSERT_SUCCESS(rte_eth_dev_stop(test_params.bonded_port_id),
+ "Failed to stop bonded port %u",
+ test_params.bonded_port_id);
FOR_EACH_SLAVE(i, slave)
remove_slave(slave);
FOR_EACH_SLAVE(i, slave)
remove_slave(slave);
@@
-361,7
+370,9
@@
remove_slaves_and_stop_bonded_device(void)
test_params.bonded_port_id, retval);
FOR_EACH_PORT(i, slave) {
test_params.bonded_port_id, retval);
FOR_EACH_PORT(i, slave) {
- rte_eth_dev_stop(slave->port_id);
+ TEST_ASSERT_SUCCESS(rte_eth_dev_stop(slave->port_id),
+ "Failed to stop bonded port %u",
+ slave->port_id);
TEST_ASSERT(slave->bonded == 0,
"Port id=%u is still marked as enslaved.", slave->port_id);
TEST_ASSERT(slave->bonded == 0,
"Port id=%u is still marked as enslaved.", slave->port_id);
@@
-480,7
+491,7
@@
make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt)
/* look for LACP */
hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
/* look for LACP */
hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
- if (hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_SLOW))
+ if (hdr->ether_type != rte_cpu_to_be_16(
RTE_
ETHER_TYPE_SLOW))
return 1;
slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *);
return 1;
slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *);
@@
-491,8
+502,9
@@
make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt)
slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *);
/* Change source address to partner address */
slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *);
/* Change source address to partner address */
- ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.s_addr);
- slow_hdr->eth_hdr.s_addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id;
+ rte_ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.s_addr);
+ slow_hdr->eth_hdr.s_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] =
+ slave->port_id;
lacp = (struct lacpdu *) &slow_hdr->slow_protocol;
/* Save last received state */
lacp = (struct lacpdu *) &slow_hdr->slow_protocol;
/* Save last received state */
@@
-503,7
+515,7
@@
make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt)
lacp->partner.state = lacp->actor.state;
lacp->partner.state = lacp->actor.state;
- ether_addr_copy(&parnter_system, &lacp->actor.port_params.system);
+
rte_
ether_addr_copy(&parnter_system, &lacp->actor.port_params.system);
lacp->actor.state = STATE_LACP_ACTIVE |
STATE_SYNCHRONIZATION |
STATE_AGGREGATION |
lacp->actor.state = STATE_LACP_ACTIVE |
STATE_SYNCHRONIZATION |
STATE_AGGREGATION |
@@
-577,7
+589,13
@@
bond_get_update_timeout_ms(void)
{
struct rte_eth_bond_8023ad_conf conf;
{
struct rte_eth_bond_8023ad_conf conf;
- rte_eth_bond_8023ad_conf_get(test_params.bonded_port_id, &conf);
+ if (rte_eth_bond_8023ad_conf_get(test_params.bonded_port_id, &conf) < 0) {
+ RTE_LOG(DEBUG, EAL, "Failed to get bonding configuration: "
+ "%s at %d\n", __func__, __LINE__);
+ RTE_TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__);
+ return 0;
+ }
+
return conf.update_timeout_ms;
}
return conf.update_timeout_ms;
}
@@
-728,14
+746,14
@@
generate_packets(struct rte_ether_addr *src_mac,
uint16_t src_port = 10, dst_port = 20;
uint16_t src_port = 10, dst_port = 20;
- uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] =
IPv
4(192, 168, 0, 1) };
- uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] =
IPv
4(192, 168, 0, 2) };
+ uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] =
RTE_IPV
4(192, 168, 0, 1) };
+ uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] =
RTE_IPV
4(192, 168, 0, 2) };
struct rte_ether_hdr pkt_eth_hdr;
struct rte_ether_hdr pkt_eth_hdr;
- struct udp_hdr pkt_udp_hdr;
+ struct
rte_
udp_hdr pkt_udp_hdr;
union {
union {
- struct ipv4_hdr v4;
- struct ipv6_hdr v6;
+ struct
rte_
ipv4_hdr v4;
+ struct
rte_
ipv6_hdr v6;
} pkt_ip_hdr;
int retval;
} pkt_ip_hdr;
int retval;
@@
-811,8
+829,10
@@
test_mode4_rx(void)
retval = bond_handshake();
TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
retval = bond_handshake();
TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
- rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac);
- ether_addr_copy(&bonded_mac, &dst_mac);
+ retval = rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac);
+ TEST_ASSERT_SUCCESS(retval, "Failed to get mac address: %s",
+ strerror(-retval));
+ rte_ether_addr_copy(&bonded_mac, &dst_mac);
/* Assert that dst address is not bonding address. Do not set the
* least significant bit of the zero byte as this would create a
/* Assert that dst address is not bonding address. Do not set the
* least significant bit of the zero byte as this would create a
@@
-823,7
+843,10
@@
test_mode4_rx(void)
/* First try with promiscuous mode enabled.
* Add 2 packets to each slave. First with bonding MAC address, second with
* different. Check if we received all of them. */
/* First try with promiscuous mode enabled.
* Add 2 packets to each slave. First with bonding MAC address, second with
* different. Check if we received all of them. */
- rte_eth_promiscuous_enable(test_params.bonded_port_id);
+ retval = rte_eth_promiscuous_enable(test_params.bonded_port_id);
+ TEST_ASSERT_SUCCESS(retval,
+ "Failed to enable promiscuous mode for port %d: %s",
+ test_params.bonded_port_id, rte_strerror(-retval));
expected_pkts_cnt = 0;
FOR_EACH_SLAVE(i, slave) {
expected_pkts_cnt = 0;
FOR_EACH_SLAVE(i, slave) {
@@
-847,7
+870,8
@@
test_mode4_rx(void)
for (i = 0; i < expected_pkts_cnt; i++) {
hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *);
for (i = 0; i < expected_pkts_cnt; i++) {
hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *);
- cnt[is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++;
+ cnt[rte_is_same_ether_addr(&hdr->d_addr,
+ &bonded_mac)]++;
}
free_pkts(pkts, expected_pkts_cnt);
}
free_pkts(pkts, expected_pkts_cnt);
@@
-867,7
+891,10
@@
test_mode4_rx(void)
/* Now, disable promiscuous mode. When promiscuous mode is disabled we
* expect to receive only packets that are directed to bonding port. */
/* Now, disable promiscuous mode. When promiscuous mode is disabled we
* expect to receive only packets that are directed to bonding port. */
- rte_eth_promiscuous_disable(test_params.bonded_port_id);
+ retval = rte_eth_promiscuous_disable(test_params.bonded_port_id);
+ TEST_ASSERT_SUCCESS(retval,
+ "Failed to disable promiscuous mode for port %d: %s",
+ test_params.bonded_port_id, rte_strerror(-retval));
expected_pkts_cnt = 0;
FOR_EACH_SLAVE(i, slave) {
expected_pkts_cnt = 0;
FOR_EACH_SLAVE(i, slave) {
@@
-891,7
+918,8
@@
test_mode4_rx(void)
for (i = 0; i < expected_pkts_cnt; i++) {
hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *);
for (i = 0; i < expected_pkts_cnt; i++) {
hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *);
- eq_cnt += is_same_ether_addr(&hdr->d_addr, &bonded_mac);
+ eq_cnt += rte_is_same_ether_addr(&hdr->d_addr,
+ &bonded_mac);
}
free_pkts(pkts, expected_pkts_cnt);
}
free_pkts(pkts, expected_pkts_cnt);
@@
-928,11
+956,11
@@
test_mode4_rx(void)
FOR_EACH_SLAVE(i, slave) {
void *pkt = NULL;
FOR_EACH_SLAVE(i, slave) {
void *pkt = NULL;
- dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id;
+ dst_mac.addr_bytes[
RTE_
ETHER_ADDR_LEN - 1] = slave->port_id;
retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1);
TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst.");
retval = generate_and_put_packets(slave, &src_mac, &dst_mac, 1);
TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst.");
- src_mac.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id;
+ src_mac.addr_bytes[
RTE_
ETHER_ADDR_LEN - 1] = slave->port_id;
retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1);
TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst.");
retval = generate_and_put_packets(slave, &src_mac, &bonded_mac, 1);
TEST_ASSERT_SUCCESS(retval, "Failed to generate test packet burst.");
@@
-989,11
+1017,12
@@
test_mode4_tx_burst(void)
retval = bond_handshake();
TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
retval = bond_handshake();
TEST_ASSERT_SUCCESS(retval, "Initial handshake failed");
- rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac);
-
+ retval = rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac);
+ TEST_ASSERT_SUCCESS(retval, "Failed to get mac address: %s",
+ strerror(-retval));
/* Prepare burst */
for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) {
/* Prepare burst */
for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) {
- dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = pkts_cnt;
+ dst_mac.addr_bytes[
RTE_
ETHER_ADDR_LEN - 1] = pkts_cnt;
retval = generate_packets(&bonded_mac, &dst_mac, 1, &pkts[pkts_cnt]);
if (retval != 1)
retval = generate_packets(&bonded_mac, &dst_mac, 1, &pkts[pkts_cnt]);
if (retval != 1)
@@
-1066,7
+1095,7
@@
test_mode4_tx_burst(void)
/* Prepare burst. */
for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) {
/* Prepare burst. */
for (pkts_cnt = 0; pkts_cnt < RTE_DIM(pkts); pkts_cnt++) {
- dst_mac.addr_bytes[ETHER_ADDR_LEN - 1] = pkts_cnt;
+ dst_mac.addr_bytes[
RTE_
ETHER_ADDR_LEN - 1] = pkts_cnt;
retval = generate_packets(&bonded_mac, &dst_mac, 1, &pkts[pkts_cnt]);
if (retval != 1)
retval = generate_packets(&bonded_mac, &dst_mac, 1, &pkts[pkts_cnt]);
if (retval != 1)
@@
-1133,13
+1162,15
@@
init_marker(struct rte_mbuf *pkt, struct slave_conf *slave)
struct marker_header *);
/* Copy multicast destination address */
struct marker_header *);
/* Copy multicast destination address */
- ether_addr_copy(&slow_protocol_mac_addr, &marker_hdr->eth_hdr.d_addr);
+ rte_ether_addr_copy(&slow_protocol_mac_addr,
+ &marker_hdr->eth_hdr.d_addr);
/* Init source address */
/* Init source address */
- ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.s_addr);
- marker_hdr->eth_hdr.s_addr.addr_bytes[ETHER_ADDR_LEN-1] = slave->port_id;
+ rte_ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.s_addr);
+ marker_hdr->eth_hdr.s_addr.addr_bytes[RTE_ETHER_ADDR_LEN - 1] =
+ slave->port_id;
- marker_hdr->eth_hdr.ether_type = rte_cpu_to_be_16(ETHER_TYPE_SLOW);
+ marker_hdr->eth_hdr.ether_type = rte_cpu_to_be_16(
RTE_
ETHER_TYPE_SLOW);
marker_hdr->marker.subtype = SLOW_SUBTYPE_MARKER;
marker_hdr->marker.version_number = 1;
marker_hdr->marker.subtype = SLOW_SUBTYPE_MARKER;
marker_hdr->marker.version_number = 1;
@@
-1165,7
+1196,7
@@
test_mode4_marker(void)
int retval;
uint16_t nb_pkts;
uint8_t i, j;
int retval;
uint16_t nb_pkts;
uint8_t i, j;
- const uint16_t ethtype_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW);
+ const uint16_t ethtype_slow_be = rte_be_to_cpu_16(
RTE_
ETHER_TYPE_SLOW);
retval = initialize_bonded_device_with_slaves(TEST_MARKER_SLAVE_COUT,
0);
retval = initialize_bonded_device_with_slaves(TEST_MARKER_SLAVE_COUT,
0);
@@
-1361,11
+1392,11
@@
test_mode4_ext_ctrl(void)
},
};
},
};
- ether_addr_copy(&parnter_system, &src_mac);
- ether_addr_copy(&slow_protocol_mac_addr, &dst_mac);
+
rte_
ether_addr_copy(&parnter_system, &src_mac);
+
rte_
ether_addr_copy(&slow_protocol_mac_addr, &dst_mac);
initialize_eth_header(&lacpdu.eth_hdr, &src_mac, &dst_mac,
initialize_eth_header(&lacpdu.eth_hdr, &src_mac, &dst_mac,
- ETHER_TYPE_SLOW, 0, 0);
+
RTE_
ETHER_TYPE_SLOW, 0, 0);
for (i = 0; i < SLAVE_COUNT; i++) {
lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool);
for (i = 0; i < SLAVE_COUNT; i++) {
lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool);
@@
-1415,11
+1446,11
@@
test_mode4_ext_lacp(void)
},
};
},
};
- ether_addr_copy(&parnter_system, &src_mac);
- ether_addr_copy(&slow_protocol_mac_addr, &dst_mac);
+
rte_
ether_addr_copy(&parnter_system, &src_mac);
+
rte_
ether_addr_copy(&slow_protocol_mac_addr, &dst_mac);
initialize_eth_header(&lacpdu.eth_hdr, &src_mac, &dst_mac,
initialize_eth_header(&lacpdu.eth_hdr, &src_mac, &dst_mac,
- ETHER_TYPE_SLOW, 0, 0);
+
RTE_
ETHER_TYPE_SLOW, 0, 0);
for (i = 0; i < SLAVE_COUNT; i++) {
lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool);
for (i = 0; i < SLAVE_COUNT; i++) {
lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool);