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 Shelarstruct vport_net { 39aa310701e787087dbfbccf1409982a96e16c57a6Pravin B Shelar struct vport __rcu *gre_vport; 40aa310701e787087dbfbccf1409982a96e16c57a6Pravin B Shelar}; 41aa310701e787087dbfbccf1409982a96e16c57a6Pravin B Shelar 42ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossint ovs_vport_init(void); 43ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossvoid ovs_vport_exit(void); 44ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 45ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport *ovs_vport_add(const struct vport_parms *); 46ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossvoid ovs_vport_del(struct vport *); 47ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 4846df7b814548849deee01f50bc75f8f5ae8cd767Pravin B Shelarstruct vport *ovs_vport_locate(struct net *net, const char *name); 49ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 50ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossvoid ovs_vport_get_stats(struct vport *, struct ovs_vport_stats *); 51ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 52ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossint ovs_vport_set_options(struct vport *, struct nlattr *options); 53ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossint ovs_vport_get_options(const struct vport *, struct sk_buff *); 54ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 555cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wangint ovs_vport_set_upcall_portids(struct vport *, struct nlattr *pids); 565cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wangint ovs_vport_get_upcall_portids(const struct vport *, struct sk_buff *); 575cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wangu32 ovs_vport_find_upcall_portid(const struct vport *, struct sk_buff *); 585cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang 59ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossint ovs_vport_send(struct vport *, struct sk_buff *); 60ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 61ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/* The following definitions are for implementers of vport devices: */ 62ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 63ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport_err_stats { 64e403aded79a1bfb610adc53490ded8d2058f9dafLi RongQing atomic_long_t rx_dropped; 65e403aded79a1bfb610adc53490ded8d2058f9dafLi RongQing atomic_long_t rx_errors; 66e403aded79a1bfb610adc53490ded8d2058f9dafLi RongQing atomic_long_t tx_dropped; 67e403aded79a1bfb610adc53490ded8d2058f9dafLi RongQing atomic_long_t tx_errors; 68ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross}; 695cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang/** 705cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * struct vport_portids - array of netlink portids of a vport. 715cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * must be protected by rcu. 725cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * @rn_ids: The reciprocal value of @n_ids. 735cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * @rcu: RCU callback head for deferred destruction. 745cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * @n_ids: Size of @ids array. 755cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * @ids: Array storing the Netlink socket pids to be used for packets received 765cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * on this port that miss the flow table. 775cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang */ 785cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wangstruct vport_portids { 795cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang struct reciprocal_value rn_ids; 805cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang struct rcu_head rcu; 815cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang u32 n_ids; 825cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang u32 ids[]; 835cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang}; 84ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 85ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/** 86ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * struct vport - one port within a datapath 87ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @rcu: RCU callback head for deferred destruction. 88ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @dp: Datapath to which this port belongs. 895cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang * @upcall_portids: RCU protected 'struct vport_portids'. 9003599c94111bdac92fb5a70d592f5382b6fda75fThomas Graf * @port_no: Index into @dp's @ports array. 91ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @hash_node: Element in @dev_table hash table in vport.c. 9215eac2a74277bc7de68a7c2a64a7c91b4b6f5961Pravin B Shelar * @dp_hash_node: Element in @datapath->ports hash table in datapath.c. 93ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @ops: Class structure. 94ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @percpu_stats: Points to per-CPU statistics used and maintained by vport 95ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @err_stats: Points to error statistics used and maintained by vport 96ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross */ 97ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport { 98ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross struct rcu_head rcu; 99ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross struct datapath *dp; 1005cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang struct vport_portids __rcu *upcall_portids; 10103599c94111bdac92fb5a70d592f5382b6fda75fThomas Graf u16 port_no; 102ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 103ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross struct hlist_node hash_node; 10415eac2a74277bc7de68a7c2a64a7c91b4b6f5961Pravin B Shelar struct hlist_node dp_hash_node; 105ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross const struct vport_ops *ops; 106ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 1078f84985fec10de64a6b4cdfea45f2b0ab8f07c78Li RongQing struct pcpu_sw_netstats __percpu *percpu_stats; 108ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 109ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross struct vport_err_stats err_stats; 110ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross}; 111ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 112ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/** 113ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * struct vport_parms - parameters for creating a new vport 114ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * 115ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @name: New vport's name. 116ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @type: New vport's type. 117ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @options: %OVS_VPORT_ATTR_OPTIONS attribute from Netlink message, %NULL if 118ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * none was supplied. 119ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @dp: New vport's datapath. 120ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @port_no: New vport's port number. 121ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross */ 122ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport_parms { 123ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross const char *name; 124ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross enum ovs_vport_type type; 125ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross struct nlattr *options; 126ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 127ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross /* For ovs_vport_alloc(). */ 128ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross struct datapath *dp; 129ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross u16 port_no; 1305cd667b0a4567048bb555927d6ee564f4e5620a9Alex Wang struct nlattr *upcall_portids; 131ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross}; 132ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 133ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/** 134ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * struct vport_ops - definition of a type of virtual port 135ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * 136ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @type: %OVS_VPORT_TYPE_* value for this type of virtual port. 137ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @create: Create a new vport configured as specified. On success returns 138ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * a new vport allocated with ovs_vport_alloc(), otherwise an ERR_PTR() value. 139ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @destroy: Destroys a vport. Must call vport_free() on the vport but not 140ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * before an RCU grace period has elapsed. 141ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @set_options: Modify the configuration of an existing vport. May be %NULL 142ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * if modification is not supported. 143ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @get_options: Appends vport-specific attributes for the configuration of an 144ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * existing vport to a &struct sk_buff. May be %NULL for a vport that does not 145ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * have any configuration. 146ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @get_name: Get the device's name. 14791b7514cdff406ad8f63d09b74f664c37bed2e01Pravin B Shelar * @send: Send a packet on the device. Returns the length of the packet sent, 14891b7514cdff406ad8f63d09b74f664c37bed2e01Pravin B Shelar * zero for dropped packets or negative for error. 149ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross */ 150ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport_ops { 151ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross enum ovs_vport_type type; 152ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 1538e4e1713e4978447c5f799aa668dcc6d2cb0dee9Pravin B Shelar /* Called with ovs_mutex. */ 154ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross struct vport *(*create)(const struct vport_parms *); 155ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross void (*destroy)(struct vport *); 156ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 157ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross int (*set_options)(struct vport *, struct nlattr *); 158ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross int (*get_options)(const struct vport *, struct sk_buff *); 159ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 1608e4e1713e4978447c5f799aa668dcc6d2cb0dee9Pravin B Shelar /* Called with rcu_read_lock or ovs_mutex. */ 161ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross const char *(*get_name)(const struct vport *); 162ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 163ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross int (*send)(struct vport *, struct sk_buff *); 164ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross}; 165ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 166ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossenum vport_err_type { 167ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross VPORT_E_RX_DROPPED, 168ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross VPORT_E_RX_ERROR, 169ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross VPORT_E_TX_DROPPED, 170ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross VPORT_E_TX_ERROR, 171ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross}; 172ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 173ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstruct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *, 174ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross const struct vport_parms *); 175ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossvoid ovs_vport_free(struct vport *); 176aa310701e787087dbfbccf1409982a96e16c57a6Pravin B Shelarvoid ovs_vport_deferred_free(struct vport *vport); 177ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 178ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross#define VPORT_ALIGN 8 179ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 180ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/** 181ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * vport_priv - access private data area of vport 182ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * 183ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @vport: vport to access 184ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * 185ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * If a nonzero size was passed in priv_size of vport_alloc() a private data 186ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * area was allocated on creation. This allows that area to be accessed and 187ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * used for any purpose needed by the vport implementer. 188ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross */ 189ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossstatic inline void *vport_priv(const struct vport *vport) 190ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross{ 19107dc0602c5976cfc36ccffe5c6d73234f204d585Daniele Di Proietto return (u8 *)(uintptr_t)vport + ALIGN(sizeof(struct vport), VPORT_ALIGN); 192ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross} 193ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 194ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/** 195ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * vport_from_priv - lookup vport from private data pointer 196ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * 197ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * @priv: Start of private data area. 198ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * 199ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * It is sometimes useful to translate from a pointer to the private data 200ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * area to the vport, such as in the case where the private data pointer is 201ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * the result of a hash table lookup. @priv must point to the start of the 202ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * private data area. 203ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross */ 204d0b4da137508db3d38998eae7f62c0f9699ee08cDaniele Di Proiettostatic inline struct vport *vport_from_priv(void *priv) 205ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross{ 206d0b4da137508db3d38998eae7f62c0f9699ee08cDaniele Di Proietto return (struct vport *)((u8 *)priv - ALIGN(sizeof(struct vport), VPORT_ALIGN)); 207ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross} 208ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 2097d5437c709ded4f152cb8b305d17972d6707f20cPravin B Shelarvoid ovs_vport_receive(struct vport *, struct sk_buff *, 210f0b128c1e2cc33ad104daf0f51a51e34f7763c5fJesse Gross struct ovs_tunnel_info *); 211ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross 212ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross/* List of statically compiled vport implementations. Don't forget to also 213ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Gross * add yours to the list at the top of vport.c. */ 214ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossextern const struct vport_ops ovs_netdev_vport_ops; 215ccb1352e76cff0524e7ccb2074826a092dd13016Jesse Grossextern const struct vport_ops ovs_internal_vport_ops; 216aa310701e787087dbfbccf1409982a96e16c57a6Pravin B Shelarextern const struct vport_ops ovs_gre_vport_ops; 21758264848a5a7b91195f43c4729072e8cc980288dPravin B Shelarextern const struct vport_ops ovs_vxlan_vport_ops; 218f5796684069e0c71c65bce6a6d4766114aec1396Jesse Grossextern const struct vport_ops ovs_geneve_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