diff options
author | Thomas Graf <tgraf@suug.ch> | 2015-07-21 04:44:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-07-21 13:39:07 -0400 |
commit | c9db965c524ea27451e60d5ddcd242f6c33a70fd (patch) | |
tree | c882141fdf3669ef625560b9faf31408b145d298 | |
parent | be4ace6e6b1bc12e18b25fe764917e09a1f96d7b (diff) |
openvswitch: Abstract vport name through ovs_vport_name()
This allows to get rid of the get_name() vport ops later on.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/openvswitch/datapath.c | 4 | ||||
-rw-r--r-- | net/openvswitch/vport-internal_dev.c | 1 | ||||
-rw-r--r-- | net/openvswitch/vport-netdev.c | 6 | ||||
-rw-r--r-- | net/openvswitch/vport-netdev.h | 1 | ||||
-rw-r--r-- | net/openvswitch/vport.c | 4 | ||||
-rw-r--r-- | net/openvswitch/vport.h | 5 |
6 files changed, 9 insertions, 12 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 19df28ee5094..ffe984f5b95c 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -176,7 +176,7 @@ static inline struct datapath *get_dp(struct net *net, int dp_ifindex) | |||
176 | const char *ovs_dp_name(const struct datapath *dp) | 176 | const char *ovs_dp_name(const struct datapath *dp) |
177 | { | 177 | { |
178 | struct vport *vport = ovs_vport_ovsl_rcu(dp, OVSP_LOCAL); | 178 | struct vport *vport = ovs_vport_ovsl_rcu(dp, OVSP_LOCAL); |
179 | return vport->ops->get_name(vport); | 179 | return ovs_vport_name(vport); |
180 | } | 180 | } |
181 | 181 | ||
182 | static int get_dpifindex(const struct datapath *dp) | 182 | 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 | if (nla_put_u32(skb, OVS_VPORT_ATTR_PORT_NO, vport->port_no) || | 1800 | if (nla_put_u32(skb, OVS_VPORT_ATTR_PORT_NO, vport->port_no) || |
1801 | nla_put_u32(skb, OVS_VPORT_ATTR_TYPE, vport->ops->type) || | 1801 | nla_put_u32(skb, OVS_VPORT_ATTR_TYPE, vport->ops->type) || |
1802 | nla_put_string(skb, OVS_VPORT_ATTR_NAME, | 1802 | nla_put_string(skb, OVS_VPORT_ATTR_NAME, |
1803 | vport->ops->get_name(vport))) | 1803 | ovs_vport_name(vport))) |
1804 | goto nla_put_failure; | 1804 | goto nla_put_failure; |
1805 | 1805 | ||
1806 | ovs_vport_get_stats(vport, &vport_stats); | 1806 | ovs_vport_get_stats(vport, &vport_stats); |
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c index a2c205d9a8d5..c058bbf876c3 100644 --- a/net/openvswitch/vport-internal_dev.c +++ b/net/openvswitch/vport-internal_dev.c | |||
@@ -242,7 +242,6 @@ static struct vport_ops ovs_internal_vport_ops = { | |||
242 | .type = OVS_VPORT_TYPE_INTERNAL, | 242 | .type = OVS_VPORT_TYPE_INTERNAL, |
243 | .create = internal_dev_create, | 243 | .create = internal_dev_create, |
244 | .destroy = internal_dev_destroy, | 244 | .destroy = internal_dev_destroy, |
245 | .get_name = ovs_netdev_get_name, | ||
246 | .send = internal_dev_recv, | 245 | .send = internal_dev_recv, |
247 | }; | 246 | }; |
248 | 247 | ||
diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c index 1c9696693f66..e682bdc34a5c 100644 --- a/net/openvswitch/vport-netdev.c +++ b/net/openvswitch/vport-netdev.c | |||
@@ -171,11 +171,6 @@ static void netdev_destroy(struct vport *vport) | |||
171 | call_rcu(&vport->rcu, free_port_rcu); | 171 | call_rcu(&vport->rcu, free_port_rcu); |
172 | } | 172 | } |
173 | 173 | ||
174 | const char *ovs_netdev_get_name(const struct vport *vport) | ||
175 | { | ||
176 | return vport->dev->name; | ||
177 | } | ||
178 | |||
179 | static unsigned int packet_length(const struct sk_buff *skb) | 174 | static unsigned int packet_length(const struct sk_buff *skb) |
180 | { | 175 | { |
181 | unsigned int length = skb->len - ETH_HLEN; | 176 | unsigned int length = skb->len - ETH_HLEN; |
@@ -223,7 +218,6 @@ static struct vport_ops ovs_netdev_vport_ops = { | |||
223 | .type = OVS_VPORT_TYPE_NETDEV, | 218 | .type = OVS_VPORT_TYPE_NETDEV, |
224 | .create = netdev_create, | 219 | .create = netdev_create, |
225 | .destroy = netdev_destroy, | 220 | .destroy = netdev_destroy, |
226 | .get_name = ovs_netdev_get_name, | ||
227 | .send = netdev_send, | 221 | .send = netdev_send, |
228 | }; | 222 | }; |
229 | 223 | ||
diff --git a/net/openvswitch/vport-netdev.h b/net/openvswitch/vport-netdev.h index 1c52aed255c5..684fb88723a4 100644 --- a/net/openvswitch/vport-netdev.h +++ b/net/openvswitch/vport-netdev.h | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | struct vport *ovs_netdev_get_vport(struct net_device *dev); | 27 | struct vport *ovs_netdev_get_vport(struct net_device *dev); |
28 | 28 | ||
29 | const char *ovs_netdev_get_name(const struct vport *); | ||
30 | void ovs_netdev_detach_dev(struct vport *); | 29 | void ovs_netdev_detach_dev(struct vport *); |
31 | 30 | ||
32 | int __init ovs_netdev_init(void); | 31 | int __init ovs_netdev_init(void); |
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index af23ba077836..d14f59403c5e 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c | |||
@@ -113,7 +113,7 @@ struct vport *ovs_vport_locate(const struct net *net, const char *name) | |||
113 | struct vport *vport; | 113 | struct vport *vport; |
114 | 114 | ||
115 | hlist_for_each_entry_rcu(vport, bucket, hash_node) | 115 | hlist_for_each_entry_rcu(vport, bucket, hash_node) |
116 | if (!strcmp(name, vport->ops->get_name(vport)) && | 116 | if (!strcmp(name, ovs_vport_name(vport)) && |
117 | net_eq(ovs_dp_get_net(vport->dp), net)) | 117 | net_eq(ovs_dp_get_net(vport->dp), net)) |
118 | return vport; | 118 | return vport; |
119 | 119 | ||
@@ -226,7 +226,7 @@ struct vport *ovs_vport_add(const struct vport_parms *parms) | |||
226 | } | 226 | } |
227 | 227 | ||
228 | bucket = hash_bucket(ovs_dp_get_net(vport->dp), | 228 | bucket = hash_bucket(ovs_dp_get_net(vport->dp), |
229 | vport->ops->get_name(vport)); | 229 | ovs_vport_name(vport)); |
230 | hlist_add_head_rcu(&vport->hash_node, bucket); | 230 | hlist_add_head_rcu(&vport->hash_node, bucket); |
231 | return vport; | 231 | return vport; |
232 | } | 232 | } |
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h index e05ec68439d1..1a689c28b5a6 100644 --- a/net/openvswitch/vport.h +++ b/net/openvswitch/vport.h | |||
@@ -237,6 +237,11 @@ static inline void ovs_skb_postpush_rcsum(struct sk_buff *skb, | |||
237 | skb->csum = csum_add(skb->csum, csum_partial(start, len, 0)); | 237 | skb->csum = csum_add(skb->csum, csum_partial(start, len, 0)); |
238 | } | 238 | } |
239 | 239 | ||
240 | static inline const char *ovs_vport_name(struct vport *vport) | ||
241 | { | ||
242 | return vport->dev ? vport->dev->name : vport->ops->get_name(vport); | ||
243 | } | ||
244 | |||
240 | int ovs_vport_ops_register(struct vport_ops *ops); | 245 | int ovs_vport_ops_register(struct vport_ops *ops); |
241 | void ovs_vport_ops_unregister(struct vport_ops *ops); | 246 | void ovs_vport_ops_unregister(struct vport_ops *ops); |
242 | 247 | ||