/* * netsniff-ng - the packet sniffing beast * Copyright 2009, 2010 Daniel Borkmann. * Copyright 2014, 2015 Tobias Klauser * Subject to the GPL, version 2. */ #include #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "die.h" #include "ring.h" #include "built_in.h" void setup_ring_layout_generic(struct ring *ring, size_t size, bool jumbo_support) { memset(&ring->layout, 0, sizeof(ring->layout)); ring->layout.tp_block_size = (jumbo_support ? RUNTIME_PAGE_SIZE << 4 : RUNTIME_PAGE_SIZE << 2); ring->layout.tp_frame_size = (jumbo_support ? TPACKET_ALIGNMENT << 12 : TPACKET_ALIGNMENT << 7); ring->layout.tp_block_nr = size / ring->layout.tp_block_size; ring->layout.tp_frame_nr = size / ring->layout.tp_frame_size; } void mmap_ring_generic(int sock, struct ring *ring) { ring->mm_space = mmap(NULL, ring->mm_len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_LOCKED | MAP_POPULATE, sock, 0); if (ring->mm_space == MAP_FAILED) panic("Cannot mmap {TX,RX}_RING!\n"); } void alloc_ring_frames_generic(struct ring *ring, size_t num, size_t size) { size_t i, len = num * sizeof(*ring->frames); ring->frames = xzmalloc_aligned(len, CO_CACHE_LINE_SIZE); for (i = 0; i < num; ++i) { ring->frames[i].iov_len = size; ring->frames[i].iov_base = ring->mm_space + (i * size); } } void bind_ring_generic(int sock, struct ring *ring, int ifindex, bool tx_only) { int ret; /* The {TX,RX}_RING registers itself to the networking stack with * dev_add_pack(), so we have one single RX_RING for all devs * otherwise you'll get the packet twice. */ memset(&ring->s_ll, 0, sizeof(ring->s_ll)); ring->s_ll.sll_family = AF_PACKET; ring->s_ll.sll_ifindex = ifindex; ring->s_ll.sll_protocol = tx_only ? 0 : htons(ETH_P_ALL); ret = bind(sock, (struct sockaddr *) &ring->s_ll, sizeof(ring->s_ll)); if (ret < 0) panic("Cannot bind {TX,RX}_RING!\n"); } hod='get' action='/cgit.cgi/linux/net-next.git/log/'>
diff options
context:
space:
mode:
authorJacky Boen <aqiank@gmail.com>2016-05-01 23:50:39 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-05-01 14:34:53 -0700
commit99aded71b52cfdfa22721c42e42efdd13a02f0a6 (patch)
tree9c91707c057c5d01603a1f71592096d90392cfb7
parent9cb2dbf316d9a020fa4a042958930b85f24f2a6f (diff)
Staging: drivers: rtl8188eu: use sizeof(*ptr) instead of sizeof(struct)
Fix coding style issue Signed-off-by: Jacky Boen <aqiank@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9ac1'>patch)
treebb8f3396fb6926735834eb989b68491f7ef55207 /Documentation/devicetree/bindings/leds
parentda2f6aba4a21f8da3331e5251a117c52764da579 (diff)
parent951d77fd5a541d68eeb7372e72cd4757e3058517 (diff)
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Two straightforward fixes. One is a concurrency issue only affecting SAS connected SATA drives, but which could hang the storage subsystem if it triggers (because the outstanding command count on error never goes back to zero) and the other is a NO_TAG fallout from the switch to hostwide tags which causes the system to crash on module insertion (we've checked carefully and only the 53c700 family of drivers is vulnerable to this issue)" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: 53c700: fix BUG on untagged commands scsi: fix race between simultaneous decrements of ->host_failed
Diffstat (limited to 'Documentation/devicetree/bindings/leds')