* [memnic PATCH] pmd: use memory barrier function instead of asm volatile
@ 2014-01-24 15:59 Olivier Matz
[not found] ` <1390579157-23890-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Olivier Matz @ 2014-01-24 15:59 UTC (permalink / raw)
To: dev-VfR2kkLFssw
Use the DPDK specific function rte_mb() instead of
the GCC statement asm volatile ("" ::: "memory").
Signed-off-by: Olivier Matz <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
---
common/memnic.h | 2 --
pmd/pmd_memnic.c | 6 +++---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/common/memnic.h b/common/memnic.h
index 6ff38a0..fdc9fa3 100644
--- a/common/memnic.h
+++ b/common/memnic.h
@@ -123,8 +123,6 @@ struct memnic_area {
/* for userspace */
#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
-#define barrier() do { asm volatile("": : :"memory"); } while (0)
-
static inline uint32_t cmpxchg(uint32_t *dst, uint32_t old, uint32_t new)
{
volatile uint32_t *ptr = (volatile uint32_t *)dst;
diff --git a/pmd/pmd_memnic.c b/pmd/pmd_memnic.c
index bc01746..1586222 100644
--- a/pmd/pmd_memnic.c
+++ b/pmd/pmd_memnic.c
@@ -100,7 +100,7 @@ static int memnic_dev_start(struct rte_eth_dev *dev)
/* invalidate */
adapter->nic->hdr.valid = 0;
- barrier();
+ rte_mb();
/* reset */
adapter->nic->hdr.reset = 1;
/* no need to wait here */
@@ -242,7 +242,7 @@ static uint16_t memnic_recv_pkts(void *rx_queue,
mb->pkt.data_len = p->len;
rx_pkts[nr] = mb;
- barrier();
+ rte_mb();
p->status = MEMNIC_PKT_ST_FREE;
if (++idx >= MEMNIC_NR_PACKET)
@@ -290,7 +290,7 @@ retry:
rte_memcpy(p->data, rte_pktmbuf_mtod(tx_pkts[nr], void *), len);
- barrier();
+ rte_mb();
p->status = MEMNIC_PKT_ST_FILLED;
rte_pktmbuf_free(tx_pkts[nr]);
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <1390579157-23890-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>]
* Re: [memnic PATCH] pmd: use memory barrier function instead of asm volatile [not found] ` <1390579157-23890-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> @ 2014-01-30 11:42 ` Hiroshi Shimamoto [not found] ` <7F861DC0615E0C47A872E6F3C5FCDDBD0102D11D-ZmjkEB1lVlLt6d3pZDjeaEtBU8KWyXPq@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Hiroshi Shimamoto @ 2014-01-30 11:42 UTC (permalink / raw) To: Olivier Matz, dev-VfR2kkLFssw@public.gmane.org > Subject: [dpdk-dev] [memnic PATCH] pmd: use memory barrier function instead of asm volatile > > Use the DPDK specific function rte_mb() instead of > the GCC statement asm volatile ("" ::: "memory"). Yes, that's preferred for DPDK, I think. Looks okay to me. By the way, I was also asked to use rte atomic function instead of cmpxchg asm statement. My re-submitted version in dpdk-ovs has such a change. What do you think? thanks, Hiroshi > > Signed-off-by: Olivier Matz <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> > --- > common/memnic.h | 2 -- > pmd/pmd_memnic.c | 6 +++--- > 2 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/common/memnic.h b/common/memnic.h > index 6ff38a0..fdc9fa3 100644 > --- a/common/memnic.h > +++ b/common/memnic.h > @@ -123,8 +123,6 @@ struct memnic_area { > /* for userspace */ > #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) > > -#define barrier() do { asm volatile("": : :"memory"); } while (0) > - > static inline uint32_t cmpxchg(uint32_t *dst, uint32_t old, uint32_t new) > { > volatile uint32_t *ptr = (volatile uint32_t *)dst; > diff --git a/pmd/pmd_memnic.c b/pmd/pmd_memnic.c > index bc01746..1586222 100644 > --- a/pmd/pmd_memnic.c > +++ b/pmd/pmd_memnic.c > @@ -100,7 +100,7 @@ static int memnic_dev_start(struct rte_eth_dev *dev) > > /* invalidate */ > adapter->nic->hdr.valid = 0; > - barrier(); > + rte_mb(); > /* reset */ > adapter->nic->hdr.reset = 1; > /* no need to wait here */ > @@ -242,7 +242,7 @@ static uint16_t memnic_recv_pkts(void *rx_queue, > mb->pkt.data_len = p->len; > rx_pkts[nr] = mb; > > - barrier(); > + rte_mb(); > p->status = MEMNIC_PKT_ST_FREE; > > if (++idx >= MEMNIC_NR_PACKET) > @@ -290,7 +290,7 @@ retry: > > rte_memcpy(p->data, rte_pktmbuf_mtod(tx_pkts[nr], void *), len); > > - barrier(); > + rte_mb(); > p->status = MEMNIC_PKT_ST_FILLED; > > rte_pktmbuf_free(tx_pkts[nr]); > -- > 1.8.4.rc3 ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <7F861DC0615E0C47A872E6F3C5FCDDBD0102D11D-ZmjkEB1lVlLt6d3pZDjeaEtBU8KWyXPq@public.gmane.org>]
* Re: [memnic PATCH] pmd: use memory barrier function instead of asm volatile [not found] ` <7F861DC0615E0C47A872E6F3C5FCDDBD0102D11D-ZmjkEB1lVlLt6d3pZDjeaEtBU8KWyXPq@public.gmane.org> @ 2014-01-31 9:52 ` Olivier MATZ 2014-02-04 13:08 ` Thomas Monjalon 1 sibling, 0 replies; 4+ messages in thread From: Olivier MATZ @ 2014-01-31 9:52 UTC (permalink / raw) To: Hiroshi Shimamoto; +Cc: dev-VfR2kkLFssw@public.gmane.org Hi Hiroshi-san, On 01/30/2014 12:42 PM, Hiroshi Shimamoto wrote: >> Subject: [dpdk-dev] [memnic PATCH] pmd: use memory barrier function instead of asm volatile > > By the way, I was also asked to use rte atomic function > instead of cmpxchg asm statement. > My re-submitted version in dpdk-ovs has such a change. > What do you think? Yes I agree about this change. Regards, Olivier ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [memnic PATCH] pmd: use memory barrier function instead of asm volatile [not found] ` <7F861DC0615E0C47A872E6F3C5FCDDBD0102D11D-ZmjkEB1lVlLt6d3pZDjeaEtBU8KWyXPq@public.gmane.org> 2014-01-31 9:52 ` Olivier MATZ @ 2014-02-04 13:08 ` Thomas Monjalon 1 sibling, 0 replies; 4+ messages in thread From: Thomas Monjalon @ 2014-02-04 13:08 UTC (permalink / raw) To: Olivier Matz; +Cc: dev-VfR2kkLFssw 30/01/2014 12:42, Hiroshi Shimamoto: > > Use the DPDK specific function rte_mb() instead of > > the GCC statement asm volatile ("" ::: "memory"). > > > > Signed-off-by: Olivier Matz <olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> > > Yes, that's preferred for DPDK, I think. > Looks okay to me. Applied, thanks. -- Thomas ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-04 13:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-24 15:59 [memnic PATCH] pmd: use memory barrier function instead of asm volatile Olivier Matz
[not found] ` <1390579157-23890-1-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-01-30 11:42 ` Hiroshi Shimamoto
[not found] ` <7F861DC0615E0C47A872E6F3C5FCDDBD0102D11D-ZmjkEB1lVlLt6d3pZDjeaEtBU8KWyXPq@public.gmane.org>
2014-01-31 9:52 ` Olivier MATZ
2014-02-04 13:08 ` Thomas Monjalon
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.