Skip to content

[PATCH v1] validation: pktio: reuse the same pktio in sub-tests to speed things up - #2421

Open
JannePeltonen wants to merge 4 commits into
OpenDataPlane:masterfrom
JannePeltonen:pktio-reuse-pktio
Open

JannePeltonen wants to merge 4 commits into
OpenDataPlane:masterfrom
JannePeltonen:pktio-reuse-pktio

Conversation

@JannePeltonen

Copy link
Copy Markdown
Collaborator

Closing an reopening a pktio can be slow and slows down 'make check' and CI when done in the pktio test between sub-tests, that just run the same test with a different type of packet or with a different size packet batch. This PR improves the pktio validation test to reuse the same pktio more often and speeds things up significantly in certain environments.

This PR also includes a fix for pcap pktio which could not handle reuse after the first packet bath was sent through it by the pktio test and a fix to pktio bcast statistics tests which used too big a packet batch.

Broadcast statistics test uses such a high number of test packets that in
some cases the packet buffer pool may get exhausted in the middle of the
test. Reduce the number of test packets by replacing the hardcoded values
for the number of packets and the number of RX attempts with the common
macros already used in other functions.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
The pcap file from which a pcap pktio reads received packets may be
appended to by another pktio that writes transmitted packets to it.
This is how the pktio_run_pcap.sh script sets things up.

When a pcap pktio gets an EOF when reading the input file, it cannot read
more packets from the file even if another pktio appends more packets to
it. This is because the EOF indicator of the stdio stream used by libpcap
is sticky, causing the pcap pktio to get an EOF even after the file has
grown. This in turn would break pktio tests on pcap pktio if the same
pktio were to be used again after one round of packet sending and
reception.

Fix the problem by clearing the sticky EOF state from the stdio stream.
This leaves a race between concurrent writers and readers (the reader can
hit a partially written packet record and libpcap would report a truncated
file error), but that is not a problem in the single-threaded pktio test
and is not addressed by this commit.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Opening and closing a pktio can be slow and doing a separate open and
close for every sub-test (e.g. each packet variant) slows down make check
(when run as root) and CI unnecessarily.

Do not close and reopen a pktio in the same test between packet type
changes. For this to work with the poll based TX completion test and
to preserve existing behaviour, do not reuse completion IDs after
odp_pktio_open() but grow the ID range appropriately.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Speed up 'make check' and CI by varying packet batch size within
the same opened and started pktio rather than rerunning the whole
test.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
@github-actions github-actions Bot changed the title validation: pktio: reuse the same pktio in sub-tests to speed things up [PATCH v1] validation: pktio: reuse the same pktio in sub-tests to speed things up Oct 14, 2026
* pktio). Clear the sticky EOF indicator of the underlying stream
* so that subsequent receive calls can see the appended packets. */
if (ret == -2 && pcap->rx)
clearerr(pcap_file(pcap->rx));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matter of taste, but alternatively, this could be done inside _pcapif_reopen(), less re-checks.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants