aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch/datapath.c
diff options
context:
space:
mode:
authorAndy Zhou <azhou@ovn.org>2017-11-10 15:09:41 -0500
committerDavid S. Miller <davem@davemloft.net>2017-11-12 20:37:07 -0500
commit9602c01e57f7b868d748c2ba2aef0efa64b71ffc (patch)
tree113c332f91bbf2002fa0f06f42b2b90bc7a6e585 /net/openvswitch/datapath.c
parent5794040647de4011598a6d005fdad95d24fd385b (diff)
openvswitch: export get_dp() API.
Later patches will invoke get_dp() outside of datapath.c. Export it. Signed-off-by: Andy Zhou <azhou@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/datapath.c')
-rw-r--r--net/openvswitch/datapath.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 4d38ac044cee..6e098035bb8f 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -142,35 +142,6 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *,
142 const struct dp_upcall_info *, 142 const struct dp_upcall_info *,
143 uint32_t cutlen); 143 uint32_t cutlen);
144 144
145/* Must be called with rcu_read_lock. */
146static struct datapath *get_dp_rcu(struct net *net, int dp_ifindex)
147{
148 struct net_device *dev = dev_get_by_index_rcu(net, dp_ifindex);
149
150 if (dev) {
151 struct vport *vport = ovs_internal_dev_get_vport(dev);
152 if (vport)
153 return vport->dp;
154 }
155
156 return NULL;
157}
158
159/* The caller must hold either ovs_mutex or rcu_read_lock to keep the
160 * returned dp pointer valid.
161 */
162static inline struct datapath *get_dp(struct net *net, int dp_ifindex)
163{
164 struct datapath *dp;
165
166 WARN_ON_ONCE(!rcu_read_lock_held() && !lockdep_ovsl_is_held());
167 rcu_read_lock();
168 dp = get_dp_rcu(net, dp_ifindex);
169 rcu_read_unlock();
170
171 return dp;
172}
173
174/* Must be called with rcu_read_lock or ovs_mutex. */ 145/* Must be called with rcu_read_lock or ovs_mutex. */
175const char *ovs_dp_name(const struct datapath *dp) 146const char *ovs_dp_name(const struct datapath *dp)
176{ 147{