From patchwork Thu Jun 15 14:05:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 1795452 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.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=hocEE9oy; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QhkbQ13bNz20Wy for ; Fri, 16 Jun 2023 00:05:54 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id D46D841930; Thu, 15 Jun 2023 14:05:51 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D46D841930 Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hocEE9oy X-Virus-Scanned: amavisd-new at osuosl.org 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 cZzPEHI7cswX; Thu, 15 Jun 2023 14:05:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 847D541949; Thu, 15 Jun 2023 14:05:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 847D541949 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CEAE0C008D; Thu, 15 Jun 2023 14:05:48 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 19A58C0092 for ; Thu, 15 Jun 2023 14:05:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8094C61435 for ; Thu, 15 Jun 2023 14:05:40 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 8094C61435 Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hocEE9oy 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 iGisUlVv4Qho for ; Thu, 15 Jun 2023 14:05:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org AC4E661431 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id AC4E661431 for ; Thu, 15 Jun 2023 14:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686837938; 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=2kYJrDuYDzE8nUOZfQj3DNEO28zQ+bwPF7hqHBGAFr4=; b=hocEE9oypZ9ylR/6AJzmGgSRqlfqZGtweek6FIo7EX1QTJAI3+tqAj1WlE51JEtOdilxJp QucmxamrUtEuyXN6msMil5m7l0Y6GKvGrWOP/W1frOnApdtUIEu3T9fwpNm8qRXTZp1ezm l5TMOrhmk2SjaNtilhAiQ7eZqzM8TFw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-628-j0LtVJw5P3WJiyxRqOFqxA-1; Thu, 15 Jun 2023 10:05:16 -0400 X-MC-Unique: j0LtVJw5P3WJiyxRqOFqxA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 09743857D0A for ; Thu, 15 Jun 2023 14:05:16 +0000 (UTC) Received: from amusil.redhat.com (unknown [10.45.224.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8325B2166B26; Thu, 15 Jun 2023 14:05:15 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Thu, 15 Jun 2023 16:05:09 +0200 Message-Id: <20230615140513.289357-2-amusil@redhat.com> In-Reply-To: <20230615140513.289357-1-amusil@redhat.com> References: <20230615140513.289357-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [RFC PATCH ovn 1/5] actions: Add mac_cache_use action 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" The mac_cache_use is just resubmit to MAC use cache table, which will be later on used by the timestamp refresh mechanism. This is a preparation for the MAC binding refresh mechanism. Signed-off-by: Ales Musil --- include/ovn/actions.h | 3 +++ lib/actions.c | 17 +++++++++++++++++ ovn-sb.xml | 8 ++++++++ tests/ovn.at | 4 ++++ tests/test-ovn.c | 1 + utilities/ovn-trace.c | 2 ++ 6 files changed, 35 insertions(+) diff --git a/include/ovn/actions.h b/include/ovn/actions.h index 23a919049..04bb6ffd0 100644 --- a/include/ovn/actions.h +++ b/include/ovn/actions.h @@ -126,6 +126,7 @@ struct collector_set_ids; OVNACT(COMMIT_LB_AFF, ovnact_commit_lb_aff) \ OVNACT(CHK_LB_AFF, ovnact_result) \ OVNACT(SAMPLE, ovnact_sample) \ + OVNACT(MAC_CACHE_USE, ovnact_null) \ /* enum ovnact_type, with a member OVNACT_ for each action. */ enum OVS_PACKED_ENUM ovnact_type { @@ -879,6 +880,8 @@ struct ovnact_encode_params { sends packets to controller. */ uint32_t common_nat_ct_zone; /* When performing NAT in a common CT zone, this determines which CT zone to use */ + uint32_t mac_cache_use_table; /* OpenFlow table for 'mac_cache_use' + * to resubmit. */ }; void ovnacts_encode(const struct ovnact[], size_t ovnacts_len, diff --git a/lib/actions.c b/lib/actions.c index 037172e60..4f67df13f 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -5224,6 +5224,20 @@ encode_CHK_LB_AFF(const struct ovnact_result *res, MLF_USE_LB_AFF_SESSION_BIT, ofpacts); } +static void +format_MAC_CACHE_USE(const struct ovnact_null *null OVS_UNUSED, struct ds *s) +{ + ds_put_cstr(s, "mac_cache_use;"); +} + +static void +encode_MAC_CACHE_USE(const struct ovnact_null *null OVS_UNUSED, + const struct ovnact_encode_params *ep, + struct ofpbuf *ofpacts) +{ + emit_resubmit(ofpacts, ep->mac_cache_use_table); +} + /* Parses an assignment or exchange or put_dhcp_opts action. */ static void parse_set_action(struct action_context *ctx) @@ -5429,9 +5443,12 @@ parse_action(struct action_context *ctx) parse_commit_lb_aff(ctx, ovnact_put_COMMIT_LB_AFF(ctx->ovnacts)); } else if (lexer_match_id(ctx->lexer, "sample")) { parse_sample(ctx); + } else if (lexer_match_id(ctx->lexer, "mac_cache_use")) { + ovnact_put_MAC_CACHE_USE(ctx->ovnacts); } else { lexer_syntax_error(ctx->lexer, "expecting action"); } + lexer_force_match(ctx->lexer, LEX_T_SEMICOLON); return !ctx->lexer->error; } diff --git a/ovn-sb.xml b/ovn-sb.xml index f9dd13602..46aedf973 100644 --- a/ovn-sb.xml +++ b/ovn-sb.xml @@ -2790,6 +2790,14 @@ tcp.flags = RST; + +
mac_cache_use;
+
+

+ This action resubmits to corresponding table which updates the + use statistics of MAC cache. +

+
diff --git a/tests/ovn.at b/tests/ovn.at index 544fba187..049f04502 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -2253,6 +2253,10 @@ sample(probability=0,collector_set=200,obs_domain=300,obs_point=foo); sample(probability=10,foo=bar,obs_domain=0,obs_point=1000); Syntax error at `foo' unknown argument. +# mac_cache_use +mac_cache_use; + encodes as resubmit(,79) + # Miscellaneous negative tests. ; Syntax error at `;'. diff --git a/tests/test-ovn.c b/tests/test-ovn.c index 6c7754eac..1f1e27b51 100644 --- a/tests/test-ovn.c +++ b/tests/test-ovn.c @@ -1374,6 +1374,7 @@ test_parse_actions(struct ovs_cmdl_context *ctx OVS_UNUSED) .common_nat_ct_zone = MFF_LOG_DNAT_ZONE, .in_port_sec_ptable = OFTABLE_CHK_IN_PORT_SEC, .out_port_sec_ptable = OFTABLE_CHK_OUT_PORT_SEC, + .mac_cache_use_table = OFTABLE_MAC_CACHE_USE, .lflow_uuid.parts = { 0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc, 0xdddddddd}, .dp_key = 0xabcdef, diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c index fb54ed060..e6b161850 100644 --- a/utilities/ovn-trace.c +++ b/utilities/ovn-trace.c @@ -3353,6 +3353,8 @@ trace_actions(const struct ovnact *ovnacts, size_t ovnacts_len, break; case OVNACT_SAMPLE: break; + case OVNACT_MAC_CACHE_USE: + break; } } ofpbuf_uninit(&stack);