Commit 98e821a2 authored by Willem de Bruijn's avatar Willem de Bruijn Committed by David S. Miller

net: fix psock_fanout on sparc64

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: default avatarWillem de Bruijn <willemb@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eaaa3139
...@@ -182,7 +182,13 @@ static char *sock_fanout_open_ring(int fd) ...@@ -182,7 +182,13 @@ static char *sock_fanout_open_ring(int fd)
.tp_frame_nr = RING_NUM_FRAMES, .tp_frame_nr = RING_NUM_FRAMES,
}; };
char *ring; 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, if (setsockopt(fd, SOL_PACKET, PACKET_RX_RING, (void *) &req,
sizeof(req))) { sizeof(req))) {
perror("packetsock ring setsockopt"); perror("packetsock ring setsockopt");
...@@ -201,7 +207,7 @@ static char *sock_fanout_open_ring(int fd) ...@@ -201,7 +207,7 @@ static char *sock_fanout_open_ring(int fd)
static int sock_fanout_read_ring(int fd, void *ring) static int sock_fanout_read_ring(int fd, void *ring)
{ {
struct tpacket_hdr *header = ring; struct tpacket2_hdr *header = ring;
int count = 0; int count = 0;
while (header->tp_status & TP_STATUS_USER && count < RING_NUM_FRAMES) { while (header->tp_status & TP_STATUS_USER && count < RING_NUM_FRAMES) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment