Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
vport.c File Reference
#include <linux/etherdevice.h>
#include <linux/if.h>
#include <linux/if_vlan.h>
#include <linux/jhash.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/percpu.h>
#include <linux/rcupdate.h>
#include <linux/rtnetlink.h>
#include <linux/compat.h>
#include <net/net_namespace.h>
#include "datapath.h"
#include "vport.h"
#include "vport-internal_dev.h"

Go to the source code of this file.

Macros

#define VPORT_HASH_BUCKETS   1024
 

Functions

int ovs_vport_init (void)
 
void ovs_vport_exit (void)
 
: name of port to find

ovs_vport_locate - find a port that has already been created

Must be called with RTNL or RCU read lock.

struct vportovs_vport_locate (struct net *net, const char *name)
 
struct vportovs_vport_alloc (int priv_size, const struct vport_ops *ops, const struct vport_parms *parms)
 
void ovs_vport_free (struct vport *vport)
 
struct vportovs_vport_add (const struct vport_parms *parms)
 
int ovs_vport_set_options (struct vport *vport, struct nlattr *options)
 
void ovs_vport_del (struct vport *vport)
 
void ovs_vport_get_stats (struct vport *vport, struct ovs_vport_stats *stats)
 
int ovs_vport_get_options (const struct vport *vport, struct sk_buff *skb)
 
void ovs_vport_receive (struct vport *vport, struct sk_buff *skb)
 
int ovs_vport_send (struct vport *vport, struct sk_buff *skb)
 
void ovs_vport_record_error (struct vport *vport, enum vport_err_type err_type)
 

Macro Definition Documentation

#define VPORT_HASH_BUCKETS   1024

Definition at line 45 of file vport.c.

Function Documentation

struct vport* ovs_vport_add ( const struct vport_parms parms)
read

ovs_vport_add - add vport device (for kernel callers)

: Information about new vport.

Creates a new vport with the specified configuration (which is dependent on device type). RTNL lock must be held.

Definition at line 167 of file vport.c.

struct vport* ovs_vport_alloc ( int  priv_size,
const struct vport_ops ops,
const struct vport_parms parms 
)
read

ovs_vport_alloc - allocate and initialize new vport

: Size of private data area to allocate. : vport device ops

Allocate and initialize a new vport defined by . The vport will contain a private data area of size that can be accessed using vport_priv(). vports that are no longer needed should be released with vport_free().

Definition at line 110 of file vport.c.

void ovs_vport_del ( struct vport vport)

ovs_vport_del - delete existing vport device

: vport to delete.

Detaches from its datapath and destroys it. It is possible to fail for reasons such as lack of memory. RTNL lock must be held.

Definition at line 224 of file vport.c.

void ovs_vport_exit ( void  )

ovs_vport_exit - shutdown vport subsystem

Called at module exit time to shutdown the vport subsystem.

Definition at line 67 of file vport.c.

void ovs_vport_free ( struct vport vport)

ovs_vport_free - uninitialize and free vport

: vport to free

Frees a vport allocated with vport_alloc() when it is no longer needed.

The caller must ensure that an RCU grace period has passed since the last time was in a datapath.

Definition at line 153 of file vport.c.

int ovs_vport_get_options ( const struct vport vport,
struct sk_buff skb 
)

ovs_vport_get_options - retrieve device options

: vport from which to retrieve the options. : sk_buff where options should be appended.

Retrieves the configuration of the given device, appending an OVS_VPORT_ATTR_OPTIONS attribute that in turn contains nested vport-specific attributes to .

Returns 0 if successful, -EMSGSIZE if has insufficient room, or another negative error code if a real error occurred. If an error occurs, is left unmodified.

Must be called with RTNL lock or rcu_read_lock.

Definition at line 302 of file vport.c.

void ovs_vport_get_stats ( struct vport vport,
struct ovs_vport_stats stats 
)

ovs_vport_get_stats - retrieve device stats

: vport from which to retrieve the stats : location to store stats

Retrieves transmit, receive, and error stats for the given device.

Must be called with RTNL lock or rcu_read_lock.

Definition at line 243 of file vport.c.

int ovs_vport_init ( void  )

ovs_vport_init - initialize vport subsystem

Called at module load time to initialize the vport subsystem.

Definition at line 52 of file vport.c.

struct vport* ovs_vport_locate ( struct net net,
const char name 
)
read

Definition at line 85 of file vport.c.

void ovs_vport_receive ( struct vport vport,
struct sk_buff skb 
)

ovs_vport_receive - pass up received packet to the datapath for processing

: vport that received the packet : skb that was received

Must be called with rcu_read_lock. The packet cannot be shared and skb->data should point to the Ethernet header. The caller must have already called compute_ip_summed() to initialize the checksumming fields.

Definition at line 332 of file vport.c.

void ovs_vport_record_error ( struct vport vport,
enum vport_err_type  err_type 
)

ovs_vport_record_error - indicate device error to generic stats layer

: vport that encountered the error : one of enum vport_err_type types to indicate the error type

If using the vport generic stats layer indicate that an error of the given type has occured.

Definition at line 381 of file vport.c.

int ovs_vport_send ( struct vport vport,
struct sk_buff skb 
)

ovs_vport_send - send a packet on a device

: vport on which to send the packet : skb to send

Sends the given packet and returns the length of data sent. Either RTNL lock or rcu_read_lock must be held.

Definition at line 355 of file vport.c.

int ovs_vport_set_options ( struct vport vport,
struct nlattr options 
)

ovs_vport_set_options - modify existing vport device (for kernel callers)

: vport to modify. : New configuration.

Modifies an existing device with the specified configuration (which is dependent on device type). RTNL lock must be held.

Definition at line 207 of file vport.c.