vport.c (8f0aad6f35f7e8b3118b7b8a65e8e76b135cc4cb) | vport.c (12eb18f7115884b0c1513dda31b0051121116b3a) |
---|---|
1/* 2 * Copyright (c) 2007-2014 Nicira, Inc. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of version 2 of the GNU General Public 6 * License as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, but --- 54 unchanged lines hidden (view full) --- 63 * 64 * Called at module exit time to shutdown the vport subsystem. 65 */ 66void ovs_vport_exit(void) 67{ 68 kfree(dev_table); 69} 70 | 1/* 2 * Copyright (c) 2007-2014 Nicira, Inc. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of version 2 of the GNU General Public 6 * License as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, but --- 54 unchanged lines hidden (view full) --- 63 * 64 * Called at module exit time to shutdown the vport subsystem. 65 */ 66void ovs_vport_exit(void) 67{ 68 kfree(dev_table); 69} 70 |
71static struct hlist_head *hash_bucket(struct net *net, const char *name) | 71static struct hlist_head *hash_bucket(const struct net *net, const char *name) |
72{ 73 unsigned int hash = jhash(name, strlen(name), (unsigned long) net); 74 return &dev_table[hash & (VPORT_HASH_BUCKETS - 1)]; 75} 76 77int ovs_vport_ops_register(struct vport_ops *ops) 78{ 79 int err = -EEXIST; --- 22 unchanged lines hidden (view full) --- 102 103/** 104 * ovs_vport_locate - find a port that has already been created 105 * 106 * @name: name of port to find 107 * 108 * Must be called with ovs or RCU read lock. 109 */ | 72{ 73 unsigned int hash = jhash(name, strlen(name), (unsigned long) net); 74 return &dev_table[hash & (VPORT_HASH_BUCKETS - 1)]; 75} 76 77int ovs_vport_ops_register(struct vport_ops *ops) 78{ 79 int err = -EEXIST; --- 22 unchanged lines hidden (view full) --- 102 103/** 104 * ovs_vport_locate - find a port that has already been created 105 * 106 * @name: name of port to find 107 * 108 * Must be called with ovs or RCU read lock. 109 */ |
110struct vport *ovs_vport_locate(struct net *net, const char *name) | 110struct vport *ovs_vport_locate(const struct net *net, const char *name) |
111{ 112 struct hlist_head *bucket = hash_bucket(net, name); 113 struct vport *vport; 114 115 hlist_for_each_entry_rcu(vport, bucket, hash_node) 116 if (!strcmp(name, vport->ops->get_name(vport)) && 117 net_eq(ovs_dp_get_net(vport->dp), net)) 118 return vport; --- 256 unchanged lines hidden (view full) --- 375 * 376 * Sets the vport's upcall_portids to @ids. 377 * 378 * Returns 0 if successful, -EINVAL if @ids is zero length or cannot be parsed 379 * as an array of U32. 380 * 381 * Must be called with ovs_mutex. 382 */ | 111{ 112 struct hlist_head *bucket = hash_bucket(net, name); 113 struct vport *vport; 114 115 hlist_for_each_entry_rcu(vport, bucket, hash_node) 116 if (!strcmp(name, vport->ops->get_name(vport)) && 117 net_eq(ovs_dp_get_net(vport->dp), net)) 118 return vport; --- 256 unchanged lines hidden (view full) --- 375 * 376 * Sets the vport's upcall_portids to @ids. 377 * 378 * Returns 0 if successful, -EINVAL if @ids is zero length or cannot be parsed 379 * as an array of U32. 380 * 381 * Must be called with ovs_mutex. 382 */ |
383int ovs_vport_set_upcall_portids(struct vport *vport, struct nlattr *ids) | 383int ovs_vport_set_upcall_portids(struct vport *vport, const struct nlattr *ids) |
384{ 385 struct vport_portids *old, *vport_portids; 386 387 if (!nla_len(ids) || nla_len(ids) % sizeof(u32)) 388 return -EINVAL; 389 390 old = ovsl_dereference(vport->upcall_portids); 391 --- 74 unchanged lines hidden (view full) --- 466 * @vport: vport that received the packet 467 * @skb: skb that was received 468 * @tun_key: tunnel (if any) that carried packet 469 * 470 * Must be called with rcu_read_lock. The packet cannot be shared and 471 * skb->data should point to the Ethernet header. 472 */ 473void ovs_vport_receive(struct vport *vport, struct sk_buff *skb, | 384{ 385 struct vport_portids *old, *vport_portids; 386 387 if (!nla_len(ids) || nla_len(ids) % sizeof(u32)) 388 return -EINVAL; 389 390 old = ovsl_dereference(vport->upcall_portids); 391 --- 74 unchanged lines hidden (view full) --- 466 * @vport: vport that received the packet 467 * @skb: skb that was received 468 * @tun_key: tunnel (if any) that carried packet 469 * 470 * Must be called with rcu_read_lock. The packet cannot be shared and 471 * skb->data should point to the Ethernet header. 472 */ 473void ovs_vport_receive(struct vport *vport, struct sk_buff *skb, |
474 struct ovs_tunnel_info *tun_info) | 474 const struct ovs_tunnel_info *tun_info) |
475{ 476 struct pcpu_sw_netstats *stats; 477 struct sw_flow_key key; 478 int error; 479 480 stats = this_cpu_ptr(vport->percpu_stats); 481 u64_stats_update_begin(&stats->syncp); 482 stats->rx_packets++; --- 154 unchanged lines hidden --- | 475{ 476 struct pcpu_sw_netstats *stats; 477 struct sw_flow_key key; 478 int error; 479 480 stats = this_cpu_ptr(vport->percpu_stats); 481 u64_stats_update_begin(&stats->syncp); 482 stats->rx_packets++; --- 154 unchanged lines hidden --- |