diff mbox series

[net] ibmvnic: add memory barrier to protect long term buffer

Message ID 20210213024840.56036-1-ljp@linux.ibm.com (mailing list archive)
State Accepted
Commit 42557dab78edc8235aba5b441f2eb35f725a0ede
Delegated to: Netdev Maintainers
Headers show
Series [net] ibmvnic: add memory barrier to protect long term buffer | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers fail 3 blamed authors not CCed: tlfalcon@linux.vnet.ibm.com davem@davemloft.net jallen@linux.vnet.ibm.com; 8 maintainers not CCed: mpe@ellerman.id.au paulus@samba.org kuba@kernel.org davem@davemloft.net tlfalcon@linux.vnet.ibm.com benh@kernel.crashing.org jallen@linux.vnet.ibm.com linuxppc-dev@lists.ozlabs.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 19 this patch: 19
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Lijun Pan Feb. 13, 2021, 2:48 a.m. UTC
dma_rmb() barrier is added to load the long term buffer before copying
it to socket buffer; and dma_wmb() barrier is added to update the
long term buffer before it being accessed by VIOS (virtual i/o server).

Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
Acked-by: Thomas Falcon <tlfalcon@linux.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 15, 2021, 11:20 p.m. UTC | #1
Hello:

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

On Fri, 12 Feb 2021 20:48:40 -0600 you wrote:
> dma_rmb() barrier is added to load the long term buffer before copying
> it to socket buffer; and dma_wmb() barrier is added to update the
> long term buffer before it being accessed by VIOS (virtual i/o server).
> 
> Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
> Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
> Acked-by: Thomas Falcon <tlfalcon@linux.ibm.com>
> 
> [...]

Here is the summary with links:
  - [net] ibmvnic: add memory barrier to protect long term buffer
    https://git.kernel.org/netdev/net/c/42557dab78ed

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

Patch

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index c8b0d99608d5..cd201f89ce6c 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1705,6 +1705,9 @@  static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
 		skb_copy_from_linear_data(skb, dst, skb->len);
 	}
 
+	/* post changes to long_term_buff *dst before VIOS accessing it */
+	dma_wmb();
+
 	tx_pool->consumer_index =
 	    (tx_pool->consumer_index + 1) % tx_pool->num_buffers;
 
@@ -2544,6 +2547,8 @@  static int ibmvnic_poll(struct napi_struct *napi, int budget)
 		offset = be16_to_cpu(next->rx_comp.off_frame_data);
 		flags = next->rx_comp.flags;
 		skb = rx_buff->skb;
+		/* load long_term_buff before copying to skb */
+		dma_rmb();
 		skb_copy_to_linear_data(skb, rx_buff->data + offset,
 					length);