{"id":807812,"url":"http://patchwork.ozlabs.org/api/patches/807812/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/patch/1504115149-26864-3-git-send-email-ktraynor@redhat.com/","project":{"id":47,"url":"http://patchwork.ozlabs.org/api/projects/47/?format=json","name":"Open vSwitch","link_name":"openvswitch","list_id":"ovs-dev.openvswitch.org","list_email":"ovs-dev@openvswitch.org","web_url":"http://openvswitch.org/","scm_url":"git@github.com:openvswitch/ovs.git","webscm_url":"https://github.com/openvswitch/ovs","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504115149-26864-3-git-send-email-ktraynor@redhat.com>","list_archive_url":null,"date":"2017-08-30T17:45:49","name":"[ovs-dev,3/3] dpif-netdev: Calculate rxq cycles prior to rxq_cycle_sort calls.","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c95680ba256e737de87c625eadf43fbad0833c02","submitter":{"id":70482,"url":"http://patchwork.ozlabs.org/api/people/70482/?format=json","name":"Kevin Traynor","email":"ktraynor@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/openvswitch/patch/1504115149-26864-3-git-send-email-ktraynor@redhat.com/mbox/","series":[{"id":672,"url":"http://patchwork.ozlabs.org/api/series/672/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/list/?series=672","date":"2017-08-30T17:45:47","name":"[ovs-dev,1/3] dpif-netdev: Rename rxq_interval.","version":1,"mbox":"http://patchwork.ozlabs.org/series/672/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/807812/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807812/checks/","tags":{},"related":[],"headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","ovs-dev@mail.linuxfoundation.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=ktraynor@redhat.com"],"Received":["from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjCcq5Pw8z9sN7\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 03:47:07 +1000 (AEST)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 20880C13;\n\tWed, 30 Aug 2017 17:46:06 +0000 (UTC)","from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 836CEC04\n\tfor <dev@openvswitch.org>; Wed, 30 Aug 2017 17:46:02 +0000 (UTC)","from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 49B9442E\n\tfor <dev@openvswitch.org>; Wed, 30 Aug 2017 17:46:02 +0000 (UTC)","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id B713A5F795;\n\tWed, 30 Aug 2017 17:46:01 +0000 (UTC)","from ktraynor.remote.csb (ovpn-117-75.ams2.redhat.com\n\t[10.36.117.75])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 785439B519;\n\tWed, 30 Aug 2017 17:46:00 +0000 (UTC)"],"X-Greylist":["domain auto-whitelisted by SQLgrey-1.7.6","Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tWed, 30 Aug 2017 17:46:01 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com B713A5F795","From":"Kevin Traynor <ktraynor@redhat.com>","To":"dev@openvswitch.org, ktraynor@redhat.com, dball@vmware.com,\n\ti.maximets@samsung.com","Date":"Wed, 30 Aug 2017 18:45:49 +0100","Message-Id":"<1504115149-26864-3-git-send-email-ktraynor@redhat.com>","In-Reply-To":"<1504115149-26864-1-git-send-email-ktraynor@redhat.com>","References":"<1504115149-26864-1-git-send-email-ktraynor@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.12","X-Spam-Status":"No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,\n\tRP_MATCHES_RCVD autolearn=disabled version=3.3.1","X-Spam-Checker-Version":"SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org","Subject":"[ovs-dev] [PATCH 3/3] dpif-netdev: Calculate rxq cycles prior to\n\trxq_cycle_sort calls.","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.12","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"},"content":"rxq_cycle_sort summed the latest cycles from each queue for sorting.\nWhile each comparison was correct with the latest cycles, the cycles\ncould change between calls to rxq_cycle_sort. In order to use\nconsistent values through each call to rxq_cycle_sort, sum the cycles\nprior to rxq_cycle_sort being called.\n\nAlso, change return to 0 when values are equal.\n\nReported-by: Ilya Maximets <i.maximets@samsung.com>\nSigned-off-by: Kevin Traynor <ktraynor@redhat.com>\n---\n lib/dpif-netdev.c | 22 +++++++++++++---------\n 1 file changed, 13 insertions(+), 9 deletions(-)","diff":"diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c\nindex 1db9f10..7c21ee5 100644\n--- a/lib/dpif-netdev.c\n+++ b/lib/dpif-netdev.c\n@@ -3432,18 +3432,14 @@ rxq_cycle_sort(const void *a, const void *b)\n     struct dp_netdev_rxq *qb;\n     uint64_t total_qa, total_qb;\n-    unsigned i;\n \n     qa = *(struct dp_netdev_rxq **) a;\n     qb = *(struct dp_netdev_rxq **) b;\n \n-    total_qa = total_qb = 0;\n-    for (i = 0; i < PMD_RXQ_INTERVAL_MAX; i++) {\n-        total_qa += dp_netdev_rxq_get_intrvl_cycles(qa, i);\n-        total_qb += dp_netdev_rxq_get_intrvl_cycles(qb, i);\n-    }\n-    dp_netdev_rxq_set_cycles(qa, RXQ_CYCLES_PROC_HIST, total_qa);\n-    dp_netdev_rxq_set_cycles(qb, RXQ_CYCLES_PROC_HIST, total_qb);\n+    total_qa = dp_netdev_rxq_get_cycles(qa, RXQ_CYCLES_PROC_HIST);\n+    total_qb = dp_netdev_rxq_get_cycles(qb, RXQ_CYCLES_PROC_HIST);\n \n-    if (total_qa >= total_qb) {\n+    if (total_qa == total_qb) {\n+        return 0;\n+    } else if (total_qa > total_qb) {\n         return -1;\n     }\n@@ -3493,4 +3489,6 @@ rxq_scheduling(struct dp_netdev *dp, bool pinned) OVS_REQUIRES(dp->port_mutex)\n                 }\n             } else if (!pinned && q->core_id == OVS_CORE_UNSPEC) {\n+                uint64_t cycle_hist = 0;\n+\n                 if (n_rxqs == 0) {\n                     rxqs = xmalloc(sizeof *rxqs);\n@@ -3498,4 +3496,10 @@ rxq_scheduling(struct dp_netdev *dp, bool pinned) OVS_REQUIRES(dp->port_mutex)\n                     rxqs = xrealloc(rxqs, sizeof *rxqs * (n_rxqs + 1));\n                 }\n+\n+                for (unsigned i = 0; i < PMD_RXQ_INTERVAL_MAX; i++) {\n+                    cycle_hist += dp_netdev_rxq_get_intrvl_cycles(q, i);\n+                }\n+                dp_netdev_rxq_set_cycles(q, RXQ_CYCLES_PROC_HIST, cycle_hist);\n+\n                 /* Store the queue. */\n                 rxqs[n_rxqs++] = q;\n","prefixes":["ovs-dev","3/3"]}