summaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-04-24 23:08:00 +0000
committerDavid S. Miller <davem@davemloft.net>2013-04-29 12:26:53 -0400
commitfdd5f43a1b53a844d04c6eda2cbdbe044b629ae7 (patch)
treee27205f97443fed29f28cb16b63e4204afe2f1d5 /tools/testing
parent823aa873bc782f1c51b1ce8ec6da7cfcaf93836e (diff)
downloadop-kernel-dev-fdd5f43a1b53a844d04c6eda2cbdbe044b629ae7.zip
op-kernel-dev-fdd5f43a1b53a844d04c6eda2cbdbe044b629ae7.tar.gz
selftests: psock_tpacket: fix status check
Testing like this for TP_STATUS_AVAILABLE clearly is a stupid bug since it always returns true. Fix this by only checking for flags where the kernel owns the packet and negate this result, since we also could run into the non-zero status TP_STATUS_WRONG_FORMAT and need to reclaim frames. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/net/psock_tpacket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/net/psock_tpacket.c b/tools/testing/selftests/net/psock_tpacket.c
index a8d7ffa..c41b586 100644
--- a/tools/testing/selftests/net/psock_tpacket.c
+++ b/tools/testing/selftests/net/psock_tpacket.c
@@ -300,7 +300,7 @@ static void walk_v1_v2_rx(int sock, struct ring *ring)
static inline int __v1_tx_kernel_ready(struct tpacket_hdr *hdr)
{
- return ((hdr->tp_status & TP_STATUS_AVAILABLE) == TP_STATUS_AVAILABLE);
+ return !(hdr->tp_status & (TP_STATUS_SEND_REQUEST | TP_STATUS_SENDING));
}
static inline void __v1_tx_user_ready(struct tpacket_hdr *hdr)
@@ -311,7 +311,7 @@ static inline void __v1_tx_user_ready(struct tpacket_hdr *hdr)
static inline int __v2_tx_kernel_ready(struct tpacket2_hdr *hdr)
{
- return ((hdr->tp_status & TP_STATUS_AVAILABLE) == TP_STATUS_AVAILABLE);
+ return !(hdr->tp_status & (TP_STATUS_SEND_REQUEST | TP_STATUS_SENDING));
}
static inline void __v2_tx_user_ready(struct tpacket2_hdr *hdr)
OpenPOWER on IntegriCloud