[ovs-dev] [PATCH] netdev-dpdk: Pass queue id to dpdk_do_tx_copy().

Alex Wang alexw at nicira.com
Fri Sep 19 00:27:04 UTC 2014


Thx a lot,

Applied to master!

On Thu, Sep 18, 2014 at 5:21 PM, Daniele Di Proietto <ddiproietto at vmware.com
> wrote:

> Thanks for the fix Alex!
>
> Acked-by: Daniele Di Proietto <ddiproietto at vmware.com>
>
> On 9/18/14, 5:09 PM, "Alex Wang" <alexw at nicira.com> wrote:
>
> >Since dpdk_do_tx_copy() will be called by both pmd and
> >non-pmd thread, it should take the queue id as input.
> >The current ovs always uses NON_PMD_THREAD_TX_QUEUE
> >as queue id, which causes unprotected multi-access
> >to the same queue.
> >
> >This commit fixes the issue by passing the queue id
> >to dpdk_do_tx_copy().
> >
> >Reported-by: Ethan Jackson <ethan at nicira.com>
> >Signed-off-by: Alex Wang <alexw at nicira.com>
> >---
> > lib/netdev-dpdk.c |   11 +++++------
> > 1 file changed, 5 insertions(+), 6 deletions(-)
> >
> >diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> >index 1e12e8b..f2a42e8 100644
> >--- a/lib/netdev-dpdk.c
> >+++ b/lib/netdev-dpdk.c
> >@@ -70,8 +70,6 @@ static struct vlog_rate_limit rl =
> >VLOG_RATE_LIMIT_INIT(5, 20);
> > #define MP_CACHE_SZ          (256 * 2)
> > #define SOCKET0              0
> >
> >-#define NON_PMD_THREAD_TX_QUEUE 0
> >-
> > #define NIC_PORT_RX_Q_SIZE 2048  /* Size of Physical NIC RX Queue, Max
> >(n+32<=4096)*/
> > #define NIC_PORT_TX_Q_SIZE 2048  /* Size of Physical NIC TX Queue, Max
> >(n+32<=4096)*/
> >
> >@@ -783,7 +781,8 @@ dpdk_queue_pkts(struct netdev_dpdk *dev, int qid,
> >
> > /* Tx function. Transmit packets indefinitely */
> > static void
> >-dpdk_do_tx_copy(struct netdev *netdev, struct dpif_packet ** pkts, int
> >cnt)
> >+dpdk_do_tx_copy(struct netdev *netdev, int qid, struct dpif_packet **
> >pkts,
> >+                int cnt)
> >     OVS_NO_THREAD_SAFETY_ANALYSIS
> > {
> >     struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
> >@@ -832,8 +831,8 @@ dpdk_do_tx_copy(struct netdev *netdev, struct
> >dpif_packet ** pkts, int cnt)
> >         ovs_mutex_unlock(&dev->mutex);
> >     }
> >
> >-    dpdk_queue_pkts(dev, NON_PMD_THREAD_TX_QUEUE, mbufs, newcnt);
> >-    dpdk_queue_flush(dev, NON_PMD_THREAD_TX_QUEUE);
> >+    dpdk_queue_pkts(dev, qid, mbufs, newcnt);
> >+    dpdk_queue_flush(dev, qid);
> >
> >     if (!thread_is_pmd()) {
> >         ovs_mutex_unlock(&nonpmd_mempool_mutex);
> >@@ -849,7 +848,7 @@ netdev_dpdk_send(struct netdev *netdev, int qid,
> >struct dpif_packet **pkts,
> >     int i;
> >
> >     if (!may_steal || pkts[0]->ofpbuf.source != OFPBUF_DPDK) {
> >-        dpdk_do_tx_copy(netdev, pkts, cnt);
> >+        dpdk_do_tx_copy(netdev, qid, pkts, cnt);
> >
> >         if (may_steal) {
> >             for (i = 0; i < cnt; i++) {
> >--
> >1.7.9.5
> >
> >_______________________________________________
> >dev mailing list
> >dev at openvswitch.org
> >
> https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman/
> >listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=MV9BdLjtFIdhBDBaw5z%2BU
> >6SSA2gAfY4L%2F1HCy3VjlKU%3D%0A&m=LD%2F%2FRbiiFsW0UPz71GTUbMxTg33MzqvHsPG%2
> >BaBG7F6c%3D%0A&s=9f4e76b23ef2972b375cfa648354e5ea787e4cc2e803a42ee7181f460
> >191af0d
>
>



More information about the dev mailing list