Skip to contentSkip to conversation

net: mana: Add rmb after checking owner bits

PATCH Applied Haiyang Zhang 3 participants 3 messages Sep 11, 2022 – Sep 20, 2022

Subsystems (5)
lore
Share & tools
lore

Haiyang Zhang

author maintainer
#0 lore raw

PATCH 1/1 net: mana: Add rmb after checking owner bits

Per GDMA spec, rmb is necessary after checking owner_bits, before reading EQ or CQ entries.

Add rmb in these two places to comply with the specs.

Fixes ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
---
 drivers/net/ethernet/microsoft/mana/gdma_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/net/ethernet/microsoft/mana/gdma_main.c +10 -0
index 5f9240182351..e10b9f8f89e1 100644
@@ -397,6 +397,11 @@ static void mana_gd_process_eq_events(void *arg)
 			break;
 		}
 
+		/* Per GDMA spec, rmb is necessary after checking owner_bits, before
+		 * reading eqe.
+		 */
+		rmb();
+
 		mana_gd_process_eqe(eq);
 
 		eq->head++;
@@ -1134,6 +1139,11 @@ static int mana_gd_read_cqe(struct gdma_queue *cq, struct gdma_comp *comp)
 	if (WARN_ON_ONCE(owner_bits != new_bits))
 		return -1;
 
+	/* Per GDMA spec, rmb is necessary after checking owner_bits, before
+	 * reading completion info
+	 */
+	rmb();
+
 	comp->wq_num = cqe->cqe_info.wq_num;
 	comp->is_sq = cqe->cqe_info.is_sq;
 	memcpy(comp->cqe_data, cqe->cqe_data, GDMA_COMP_DATA_SIZE);
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines

From: LKML haiyangz <[email protected]> On Behalf Of Haiyang Zhang
Sent: Sunday, September 11, 2022 1:40 PM
...
Per GDMA spec, rmb is necessary after checking owner_bits, before reading EQ or CQ entries.

Quoted 7 lines

Add rmb in these two places to comply with the specs.

Fixes ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network

Adapter (MANA)")

#2 lore raw
In reply to Haiyang Zhang
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Sun, 11 Sep 2022 13:40:05 -0700 you wrote:

Per GDMA spec, rmb is necessary after checking owner_bits, before reading EQ or CQ entries.

Add rmb in these two places to comply with the specs.

Fixes ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")

[...]

Here is the summary with links:
- [net] net: mana: Add rmb after checking owner bits

    https://git.kernel.org/netdev/net/c/6fd2c68da55c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html