/* * netsniff-ng - the packet sniffing beast * Copyright 2009, 2010 Daniel Borkmann. * Copyright 2009, 2010 Emmanuel Roullit. * Copyright 2014, 2015 Tobias Klauser. * Subject to the GPL, version 2. */ #include #include #include #include #include #include #include #include #include #include "die.h" #include "xmalloc.h" #include "ring_tx.h" #include "built_in.h" static void set_packet_loss_discard(int sock) { int ret, discard = 1; ret = setsockopt(sock, SOL_PACKET, PACKET_LOSS, (void *) &discard, sizeof(discard)); if (ret < 0) panic("setsockopt: cannot set packet loss"); } void destroy_tx_ring(int sock, struct ring *ring) { int ret; munmap(ring->mm_space, ring->mm_len); ring->mm_len = 0; fmemset(&ring->layout, 0, sizeof(ring->layout)); ret = setsockopt(sock, SOL_PACKET, PACKET_TX_RING, &ring->layout, sizeof(ring->layout)); if (unlikely(ret)) panic("Cannot destroy the TX_RING: %s!\n", strerror(errno)); xfree(ring->frames); } static void setup_tx_ring_layout(int sock, struct ring *ring, size_t size, bool jumbo_support) { setup_ring_layout_generic(sock, ring, size, jumbo_support); set_sockopt_tpacket_v2(sock); ring_verify_layout(ring); } static void create_tx_ring(int sock, struct ring *ring, bool verbose) { int ret; retry: ret = setsockopt(sock, SOL_PACKET, PACKET_TX_RING, &ring->layout, sizeof(ring->layout)); if (errno == ENOMEM && ring->layout.tp_block_nr > 1) { shrink_ring_layout_generic(ring); goto retry; } if (ret < 0) panic("Cannot allocate TX_RING!\n"); ring->mm_len = (size_t) ring->layout.tp_block_size * ring->layout.tp_block_nr; if (verbose) { printf("TX,V2: %.2Lf MiB, %u Frames, each %u Byte allocated\n", (long double) ring->mm_len / (1 << 20), ring->layout.tp_frame_nr, ring->layout.tp_frame_size); } } static void alloc_tx_ring_frames(int sock __maybe_unused, struct ring *ring) { alloc_ring_frames_generic(ring, ring->layout.tp_frame_nr, ring->layout.tp_frame_size); } void ring_tx_setup(struct ring *ring, int sock, size_t size, int ifindex, bool jumbo_support, bool verbose) { fmemset(ring, 0, sizeof(*ring)); set_packet_loss_discard(sock); setup_tx_ring_layout(sock, ring, size, jumbo_support); create_tx_ring(sock, ring, verbose); mmap_ring_generic(sock, ring); alloc_tx_ring_frames(sock, ring); bind_ring_generic(sock, ring, ifindex, true); } elect name='qt'>
diff options
context:
space:
mode:
authorDavid Bond <dbond@suse.com>2016-03-23 21:49:26 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2016-05-16 11:14:29 -0400
commitb3c8eb50383178f3a4dcf1dc867001156da6473d (patch)
tree10a3cc85d4bb4dc77f02aa72e967f7d37cb90ff2 /Documentation
parent9a99425f0736a416442525ac7b15903173888b86 (diff)
ibft: Expose iBFT acpi header via sysfs
Some ethernet adapter vendors are supplying products which support optional (payed license) features. On some adapters this includes a hardware iscsi initiator. The same adapters in a normal (no extra licenses) mode of operation can be used as a software iscsi initiator. In addition, software iscsi boot initiators are becoming a standard part of many vendors uefi implementations. This is creating difficulties during early boot/install determining the proper configuration method for these adapters when they are used as a boot device. The attached patch creates sysfs entries to expose information from the acpi header of the ibft table. This information allows for a method to easily determining if an ibft table was created by a ethernet card's firmware or the system uefi/bios. In the case of a hardware initiator this information in combination with the pci vendor and device id can be used to ascertain any vendor specific behaviors that need to be accommodated. Reviewed-by: Lee Duncan <lduncan@suse.com> Signed-off-by: David Bond <dbond@suse.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'Documentation')