netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemb@google.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: Willem de Bruijn <willemb@google.com>
Subject: [PATCH net-next] net: fix psock_fanout on sparc64
Date: Thu, 21 Mar 2013 14:10:03 -0400	[thread overview]
Message-ID: <1363889403-7712-1-git-send-email-willemb@google.com> (raw)
In-Reply-To: <CA+FuTSewLdQZbWPLrdbtG2xtaWSdrPDO3yz6boXqgStYhh3fcg@mail.gmail.com>

The packetsocket fanout test uses a packet ring. Use TPACKET_V2
instead of TPACKET_V1 to work around a known 32/64 bit issue in
the older ring that manifests on sparc64.

Signed-off-by: Willem de Bruijn <willemb@google.com>
---
 tools/testing/selftests/net/psock_fanout.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/psock_fanout.c b/tools/testing/selftests/net/psock_fanout.c
index 226e5e3..59bd636 100644
--- a/tools/testing/selftests/net/psock_fanout.c
+++ b/tools/testing/selftests/net/psock_fanout.c
@@ -182,7 +182,13 @@ static char *sock_fanout_open_ring(int fd)
 		.tp_frame_nr   = RING_NUM_FRAMES,
 	};
 	char *ring;
+	int val = TPACKET_V2;
 
+	if (setsockopt(fd, SOL_PACKET, PACKET_VERSION, (void *) &val,
+		       sizeof(val))) {
+		perror("packetsock ring setsockopt version");
+		exit(1);
+	}
 	if (setsockopt(fd, SOL_PACKET, PACKET_RX_RING, (void *) &req,
 		       sizeof(req))) {
 		perror("packetsock ring setsockopt");
@@ -201,7 +207,7 @@ static char *sock_fanout_open_ring(int fd)
 
 static int sock_fanout_read_ring(int fd, void *ring)
 {
-	struct tpacket_hdr *header = ring;
+	struct tpacket2_hdr *header = ring;
 	int count = 0;
 
 	while (header->tp_status & TP_STATUS_USER && count < RING_NUM_FRAMES) {
-- 
1.8.1.3

  reply	other threads:[~2013-03-21 18:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-19 20:18 [PATCH net-next v3] packet: packet fanout rollover during socket overload Willem de Bruijn
2013-03-19 20:37 ` Eric Dumazet
2013-03-19 21:16   ` David Miller
2013-03-19 21:34     ` Willem de Bruijn
2013-03-20  6:37       ` Willem de Bruijn
2013-03-20  6:42         ` [PATCH net-next] net: fix psock_fanout selftest hash collision Willem de Bruijn
2013-03-20 16:33           ` David Miller
2013-03-20 17:59             ` David Miller
2013-03-21  0:07               ` Willem de Bruijn
2013-03-21  1:16                 ` David Miller
2013-03-21  6:31                 ` Daniel Borkmann
2013-03-21 17:27                   ` Willem de Bruijn
2013-03-21 17:46                     ` David Miller
2013-03-21 17:47                     ` Daniel Borkmann
2013-03-21 18:00                       ` Willem de Bruijn
2013-03-21 17:49                     ` David Miller
2013-03-21 17:56                       ` David Miller
2013-03-21 18:01                         ` Willem de Bruijn
2013-03-21 18:10                           ` Willem de Bruijn [this message]
2013-03-21 18:31                             ` [PATCH net-next] net: fix psock_fanout on sparc64 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363889403-7712-1-git-send-email-willemb@google.com \
    --to=willemb@google.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).