From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
To: Elad Kanfi <eladkan@mellanox.com>,
Lino Sanfilippo <lsanfil@marvell.com>,
David Miller <davem@davemloft.net>
Cc: Noam Camus <noamca@mellanox.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"abrodkin@synopsys.com" <abrodkin@synopsys.com>,
Tal Zilcer <talz@mellanox.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag
Date: Tue, 10 May 2016 20:32:49 +0200 [thread overview]
Message-ID: <57322951.3040109@gmx.de> (raw)
In-Reply-To: <HE1PR0501MB20265121CBDB2D48F66D408CCD7F0@HE1PR0501MB2026.eurprd05.prod.outlook.com>
Hi Elad,
On 08.05.2016 15:44, Elad Kanfi wrote:
>
> After reviewing the code and your suggestion, it seems that we can do without the flag tx_packet_sent and therefor the first issue becomes irrelevant.
> The indication that a packet was sent is (tx_skb != NULL) , and the sequence will be:
>
> CPU A:
> 1. tx_skb = skb
> 2. wmb() /* make sure tx_skb reaches the RAM before the HW is informed and the IRQ is fired */
> 3. nps_enet_reg_set(priv, NPS_ENET_REG_TX_CTL, tx_ctrl.value); /* send frame */
>
> CPU B:
> 1. read tx_skb
> 2. if( tx_skb != NULL ) handle tx_skb
> 3. tx_skb = NULL
>
>
Ok, without the tx_packet_sent flag the code becomes simpler. But it
does not mean that we can toss the smp_rmb in the irq handler
completely. We still have to use a read barrier there to ensure that we
see the most recent value of tx_skb. E.g like this:
if (priv->tx_skb != NULL ) {
smp_rmb()
/ * handle tx_skb */
}
With both barriers in place the code should work as expected.
Regards,
Lino
next prev parent reply other threads:[~2016-05-10 18:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-27 13:18 [PATCH v2 0/2] Net driver bugs fix Elad Kanfi
2016-04-27 13:18 ` [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag Elad Kanfi
2016-04-27 13:56 ` Lino Sanfilippo
2016-04-28 21:11 ` David Miller
2016-05-02 10:21 ` Elad Kanfi
2016-05-02 11:15 ` Lino Sanfilippo
2016-05-08 13:44 ` Elad Kanfi
2016-05-10 18:32 ` Lino Sanfilippo [this message]
2016-04-27 13:18 ` [PATCH v2 2/2] net: nps_enet: bug fix - handle lost tx interrupts Elad Kanfi
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=57322951.3040109@gmx.de \
--to=linosanfilippo@gmx.de \
--cc=abrodkin@synopsys.com \
--cc=davem@davemloft.net \
--cc=eladkan@mellanox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lsanfil@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=noamca@mellanox.com \
--cc=talz@mellanox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.