From patchwork Mon Nov 29 18:06:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valerio X-Patchwork-Id: 1561316 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AG4LeDKU; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J2tbH050qz9sVc for ; Tue, 30 Nov 2021 05:06:50 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B749841BF2; Mon, 29 Nov 2021 18:06:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w8eKY6tSUFjs; Mon, 29 Nov 2021 18:06:46 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 53CEC40585; Mon, 29 Nov 2021 18:06:45 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 188BDC0012; Mon, 29 Nov 2021 18:06:45 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 44B53C000A for ; Mon, 29 Nov 2021 18:06:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9905140449 for ; Mon, 29 Nov 2021 18:06:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kM3Dh6F5jO6Q for ; Mon, 29 Nov 2021 18:06:22 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 9E99C40434 for ; Mon, 29 Nov 2021 18:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638209181; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BGhRYrbeRXHJw7U2B55OtjxbT3rGMPWH7aQ16Tkbsfs=; b=AG4LeDKUqdWDrs97n6kFTAUNQdxUU2MhE4JvG3HAcY6Pgj5e8L66CSs9yQvKRcPN4DvFJ2 jHxOj/iuVRaLapGzi0OUA+BsMjllVzfZ3K8NW5cBDEN0Gk/TIlZjtWhPS7PJ9aSc+Bxu8k GtXhkdwICo5BGeMVDFXRJ/Bn/iJNTw4= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-355-GRuXz5WVMs6uvGGDRW5L1A-1; Mon, 29 Nov 2021 13:06:20 -0500 X-MC-Unique: GRuXz5WVMs6uvGGDRW5L1A-1 Received: by mail-wm1-f72.google.com with SMTP id 145-20020a1c0197000000b0032efc3eb9bcso12278323wmb.0 for ; Mon, 29 Nov 2021 10:06:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=BGhRYrbeRXHJw7U2B55OtjxbT3rGMPWH7aQ16Tkbsfs=; b=LsOjIOM1+815wYRrr+DLrcM2m8jRMcRTEQlmGywJmBYgjvF+2H5U8sbpWriYC9VMD0 e006OiHC3YNkmpSH4xI8ym+92/W/ClRt7CeCGrtO2v8LpUjKzCNvo2OENcQtl2LGj+QE Vf20vCNzxY/fK7KWX1ELUTOwgcteK1gSMmExYqVNFFVuSSMWp2RcR0ZCCzbTEMnvvqTp 1kuJHt35NJuRDFxJdJCxvEVgbT9a1fteILLd/6iCLqMG/w6ul8O4F0gr5rhw4SiQ5svK tfRp31gG8BOWDyN77o9DBEj7e6qFLvXcTHPGbxXW46+hZa41wfBUDnELih5I5mhXlWkz h8YQ== X-Gm-Message-State: AOAM531nVhTSJ3/Z6+xa4Lf+Elo8s7iMfJcDQQWxcS/wj4VRZ7+6w+Zf tXciISvFqS4A4YmW6fIj0S+smhEoG+VgcHgep9h7jQPfZnzHFt29b70v37R1HqtXIcJCAGfuApB YjZCXBfO4FrBPadqPsAAVMBhYUk5/YwB0dZ+bonU8WFnj6azc8Cjk/UpZnTvAZePF X-Received: by 2002:adf:ea0a:: with SMTP id q10mr36418486wrm.1.1638209178397; Mon, 29 Nov 2021 10:06:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcTwmw0Id6YizYgv+Zz5BMTlGsEEodbsYSGsa7HthzLbapMYAg//kgBxzTh+aqIyXbRTghhw== X-Received: by 2002:adf:ea0a:: with SMTP id q10mr36418454wrm.1.1638209178205; Mon, 29 Nov 2021 10:06:18 -0800 (PST) Received: from localhost (net-5-88-23-84.cust.vodafonedsl.it. [5.88.23.84]) by smtp.gmail.com with ESMTPSA id b13sm11064572wrh.32.2021.11.29.10.06.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Nov 2021 10:06:17 -0800 (PST) From: Paolo Valerio To: dev@openvswitch.org Date: Mon, 29 Nov 2021 19:06:17 +0100 Message-ID: <163820917300.3001886.2414895920910370135.stgit@fed.void> In-Reply-To: <163820911055.3001886.13118680364054625917.stgit@fed.void> References: <163820911055.3001886.13118680364054625917.stgit@fed.void> User-Agent: StGit/1.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pvalerio@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: fbl@redhat.com, i.maximets@ovn.org Subject: [ovs-dev] [PATCH RFC 5/5] conntrack: Make ovs-appctl dpctl/ct-bkts work with multiple buckets X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Without this patch "ovs-appctl dpctl/ct-bkts" produces the following output: Total Buckets: 1 Current Connections: 10246 +-----------+-----------------------------------------+ | Buckets | Connections per Buckets | +-----------+-----------------------------------------+ 0.. 7 | 10246 with this patch applied, the output becomes: Total Buckets: 1024 Current Connections: 95956 +-----------+-----------------------------------------+ | Buckets | Connections per Buckets | +-----------+-----------------------------------------+ 0.. 7 | 87 100 90 91 92 92 101 83 8.. 15 | 98 86 80 91 92 93 92 84 16.. 23 | 82 114 103 90 94 80 95 96 ... 1000..1007 | 98 88 106 100 91 99 89 81 1008..1015 | 97 99 93 67 102 97 89 86 1016..1023 | 113 79 97 86 106 93 80 90 Signed-off-by: Paolo Valerio --- lib/conntrack.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/conntrack.c b/lib/conntrack.c index 1c019af29..cbeafb22b 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -2675,7 +2675,7 @@ tuple_to_conn_key(const struct ct_dpif_tuple *tuple, uint16_t zone, static void conn_to_ct_dpif_entry(const struct conn *conn, struct ct_dpif_entry *entry, - long long now) + long long now, unsigned int bkt) { const struct conn_key *key = &conn->key_node[CT_DIR_FWD].key, *rev_key = &conn->key_node[CT_DIR_REV].key; @@ -2699,6 +2699,7 @@ conn_to_ct_dpif_entry(const struct conn *conn, struct ct_dpif_entry *entry, ovs_mutex_unlock(&conn->lock); entry->timeout = (expiration > 0) ? expiration / 1000 : 0; + entry->bkt = bkt; if (conn->alg) { /* Caller is responsible for freeing. */ @@ -2724,7 +2725,7 @@ conntrack_dump_start(struct conntrack *ct, struct conntrack_dump *dump, } dump->ct = ct; - *ptot_bkts = 1; /* Need to clean up the callers. */ + *ptot_bkts = CONNTRACK_BUCKETS; return 0; } @@ -2757,7 +2758,7 @@ conntrack_dump_next(struct conntrack_dump *dump, struct ct_dpif_entry *entry) if ((!dump->filter_zone || keyn->key.zone == dump->zone) && (keyn->key.dir == CT_DIR_FWD)) { - conn_to_ct_dpif_entry(conn, entry, now); + conn_to_ct_dpif_entry(conn, entry, now, dump->bucket); break; } }