Changeset View
Changeset View
Standalone View
Standalone View
head/sys/net/bpfdesc.h
Show All 37 Lines | |||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _NET_BPFDESC_H_ | #ifndef _NET_BPFDESC_H_ | ||||
#define _NET_BPFDESC_H_ | #define _NET_BPFDESC_H_ | ||||
#include <sys/callout.h> | #include <sys/callout.h> | ||||
#include <sys/selinfo.h> | #include <sys/selinfo.h> | ||||
#include <sys/queue.h> | #include <sys/ck.h> | ||||
#include <sys/conf.h> | #include <sys/conf.h> | ||||
#include <sys/counter.h> | #include <sys/counter.h> | ||||
#include <sys/epoch.h> | |||||
#include <net/if.h> | #include <net/if.h> | ||||
/* | /* | ||||
* Descriptor associated with each open bpf file. | * Descriptor associated with each open bpf file. | ||||
*/ | */ | ||||
struct zbuf; | struct zbuf; | ||||
struct bpf_d { | struct bpf_d { | ||||
LIST_ENTRY(bpf_d) bd_next; /* Linked list of descriptors */ | CK_LIST_ENTRY(bpf_d) bd_next; /* Linked list of descriptors */ | ||||
/* | /* | ||||
* Buffer slots: two memory buffers store the incoming packets. | * Buffer slots: two memory buffers store the incoming packets. | ||||
* The model has three slots. Sbuf is always occupied. | * The model has three slots. Sbuf is always occupied. | ||||
* sbuf (store) - Receive interrupt puts packets here. | * sbuf (store) - Receive interrupt puts packets here. | ||||
* hbuf (hold) - When sbuf is full, put buffer here and | * hbuf (hold) - When sbuf is full, put buffer here and | ||||
* wakeup read (replace sbuf with fbuf). | * wakeup read (replace sbuf with fbuf). | ||||
* fbuf (free) - When read is done, put buffer here. | * fbuf (free) - When read is done, put buffer here. | ||||
* On receiving, if sbuf is full and fbuf is 0, packet is dropped. | * On receiving, if sbuf is full and fbuf is 0, packet is dropped. | ||||
Show All 34 Lines | struct bpf_d { | ||||
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 */ | ||||
volatile u_int bd_refcnt; | |||||
struct epoch_context epoch_ctx; | |||||
}; | }; | ||||
/* 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) mtx_lock(&(bd)->bd_lock) | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |