From patchwork Mon Mar 11 17:51:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Garver X-Patchwork-Id: 1910577 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.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TtkqT0N3vz1yWy for ; Tue, 12 Mar 2024 04:51:47 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A683E60861; Mon, 11 Mar 2024 17:51: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 JVhf2VKR00Wz; Mon, 11 Mar 2024 17:51:42 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org BCC7060848 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id BCC7060848; Mon, 11 Mar 2024 17:51:42 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8AD0CC0037; Mon, 11 Mar 2024 17:51:42 +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 B3E2CC0037 for ; Mon, 11 Mar 2024 17:51:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9340C6084F for ; Mon, 11 Mar 2024 17:51:41 +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 AOXxh5wqzJyO for ; Mon, 11 Mar 2024 17:51:41 +0000 (UTC) Received-SPF: Neutral (mailfrom) identity=mailfrom; client-ip=207.211.30.44; helo=us-smtp-delivery-44.mimecast.com; envelope-from=eric@garver.life; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 7FD0060831 Authentication-Results: smtp3.osuosl.org; dmarc=none (p=none dis=none) header.from=garver.life DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 7FD0060831 Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [207.211.30.44]) by smtp3.osuosl.org (Postfix) with ESMTPS id 7FD0060831 for ; Mon, 11 Mar 2024 17:51:39 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-695-s9rBOzsKMhqAS1rwDWwtww-1; Mon, 11 Mar 2024 13:51:36 -0400 X-MC-Unique: s9rBOzsKMhqAS1rwDWwtww-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E08D811E81; Mon, 11 Mar 2024 17:51:36 +0000 (UTC) Received: from egarver-mac.redhat.com (unknown [10.22.16.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55C59112132A; Mon, 11 Mar 2024 17:51:36 +0000 (UTC) From: Eric Garver To: dev@openvswitch.org Date: Mon, 11 Mar 2024 13:51:31 -0400 Message-ID: <20240311175134.67252-3-eric@garver.life> In-Reply-To: <20240311175134.67252-1-eric@garver.life> References: <20240311175134.67252-1-eric@garver.life> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: garver.life Cc: Ilya Maximets Subject: [ovs-dev] [PATCH v11 2/5] dpif: Make get_datapath_cap() access support by pointer. 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" This avoids copying the support struct onto the stack. Signed-off-by: Eric Garver Acked-by: Eelco Chaudron --- ofproto/ofproto-dpif.c | 59 +++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index f59d69c4d1e8..d732198de5ea 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -5688,47 +5688,46 @@ ct_zone_limit_protection_update(const char *datapath_type, bool protected) static void get_datapath_cap(const char *datapath_type, struct smap *cap) { - struct odp_support odp; - struct dpif_backer_support s; + struct dpif_backer_support *s; struct dpif_backer *backer = shash_find_data(&all_dpif_backers, datapath_type); if (!backer) { return; } - s = backer->rt_support; - odp = s.odp; + s = &backer->rt_support; /* ODP_SUPPORT_FIELDS */ smap_add_format(cap, "max_vlan_headers", "%"PRIuSIZE, - odp.max_vlan_headers); - smap_add_format(cap, "max_mpls_depth", "%"PRIuSIZE, odp.max_mpls_depth); - smap_add(cap, "recirc", odp.recirc ? "true" : "false"); - smap_add(cap, "ct_state", odp.ct_state ? "true" : "false"); - smap_add(cap, "ct_zone", odp.ct_zone ? "true" : "false"); - smap_add(cap, "ct_mark", odp.ct_mark ? "true" : "false"); - smap_add(cap, "ct_label", odp.ct_label ? "true" : "false"); - smap_add(cap, "ct_state_nat", odp.ct_state_nat ? "true" : "false"); - smap_add(cap, "ct_orig_tuple", odp.ct_orig_tuple ? "true" : "false"); - smap_add(cap, "ct_orig_tuple6", odp.ct_orig_tuple6 ? "true" : "false"); - smap_add(cap, "nd_ext", odp.nd_ext ? "true" : "false"); + s->odp.max_vlan_headers); + smap_add_format(cap, "max_mpls_depth", "%"PRIuSIZE, s->odp.max_mpls_depth); + smap_add(cap, "recirc", s->odp.recirc ? "true" : "false"); + smap_add(cap, "ct_state", s->odp.ct_state ? "true" : "false"); + smap_add(cap, "ct_zone", s->odp.ct_zone ? "true" : "false"); + smap_add(cap, "ct_mark", s->odp.ct_mark ? "true" : "false"); + smap_add(cap, "ct_label", s->odp.ct_label ? "true" : "false"); + smap_add(cap, "ct_state_nat", s->odp.ct_state_nat ? "true" : "false"); + smap_add(cap, "ct_orig_tuple", s->odp.ct_orig_tuple ? "true" : "false"); + smap_add(cap, "ct_orig_tuple6", s->odp.ct_orig_tuple6 ? "true" : "false"); + smap_add(cap, "nd_ext", s->odp.nd_ext ? "true" : "false"); /* DPIF_SUPPORT_FIELDS */ - smap_add(cap, "masked_set_action", s.masked_set_action ? "true" : "false"); - smap_add(cap, "tnl_push_pop", s.tnl_push_pop ? "true" : "false"); - smap_add(cap, "ufid", s.ufid ? "true" : "false"); - smap_add(cap, "trunc", s.trunc ? "true" : "false"); - smap_add(cap, "clone", s.clone ? "true" : "false"); - smap_add(cap, "sample_nesting", s.sample_nesting ? "true" : "false"); - smap_add(cap, "ct_eventmask", s.ct_eventmask ? "true" : "false"); - smap_add(cap, "ct_clear", s.ct_clear ? "true" : "false"); - smap_add_format(cap, "max_hash_alg", "%"PRIuSIZE, s.max_hash_alg); - smap_add(cap, "check_pkt_len", s.check_pkt_len ? "true" : "false"); - smap_add(cap, "ct_timeout", s.ct_timeout ? "true" : "false"); + smap_add(cap, "masked_set_action", + s->masked_set_action ? "true" : "false"); + smap_add(cap, "tnl_push_pop", s->tnl_push_pop ? "true" : "false"); + smap_add(cap, "ufid", s->ufid ? "true" : "false"); + smap_add(cap, "trunc", s->trunc ? "true" : "false"); + smap_add(cap, "clone", s->clone ? "true" : "false"); + smap_add(cap, "sample_nesting", s->sample_nesting ? "true" : "false"); + smap_add(cap, "ct_eventmask", s->ct_eventmask ? "true" : "false"); + smap_add(cap, "ct_clear", s->ct_clear ? "true" : "false"); + smap_add_format(cap, "max_hash_alg", "%"PRIuSIZE, s->max_hash_alg); + smap_add(cap, "check_pkt_len", s->check_pkt_len ? "true" : "false"); + smap_add(cap, "ct_timeout", s->ct_timeout ? "true" : "false"); smap_add(cap, "explicit_drop_action", - s.explicit_drop_action ? "true" :"false"); - smap_add(cap, "lb_output_action", s.lb_output_action ? "true" : "false"); - smap_add(cap, "ct_zero_snat", s.ct_zero_snat ? "true" : "false"); - smap_add(cap, "add_mpls", s.add_mpls ? "true" : "false"); + s->explicit_drop_action ? "true" :"false"); + smap_add(cap, "lb_output_action", s->lb_output_action ? "true" : "false"); + smap_add(cap, "ct_zero_snat", s->ct_zero_snat ? "true" : "false"); + smap_add(cap, "add_mpls", s->add_mpls ? "true" : "false"); /* The ct_tuple_flush is implemented on dpif level, so it is supported * for all backers. */