Attention is currently required from: fixeria.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-pcap/+/39948?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed: Verified+1 by Jenkins Builder
Change subject: client: use pcap_dispatch to avoid extra pkt buffer copy ......................................................................
client: use pcap_dispatch to avoid extra pkt buffer copy
pcap_next() allows use of returned buffer until next time the same API is called. In order to do so, it internally calls pcap_dispatch() with an internal handler (in the case of linux pcapint_oneshot_linux()). That handler basically memcpy()s the pkt buffer obtained in the pcap_dispatch callback into a temporary static buffer which is then returned. We don't need any of that here, and by using pcap_dispatch() directly (as recommended in pcapint_oneshot_linux() function documentation) we can skip an extra memcpy() of each packet buffer captured.
Furthermore, it will allow us processing multiple packets from the captured queue (RA_SOCKET+mmap implementation in linux) in one poll iteration if several packets have been captured. This will be done in a follow-up patch.
pcap handle is marked non-blocking to allow polling from it without ending up blocked. Applying filter is moved beforehand, as seen in libpcap capturetest example.
Related: SYS#7290 Change-Id: I055efb66fac5e04c541d75ec2c0f654cdfb17838 --- M src/osmo_client_core.c 1 file changed, 28 insertions(+), 14 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/48/39948/4