From patchwork Thu Jan 4 20:02:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Scheurich X-Patchwork-Id: 855875 X-Patchwork-Delegate: ian.stokes@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) 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 3zCQLX68Zmz9s7c for ; Fri, 5 Jan 2018 11:20:52 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 708E6D12; Fri, 5 Jan 2018 00:19:11 +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 62A24D02 for ; Fri, 5 Jan 2018 00:19:09 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mout.web.de (mout.web.de [212.227.15.4]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2B8A64EB for ; Fri, 5 Jan 2018 00:19:07 +0000 (UTC) Received: from ubuntu.fritz.box ([89.0.12.95]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M5Jip-1epUl92g19-00zU5s; Fri, 05 Jan 2018 01:19:00 +0100 From: Jan Scheurich To: dev@openvswitch.org Date: Thu, 4 Jan 2018 21:02:39 +0100 Message-Id: <1515096166-16257-2-git-send-email-jan.scheurich@ericsson.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515096166-16257-1-git-send-email-jan.scheurich@ericsson.com> References: <1515096166-16257-1-git-send-email-jan.scheurich@ericsson.com> X-Provags-ID: V03:K0:Kz3YPR+GBfhsXRiErhszS3DJqd/q6crRqIxx98KqPOSyMfm1O5n vOvFnZ8KccamH1QUlpC/XlMPSGqmQ2wXWPOoYUwXPe/Cp6+GMzui1Sf/76F4+SaipneEzCJ SQ0soc/Akt0m5EF1ea7CAr6YcsSEXg+USnmZG5r4bV4XQsl88CedMAXbxpoG+oy2c+65Hf/ 3dpS58lMz1Yq88QVBEh7g== X-UI-Out-Filterresults: notjunk:1; V01:K0:XgvNeIVdgFU=:Q/Zc7DwY22IEgTUKoAvaBn UgAgHxPBZWBCdTKllqLHleqLffKbZq2f/19GclrH5gZTWsXH4VaA9HwLCFTYPPqQ+y6ibFbjX eB0ZTjLTjzpWDzBsdM2AEVB5fYZytDW4LtRUUrSMbJ4vHutnEfQUS+GN6kdGST889eGt4CSPZ 9yS9XtDGQZH819UonHGPHpV/JyiQ+mgYlrEd3f6QZ+SQQni/+7ZZ2SpKrteK+iRCIzhCLuOaV DTKkJwZwMX/d5MH27CWRA09/FHFKgq7icVw34GmGQPL7MN/towTS2dDQsO+JqFpQNbSpTeBPy a1NmwQb0RUxtGvYK+pAC8IjleMmbyE5uDrekDX5YtVDOnxowp0eirQtFVvWQCRFJU5+CrEFiC vAJjPtld4UZHd1HtW31KWslWywU+Z2wGlNbrX2/eQxhAE48nDQRl+fNs7l4oyEe2GEte7/jUr qxL1XpUyb+e3YoVAId3GVurHjCM71LoE/YxxFgy5YvmH5zJqAX4HTwLX8uOoTzh3/6KhbCcZ0 q47zqZdnWeAPcfWYXYC8fVJ2jZBU78a3eOfsFPQXYCGKP599skgb7a4L1URT72+sPoRjLxPKJ u0tal770cKKHjSCn2XyID15EcXM9r5ad89luDvihBUav+k3ScMEwuleXGdDqElzEpHOWdu1sC LbFA99wLCA+c1FfHf7dzHfT2Xa+0AK9WXJmMvbZjnng3NfzNOxn7rpPkkc8IVHyNby7qsCcGl Qf36XsNlLpE5VlS956RQGT/QNZ/AjGGSqcN1pF1LDg12uSWlnlbMZN73lG4VcCM+2b5AVmZOY EgQluk+MBoiQBYjRUOMLb25D4A4Ow== X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, DATE_IN_PAST_03_06, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ilya Maximets Subject: [ovs-dev] [RFC PATCH 1/8] dpif-netdev: Use microsecond granularity. 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: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Ilya Maximets Upcoming time-based output batching will require microsecond granularity for it's flexible configuration. Signed-off-by: Ilya Maximets --- lib/dpif-netdev.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 96cc4d5..279ae6b 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -181,12 +181,13 @@ struct emc_cache { /* Simple non-wildcarding single-priority classifier. */ -/* Time in ms between successive optimizations of the dpcls subtable vector */ -#define DPCLS_OPTIMIZATION_INTERVAL 1000 +/* Time in microseconds between successive optimizations of the dpcls + * subtable vector */ +#define DPCLS_OPTIMIZATION_INTERVAL 1000000LL -/* Time in ms of the interval in which rxq processing cycles used in - * rxq to pmd assignments is measured and stored. */ -#define PMD_RXQ_INTERVAL_LEN 10000 +/* Time in microseconds of the interval in which rxq processing cycles used + * in rxq to pmd assignments is measured and stored. */ +#define PMD_RXQ_INTERVAL_LEN 10000000LL /* Number of intervals for which cycles are stored * and used during rxq to pmd assignment. */ @@ -344,7 +345,7 @@ enum rxq_cycles_counter_type { RXQ_N_CYCLES }; -#define XPS_TIMEOUT_MS 500LL +#define XPS_TIMEOUT 500000LL /* In microseconds. */ /* Contained by struct dp_netdev_port's 'rxqs' member. */ struct dp_netdev_rxq { @@ -764,7 +765,7 @@ emc_cache_slow_sweep(struct emc_cache *flow_cache) static inline void pmd_thread_ctx_time_update(struct dp_netdev_pmd_thread *pmd) { - pmd->ctx.now = time_msec(); + pmd->ctx.now = time_usec(); } /* Returns true if 'dpif' is a netdev or dummy dpif, false otherwise. */ @@ -4332,7 +4333,7 @@ dp_netdev_run_meter(struct dp_netdev *dp, struct dp_packet_batch *packets_, memset(exceeded_rate, 0, cnt * sizeof *exceeded_rate); /* All packets will hit the meter at the same time. */ - long_delta_t = (now - meter->used); /* msec */ + long_delta_t = (now - meter->used) / 1000; /* msec */ /* Make sure delta_t will not be too large, so that bucket will not * wrap around below. */ @@ -4488,7 +4489,7 @@ dpif_netdev_meter_set(struct dpif *dpif, ofproto_meter_id *meter_id, meter->flags = config->flags; meter->n_bands = config->n_bands; meter->max_delta_t = 0; - meter->used = time_msec(); + meter->used = time_usec(); /* set up bands */ for (i = 0; i < config->n_bands; ++i) { @@ -5030,7 +5031,7 @@ packet_batch_per_flow_execute(struct packet_batch_per_flow *batch, struct dp_netdev_flow *flow = batch->flow; dp_netdev_flow_used(flow, batch->array.count, batch->byte_count, - batch->tcp_flags, pmd->ctx.now); + batch->tcp_flags, pmd->ctx.now / 1000); actions = dp_netdev_flow_get_actions(flow); @@ -5424,7 +5425,7 @@ dpif_netdev_xps_revalidate_pmd(const struct dp_netdev_pmd_thread *pmd, continue; } interval = pmd->ctx.now - tx->last_used; - if (tx->qid >= 0 && (purge || interval >= XPS_TIMEOUT_MS)) { + if (tx->qid >= 0 && (purge || interval >= XPS_TIMEOUT)) { port = tx->port; ovs_mutex_lock(&port->txq_used_mutex); port->txq_used[tx->qid]--; @@ -5445,7 +5446,7 @@ dpif_netdev_xps_get_tx_qid(const struct dp_netdev_pmd_thread *pmd, interval = pmd->ctx.now - tx->last_used; tx->last_used = pmd->ctx.now; - if (OVS_LIKELY(tx->qid >= 0 && interval < XPS_TIMEOUT_MS)) { + if (OVS_LIKELY(tx->qid >= 0 && interval < XPS_TIMEOUT)) { return tx->qid; } @@ -5824,7 +5825,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_, conntrack_execute(&dp->conntrack, packets_, aux->flow->dl_type, force, commit, zone, setmark, setlabel, aux->flow->tp_src, aux->flow->tp_dst, helper, nat_action_info_ref, - pmd->ctx.now); + pmd->ctx.now / 1000); break; }