Lines Matching refs:vport

95 struct vport *ovs_vport_locate(const struct net *net, const char *name)  in ovs_vport_locate()
98 struct vport *vport; in ovs_vport_locate() local
100 hlist_for_each_entry_rcu(vport, bucket, hash_node, in ovs_vport_locate()
102 if (!strcmp(name, ovs_vport_name(vport)) && in ovs_vport_locate()
103 net_eq(ovs_dp_get_net(vport->dp), net)) in ovs_vport_locate()
104 return vport; in ovs_vport_locate()
122 struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops, in ovs_vport_alloc()
125 struct vport *vport; in ovs_vport_alloc() local
129 alloc_size = sizeof(struct vport); in ovs_vport_alloc()
135 vport = kzalloc(alloc_size, GFP_KERNEL); in ovs_vport_alloc()
136 if (!vport) in ovs_vport_alloc()
139 vport->upcall_stats = netdev_alloc_pcpu_stats(struct vport_upcall_stats_percpu); in ovs_vport_alloc()
140 if (!vport->upcall_stats) { in ovs_vport_alloc()
145 vport->dp = parms->dp; in ovs_vport_alloc()
146 vport->port_no = parms->port_no; in ovs_vport_alloc()
147 vport->ops = ops; in ovs_vport_alloc()
148 INIT_HLIST_NODE(&vport->dp_hash_node); in ovs_vport_alloc()
150 if (ovs_vport_set_upcall_portids(vport, parms->upcall_portids)) { in ovs_vport_alloc()
155 return vport; in ovs_vport_alloc()
158 free_percpu(vport->upcall_stats); in ovs_vport_alloc()
160 kfree(vport); in ovs_vport_alloc()
175 void ovs_vport_free(struct vport *vport) in ovs_vport_free() argument
180 kfree(rcu_dereference_raw(vport->upcall_portids)); in ovs_vport_free()
181 free_percpu(vport->upcall_stats); in ovs_vport_free()
182 kfree(vport); in ovs_vport_free()
205 struct vport *ovs_vport_add(const struct vport_parms *parms) in ovs_vport_add()
208 struct vport *vport; in ovs_vport_add() local
217 vport = ops->create(parms); in ovs_vport_add()
218 if (IS_ERR(vport)) { in ovs_vport_add()
220 return vport; in ovs_vport_add()
223 bucket = hash_bucket(ovs_dp_get_net(vport->dp), in ovs_vport_add()
224 ovs_vport_name(vport)); in ovs_vport_add()
225 hlist_add_head_rcu(&vport->hash_node, bucket); in ovs_vport_add()
226 return vport; in ovs_vport_add()
252 int ovs_vport_set_options(struct vport *vport, struct nlattr *options) in ovs_vport_set_options() argument
254 if (!vport->ops->set_options) in ovs_vport_set_options()
256 return vport->ops->set_options(vport, options); in ovs_vport_set_options()
267 void ovs_vport_del(struct vport *vport) in ovs_vport_del() argument
269 hlist_del_rcu(&vport->hash_node); in ovs_vport_del()
270 module_put(vport->ops->owner); in ovs_vport_del()
271 vport->ops->destroy(vport); in ovs_vport_del()
284 void ovs_vport_get_stats(struct vport *vport, struct ovs_vport_stats *stats) in ovs_vport_get_stats() argument
289 dev_stats = dev_get_stats(vport->dev, &temp); in ovs_vport_get_stats()
311 int ovs_vport_get_upcall_stats(struct vport *vport, struct sk_buff *skb) in ovs_vport_get_upcall_stats() argument
323 stats = per_cpu_ptr(vport->upcall_stats, i); in ovs_vport_get_upcall_stats()
367 int ovs_vport_get_options(const struct vport *vport, struct sk_buff *skb) in ovs_vport_get_options() argument
372 if (!vport->ops->get_options) in ovs_vport_get_options()
379 err = vport->ops->get_options(vport, skb); in ovs_vport_get_options()
402 int ovs_vport_set_upcall_portids(struct vport *vport, const struct nlattr *ids) in ovs_vport_set_upcall_portids() argument
409 old = ovsl_dereference(vport->upcall_portids); in ovs_vport_set_upcall_portids()
420 rcu_assign_pointer(vport->upcall_portids, vport_portids); in ovs_vport_set_upcall_portids()
441 int ovs_vport_get_upcall_portids(const struct vport *vport, in ovs_vport_get_upcall_portids() argument
446 ids = rcu_dereference_ovsl(vport->upcall_portids); in ovs_vport_get_upcall_portids()
448 if (vport->dp->user_features & OVS_DP_F_VPORT_PIDS) in ovs_vport_get_upcall_portids()
466 u32 ovs_vport_find_upcall_portid(const struct vport *vport, in ovs_vport_find_upcall_portid() argument
473 ids = rcu_dereference(vport->upcall_portids); in ovs_vport_find_upcall_portid()
494 int ovs_vport_receive(struct vport *vport, struct sk_buff *skb, in ovs_vport_receive() argument
500 OVS_CB(skb)->input_vport = vport; in ovs_vport_receive()
504 if (unlikely(dev_net(skb->dev) != ovs_dp_get_net(vport->dp))) { in ovs_vport_receive()
540 void ovs_vport_send(struct vport *vport, struct sk_buff *skb, u8 mac_proto) in ovs_vport_send() argument
542 int mtu = vport->dev->mtu; in ovs_vport_send()
544 switch (vport->dev->type) { in ovs_vport_send()
563 if (unlikely(packet_length(skb, vport->dev) > mtu && in ovs_vport_send()
565 vport->dev->stats.tx_errors++; in ovs_vport_send()
566 if (vport->dev->flags & IFF_UP) in ovs_vport_send()
568 "%d > %d\n", vport->dev->name, in ovs_vport_send()
569 packet_length(skb, vport->dev), in ovs_vport_send()
574 skb->dev = vport->dev; in ovs_vport_send()
576 vport->ops->send(skb); in ovs_vport_send()