netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3] ibmvnic: Ensure that CRQ entry read are correctly ordered
@ 2021-01-28  1:34 Lijun Pan
  2021-01-28  3:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Lijun Pan @ 2021-01-28  1:34 UTC (permalink / raw)
  To: netdev; +Cc: Lijun Pan

Ensure that received Command-Response Queue (CRQ) entries are
properly read in order by the driver. dma_rmb barrier has
been added before accessing the CRQ descriptor to ensure
the entire descriptor is read before processing.

Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
---
v3: reword the comments in the code to make it less confusing.
v2: drop dma_wmb according to Jakub's opinion

 drivers/net/ethernet/ibm/ibmvnic.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 9778c83150f1..8820c98ea891 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -5084,6 +5084,12 @@ static void ibmvnic_tasklet(struct tasklet_struct *t)
 	while (!done) {
 		/* Pull all the valid messages off the CRQ */
 		while ((crq = ibmvnic_next_crq(adapter)) != NULL) {
+			/* This barrier makes sure ibmvnic_next_crq()'s
+			 * crq->generic.first & IBMVNIC_CRQ_CMD_RSP is loaded
+			 * before ibmvnic_handle_crq()'s
+			 * switch(gen_crq->first) and switch(gen_crq->cmd).
+			 */
+			dma_rmb();
 			ibmvnic_handle_crq(crq, adapter);
 			crq->generic.first = 0;
 		}
-- 
2.23.0


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

* Re: [PATCH net v3] ibmvnic: Ensure that CRQ entry read are correctly ordered
  2021-01-28  1:34 [PATCH net v3] ibmvnic: Ensure that CRQ entry read are correctly ordered Lijun Pan
@ 2021-01-28  3:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-28  3:20 UTC (permalink / raw)
  To: Lijun Pan; +Cc: netdev

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Wed, 27 Jan 2021 19:34:42 -0600 you wrote:
> Ensure that received Command-Response Queue (CRQ) entries are
> properly read in order by the driver. dma_rmb barrier has
> been added before accessing the CRQ descriptor to ensure
> the entire descriptor is read before processing.
> 
> Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
> Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
> 
> [...]

Here is the summary with links:
  - [net,v3] ibmvnic: Ensure that CRQ entry read are correctly ordered
    https://git.kernel.org/netdev/net/c/e41aec79e62f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-01-28  3:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-28  1:34 [PATCH net v3] ibmvnic: Ensure that CRQ entry read are correctly ordered Lijun Pan
2021-01-28  3:20 ` patchwork-bot+netdevbpf

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