Changeset View
Changeset View
Standalone View
Standalone View
sys/net/bpfdesc.h
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | struct bpf_d { | ||||
int bd_hdrcmplt; /* false to fill in src lladdr automatically */ | int bd_hdrcmplt; /* false to fill in src lladdr automatically */ | ||||
int bd_direction; /* select packet direction */ | int bd_direction; /* select packet direction */ | ||||
int bd_tstamp; /* select time stamping function */ | int bd_tstamp; /* select time stamping function */ | ||||
int bd_feedback; /* true to feed back sent packets */ | int bd_feedback; /* true to feed back sent packets */ | ||||
int bd_async; /* non-zero if packet reception should generate signal */ | int bd_async; /* non-zero if packet reception should generate signal */ | ||||
int bd_sig; /* signal to send upon packet reception */ | int bd_sig; /* signal to send upon packet reception */ | ||||
struct sigio * bd_sigio; /* information for async I/O */ | struct sigio * bd_sigio; /* information for async I/O */ | ||||
struct selinfo bd_sel; /* bsd select info */ | struct selinfo bd_sel; /* bsd select info */ | ||||
struct mtx bd_lock; /* per-descriptor lock */ | struct rwlock bd_lock; /* per-descriptor lock */ | ||||
struct callout bd_callout; /* for BPF timeouts with select */ | struct callout bd_callout; /* for BPF timeouts with select */ | ||||
struct label *bd_label; /* MAC label for descriptor */ | struct label *bd_label; /* MAC label for descriptor */ | ||||
counter_u64_t bd_fcount; /* number of packets which matched filter */ | counter_u64_t bd_fcount; /* number of packets which matched filter */ | ||||
pid_t bd_pid; /* PID which created descriptor */ | pid_t bd_pid; /* PID which created descriptor */ | ||||
int bd_locked; /* true if descriptor is locked */ | int bd_locked; /* true if descriptor is locked */ | ||||
u_int bd_bufmode; /* Current buffer mode. */ | u_int bd_bufmode; /* Current buffer mode. */ | ||||
counter_u64_t bd_wcount; /* number of packets written */ | counter_u64_t bd_wcount; /* number of packets written */ | ||||
counter_u64_t bd_wfcount; /* number of packets that matched write filter */ | counter_u64_t bd_wfcount; /* number of packets that matched write filter */ | ||||
counter_u64_t bd_wdcount; /* number of packets dropped during a write */ | counter_u64_t bd_wdcount; /* number of packets dropped during a write */ | ||||
counter_u64_t bd_zcopy; /* number of zero copy operations */ | counter_u64_t bd_zcopy; /* number of zero copy operations */ | ||||
u_char bd_compat32; /* 32-bit stream on LP64 system */ | u_char bd_compat32; /* 32-bit stream on LP64 system */ | ||||
}; | }; | ||||
/* Values for bd_state */ | /* Values for bd_state */ | ||||
#define BPF_IDLE 0 /* no select in progress */ | #define BPF_IDLE 0 /* no select in progress */ | ||||
#define BPF_WAITING 1 /* waiting for read timeout in select */ | #define BPF_WAITING 1 /* waiting for read timeout in select */ | ||||
#define BPF_TIMED_OUT 2 /* read timeout has expired in select */ | #define BPF_TIMED_OUT 2 /* read timeout has expired in select */ | ||||
#define BPFD_LOCK(bd) mtx_lock(&(bd)->bd_lock) | #define BPFD_LOCK(bd) BPFD_WLOCK(bd) | ||||
#define BPFD_UNLOCK(bd) mtx_unlock(&(bd)->bd_lock) | #define BPFD_UNLOCK(bd) BPFD_WUNLOCK(bd) | ||||
#define BPFD_LOCK_ASSERT(bd) mtx_assert(&(bd)->bd_lock, MA_OWNED) | #define BPFD_RLOCK(bd) rw_rlock(&(bd)->bd_lock) | ||||
#define BPFD_RUNLOCK(bd) rw_runlock(&(bd)->bd_lock) | |||||
#define BPFD_WLOCK(bd) rw_wlock(&(bd)->bd_lock) | |||||
#define BPFD_WUNLOCK(bd) rw_wunlock(&(bd)->bd_lock) | |||||
#define BPFD_LOCK_ASSERT(bd) rw_assert(&(bd)->bd_lock, RA_LOCKED) | |||||
#define BPFD_RLOCK_ASSERT(bd) rw_assert(&(bd)->bd_lock, RA_RLOCKED) | |||||
#define BPFD_WLOCK_ASSERT(bd) rw_assert(&(bd)->bd_lock, RA_WLOCKED) | |||||
#define BPF_PID_REFRESH(bd, td) (bd)->bd_pid = (td)->td_proc->p_pid | #define BPF_PID_REFRESH(bd, td) (bd)->bd_pid = (td)->td_proc->p_pid | ||||
#define BPF_PID_REFRESH_CUR(bd) (bd)->bd_pid = curthread->td_proc->p_pid | #define BPF_PID_REFRESH_CUR(bd) (bd)->bd_pid = curthread->td_proc->p_pid | ||||
#define BPF_LOCK() mtx_lock(&bpf_mtx) | #define BPF_LOCK() mtx_lock(&bpf_mtx) | ||||
#define BPF_UNLOCK() mtx_unlock(&bpf_mtx) | #define BPF_UNLOCK() mtx_unlock(&bpf_mtx) | ||||
#define BPF_LOCK_ASSERT() mtx_assert(&bpf_mtx, MA_OWNED) | #define BPF_LOCK_ASSERT() mtx_assert(&bpf_mtx, MA_OWNED) | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |