diff mbox

[2/2] validation: pktio: test transmit error recovery

Message ID 1447179842-2541-2-git-send-email-stuart.haslam@linaro.org
State Accepted
Commit 8bd5e2ef26458be62a7fbb322b6086b61d7654f5
Headers show

Commit Message

Stuart Haslam Nov. 10, 2015, 6:24 p.m. UTC
After inducing a transmit error send some additional packets to ensure
transmit recovers correctly.

Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
 test/validation/pktio/pktio.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
diff mbox

Patch

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index a2da47b..41106b0 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -932,6 +932,25 @@  static void pktio_test_send_failure(void)
 		} else {
 			CU_FAIL("failed to receive transmitted packets\n");
 		}
+
+		/* now reduce the size of the long packet and attempt to send
+		 * again - should work this time */
+		i = long_pkt_idx;
+		odp_packet_pull_tail(pkt_tbl[i],
+				     odp_packet_len(pkt_tbl[i]) -
+				     PKT_LEN_NORMAL);
+		pkt_seq[i] = pktio_init_packet(pkt_tbl[i]);
+		CU_ASSERT_FATAL(pkt_seq[i] != TEST_SEQ_INVALID);
+		ret = odp_pktio_send(pktio_tx, &pkt_tbl[i], TX_BATCH_LEN - i);
+		CU_ASSERT_FATAL(ret == (TX_BATCH_LEN - i));
+
+		for (; i < TX_BATCH_LEN; ++i) {
+			pkt_tbl[i] = wait_for_packet(&info_rx,
+						     pkt_seq[i], ODP_TIME_SEC);
+			if (pkt_tbl[i] == ODP_PACKET_INVALID)
+				break;
+		}
+		CU_ASSERT(i == TX_BATCH_LEN);
 	} else {
 		CU_FAIL("failed to generate test packets\n");
 	}