/* * netsniff-ng - the packet sniffing beast * Copyright 2009, 2010 Daniel Borkmann. * Subject to the GPL, version 2. */ #include #include #include #include #include #include "corking.h" #include "die.h" void set_udp_cork(int fd) { int ret, state = 1; ret = setsockopt(fd, IPPROTO_UDP, UDP_CORK, &state, sizeof(state)); if (unlikely(ret)) panic("Cannot cork UDP socket!\n"); } void set_udp_uncork(int fd) { int ret, state = 0; ret = setsockopt(fd, IPPROTO_UDP, UDP_CORK, &state, sizeof(state)); if (unlikely(ret)) panic("Cannot uncork UDP socket!\n"); } void set_tcp_cork(int fd) { int ret, state = 1; ret = setsockopt(fd, IPPROTO_TCP, TCP_CORK, &state, sizeof(state)); if (unlikely(ret)) panic("Cannot cork TCP socket!\n"); } void set_tcp_uncork(int fd) { int ret, state = 0; ret = setsockopt(fd, IPPROTO_TCP, TCP_CORK, &state, sizeof(state)); if (unlikely(ret)) panic("Cannot uncork TCP socket!\n"); } void set_sock_cork(int fd, bool is_udp) { if (is_udp) set_udp_cork(fd); else set_tcp_cork(fd); } void set_sock_uncork(int fd, bool is_udp) { if (is_udp) set_udp_uncork(fd); else set_tcp_uncork(fd); } ption value='packet-loop-back'>packet-loop-back net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>2016-09-07 19:57:49 +0530
committerDavid S. Miller <davem@davemloft.net>2016-09-07 22:44:55 -0700
commit710f3e5961a71dd58fe367eac48deecd5af45a48 (patch)
treea921082c7651bf2963c5e883ddd56fd526aec18a
parentdd0cb7dbb065f4acdd8d0597f122d0ed9e93f12e (diff)
be2net: Support UE recovery in BEx/Skyhawk adapters
This patch supports recovery from UEs caused due to Transient Parity Errors (TPE), in BE2, BE3 and Skyhawk adapters. This change avoids system reboot when such errors occur. The driver recovers from these errors such that the adapter resumes full operational status as prior to the UE. Following is the list of changes in the driver to support this: o The driver registers its UE recoverable capability with ARM FW at init time. This also allows the driver to know if the feature is supported in the FW. o As the UE recovery requires precise time bound processing, the driver creates its own error recovery work queue with a single worker thread (per module, shared across functions). o Each function runs an error detection task at an interval of 1 second as required by the FW. The error detection logic already exists for BEx/SH, but it now runs in the context of a separate worker thread. o When an error is detected by the task, if it is recoverable, the PF0 driver instance initiates a soft reset, while other PF driver instances wait for the reset to complete and the chip to become ready. Once the chip is ready, all driver instances including PF0, resume to reinitialize the respective functions. o The PF0 driver checks for some recovery criteria, to determine if the recovery can be initiated. If the criteria is not met, the PF0 driver does not initiate a soft reset, it retains the existing behavior to stop further processing and requires a reboot to get the chip to operational state again. o To allow each function to share the workq, while also making progress in its recovery process, a per-function recovery state machine is used. The per-function tasks avoid blocking operations like msleep() while in this state machine (until reinit state) and instead reschedule for the required delay. o With these changes, the existing error recovery code for Lancer also runs in the context of the new worker thread. Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>