linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: Lino Sanfilippo <LinoSanfilippo@gmx.de>,
	bh74.an@samsung.com, ks.giri@samsung.com,
	vipul.pandya@samsung.com, peppe.cavallaro@st.com,
	alexandre.torgue@st.com, davem@davemloft.net,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] net: ethernet: sxgbe: remove private tx queue lock
Date: Mon, 19 Dec 2016 11:02:15 +0100	[thread overview]
Message-ID: <20161219100215.GA6296@amd> (raw)
In-Reply-To: <20161218001507.GA5343@electric-eye.fr.zoreil.com>

[-- Attachment #1: Type: text/plain, Size: 2119 bytes --]

Hi!

> Lino, have you considered via-rhine.c since its "move work from irq to
> workqueue context" changes that started in
> 7ab87ff4c770eed71e3777936299292739fcd0fe [*] ?
> 
> It's a shameless plug - originated in r8169.c - but it should be rather
> close to what the sxgbe and friends require. Thought / opinion ?
> 
> [*] Including fixes/changes in:
> - 3a5a883a8a663b930908cae4abe5ec913b9b2fd2
> - e1efa87241272104d6a12c8b9fcdc4f62634d447
> - 810f19bcb862f8889b27e0c9d9eceac9593925dd
> - e45af497950a89459a0c4b13ffd91e1729fffef4
> - a926592f5e4e900f3fa903298c4619a131e60963
> - 559bcac35facfed49ab4f408e162971612dcfdf3

Considering the memory barriers... is something like this neccessary
in the via-rhine?

AFAICT... we need a barrier after making sure that descriptor is no
longer owned by DMA (to make sure we don't get stale data in rest of
descriptor)... and we need a barrier before giving the descriptor to
the dma, to make sure DMA engine sees the complete update....?

Thanks,
								Pavel

diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index ba5c542..3806e72 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -1952,6 +1952,7 @@ static void rhine_tx(struct net_device *dev)
 			  entry, txstatus);
 		if (txstatus & DescOwn)
 			break;
+		dma_rmb();
 		skb = rp->tx_skbuff[entry];
 		if (txstatus & 0x8000) {
 			netif_dbg(rp, tx_done, dev,
@@ -2061,6 +2062,7 @@ static int rhine_rx(struct net_device *dev, int limit)
 
 		if (desc_status & DescOwn)
 			break;
+		dma_rmb();
 
 		netif_dbg(rp, rx_status, dev, "%s() status %08x\n", __func__,
 			  desc_status);
@@ -2146,6 +2148,7 @@ static int rhine_rx(struct net_device *dev, int limit)
 			u64_stats_update_end(&rp->rx_stats.syncp);
 		}
 give_descriptor_to_nic:
+		dma_wmb();
 		desc->rx_status = cpu_to_le32(DescOwn);
 		entry = (++rp->cur_rx) % RX_RING_SIZE;
 	}

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  parent reply	other threads:[~2016-12-19 10:02 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07 20:05 Remove private locks to avoid possible deadlock Lino Sanfilippo
2016-12-07 20:05 ` [PATCH 1/2] net: ethernet: sxgbe: remove private tx queue lock Lino Sanfilippo
2016-12-07 23:15   ` Francois Romieu
2016-12-08 20:32     ` Lino Sanfilippo
2016-12-08 21:54       ` Pavel Machek
2016-12-08 22:12         ` Lino Sanfilippo
2016-12-08 22:18           ` Pavel Machek
2016-12-08 22:45             ` Lino Sanfilippo
2016-12-08 23:19       ` Francois Romieu
2016-12-09 11:21         ` Pavel Machek
2016-12-10  2:25           ` Lino Sanfilippo
2016-12-11 20:11             ` Pavel Machek
2016-12-15 19:27               ` Lino Sanfilippo
2016-12-15 21:03                 ` Pavel Machek
2016-12-15 21:32                   ` Lino Sanfilippo
2016-12-15 22:33                     ` Lino Sanfilippo
2016-12-17 17:31                       ` Pavel Machek
2016-12-18  0:15                         ` Francois Romieu
2016-12-18 16:15                           ` Lino Sanfilippo
2016-12-18 17:23                             ` Pavel Machek
2016-12-18 18:30                             ` Pavel Machek
2016-12-19 22:49                               ` Lino Sanfilippo
2016-12-18 20:16                             ` Pavel Machek
2016-12-19 10:02                           ` Pavel Machek [this message]
2016-12-20  0:05                             ` Francois Romieu
2016-12-07 20:05 ` [PATCH 2/2] net: ethernet: stmmac: " Lino Sanfilippo
2016-12-07 20:55   ` Pavel Machek
2016-12-07 20:59   ` Pavel Machek
2016-12-07 21:37   ` Pavel Machek
2016-12-07 21:43     ` Lino Sanfilippo
2016-12-07 22:34       ` Lino Sanfilippo
2016-12-07 23:21         ` Pavel Machek
2016-12-07 23:41     ` David Miller
2016-12-08 14:08       ` Pavel Machek
2016-12-08 15:26         ` David Miller
2016-12-08 15:46           ` Pavel Machek

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=20161219100215.GA6296@amd \
    --to=pavel@ucw.cz \
    --cc=LinoSanfilippo@gmx.de \
    --cc=alexandre.torgue@st.com \
    --cc=bh74.an@samsung.com \
    --cc=davem@davemloft.net \
    --cc=ks.giri@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=romieu@fr.zoreil.com \
    --cc=vipul.pandya@samsung.com \
    /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).