Commit c9db965c authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

openvswitch: Abstract vport name through ovs_vport_name()

This allows to get rid of the get_name() vport ops later on.
Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent be4ace6e
...@@ -176,7 +176,7 @@ static inline struct datapath *get_dp(struct net *net, int dp_ifindex) ...@@ -176,7 +176,7 @@ static inline struct datapath *get_dp(struct net *net, int dp_ifindex)
const char *ovs_dp_name(const struct datapath *dp) const char *ovs_dp_name(const struct datapath *dp)
{ {
struct vport *vport = ovs_vport_ovsl_rcu(dp, OVSP_LOCAL); struct vport *vport = ovs_vport_ovsl_rcu(dp, OVSP_LOCAL);
return vport->ops->get_name(vport); return ovs_vport_name(vport);
} }
static int get_dpifindex(const struct datapath *dp) static int get_dpifindex(const struct datapath *dp)
...@@ -1800,7 +1800,7 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, ...@@ -1800,7 +1800,7 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb,
if (nla_put_u32(skb, OVS_VPORT_ATTR_PORT_NO, vport->port_no) || if (nla_put_u32(skb, OVS_VPORT_ATTR_PORT_NO, vport->port_no) ||
nla_put_u32(skb, OVS_VPORT_ATTR_TYPE, vport->ops->type) || nla_put_u32(skb, OVS_VPORT_ATTR_TYPE, vport->ops->type) ||
nla_put_string(skb, OVS_VPORT_ATTR_NAME, nla_put_string(skb, OVS_VPORT_ATTR_NAME,
vport->ops->get_name(vport))) ovs_vport_name(vport)))
goto nla_put_failure; goto nla_put_failure;
ovs_vport_get_stats(vport, &vport_stats); ovs_vport_get_stats(vport, &vport_stats);
......
...@@ -242,7 +242,6 @@ static struct vport_ops ovs_internal_vport_ops = { ...@@ -242,7 +242,6 @@ static struct vport_ops ovs_internal_vport_ops = {
.type = OVS_VPORT_TYPE_INTERNAL, .type = OVS_VPORT_TYPE_INTERNAL,
.create = internal_dev_create, .create = internal_dev_create,
.destroy = internal_dev_destroy, .destroy = internal_dev_destroy,
.get_name = ovs_netdev_get_name,
.send = internal_dev_recv, .send = internal_dev_recv,
}; };
......
...@@ -171,11 +171,6 @@ static void netdev_destroy(struct vport *vport) ...@@ -171,11 +171,6 @@ static void netdev_destroy(struct vport *vport)
call_rcu(&vport->rcu, free_port_rcu); call_rcu(&vport->rcu, free_port_rcu);
} }
const char *ovs_netdev_get_name(const struct vport *vport)
{
return vport->dev->name;
}
static unsigned int packet_length(const struct sk_buff *skb) static unsigned int packet_length(const struct sk_buff *skb)
{ {
unsigned int length = skb->len - ETH_HLEN; unsigned int length = skb->len - ETH_HLEN;
...@@ -223,7 +218,6 @@ static struct vport_ops ovs_netdev_vport_ops = { ...@@ -223,7 +218,6 @@ static struct vport_ops ovs_netdev_vport_ops = {
.type = OVS_VPORT_TYPE_NETDEV, .type = OVS_VPORT_TYPE_NETDEV,
.create = netdev_create, .create = netdev_create,
.destroy = netdev_destroy, .destroy = netdev_destroy,
.get_name = ovs_netdev_get_name,
.send = netdev_send, .send = netdev_send,
}; };
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
struct vport *ovs_netdev_get_vport(struct net_device *dev); struct vport *ovs_netdev_get_vport(struct net_device *dev);
const char *ovs_netdev_get_name(const struct vport *);
void ovs_netdev_detach_dev(struct vport *); void ovs_netdev_detach_dev(struct vport *);
int __init ovs_netdev_init(void); int __init ovs_netdev_init(void);
......
...@@ -113,7 +113,7 @@ struct vport *ovs_vport_locate(const struct net *net, const char *name) ...@@ -113,7 +113,7 @@ struct vport *ovs_vport_locate(const struct net *net, const char *name)
struct vport *vport; struct vport *vport;
hlist_for_each_entry_rcu(vport, bucket, hash_node) hlist_for_each_entry_rcu(vport, bucket, hash_node)
if (!strcmp(name, vport->ops->get_name(vport)) && if (!strcmp(name, ovs_vport_name(vport)) &&
net_eq(ovs_dp_get_net(vport->dp), net)) net_eq(ovs_dp_get_net(vport->dp), net))
return vport; return vport;
...@@ -226,7 +226,7 @@ struct vport *ovs_vport_add(const struct vport_parms *parms) ...@@ -226,7 +226,7 @@ struct vport *ovs_vport_add(const struct vport_parms *parms)
} }
bucket = hash_bucket(ovs_dp_get_net(vport->dp), bucket = hash_bucket(ovs_dp_get_net(vport->dp),
vport->ops->get_name(vport)); ovs_vport_name(vport));
hlist_add_head_rcu(&vport->hash_node, bucket); hlist_add_head_rcu(&vport->hash_node, bucket);
return vport; return vport;
} }
......
...@@ -237,6 +237,11 @@ static inline void ovs_skb_postpush_rcsum(struct sk_buff *skb, ...@@ -237,6 +237,11 @@ static inline void ovs_skb_postpush_rcsum(struct sk_buff *skb,
skb->csum = csum_add(skb->csum, csum_partial(start, len, 0)); skb->csum = csum_add(skb->csum, csum_partial(start, len, 0));
} }
static inline const char *ovs_vport_name(struct vport *vport)
{
return vport->dev ? vport->dev->name : vport->ops->get_name(vport);
}
int ovs_vport_ops_register(struct vport_ops *ops); int ovs_vport_ops_register(struct vport_ops *ops);
void ovs_vport_ops_unregister(struct vport_ops *ops); void ovs_vport_ops_unregister(struct vport_ops *ops);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment