Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
gen_stats.h File Reference
#include <linux/gen_stats.h>
#include <linux/socket.h>
#include <linux/rtnetlink.h>
#include <linux/pkt_sched.h>

Go to the source code of this file.

Data Structures

struct  gnet_dump
 

Functions

int gnet_stats_start_copy (struct sk_buff *skb, int type, spinlock_t *lock, struct gnet_dump *d)
 
int gnet_stats_start_copy_compat (struct sk_buff *skb, int type, int tc_stats_type, int xstats_type, spinlock_t *lock, struct gnet_dump *d)
 
int gnet_stats_copy_basic (struct gnet_dump *d, struct gnet_stats_basic_packed *b)
 
int gnet_stats_copy_rate_est (struct gnet_dump *d, const struct gnet_stats_basic_packed *b, struct gnet_stats_rate_est *r)
 
int gnet_stats_copy_queue (struct gnet_dump *d, struct gnet_stats_queue *q)
 
int gnet_stats_copy_app (struct gnet_dump *d, void *st, int len)
 
int gnet_stats_finish_copy (struct gnet_dump *d)
 
int gen_new_estimator (struct gnet_stats_basic_packed *bstats, struct gnet_stats_rate_est *rate_est, spinlock_t *stats_lock, struct nlattr *opt)
 
void gen_kill_estimator (struct gnet_stats_basic_packed *bstats, struct gnet_stats_rate_est *rate_est)
 
int gen_replace_estimator (struct gnet_stats_basic_packed *bstats, struct gnet_stats_rate_est *rate_est, spinlock_t *stats_lock, struct nlattr *opt)
 
bool gen_estimator_active (const struct gnet_stats_basic_packed *bstats, const struct gnet_stats_rate_est *rate_est)
 

Function Documentation

bool gen_estimator_active ( const struct gnet_stats_basic_packed bstats,
const struct gnet_stats_rate_est rate_est 
)

gen_estimator_active - test if estimator is currently in use : basic statistics : rate estimator statistics

Returns true if estimator is active, and false if not.

Definition at line 308 of file gen_estimator.c.

void gen_kill_estimator ( struct gnet_stats_basic_packed bstats,
struct gnet_stats_rate_est rate_est 
)

gen_kill_estimator - remove a rate estimator : basic statistics : rate estimator statistics

Removes the rate estimator specified by &bstats and &rate_est.

Note : Caller should respect an RCU grace period before freeing stats_lock

Definition at line 260 of file gen_estimator.c.

int gen_new_estimator ( struct gnet_stats_basic_packed bstats,
struct gnet_stats_rate_est rate_est,
spinlock_t stats_lock,
struct nlattr opt 
)

gen_new_estimator - create a new rate estimator : basic statistics : rate estimator statistics : statistics lock : rate estimator configuration TLV

Creates a new rate estimator with &bstats as source and &rate_est as destination. A new timer with the interval specified in the configuration TLV is created. Upon each interval, the latest statistics will be read from &bstats and the estimated rate will be stored in &rate_est with the statistics lock grabed during this period.

Returns 0 on success or a negative error code.

Definition at line 205 of file gen_estimator.c.

int gen_replace_estimator ( struct gnet_stats_basic_packed bstats,
struct gnet_stats_rate_est rate_est,
spinlock_t stats_lock,
struct nlattr opt 
)

gen_replace_estimator - replace rate estimator configuration : basic statistics : rate estimator statistics : statistics lock : rate estimator configuration TLV

Replaces the configuration of a rate estimator by calling gen_kill_estimator() and gen_new_estimator().

Returns 0 on success or a negative error code.

Definition at line 292 of file gen_estimator.c.

int gnet_stats_copy_app ( struct gnet_dump d,
void st,
int  len 
)

gnet_stats_copy_app - copy application specific statistics into statistics TLV : dumping handle : application specific statistics data : length of data

Appends the application sepecific statistics to the top level TLV created by gnet_stats_start_copy() and remembers the data for XSTATS if the dumping handle is in backward compatibility mode.

Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient.

Definition at line 205 of file gen_stats.c.

int gnet_stats_copy_basic ( struct gnet_dump d,
struct gnet_stats_basic_packed b 
)

gnet_stats_copy_basic - copy basic statistics into statistic TLV : dumping handle : basic statistics

Appends the basic statistics to the top level TLV created by gnet_stats_start_copy().

Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient.

Definition at line 112 of file gen_stats.c.

int gnet_stats_copy_queue ( struct gnet_dump d,
struct gnet_stats_queue q 
)

gnet_stats_copy_queue - copy queue statistics into statistics TLV : dumping handle : queue statistics

Appends the queue statistics to the top level TLV created by gnet_stats_start_copy().

Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient.

Definition at line 175 of file gen_stats.c.

int gnet_stats_copy_rate_est ( struct gnet_dump d,
const struct gnet_stats_basic_packed b,
struct gnet_stats_rate_est r 
)

gnet_stats_copy_rate_est - copy rate estimator statistics into statistics TLV : dumping handle : basic statistics : rate estimator statistics

Appends the rate estimator statistics to the top level TLV created by gnet_stats_start_copy().

Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient.

Definition at line 144 of file gen_stats.c.

int gnet_stats_finish_copy ( struct gnet_dump d)

gnet_stats_finish_copy - finish dumping procedure : dumping handle

Corrects the length of the top level TLV to include all TLVs added by gnet_stats_copy_XXX() calls. Adds the backward compatibility TLVs if gnet_stats_start_copy_compat() was used and releases the statistics lock.

Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient.

Definition at line 232 of file gen_stats.c.

int gnet_stats_start_copy ( struct sk_buff skb,
int  type,
spinlock_t lock,
struct gnet_dump d 
)

gnet_stats_start_copy_compat - start dumping procedure in compatibility mode : socket buffer to put statistics TLVs into : TLV type for top level statistic TLV : statistics lock : dumping handle

Initializes the dumping handle, grabs the statistic lock and appends an empty TLV header to the socket buffer for use a container for all other statistic TLVS.

Returns 0 on success or -1 if the room in the socket buffer was not sufficient.

Definition at line 93 of file gen_stats.c.

int gnet_stats_start_copy_compat ( struct sk_buff skb,
int  type,
int  tc_stats_type,
int  xstats_type,
spinlock_t lock,
struct gnet_dump d 
)

gnet_stats_start_copy_compat - start dumping procedure in compatibility mode : socket buffer to put statistics TLVs into : TLV type for top level statistic TLV : TLV type for backward compatibility struct tc_stats TLV : TLV type for backward compatibility xstats TLV : statistics lock : dumping handle

Initializes the dumping handle, grabs the statistic lock and appends an empty TLV header to the socket buffer for use a container for all other statistic TLVS.

The dumping handle is marked to be in backward compatibility mode telling all gnet_stats_copy_XXX() functions to fill a local copy of struct tc_stats.

Returns 0 on success or -1 if the room in the socket buffer was not sufficient.

Definition at line 58 of file gen_stats.c.