netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] dp83640: don't hold spinlock while calling netif_rx_ni
@ 2017-08-30  6:58 Stefan Sørensen
  2017-08-30 21:50 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Sørensen @ 2017-08-30  6:58 UTC (permalink / raw)
  To: richardcochran, netdev, davem; +Cc: Stefan Sørensen

We should not hold a spinlock while pushing the skb into the networking
stack, so move the call to netif_rx_ni out of the critical region to where
we have dropped the spinlock.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
---
 drivers/net/phy/dp83640.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index c3065236ffcc..cbd629822f04 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -874,7 +874,6 @@ static void decode_rxts(struct dp83640_private *dp83640,
 			shhwtstamps = skb_hwtstamps(skb);
 			memset(shhwtstamps, 0, sizeof(*shhwtstamps));
 			shhwtstamps->hwtstamp = ns_to_ktime(rxts->ns);
-			netif_rx_ni(skb);
 			list_add(&rxts->list, &dp83640->rxpool);
 			break;
 		}
@@ -885,6 +884,9 @@ static void decode_rxts(struct dp83640_private *dp83640,
 		list_add_tail(&rxts->list, &dp83640->rxts);
 out:
 	spin_unlock_irqrestore(&dp83640->rx_lock, flags);
+
+	if (shhwtstamps)
+		netif_rx_ni(skb);
 }
 
 static void decode_txts(struct dp83640_private *dp83640,
@@ -1425,7 +1427,6 @@ static bool dp83640_rxtstamp(struct phy_device *phydev,
 			shhwtstamps = skb_hwtstamps(skb);
 			memset(shhwtstamps, 0, sizeof(*shhwtstamps));
 			shhwtstamps->hwtstamp = ns_to_ktime(rxts->ns);
-			netif_rx_ni(skb);
 			list_del_init(&rxts->list);
 			list_add(&rxts->list, &dp83640->rxpool);
 			break;
@@ -1438,6 +1439,8 @@ static bool dp83640_rxtstamp(struct phy_device *phydev,
 		skb_info->tmo = jiffies + SKB_TIMESTAMP_TIMEOUT;
 		skb_queue_tail(&dp83640->rx_queue, skb);
 		schedule_delayed_work(&dp83640->ts_work, SKB_TIMESTAMP_TIMEOUT);
+	} else {
+		netif_rx_ni(skb);
 	}
 
 	return true;
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] dp83640: don't hold spinlock while calling netif_rx_ni
  2017-08-30  6:58 [PATCH net-next] dp83640: don't hold spinlock while calling netif_rx_ni Stefan Sørensen
@ 2017-08-30 21:50 ` David Miller
  2017-08-31  7:25   ` Richard Cochran
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2017-08-30 21:50 UTC (permalink / raw)
  To: stefan.sorensen; +Cc: richardcochran, netdev

From: Stefan Sørensen <stefan.sorensen@spectralink.com>
Date: Wed, 30 Aug 2017 08:58:47 +0200

> We should not hold a spinlock while pushing the skb into the networking
> stack, so move the call to netif_rx_ni out of the critical region to where
> we have dropped the spinlock.
> 
> Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>

Looks good, applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] dp83640: don't hold spinlock while calling netif_rx_ni
  2017-08-30 21:50 ` David Miller
@ 2017-08-31  7:25   ` Richard Cochran
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Cochran @ 2017-08-31  7:25 UTC (permalink / raw)
  To: David Miller; +Cc: stefan.sorensen, netdev

On Wed, Aug 30, 2017 at 02:50:31PM -0700, David Miller wrote:
> From: Stefan Sørensen <stefan.sorensen@spectralink.com>
> Date: Wed, 30 Aug 2017 08:58:47 +0200
> 
> > We should not hold a spinlock while pushing the skb into the networking
> > stack, so move the call to netif_rx_ni out of the critical region to where
> > we have dropped the spinlock.
> > 
> > Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
> 
> Looks good, applied, thanks.

And thanks, Stefan, for following up on this.  For the record, we
discussed this fix back in April.

    https://patchwork.ozlabs.org/patch/752201/

Cheers,
Richard

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-31  7:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-30  6:58 [PATCH net-next] dp83640: don't hold spinlock while calling netif_rx_ni Stefan Sørensen
2017-08-30 21:50 ` David Miller
2017-08-31  7:25   ` Richard Cochran

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).