vport.h revision e403aded79a1bfb610adc53490ded8d2058f9daf
1ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/*
2caf2ee14bbc2c6bd73cf0decf576007e0239a482Raju Subramanian * Copyright (c) 2007-2012 Nicira, Inc.
3ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross *
4ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * This program is free software; you can redistribute it and/or
5ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * modify it under the terms of version 2 of the GNU General Public
6ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * License as published by the Free Software Foundation.
7ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross *
8ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * This program is distributed in the hope that it will be useful, but
9ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * WITHOUT ANY WARRANTY; without even the implied warranty of
10ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * General Public License for more details.
12ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross *
13ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * You should have received a copy of the GNU General Public License
14ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * along with this program; if not, write to the Free Software
15ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * 02110-1301, USA
17ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross */
18ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
19ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross#ifndef VPORT_H
20ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross#define VPORT_H 1
21ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
22e0f0ecf33c3f13401f90bff5afdc3ed1bb40b9afPravin B Shelar#include <linux/if_tunnel.h>
23ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross#include <linux/list.h>
2446df7b814548849deee01f50bc75f8f5ae8cd767Pravin B Shelar#include <linux/netlink.h>
25ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross#include <linux/openvswitch.h>
265cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang#include <linux/reciprocal_div.h>
27ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross#include <linux/skbuff.h>
28ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross#include <linux/spinlock.h>
29ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross#include <linux/u64_stats_sync.h>
30ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
31ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross#include "datapath.h"
32ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
33ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport;
34ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport_parms;
35ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
36ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/* The following definitions are for users of the vport subsytem: */
37ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
38aa310701e787087dbfbccf1409982a96e16c57a6Pravin B Shelar/* The following definitions are for users of the vport subsytem: */
39aa310701e787087dbfbccf1409982a96e16c57a6Pravin B Shelarstruct vport_net {
40aa310701e787087dbfbccf1409982a96e16c57a6Pravin B Shelar	struct vport __rcu *gre_vport;
41aa310701e787087dbfbccf1409982a96e16c57a6Pravin B Shelar};
42aa310701e787087dbfbccf1409982a96e16c57a6Pravin B Shelar
43ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossint ovs_vport_init(void);
44ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossvoid ovs_vport_exit(void);
45ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
46ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport *ovs_vport_add(const struct vport_parms *);
47ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossvoid ovs_vport_del(struct vport *);
48ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
4946df7b814548849deee01f50bc75f8f5ae8cd767Pravin B Shelarstruct vport *ovs_vport_locate(struct net *net, const char *name);
50ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
51ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossvoid ovs_vport_get_stats(struct vport *, struct ovs_vport_stats *);
52ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
53ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossint ovs_vport_set_options(struct vport *, struct nlattr *options);
54ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossint ovs_vport_get_options(const struct vport *, struct sk_buff *);
55ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
565cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wangint ovs_vport_set_upcall_portids(struct vport *, struct nlattr *pids);
575cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wangint ovs_vport_get_upcall_portids(const struct vport *, struct sk_buff *);
585cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wangu32 ovs_vport_find_upcall_portid(const struct vport *, struct sk_buff *);
595cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang
60ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossint ovs_vport_send(struct vport *, struct sk_buff *);
61ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
62ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/* The following definitions are for implementers of vport devices: */
63ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
64ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport_err_stats {
65e403aded79a1bfb610adc53490ded8d2058f9dafLi RongQing	atomic_long_t rx_dropped;
66e403aded79a1bfb610adc53490ded8d2058f9dafLi RongQing	atomic_long_t rx_errors;
67e403aded79a1bfb610adc53490ded8d2058f9dafLi RongQing	atomic_long_t tx_dropped;
68e403aded79a1bfb610adc53490ded8d2058f9dafLi RongQing	atomic_long_t tx_errors;
69ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross};
705cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang/**
715cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * struct vport_portids - array of netlink portids of a vport.
725cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang *                        must be protected by rcu.
735cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * @rn_ids: The reciprocal value of @n_ids.
745cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * @rcu: RCU callback head for deferred destruction.
755cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * @n_ids: Size of @ids array.
765cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * @ids: Array storing the Netlink socket pids to be used for packets received
775cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * on this port that miss the flow table.
785cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang */
795cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wangstruct vport_portids {
805cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang	struct reciprocal_value rn_ids;
815cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang	struct rcu_head rcu;
825cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang	u32 n_ids;
835cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang	u32 ids[];
845cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang};
85ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
86ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/**
87ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * struct vport - one port within a datapath
88ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @rcu: RCU callback head for deferred destruction.
89ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @dp: Datapath to which this port belongs.
905cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * @upcall_portids: RCU protected 'struct vport_portids'.
9103599c94111bdac92fb5a70d592f5382b6fda75fThomas Graf * @port_no: Index into @dp's @ports array.
92ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @hash_node: Element in @dev_table hash table in vport.c.
9315eac2a74277bc7de68a7c2a64a7c91b4b6f5961Pravin B Shelar * @dp_hash_node: Element in @datapath->ports hash table in datapath.c.
94ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @ops: Class structure.
95ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @percpu_stats: Points to per-CPU statistics used and maintained by vport
96ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @err_stats: Points to error statistics used and maintained by vport
97ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross */
98ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport {
99ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	struct rcu_head rcu;
100ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	struct datapath	*dp;
1015cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang	struct vport_portids __rcu *upcall_portids;
10203599c94111bdac92fb5a70d592f5382b6fda75fThomas Graf	u16 port_no;
103ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
104ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	struct hlist_node hash_node;
10515eac2a74277bc7de68a7c2a64a7c91b4b6f5961Pravin B Shelar	struct hlist_node dp_hash_node;
106ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	const struct vport_ops *ops;
107ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
1088f84985fec10de64a6b4cdfea45f2b0ab8f07c78Li RongQing	struct pcpu_sw_netstats __percpu *percpu_stats;
109ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
110ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	struct vport_err_stats err_stats;
111ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross};
112ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
113ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/**
114ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * struct vport_parms - parameters for creating a new vport
115ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross *
116ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @name: New vport's name.
117ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @type: New vport's type.
118ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @options: %OVS_VPORT_ATTR_OPTIONS attribute from Netlink message, %NULL if
119ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * none was supplied.
120ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @dp: New vport's datapath.
121ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @port_no: New vport's port number.
122ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross */
123ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport_parms {
124ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	const char *name;
125ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	enum ovs_vport_type type;
126ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	struct nlattr *options;
127ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
128ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	/* For ovs_vport_alloc(). */
129ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	struct datapath *dp;
130ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	u16 port_no;
1315cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang	struct nlattr *upcall_portids;
132ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross};
133ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
134ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/**
135ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * struct vport_ops - definition of a type of virtual port
136ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross *
137ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @type: %OVS_VPORT_TYPE_* value for this type of virtual port.
138ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @create: Create a new vport configured as specified.  On success returns
139ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * a new vport allocated with ovs_vport_alloc(), otherwise an ERR_PTR() value.
140ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @destroy: Destroys a vport.  Must call vport_free() on the vport but not
141ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * before an RCU grace period has elapsed.
142ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @set_options: Modify the configuration of an existing vport.  May be %NULL
143ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * if modification is not supported.
144ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @get_options: Appends vport-specific attributes for the configuration of an
145ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * existing vport to a &struct sk_buff.  May be %NULL for a vport that does not
146ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * have any configuration.
147ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @get_name: Get the device's name.
14891b7514cdff406ad8f63d09b74f664c37bed2e01Pravin B Shelar * @send: Send a packet on the device.  Returns the length of the packet sent,
14991b7514cdff406ad8f63d09b74f664c37bed2e01Pravin B Shelar * zero for dropped packets or negative for error.
150ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross */
151ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport_ops {
152ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	enum ovs_vport_type type;
153ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
1548e4e1713e4978447c5f799aa668dcc6d2cb0dee9Pravin B Shelar	/* Called with ovs_mutex. */
155ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	struct vport *(*create)(const struct vport_parms *);
156ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	void (*destroy)(struct vport *);
157ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
158ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	int (*set_options)(struct vport *, struct nlattr *);
159ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	int (*get_options)(const struct vport *, struct sk_buff *);
160ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
1618e4e1713e4978447c5f799aa668dcc6d2cb0dee9Pravin B Shelar	/* Called with rcu_read_lock or ovs_mutex. */
162ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	const char *(*get_name)(const struct vport *);
163ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
164ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	int (*send)(struct vport *, struct sk_buff *);
165ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross};
166ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
167ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossenum vport_err_type {
168ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	VPORT_E_RX_DROPPED,
169ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	VPORT_E_RX_ERROR,
170ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	VPORT_E_TX_DROPPED,
171ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross	VPORT_E_TX_ERROR,
172ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross};
173ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
174ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *,
175ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross			      const struct vport_parms *);
176ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossvoid ovs_vport_free(struct vport *);
177aa310701e787087dbfbccf1409982a96e16c57a6Pravin B Shelarvoid ovs_vport_deferred_free(struct vport *vport);
178ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
179ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross#define VPORT_ALIGN 8
180ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
181ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/**
182ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross *	vport_priv - access private data area of vport
183ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross *
184ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @vport: vport to access
185ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross *
186ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * If a nonzero size was passed in priv_size of vport_alloc() a private data
187ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * area was allocated on creation.  This allows that area to be accessed and
188ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * used for any purpose needed by the vport implementer.
189ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross */
190ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstatic inline void *vport_priv(const struct vport *vport)
191ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross{
19207dc0602c5976cfc36ccffe5c6d73234f204d585Daniele Di Proietto	return (u8 *)(uintptr_t)vport + ALIGN(sizeof(struct vport), VPORT_ALIGN);
193ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross}
194ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
195ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/**
196ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross *	vport_from_priv - lookup vport from private data pointer
197ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross *
198ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @priv: Start of private data area.
199ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross *
200ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * It is sometimes useful to translate from a pointer to the private data
201ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * area to the vport, such as in the case where the private data pointer is
202ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * the result of a hash table lookup.  @priv must point to the start of the
203ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * private data area.
204ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross */
205d0b4da137508db3d38998eae7f62c0f9699ee08cDaniele Di Proiettostatic inline struct vport *vport_from_priv(void *priv)
206ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross{
207d0b4da137508db3d38998eae7f62c0f9699ee08cDaniele Di Proietto	return (struct vport *)((u8 *)priv - ALIGN(sizeof(struct vport), VPORT_ALIGN));
208ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross}
209ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
2107d5437c709ded4f152cb8b305d17972d6707f20cPravin B Shelarvoid ovs_vport_receive(struct vport *, struct sk_buff *,
2117d5437c709ded4f152cb8b305d17972d6707f20cPravin B Shelar		       struct ovs_key_ipv4_tunnel *);
212ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
213ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/* List of statically compiled vport implementations.  Don't forget to also
214ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * add yours to the list at the top of vport.c. */
215ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossextern const struct vport_ops ovs_netdev_vport_ops;
216ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossextern const struct vport_ops ovs_internal_vport_ops;
217aa310701e787087dbfbccf1409982a96e16c57a6Pravin B Shelarextern const struct vport_ops ovs_gre_vport_ops;
21858264848a5a7b91195f43c4729072e8cc980288dPravin B Shelarextern const struct vport_ops ovs_vxlan_vport_ops;
219ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross
220b34df5e805a6e98cae0bc5bc80c1b52d9ff811dePravin B Shelarstatic inline void ovs_skb_postpush_rcsum(struct sk_buff *skb,
221b34df5e805a6e98cae0bc5bc80c1b52d9ff811dePravin B Shelar				      const void *start, unsigned int len)
222b34df5e805a6e98cae0bc5bc80c1b52d9ff811dePravin B Shelar{
223b34df5e805a6e98cae0bc5bc80c1b52d9ff811dePravin B Shelar	if (skb->ip_summed == CHECKSUM_COMPLETE)
224b34df5e805a6e98cae0bc5bc80c1b52d9ff811dePravin B Shelar		skb->csum = csum_add(skb->csum, csum_partial(start, len, 0));
225b34df5e805a6e98cae0bc5bc80c1b52d9ff811dePravin B Shelar}
226b34df5e805a6e98cae0bc5bc80c1b52d9ff811dePravin B Shelar
227ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross#endif /* vport.h */
228