From patchwork Sat Dec 3 02:14:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniele Di Proietto X-Patchwork-Id: 702213 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tVvmq1cY3z9t1d for ; Sat, 3 Dec 2016 13:17:31 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 1A92BB8B; Sat, 3 Dec 2016 02:14:51 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 56295B0B for ; Sat, 3 Dec 2016 02:14:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from EX13-EDG-OU-002.vmware.com (ex13-edg-ou-002.vmware.com [208.91.0.190]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 09970210 for ; Sat, 3 Dec 2016 02:14:45 +0000 (UTC) Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Fri, 2 Dec 2016 18:14:03 -0800 Received: from sc9-mailhost1.vmware.com (htb-1n-eng-dhcp161.eng.vmware.com [10.33.74.161]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id AA0D640615; Fri, 2 Dec 2016 18:14:42 -0800 (PST) From: Daniele Di Proietto To: Date: Fri, 2 Dec 2016 18:14:09 -0800 Message-ID: <20161203021418.103114-11-diproiettod@vmware.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161203021418.103114-1-diproiettod@vmware.com> References: <20161203021418.103114-1-diproiettod@vmware.com> MIME-Version: 1.0 Received-SPF: None (EX13-EDG-OU-002.vmware.com: diproiettod@vmware.com does not designate permitted sender hosts) X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ilya Maximets , Daniele Di Proietto Subject: [ovs-dev] [PATCH v2 10/19] dpif-netdev: Make 'static_tx_qid' const. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Since previous commit, 'static_tx_qid' doesn't need to be atomic and is actually never touched (except for initialization), so it can be made const. Signed-off-by: Daniele Di Proietto --- lib/dpif-netdev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 35e798b..e1366a6 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -496,7 +496,7 @@ struct dp_netdev_pmd_thread { /* Queue id used by this pmd thread to send packets on all netdevs if * XPS disabled for this netdev. All static_tx_qid's are unique and less * than 'ovs_numa_get_n_cores() + 1'. */ - atomic_int static_tx_qid; + const int static_tx_qid; struct ovs_mutex port_mutex; /* Mutex for 'poll_list' and 'tx_ports'. */ /* List of rx queues to poll. */ @@ -3283,10 +3283,9 @@ dp_netdev_configure_pmd(struct dp_netdev_pmd_thread *pmd, struct dp_netdev *dp, pmd->numa_id = numa_id; pmd->poll_cnt = 0; - atomic_init(&pmd->static_tx_qid, - (core_id == NON_PMD_CORE_ID) - ? ovs_numa_get_n_cores() - : get_n_pmd_threads(dp)); + *CONST_CAST(int *, &pmd->static_tx_qid) = (core_id == NON_PMD_CORE_ID) + ? ovs_numa_get_n_cores() + : get_n_pmd_threads(dp); ovs_refcount_init(&pmd->ref_cnt); latch_init(&pmd->exit_latch); @@ -4391,7 +4390,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_, if (dynamic_txqs) { tx_qid = dpif_netdev_xps_get_tx_qid(pmd, p, now); } else { - atomic_read_relaxed(&pmd->static_tx_qid, &tx_qid); + tx_qid = pmd->static_tx_qid; } netdev_send(p->port->netdev, tx_qid, packets_, may_steal,