netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shannon Nelson <shannon.nelson@oracle.com>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shannon Nelson <shannon.nelson@oracle.com>
Subject: [PATCH v2 net-next 7/9] sunvnet: remove extra rcu_read_unlocks
Date: Tue,  7 Feb 2017 14:13:00 -0800	[thread overview]
Message-ID: <1486505582-76823-8-git-send-email-shannon.nelson@oracle.com> (raw)
In-Reply-To: <1486505582-76823-1-git-send-email-shannon.nelson@oracle.com>

The RCU read lock is grabbed first thing in sunvnet_start_xmit_common()
so it always needs to be released.  This removes the conditional release
in the dropped packet error path and removes a couple of superfluous
calls in the middle of the code.

Reported-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
---
 drivers/net/ethernet/sun/sunvnet_common.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/sun/sunvnet_common.c b/drivers/net/ethernet/sun/sunvnet_common.c
index d2aed2c..9384db0 100644
--- a/drivers/net/ethernet/sun/sunvnet_common.c
+++ b/drivers/net/ethernet/sun/sunvnet_common.c
@@ -1279,10 +1279,8 @@ int sunvnet_start_xmit_common(struct sk_buff *skb, struct net_device *dev,
 
 	rcu_read_lock();
 	port = vnet_tx_port(skb, dev);
-	if (unlikely(!port)) {
-		rcu_read_unlock();
+	if (unlikely(!port))
 		goto out_dropped;
-	}
 
 	if (skb_is_gso(skb) && skb->len > port->tsolen) {
 		err = vnet_handle_offloads(port, skb, vnet_tx_port);
@@ -1307,7 +1305,6 @@ int sunvnet_start_xmit_common(struct sk_buff *skb, struct net_device *dev,
 			fl4.saddr = ip_hdr(skb)->saddr;
 
 			rt = ip_route_output_key(dev_net(dev), &fl4);
-			rcu_read_unlock();
 			if (!IS_ERR(rt)) {
 				skb_dst_set(skb, &rt->dst);
 				icmp_send(skb, ICMP_DEST_UNREACH,
@@ -1467,8 +1464,7 @@ int sunvnet_start_xmit_common(struct sk_buff *skb, struct net_device *dev,
 				jiffies + VNET_CLEAN_TIMEOUT);
 	else if (port)
 		del_timer(&port->clean_timer);
-	if (port)
-		rcu_read_unlock();
+	rcu_read_unlock();
 	if (skb)
 		dev_kfree_skb(skb);
 	vnet_free_skbs(freeskbs);
-- 
1.7.1


  parent reply	other threads:[~2017-02-07 22:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 22:12 [PATCH v2 net-next 0/9] sunvnet driver updates Shannon Nelson
2017-02-07 22:12 ` [PATCH v2 net-next 1/9] sunvnet: make sunvnet common code dynamically loadable Shannon Nelson
2017-02-08 19:29   ` David Miller
2017-02-08 21:50     ` Shannon Nelson
2017-02-07 22:12 ` [PATCH v2 net-next 2/9] sunvnet: remove unused variable in maybe_tx_wakeup Shannon Nelson
2017-02-07 22:12 ` [PATCH v2 net-next 3/9] sunvnet: update version and version printing Shannon Nelson
2017-02-07 22:12 ` [PATCH v2 net-next 4/9] sunvnet: add driver stats for ethtool support Shannon Nelson
2017-02-07 22:12 ` [PATCH v2 net-next 5/9] sunvnet: add memory barrier before check for tx enable Shannon Nelson
2017-02-07 22:12 ` [PATCH v2 net-next 6/9] sunvnet: straighten up message event handling logic Shannon Nelson
2017-02-08 15:59   ` Sowmini Varadhan
2017-02-08 16:28     ` Shannon Nelson
2017-02-08 16:34       ` Sowmini Varadhan
2017-02-07 22:13 ` Shannon Nelson [this message]
2017-02-07 22:13 ` [PATCH v2 net-next 8/9] ldmvsw: update and simplify version string Shannon Nelson
2017-02-07 22:13 ` [PATCH v2 net-next 9/9] ldmvsw: disable tso and gso for bridge operations Shannon Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1486505582-76823-8-git-send-email-shannon.nelson@oracle.com \
    --to=shannon.nelson@oracle.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).