Commit ac4e4af1 authored by Vlad Yasevich's avatar Vlad Yasevich Committed by David S. Miller

macvtap: Consistently use rcu functions

Currently macvtap uses rcu_bh functions in its
user facing fuction macvtap_get_user() and macvtap_put_user().
However, its packet handlers use normal rcu as the rcu_read_lock()
is taken in netif_receive_skb().  We can safely discontinue
the usage or rcu with bh disabled.
Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 441ac0fc
...@@ -754,8 +754,8 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, ...@@ -754,8 +754,8 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
skb_probe_transport_header(skb, ETH_HLEN); skb_probe_transport_header(skb, ETH_HLEN);
rcu_read_lock_bh(); rcu_read_lock();
vlan = rcu_dereference_bh(q->vlan); vlan = rcu_dereference(q->vlan);
/* copy skb_ubuf_info for callback when skb has no error */ /* copy skb_ubuf_info for callback when skb has no error */
if (zerocopy) { if (zerocopy) {
skb_shinfo(skb)->destructor_arg = m->msg_control; skb_shinfo(skb)->destructor_arg = m->msg_control;
...@@ -766,7 +766,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, ...@@ -766,7 +766,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
macvlan_start_xmit(skb, vlan->dev); macvlan_start_xmit(skb, vlan->dev);
else else
kfree_skb(skb); kfree_skb(skb);
rcu_read_unlock_bh(); rcu_read_unlock();
return total_len; return total_len;
...@@ -774,11 +774,11 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, ...@@ -774,11 +774,11 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
kfree_skb(skb); kfree_skb(skb);
err: err:
rcu_read_lock_bh(); rcu_read_lock();
vlan = rcu_dereference_bh(q->vlan); vlan = rcu_dereference(q->vlan);
if (vlan) if (vlan)
vlan->dev->stats.tx_dropped++; vlan->dev->stats.tx_dropped++;
rcu_read_unlock_bh(); rcu_read_unlock();
return err; return err;
} }
...@@ -854,11 +854,11 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, ...@@ -854,11 +854,11 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
copied += len; copied += len;
done: done:
rcu_read_lock_bh(); rcu_read_lock();
vlan = rcu_dereference_bh(q->vlan); vlan = rcu_dereference(q->vlan);
if (vlan) if (vlan)
macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0); macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0);
rcu_read_unlock_bh(); rcu_read_unlock();
return ret ? ret : copied; return ret ? ret : copied;
} }
......
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