Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
vport.h File Reference
#include <linux/list.h>
#include <linux/netlink.h>
#include <linux/openvswitch.h>
#include <linux/skbuff.h>
#include <linux/spinlock.h>
#include <linux/u64_stats_sync.h>
#include "datapath.h"

Go to the source code of this file.

Data Structures

struct  vport_percpu_stats
struct  vport_err_stats
struct  vport
struct  vport_parms
struct  vport_ops


int ovs_vport_init (void)
void ovs_vport_exit (void)
struct vportovs_vport_add (const struct vport_parms *)
void ovs_vport_del (struct vport *)
struct vportovs_vport_locate (struct net *net, const char *name)
void ovs_vport_get_stats (struct vport *, struct ovs_vport_stats *)
int ovs_vport_set_options (struct vport *, struct nlattr *options)
int ovs_vport_get_options (const struct vport *, struct sk_buff *)
int ovs_vport_send (struct vport *, struct sk_buff *)

: New vport's name.

struct vport_parms - parameters for creating a new vport

: New vport's type. : OVS_VPORT_ATTR_OPTIONS attribute from Netlink message, NULL if none was supplied. : New vport's datapath. : New vport's port number.

#define VPORT_ALIGN   8
struct vport_ops ovs_netdev_vport_ops
struct vport_ops ovs_internal_vport_ops
struct vportovs_vport_alloc (int priv_size, const struct vport_ops *, const struct vport_parms *)
void ovs_vport_free (struct vport *)
void ovs_vport_receive (struct vport *, struct sk_buff *)
void ovs_vport_record_error (struct vport *, enum vport_err_type err_type)

Macro Definition Documentation

#define VPORT_ALIGN   8

Definition at line 167 of file vport.h.

Enumeration Type Documentation


Definition at line 156 of file vport.h.

Function Documentation

struct vport* ovs_vport_add ( const struct vport_parms parms)

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 

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 

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.

Variable Documentation

struct vport_ops ovs_internal_vport_ops

Definition at line 234 of file vport-internal_dev.c.

struct vport_ops ovs_netdev_vport_ops

Definition at line 191 of file vport-netdev.c.