From patchwork Fri Mar 12 11:59:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 1451943 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=K6FNoBp3; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (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 ozlabs.org (Postfix) with ESMTPS id 4Dxkrh2n3Kz9sS8 for ; Fri, 12 Mar 2021 22:59:48 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id E01866FAD0; Fri, 12 Mar 2021 11:59:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mbZbijdmgm6o; Fri, 12 Mar 2021 11:59:42 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTP id 1851160679; Fri, 12 Mar 2021 11:59:41 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7AFA0C0014; Fri, 12 Mar 2021 11:59:39 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 95679C0001 for ; Fri, 12 Mar 2021 11:59:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 7772B4E90F for ; Fri, 12 Mar 2021 11:59:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=netronome-com.20150623.gappssmtp.com 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 WLeVEBNci5Ah for ; Fri, 12 Mar 2021 11:59:36 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by smtp4.osuosl.org (Postfix) with ESMTPS id 8FD9A49AA0 for ; Fri, 12 Mar 2021 11:59:36 +0000 (UTC) Received: by mail-ed1-x52f.google.com with SMTP id dm8so7568777edb.2 for ; Fri, 12 Mar 2021 03:59:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZIGSdvGiYD2GBELDgywDOmwwWxenr12Kr2DoMn//kuM=; b=K6FNoBp3iaOoTnIeSBJPI08xYxLWf+WRaS9aojN/D5y9K9Ur8yhrwZUUz1SGZdi8jg zMucdoWwTrn6opzzzTnUD8Ja49qCWOn8iPpykWx3J9Xs3CJoX9qijV75OoEw+mhcMQvf PhpAiqx//z2C3LxuzABetTsp78MifQU/hDsBhvwS5ePOgiy8QnIUvSZLBOqiu5zxEtPU k06c5z50ja0lWX6VpUugObuhxi4Vttw3K7zNYM8NC4DLP5jtbWJp151apkhquWcl9JzY bZEK1p9WBLSPmxyn4Vg0b3QT8OWRa4s1EkQo/S8v6p3+7C9R0PyizKF5VqcrKMu3X+sR 9nVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZIGSdvGiYD2GBELDgywDOmwwWxenr12Kr2DoMn//kuM=; b=s9XGn501zEZNJJW1U1qtW/PfiPv933y5XnkUo2WRh3orjsYRKankh14MDGguR5VbDq YhuzthJVQ488gM/Esmj1vMI0KvB04J/9BTOcczHeNkeP9QuLGVU9OnPxK1GZqvUEZxqJ z0wnom897SRlStm19mj9WhsDoop0eFTbomUox5KT84tnNxA/z5Kv7gSHqSeqnHzNgKio YbiV51ts/xokzL+JEO7Nag0+nrTaAa/gUl5geidX8eu5AtpKbitN6JC8cIvLnkBXGq9W lsExIy9SZvICJWtsR6WiH68+OLMjiS6nLb6mLT9YKaJ+klCSQsNE8T2AdhOK87VlwbLI JD0A== X-Gm-Message-State: AOAM532uLRHiMIBuplcyf6QK2gU/OlJooiLeid/KweKFhfxsvUE8FHJO JUWYLgarhOzuYRJ3q9bCJQ453F8ZpWxWcEgMTaqMUh+Wl9ySIFoHY9LN0QCcV06YK2aQZeE7LUP fQKPEQZARmj6bhZLdk0wEwQB804EKNk9QWQd7mGQ1CPVJNmdxRbWtMh9vECZuu9yUH1ZjUVoZgQ == X-Google-Smtp-Source: ABdhPJxduzy1wJTzuhNOPKsHcuRjI58xZQYdefgC4WUFxt1Hdfue4z3brGTL/+xNbAtAulvOWJ/5ig== X-Received: by 2002:a05:6402:30b9:: with SMTP id df25mr13943028edb.136.1615550374374; Fri, 12 Mar 2021 03:59:34 -0800 (PST) Received: from madeliefje.horms.nl ([2001:982:7ed1:403:9eeb:e8ff:fe0d:5b6a]) by smtp.gmail.com with ESMTPSA id r17sm2857401edx.1.2021.03.12.03.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 03:59:33 -0800 (PST) From: Simon Horman To: dev@openvswitch.org Date: Fri, 12 Mar 2021 12:59:16 +0100 Message-Id: <20210312115917.6838-2-simon.horman@netronome.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210312115917.6838-1-simon.horman@netronome.com> References: <20210312115917.6838-1-simon.horman@netronome.com> MIME-Version: 1.0 Cc: oss-drivers@netronome.com, Simon Horman , Tianyu Yuan , "Yong . Xu" Subject: [ovs-dev] [PATCH v2 1/2] netdev-linux: correct unit of burst parameter 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" From: "Yong.Xu" Correct calculation of burst parameter used when configuring TC policer action for ingress port-based policing in the case where TC offload is in use. This now matches the value calculated for the case where TC offload is not in use. The division by 8 is to convert from bits to bytes. Its unclear why 64 was previously used. Fixes: e7f6ba220 ("lib/tc: add ingress ratelimiting support for tc-offload") Signed-off-by: Yong.Xu [simon: reworked changelog] Signed-off-by: Simon Horman Signed-off-by: Louis Peens --- lib/netdev-linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 15b25084b..f87a20075 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -2572,7 +2572,7 @@ exit: static struct tc_police tc_matchall_fill_police(uint32_t kbits_rate, uint32_t kbits_burst) { - unsigned int bsize = MIN(UINT32_MAX / 1024, kbits_burst) * 1024 / 64; + unsigned int bsize = MIN(UINT32_MAX / 1024, kbits_burst) * 1024 / 8; unsigned int bps = ((uint64_t) kbits_rate * 1000) / 8; struct tc_police police; struct tc_ratespec rate; From patchwork Fri Mar 12 11:59:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 1451944 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=jpJQ0SO+; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 ozlabs.org (Postfix) with ESMTPS id 4Dxkrm336kz9sS8 for ; Fri, 12 Mar 2021 22:59:52 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 60E0B6FA78; Fri, 12 Mar 2021 11:59:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WbEnGIvQ-AWX; Fri, 12 Mar 2021 11:59:43 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTP id 32CB96FACA; Fri, 12 Mar 2021 11:59:42 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2C4ABC0019; Fri, 12 Mar 2021 11:59:40 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id CA232C0012 for ; Fri, 12 Mar 2021 11:59:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8F57960679 for ; Fri, 12 Mar 2021 11:59:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SoZJrOA_QMB6 for ; Fri, 12 Mar 2021 11:59:37 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by smtp3.osuosl.org (Postfix) with ESMTPS id A3C7B60676 for ; Fri, 12 Mar 2021 11:59:37 +0000 (UTC) Received: by mail-ej1-x62d.google.com with SMTP id ox4so37228465ejb.11 for ; Fri, 12 Mar 2021 03:59:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cwsW6uWJ7889KuZrdkmcMKeVLeX6X/g6EjgZMNy+y90=; b=jpJQ0SO+kBSP9QHdOobQNJXFkZdf5kshAvYn9WGitM91SqLAjgs8lYexgdFCT10fgw j9HwiXSgBCl2krHNPaF1vmMg73EMErNnbuhILeBA+nQFjd6KhjK43f+SlsJ8fNw9EYRJ tyMLl8qkB+cLMjDfKZ2CMsrW+qND4BCOJXmVPawuCt/7PIt2jnUksnIyG/b6JpRecXXQ ozNEpdBzvNY9g4oIFwIqqlqCz0VBmcPge8w5Wzi9nxPj8pkXDlgGkgj9TuhFJlsRYP1k LCGhbYpIXke/LsD9OmUbWrbNML0i9epSqBbWa5i3wO66T7tLhseBJmZKqw9DIwpw1Y4e vIdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cwsW6uWJ7889KuZrdkmcMKeVLeX6X/g6EjgZMNy+y90=; b=qt49yaHbYk34G0ugnmww4Z1jD7GEGSFXZr/2dghyVrqSvpldIFr5Brg1UxKx3dvBix cpNMmgJaiE/KvzP9xAO8HQjBCAadEqft9KfYESy11hbxPje5xC1O+pMhi9B5bKvd4C+8 0r8IblDWFxfjDAuq5aLkCiJuTct6VpYVJFAXYX79MDkz3LUGN1CnA5C+KJjRiEUVGFoA kn39BR4LRf+Je7f/dfGeOGngRyfuw+TTQ9uwZLU2l7DZ6cYN9TTSuQ7N6Rpq91gOCYmU zu9xP+FiRPkUqTNab06o1HUYiRaZELW2t+UdIW5Di8E8ZZ+OLFugdwzY/3sT+wEJPijD kkkw== X-Gm-Message-State: AOAM530e2aE/WVPa3i0EtYFsapUyx8+JdgF0fVVZ1pMvHVwbTSJ2xIzT 8E1edAwGqL/tm4U7+5Cz1xISDkhE2b27WxUundjd/Jmft1Qf6WKnqHZUMHju+im0A34b2NAW0TU vUa7JOtbEXTdcwN+kxGTbjM/lACsfITeW0PR7Eq3XLOi0ndqCr0B+++CTtWfK2f4rwXwdlmDqRg == X-Google-Smtp-Source: ABdhPJx0so/hHcmix1e6nraZ58z0kLNxX5AfGJg0YNiyifuFUVXXSzZdsknFrtk0i8mWcur4QhBbkA== X-Received: by 2002:a17:906:a0d3:: with SMTP id bh19mr8340573ejb.199.1615550375503; Fri, 12 Mar 2021 03:59:35 -0800 (PST) Received: from madeliefje.horms.nl ([2001:982:7ed1:403:9eeb:e8ff:fe0d:5b6a]) by smtp.gmail.com with ESMTPSA id r17sm2857401edx.1.2021.03.12.03.59.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 03:59:35 -0800 (PST) From: Simon Horman To: dev@openvswitch.org Date: Fri, 12 Mar 2021 12:59:17 +0100 Message-Id: <20210312115917.6838-3-simon.horman@netronome.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210312115917.6838-1-simon.horman@netronome.com> References: <20210312115917.6838-1-simon.horman@netronome.com> MIME-Version: 1.0 Cc: oss-drivers@netronome.com, Simon Horman , Tianyu Yuan , "Yong . Xu" Subject: [ovs-dev] [PATCH v2 2/2] testsuite: add test cases for ingress_policing parameters 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" From: Tianyu Yuan * Exercise OVS setting of ingress_policing parameters using ovs-vsctl and verify that the correct values are stored on OVSDB. * Verify the ingress_policing parameters with tc command. Also check offload and non-offload in tc software datapath based on tc filter type (matchall and basic). Example invocation: make check TESTSUITEFLAGS='-k ingress_policing' make check-offloads TESTSUITEFLAGS='-k ingress_policing' Signed-off-by: Tianyu Yuan Signed-off-by: Simon Horman Signed-off-by: Louis Peens --- tests/ovs-vsctl.at | 58 ++++++++++++++++++++++++++++++++ tests/system-offloads-traffic.at | 47 ++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/tests/ovs-vsctl.at b/tests/ovs-vsctl.at index d2cb41403..790d46f18 100644 --- a/tests/ovs-vsctl.at +++ b/tests/ovs-vsctl.at @@ -1659,3 +1659,61 @@ AT_CHECK([grep "server name" ovsdb-server.log], [0], OVS_VSCTL_CLEANUP AT_CLEANUP + +dnl ---------------------------------------------------------------------- +AT_BANNER([set ingress policing test]) + +AT_SETUP([set ingress_policing_rate and ingress_policing_burst]) +AT_KEYWORDS([ingress_policing]) +OVS_VSCTL_SETUP +AT_CHECK([RUN_OVS_VSCTL_TOGETHER( + [add-br a], + [add-port a a1], + [set interface a1 ingress_policing_rate=100], + [set interface a1 ingress_policing_burst=10], + [list interface a1 > configured_interface_a1.txt])], + [0], []) +AT_CHECK( + [uuidfilt configured_interface_a1.txt], + [0], + [[ + + + +_uuid : <0> +admin_state : [] +bfd : {} +bfd_status : {} +cfm_fault : [] +cfm_fault_status : [] +cfm_flap_count : [] +cfm_health : [] +cfm_mpid : [] +cfm_remote_mpids : [] +cfm_remote_opstate : [] +duplex : [] +error : [] +external_ids : {} +ifindex : [] +ingress_policing_burst: 10 +ingress_policing_rate: 100 +lacp_current : [] +link_resets : [] +link_speed : [] +link_state : [] +lldp : {} +mac : [] +mac_in_use : [] +mtu : [] +mtu_request : [] +name : a1 +ofport : [] +ofport_request : [] +options : {} +other_config : {} +statistics : {} +status : {} +type : "" +]]) +OVS_VSCTL_CLEANUP +AT_CLEANUP diff --git a/tests/system-offloads-traffic.at b/tests/system-offloads-traffic.at index 4f601ef93..b9cd29c95 100644 --- a/tests/system-offloads-traffic.at +++ b/tests/system-offloads-traffic.at @@ -70,3 +70,50 @@ AT_CHECK([ovs-appctl upcall/show | grep -E "offloaded flows : [[1-9]]"], [0], [i OVS_TRAFFIC_VSWITCHD_STOP AT_CLEANUP + +AT_SETUP([offloads - set ingress_policing_rate and ingress_policing_burst - offloads disabled]) +AT_KEYWORDS([ingress_policing]) +OVS_TRAFFIC_VSWITCHD_START() +AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=false]) +AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) +ADD_NAMESPACES(at_ns0) +ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") +AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_rate=100]) +AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_burst=10]) +AT_CHECK([ovs-vsctl list open | grep other_config > other_config.txt]) +AT_CHECK([cat other_config.txt],[0], + [other_config : {hw-offload="false"} +]) +AT_CHECK([tc -s -d filter show dev ovs-p0 ingress |grep rate| awk '{a=index($0,"rate");b=index($0,"mtu");print substr($0,a,b-a-1)}' > tc_ovs-p0.txt ],[0],[]) +AT_CHECK([cat tc_ovs-p0.txt],[0], + [rate 100Kbit burst 1280b +]) +AT_CHECK([tc -s -d filter show dev ovs-p0 ingress | grep basic | head -n 1 | awk '{a=index($0,"basic");print substr($0,a,5)}'| head -n 1],[0], + [basic +]) +OVS_TRAFFIC_VSWITCHD_STOP +AT_CLEANUP + + +AT_SETUP([offloads - set ingress_policing_rate and ingress_policing_burst - offloads enabled]) +AT_KEYWORDS([ingress_policing]) +OVS_TRAFFIC_VSWITCHD_START() +AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=true]) +AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) +ADD_NAMESPACES(at_ns0) +ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24") +AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_rate=100]) +AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_burst=10]) +AT_CHECK([ovs-vsctl list open | grep other_config > other_config.txt]) +AT_CHECK([cat other_config.txt],[0], + [other_config : {hw-offload="true"} +]) +AT_CHECK([tc -s -d filter show dev ovs-p0 ingress | grep rate| awk '{a=index($0,"rate");b=index($0,"mtu");print substr($0,a,b-a-1)}' > tc_ovs-p0.txt ],[0],[]) +AT_CHECK([cat tc_ovs-p0.txt],[0], + [rate 100Kbit burst 1280b +]) +AT_CHECK([tc -s -d filter show dev ovs-p0 ingress | grep matchall | head -n 1 | awk '{a=index($0,"matchall");print substr($0,a,8)}'| head -n 1],[0], + [matchall +]) +OVS_TRAFFIC_VSWITCHD_STOP +AT_CLEANUP