21 #include <linux/if_vlan.h>
23 #include <linux/kernel.h>
24 #include <linux/list.h>
28 #include <linux/rtnetlink.h>
38 static const struct vport_ops *vport_ops_list[] = {
45 #define VPORT_HASH_BUCKETS 1024
74 unsigned int hash = jhash(name,
strlen(name), (
unsigned long) net);
91 hlist_for_each_entry_rcu(vport, node, bucket, hash_node)
92 if (!
strcmp(name, vport->
ops->get_name(vport)) &&
93 net_eq(ovs_dp_get_net(vport->
dp), net))
116 alloc_size =
sizeof(
struct vport);
119 alloc_size += priv_size;
126 vport->
dp = parms->
dp;
175 for (i = 0; i <
ARRAY_SIZE(vport_ops_list); i++) {
176 if (vport_ops_list[i]->
type == parms->
type) {
179 vport = vport_ops_list[
i]->
create(parms);
181 err = PTR_ERR(vport);
186 vport->
ops->get_name(vport));
187 hlist_add_head_rcu(&vport->
hash_node, bucket);
211 if (!vport->
ops->set_options)
213 return vport->
ops->set_options(vport, options);
230 vport->
ops->destroy(vport);
247 memset(stats, 0,
sizeof(*stats));
275 start = u64_stats_fetch_begin_bh(&percpu_stats->
sync);
276 local_stats = *percpu_stats;
277 }
while (u64_stats_fetch_retry_bh(&percpu_stats->
sync, start));
310 if (vport->
ops->get_options) {
311 int err = vport->
ops->get_options(vport, skb);
313 nla_nest_cancel(skb, nla);
318 nla_nest_end(skb, nla);
338 u64_stats_update_begin(&stats->
sync);
341 u64_stats_update_end(&stats->
sync);
357 int sent = vport->
ops->send(vport, skb);
364 u64_stats_update_begin(&stats->
sync);
367 u64_stats_update_end(&stats->
sync);