.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * 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 |
---|
9 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
11 | | - * General Public License for more details. |
---|
12 | | - * |
---|
13 | | - * You should have received a copy of the GNU General Public License |
---|
14 | | - * along with this program; if not, write to the Free Software |
---|
15 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
---|
16 | | - * 02110-1301, USA |
---|
17 | 4 | */ |
---|
18 | 5 | |
---|
19 | 6 | #include <linux/etherdevice.h> |
---|
.. | .. |
---|
100 | 87 | /** |
---|
101 | 88 | * ovs_vport_locate - find a port that has already been created |
---|
102 | 89 | * |
---|
| 90 | + * @net: network namespace |
---|
103 | 91 | * @name: name of port to find |
---|
104 | 92 | * |
---|
105 | 93 | * Must be called with ovs or RCU read lock. |
---|
.. | .. |
---|
109 | 97 | struct hlist_head *bucket = hash_bucket(net, name); |
---|
110 | 98 | struct vport *vport; |
---|
111 | 99 | |
---|
112 | | - hlist_for_each_entry_rcu(vport, bucket, hash_node) |
---|
| 100 | + hlist_for_each_entry_rcu(vport, bucket, hash_node, |
---|
| 101 | + lockdep_ovsl_is_held()) |
---|
113 | 102 | if (!strcmp(name, ovs_vport_name(vport)) && |
---|
114 | 103 | net_eq(ovs_dp_get_net(vport->dp), net)) |
---|
115 | 104 | return vport; |
---|
.. | .. |
---|
129 | 118 | * vport_free(). |
---|
130 | 119 | */ |
---|
131 | 120 | struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops, |
---|
132 | | - const struct vport_parms *parms) |
---|
| 121 | + const struct vport_parms *parms) |
---|
133 | 122 | { |
---|
134 | 123 | struct vport *vport; |
---|
135 | 124 | size_t alloc_size; |
---|
.. | .. |
---|
261 | 250 | */ |
---|
262 | 251 | void ovs_vport_del(struct vport *vport) |
---|
263 | 252 | { |
---|
264 | | - ASSERT_OVSL(); |
---|
265 | | - |
---|
266 | 253 | hlist_del_rcu(&vport->hash_node); |
---|
267 | 254 | module_put(vport->ops->owner); |
---|
268 | 255 | vport->ops->destroy(vport); |
---|
.. | .. |
---|
319 | 306 | if (!vport->ops->get_options) |
---|
320 | 307 | return 0; |
---|
321 | 308 | |
---|
322 | | - nla = nla_nest_start(skb, OVS_VPORT_ATTR_OPTIONS); |
---|
| 309 | + nla = nla_nest_start_noflag(skb, OVS_VPORT_ATTR_OPTIONS); |
---|
323 | 310 | if (!nla) |
---|
324 | 311 | return -EMSGSIZE; |
---|
325 | 312 | |
---|
.. | .. |
---|
410 | 397 | * |
---|
411 | 398 | * Returns the portid of the target socket. Must be called with rcu_read_lock. |
---|
412 | 399 | */ |
---|
413 | | -u32 ovs_vport_find_upcall_portid(const struct vport *vport, struct sk_buff *skb) |
---|
| 400 | +u32 ovs_vport_find_upcall_portid(const struct vport *vport, |
---|
| 401 | + struct sk_buff *skb) |
---|
414 | 402 | { |
---|
415 | 403 | struct vport_portids *ids; |
---|
416 | 404 | u32 ids_index; |
---|
.. | .. |
---|
418 | 406 | |
---|
419 | 407 | ids = rcu_dereference(vport->upcall_portids); |
---|
420 | 408 | |
---|
421 | | - if (ids->n_ids == 1 && ids->ids[0] == 0) |
---|
422 | | - return 0; |
---|
| 409 | + /* If there is only one portid, select it in the fast-path. */ |
---|
| 410 | + if (ids->n_ids == 1) |
---|
| 411 | + return ids->ids[0]; |
---|
423 | 412 | |
---|
424 | 413 | hash = skb_get_hash(skb); |
---|
425 | 414 | ids_index = hash - ids->n_ids * reciprocal_divide(hash, ids->rn_ids); |
---|
.. | .. |
---|
431 | 420 | * |
---|
432 | 421 | * @vport: vport that received the packet |
---|
433 | 422 | * @skb: skb that was received |
---|
434 | | - * @tun_key: tunnel (if any) that carried packet |
---|
| 423 | + * @tun_info: tunnel (if any) that carried packet |
---|
435 | 424 | * |
---|
436 | 425 | * Must be called with rcu_read_lock. The packet cannot be shared and |
---|
437 | 426 | * skb->data should point to the Ethernet header. |
---|
.. | .. |
---|
514 | 503 | } |
---|
515 | 504 | |
---|
516 | 505 | skb->dev = vport->dev; |
---|
| 506 | + skb->tstamp = 0; |
---|
517 | 507 | vport->ops->send(skb); |
---|
518 | 508 | return; |
---|
519 | 509 | |
---|