All of lore.kernel.org
 help / color / mirror / Atom feed
From: troy.kisky@boundarydevices.com (Troy Kisky)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next V2 7/8] net: fec: don't transfer ownership until descriptor write is complete
Date: Wed, 24 Feb 2016 13:38:32 -0700	[thread overview]
Message-ID: <56CE14C8.70708@boundarydevices.com> (raw)
In-Reply-To: <20160205170347.45a91314@jclayton-pc>

On 2/5/2016 6:03 PM, Joshua Clayton wrote:
> On Fri,  5 Feb 2016 14:52:49 -0700
> Troy Kisky <troy.kisky@boundarydevices.com> wrote:
> 
>> If you don't own it, you shouldn't write to it.
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>> ---
>>  drivers/net/ethernet/freescale/fec_main.c | 14 +++++++++++++-
>>  1 file changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/fec_main.c
>> b/drivers/net/ethernet/freescale/fec_main.c index ca2708d..97ca72a
>> 100644 --- a/drivers/net/ethernet/freescale/fec_main.c
>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>> @@ -390,6 +390,10 @@ fec_enet_txq_submit_frag_skb(struct
>> fec_enet_priv_tx_q *txq, 
>>  		bdp->cbd_bufaddr = cpu_to_fec32(addr);
>>  		bdp->cbd_datlen = cpu_to_fec16(frag_len);
>> +		/* Make sure the updates to rest of the descriptor
>> are
>> +		 * performed before transferring ownership.
>> +		 */
>> +		wmb();
>>  		bdp->cbd_sc = cpu_to_fec16(status);
> You use almost exactly the same code in each place.
> I'd prefer to have wmb(); bdp->cbd_sc = cpu_to_fec16(status) wrapped in
> a function or function like macro, and put the comment in one place.
> 

Thanks for the review. I added a patch to the end of the series to create a common
"trigger_tx" subroutine which should address this.

WARNING: multiple messages have this Message-ID (diff)
From: Troy Kisky <troy.kisky@boundarydevices.com>
To: Joshua Clayton <stillcompiling@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	B38611@freescale.com, fabio.estevam@freescale.com,
	andrew@lunn.ch, linux@arm.linux.org.uk, arnd@arndb.de,
	laci@boundarydevices.com, johannes@sipsolutions.net,
	l.stach@pengutronix.de, shawnguo@kernel.org,
	linux-arm-kernel@lists.infradead.org, tremyfr@gmail.com
Subject: Re: [PATCH net-next V2 7/8] net: fec: don't transfer ownership until descriptor write is complete
Date: Wed, 24 Feb 2016 13:38:32 -0700	[thread overview]
Message-ID: <56CE14C8.70708@boundarydevices.com> (raw)
In-Reply-To: <20160205170347.45a91314@jclayton-pc>

On 2/5/2016 6:03 PM, Joshua Clayton wrote:
> On Fri,  5 Feb 2016 14:52:49 -0700
> Troy Kisky <troy.kisky@boundarydevices.com> wrote:
> 
>> If you don't own it, you shouldn't write to it.
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>> ---
>>  drivers/net/ethernet/freescale/fec_main.c | 14 +++++++++++++-
>>  1 file changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/fec_main.c
>> b/drivers/net/ethernet/freescale/fec_main.c index ca2708d..97ca72a
>> 100644 --- a/drivers/net/ethernet/freescale/fec_main.c
>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>> @@ -390,6 +390,10 @@ fec_enet_txq_submit_frag_skb(struct
>> fec_enet_priv_tx_q *txq, 
>>  		bdp->cbd_bufaddr = cpu_to_fec32(addr);
>>  		bdp->cbd_datlen = cpu_to_fec16(frag_len);
>> +		/* Make sure the updates to rest of the descriptor
>> are
>> +		 * performed before transferring ownership.
>> +		 */
>> +		wmb();
>>  		bdp->cbd_sc = cpu_to_fec16(status);
> You use almost exactly the same code in each place.
> I'd prefer to have wmb(); bdp->cbd_sc = cpu_to_fec16(status) wrapped in
> a function or function like macro, and put the comment in one place.
> 

Thanks for the review. I added a patch to the end of the series to create a common
"trigger_tx" subroutine which should address this.

  reply	other threads:[~2016-02-24 20:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05 21:52 [PATCH net-next V2 0/8] net: fec: cleanup/fixes Troy Kisky
2016-02-05 21:52 ` Troy Kisky
2016-02-05 21:52 ` [PATCH net-next V2 1/8] net: fec: stop the "rcv is not +last, " error messages Troy Kisky
2016-02-05 21:52   ` Troy Kisky
2016-02-05 21:52 ` [PATCH net-next V2 2/8] net: fec: fix rx error counts Troy Kisky
2016-02-05 21:52   ` Troy Kisky
2016-02-05 21:52 ` [PATCH net-next V2 3/8] net: fec: fix fec_enet_get_free_txdesc_num Troy Kisky
2016-02-05 21:52   ` Troy Kisky
2016-02-05 21:52 ` [PATCH net-next V2 4/8] net: fec: add struct bufdesc_prop Troy Kisky
2016-02-05 21:52   ` Troy Kisky
2016-02-05 21:52 ` [PATCH net-next V2 5/8] net: fec: add variable reg_desc_active to speed things up Troy Kisky
2016-02-05 21:52   ` Troy Kisky
2016-02-05 21:52 ` [PATCH net-next V2 6/8] net: fec: don't disable FEC_ENET_TS_TIMER interrupt Troy Kisky
2016-02-05 21:52   ` Troy Kisky
2016-02-05 21:52 ` [PATCH net-next V2 7/8] net: fec: don't transfer ownership until descriptor write is complete Troy Kisky
2016-02-05 21:52   ` Troy Kisky
2016-02-06  1:03   ` Joshua Clayton
2016-02-06  1:03     ` Joshua Clayton
2016-02-24 20:38     ` Troy Kisky [this message]
2016-02-24 20:38       ` Troy Kisky
2016-02-06 11:52   ` Sergei Shtylyov
2016-02-06 11:52     ` Sergei Shtylyov
2016-02-24 20:39     ` Troy Kisky
2016-02-24 20:39       ` Troy Kisky
2016-02-05 21:52 ` [PATCH net-next V2 8/8] net: fec: improve error handling Troy Kisky
2016-02-05 21:52   ` Troy Kisky
2016-02-11 11:15 ` [PATCH net-next V2 0/8] net: fec: cleanup/fixes David Miller
2016-02-11 11:15   ` David Miller

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=56CE14C8.70708@boundarydevices.com \
    --to=troy.kisky@boundarydevices.com \
    --cc=linux-arm-kernel@lists.infradead.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 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.