FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 08-03-2012, 01:24 AM
Ike Panhc
 
Default UBUNTU: SAUCE: net: calxedaxgmac: add write barriers around setting owner bit

From: Rob Herring <rob.herring@calxeda.com>

BugLink: http://launchpad.net/bugs/1008345

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
drivers/net/ethernet/calxeda/xgmac.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index cd64c6b..8f43dc4 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -332,7 +332,7 @@
#define DESC_BUFFER2_SZ_OFFSET 16

struct xgmac_dma_desc {
- __le32 flags;
+ volatile __le32 flags;
__le32 buf_size;
__le32 buf1_addr; /* Buffer 1 Address Pointer */
__le32 buf2_addr; /* Buffer 2 Address Pointer */
@@ -451,15 +451,20 @@ static inline int desc_get_owner(struct xgmac_dma_desc *p)
static inline void desc_set_rx_owner(struct xgmac_dma_desc *p)
{
/* Clear all fields and set the owner */
+ wmb();
p->flags = cpu_to_le32(DESC_OWN);
+ wmb();
}

static inline void desc_set_tx_owner(struct xgmac_dma_desc *p, u32 flags)
{
- u32 tmpflags = le32_to_cpu(p->flags);
+ u32 tmpflags;
+ wmb();
+ tmpflags = le32_to_cpu(p->flags);
tmpflags &= TXDESC_END_RING;
tmpflags |= flags | DESC_OWN;
p->flags = cpu_to_le32(tmpflags);
+ wmb();
}

static inline int desc_get_tx_ls(struct xgmac_dma_desc *p)
--
1.7.9.5


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 01:41 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org