Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
flow.c File Reference
#include "flow.h"
#include "datapath.h"
#include <linux/uaccess.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/if_ether.h>
#include <linux/if_vlan.h>
#include <net/llc_pdu.h>
#include <linux/kernel.h>
#include <linux/jhash.h>
#include <linux/jiffies.h>
#include <linux/llc.h>
#include <linux/module.h>
#include <linux/in.h>
#include <linux/rcupdate.h>
#include <linux/if_arp.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/tcp.h>
#include <linux/udp.h>
#include <linux/icmp.h>
#include <linux/icmpv6.h>
#include <linux/rculist.h>
#include <net/ip.h>
#include <net/ipv6.h>
#include <net/ndisc.h>

Go to the source code of this file.

Macros

#define SW_FLOW_KEY_OFFSET(field)
 
#define TCP_FLAGS_OFFSET   13
 
#define TCP_FLAG_MASK   0x3f
 

Functions

u64 ovs_flow_used_time (unsigned long flow_jiffies)
 
void ovs_flow_used (struct sw_flow *flow, struct sk_buff *skb)
 
struct sw_flow_actionsovs_flow_actions_alloc (const struct nlattr *actions)
 
struct sw_flowovs_flow_alloc (void)
 
struct flow_tableovs_flow_tbl_alloc (int new_size)
 
void ovs_flow_tbl_destroy (struct flow_table *table)
 
void ovs_flow_tbl_deferred_destroy (struct flow_table *table)
 
struct sw_flowovs_flow_tbl_next (struct flow_table *table, u32 *bucket, u32 *last)
 
struct flow_tableovs_flow_tbl_rehash (struct flow_table *table)
 
struct flow_tableovs_flow_tbl_expand (struct flow_table *table)
 
void ovs_flow_free (struct sw_flow *flow)
 
void ovs_flow_deferred_free (struct sw_flow *flow)
 
void ovs_flow_deferred_free_acts (struct sw_flow_actions *sf_acts)
 
int ovs_flow_extract (struct sk_buff *skb, u16 in_port, struct sw_flow_key *key, int *key_lenp)
 
u32 ovs_flow_hash (const struct sw_flow_key *key, int key_len)
 
struct sw_flowovs_flow_tbl_lookup (struct flow_table *table, struct sw_flow_key *key, int key_len)
 
void ovs_flow_tbl_insert (struct flow_table *table, struct sw_flow *flow)
 
void ovs_flow_tbl_remove (struct flow_table *table, struct sw_flow *flow)
 
int ovs_flow_from_nlattrs (struct sw_flow_key *swkey, int *key_lenp, const struct nlattr *attr)
 
int ovs_flow_metadata_from_nlattrs (u32 *priority, u16 *in_port, const struct nlattr *attr)
 
int ovs_flow_to_nlattrs (const struct sw_flow_key *swkey, struct sk_buff *skb)
 
int ovs_flow_init (void)
 
void ovs_flow_exit (void)
 

Variables

const int ovs_key_lens [OVS_KEY_ATTR_MAX+1]
 

Macro Definition Documentation

#define SW_FLOW_KEY_OFFSET (   field)
Value:
(offsetof(struct sw_flow_key, field) + \
FIELD_SIZEOF(struct sw_flow_key, field))

Definition at line 123 of file flow.c.

#define TCP_FLAG_MASK   0x3f

Definition at line 179 of file flow.c.

#define TCP_FLAGS_OFFSET   13

Definition at line 178 of file flow.c.

Function Documentation

struct sw_flow_actions* ovs_flow_actions_alloc ( const struct nlattr actions)
read

Definition at line 201 of file flow.c.

struct sw_flow* ovs_flow_alloc ( void  )
read

Definition at line 218 of file flow.c.

void ovs_flow_deferred_free ( struct sw_flow flow)

Definition at line 422 of file flow.c.

void ovs_flow_deferred_free_acts ( struct sw_flow_actions sf_acts)

Definition at line 429 of file flow.c.

void ovs_flow_exit ( void  )

Definition at line 1333 of file flow.c.

int ovs_flow_extract ( struct sk_buff skb,
u16  in_port,
struct sw_flow_key key,
int key_lenp 
)

ovs_flow_extract - extracts a flow key from an Ethernet frame. : sk_buff that contains the frame, with skb->data pointing to the Ethernet header : port number on which was received. : output flow key : length of output flow key

The caller must ensure that skb->len >= ETH_HLEN.

Returns 0 if successful, otherwise a negative errno value.

Initializes header pointers as follows:

  • skb->network_header: just past the Ethernet header, or just past the VLAN header, to the first byte of the Ethernet payload.
  • skb->transport_header: If key->dl_type is ETH_P_IP or ETH_P_IPV6 on output, then just past the IP header, if one is present and of a correct length, otherwise the same as skb->network_header. For other key->dl_type values it is left untouched.

Definition at line 596 of file flow.c.

void ovs_flow_free ( struct sw_flow flow)

Definition at line 403 of file flow.c.

int ovs_flow_from_nlattrs ( struct sw_flow_key swkey,
int key_lenp,
const struct nlattr attr 
)

ovs_flow_from_nlattrs - parses Netlink attributes into a flow key. : receives the extracted flow key. : number of bytes used in . : Netlink attribute holding nested OVS_KEY_ATTR_* Netlink attribute sequence.

Definition at line 960 of file flow.c.

u32 ovs_flow_hash ( const struct sw_flow_key key,
int  key_len 
)

Definition at line 758 of file flow.c.

int ovs_flow_init ( void  )

Definition at line 1322 of file flow.c.

int ovs_flow_metadata_from_nlattrs ( u32 priority,
u16 in_port,
const struct nlattr attr 
)

ovs_flow_metadata_from_nlattrs - parses Netlink attributes into a flow key. : receives the extracted input port. : Netlink attribute holding nested OVS_KEY_ATTR_* Netlink attribute sequence.

This parses a series of Netlink attributes that form a flow key, which must take the same form accepted by flow_from_nlattrs(), but only enough of it to get the metadata, that is, the parts of the flow key that cannot be extracted from the packet itself.

Definition at line 1125 of file flow.c.

struct flow_table* ovs_flow_tbl_alloc ( int  new_size)
read

Definition at line 267 of file flow.c.

void ovs_flow_tbl_deferred_destroy ( struct flow_table table)

Definition at line 323 of file flow.c.

void ovs_flow_tbl_destroy ( struct flow_table table)

Definition at line 289 of file flow.c.

struct flow_table* ovs_flow_tbl_expand ( struct flow_table table)
read

Definition at line 398 of file flow.c.

void ovs_flow_tbl_insert ( struct flow_table table,
struct sw_flow flow 
)

Definition at line 784 of file flow.c.

struct sw_flow* ovs_flow_tbl_lookup ( struct flow_table table,
struct sw_flow_key key,
int  key_len 
)
read

Definition at line 763 of file flow.c.

struct sw_flow* ovs_flow_tbl_next ( struct flow_table table,
u32 bucket,
u32 last 
)
read

Definition at line 331 of file flow.c.

struct flow_table* ovs_flow_tbl_rehash ( struct flow_table table)
read

Definition at line 393 of file flow.c.

void ovs_flow_tbl_remove ( struct flow_table table,
struct sw_flow flow 
)

Definition at line 793 of file flow.c.

int ovs_flow_to_nlattrs ( const struct sw_flow_key swkey,
struct sk_buff skb 
)

Definition at line 1159 of file flow.c.

void ovs_flow_used ( struct sw_flow flow,
struct sk_buff skb 
)

Definition at line 181 of file flow.c.

u64 ovs_flow_used_time ( unsigned long  flow_jiffies)

Definition at line 110 of file flow.c.

Variable Documentation

const int ovs_key_lens[OVS_KEY_ATTR_MAX+1]
Initial value:
= {
[OVS_KEY_ATTR_IPV4] = sizeof(struct ovs_key_ipv4),
[OVS_KEY_ATTR_IPV6] = sizeof(struct ovs_key_ipv6),
[OVS_KEY_ATTR_TCP] = sizeof(struct ovs_key_tcp),
[OVS_KEY_ATTR_UDP] = sizeof(struct ovs_key_udp),
[OVS_KEY_ATTR_ICMP] = sizeof(struct ovs_key_icmp),
[OVS_KEY_ATTR_ICMPV6] = sizeof(struct ovs_key_icmpv6),
[OVS_KEY_ATTR_ARP] = sizeof(struct ovs_key_arp),
[OVS_KEY_ATTR_ND] = sizeof(struct ovs_key_nd),
}

Definition at line 801 of file flow.c.