From patchwork Mon Nov 11 10:43:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 2009775 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=Yabjel+3; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xn5kQ6Vjyz1xyD for ; Mon, 11 Nov 2024 21:43:42 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 54DE86061E; Mon, 11 Nov 2024 10:43:41 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id a5j3Es97NXjK; Mon, 11 Nov 2024 10:43:40 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 189C060606 Authentication-Results: smtp3.osuosl.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=Yabjel+3 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 189C060606; Mon, 11 Nov 2024 10:43:40 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DA02DC0889; Mon, 11 Nov 2024 10:43:39 +0000 (UTC) X-Original-To: ovs-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 2D513C087D for ; Mon, 11 Nov 2024 10:43:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 20E5A4036A for ; Mon, 11 Nov 2024 10:43:38 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id tW-o9ZNhwN3H for ; Mon, 11 Nov 2024 10:43:36 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=dceara@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org A62EB4032B Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org A62EB4032B Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Yabjel+3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id A62EB4032B for ; Mon, 11 Nov 2024 10:43:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731321814; 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; bh=WInMmRVf7UDxGsCvaPNEDLBjbj8na35YJQG+su+BYp8=; b=Yabjel+3byOWTEI1X1Rq2uQdoMqN5QWYRXPamqJ6/lIsbqiz1kcaHhtI/rseTVxmtNEl8J byBe5X04ihD95BHTjvC79GEU8VrTEsguH6o3o2/Atdmj2UQ87v52slwofQd97MrJPC1puP eStu5Fs4ZuDDXfmSkpAJUWDuthFciWc= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-104-R8V1bwuBMomtDnk58UA7-A-1; Mon, 11 Nov 2024 05:43:33 -0500 X-MC-Unique: R8V1bwuBMomtDnk58UA7-A-1 X-Mimecast-MFC-AGG-ID: R8V1bwuBMomtDnk58UA7-A Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D837519560A6; Mon, 11 Nov 2024 10:43:31 +0000 (UTC) Received: from cecil-rh.redhat.com (unknown [10.39.193.175]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 99C9F19560A3; Mon, 11 Nov 2024 10:43:30 +0000 (UTC) From: Dumitru Ceara To: ovs-dev@openvswitch.org Date: Mon, 11 Nov 2024 11:43:27 +0100 Message-ID: <20241111104327.65539-1-dceara@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: jo4ZpRo59TOwschhPjViHBpNuJK2jV5ThGeUZ9Nktdc_1731321812 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] logical-fields: Reuse registers for ct_*_dst() actions. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: i.maximets@ovn.org Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The actions that retrieve the original tuple destination IPs and ports were used in the following way in ovn-northd: REG_ORIG_DIP_IPV4 " = ct_nw_dst() REG_ORIG_DIP_IPV6 " = ct_ip6_dst() REG_ORIG_TP_DPORT " = ct_tp_dst() Where: REG_ORIG_DIP_IPV4 is reg1 REG_ORIG_DIP_IPV6 is xxreg1 REG_ORIG_TP_DPORT is reg2[0..15] While the actions use a different intermediate register: ct_nw_dst() was reg4<-0; reg4<-ct_nw_dst ct_ip6_dst() was xxreg0<-0; xxreg0<-ct_ip6_dst ct_tp_dst() was reg8[0..15]<-0; reg8[0..15]<-ct_tp_dst We can reduce the set of registers we use in the OVN pipeline by changing the action definition to use the same registers ovn-northd uses as final destination for the ct_*_dst() values. This will generate the following openflow rules: REG_ORIG_DIP_IPV4 " = ct_nw_dst() reg1<-0; reg1<-ct_nw_dst; reg1<-reg1 REG_ORIG_DIP_IPV6 " = ct_ip6_dst() xxreg1<-0; xxreg1<-ct_ip6_dst; xxreg1<-xxreg1 REG_ORIG_TP_DPORT " = ct_tp_dst() reg2[0..15]<-0; reg2[0..15]<-ct_tp_dst; reg2[0..15]<-reg2[0..15] As Ilya Maximets points out, overlapping source and destination are well defined for move actions: https://opennetworking.org/wp-content/uploads/2014/10/openflow-switch-v1.5.0.noipr.pdf This action must behaves properly when src_oxm_id overlaps with dst_oxm_id, that is, it behaves as if src_oxm_id were copied out to a temporary buffer, then the temporary buffer copied to dst_oxm_id, if this is not possible the switch must reject the Copy Field action with a Bad Set Type error message. OpenvSwitch doesn't reject such actions. Fixes: 0f806cf08c36 ("Fix load balanced hairpin traffic for fragmented packets.") Signed-off-by: Dumitru Ceara Acked-by: Ales Musil --- include/ovn/logical-fields.h | 7 ++++--- tests/ovn.at | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/ovn/logical-fields.h b/include/ovn/logical-fields.h index d563e044cb..70c6b93c41 100644 --- a/include/ovn/logical-fields.h +++ b/include/ovn/logical-fields.h @@ -60,9 +60,10 @@ enum ovn_controller_event { #define MFF_LOG_LB_AFF_MATCH_LR_IP6_ADDR MFF_XXREG1 #define MFF_LOG_LB_AFF_MATCH_PORT MFF_REG8 -#define MFF_LOG_CT_ORIG_NW_DST_ADDR MFF_REG4 -#define MFF_LOG_CT_ORIG_IP6_DST_ADDR MFF_XXREG0 -#define MFF_LOG_CT_ORIG_TP_DST_PORT MFF_REG8 +#define MFF_LOG_CT_ORIG_NW_DST_ADDR MFF_REG1 /* REG_ORIG_DIP_IPV4 */ +#define MFF_LOG_CT_ORIG_IP6_DST_ADDR MFF_XXREG1 /* REG_ORIG_DIP_IPV6 */ +#define MFF_LOG_CT_ORIG_TP_DST_PORT MFF_REG2 /* REG_ORIG_TP_DPORT + * (bits 0..15). */ void ovn_init_symtab(struct shash *symtab); diff --git a/tests/ovn.at b/tests/ovn.at index 15b78f4c37..03fd2090fc 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -2420,10 +2420,10 @@ mac_cache_use; # ct_nw_dst() reg1 = ct_nw_dst(); - encodes as set_field:0->reg4,resubmit(,OFTABLE_CT_ORIG_NW_DST_LOAD),move:NXM_NX_REG4[[]]->NXM_NX_XXREG0[[64..95]] + encodes as set_field:0->reg1,resubmit(,OFTABLE_CT_ORIG_NW_DST_LOAD),move:NXM_NX_REG1[[]]->NXM_NX_XXREG0[[64..95]] xreg1[[3..34]] = ct_nw_dst(); - encodes as set_field:0->reg4,resubmit(,OFTABLE_CT_ORIG_NW_DST_LOAD),move:NXM_NX_REG4[[]]->NXM_NX_XXREG0[[3..34]] + encodes as set_field:0->reg1,resubmit(,OFTABLE_CT_ORIG_NW_DST_LOAD),move:NXM_NX_REG1[[]]->NXM_NX_XXREG0[[3..34]] reg1[[3..34]] = ct_nw_dst(); Cannot select bits 3 to 34 of 32-bit field reg1. @@ -2442,7 +2442,7 @@ ct_nw_dst(); # ct_ip6_dst() xxreg1 = ct_ip6_dst(); - encodes as set_field:0/0xffffffffffffffff->xxreg0,set_field:0/0xffffffffffffffff0000000000000000->xxreg0,resubmit(,OFTABLE_CT_ORIG_IP6_DST_LOAD),move:NXM_NX_XXREG0[[]]->NXM_NX_XXREG1[[]] + encodes as set_field:0/0xffffffffffffffff->xxreg1,set_field:0/0xffffffffffffffff0000000000000000->xxreg1,resubmit(,OFTABLE_CT_ORIG_IP6_DST_LOAD),move:NXM_NX_XXREG1[[]]->NXM_NX_XXREG1[[]] reg1 = ct_ip6_dst(); Cannot use 32-bit field reg1[[0..31]] where 128-bit field is required. @@ -2455,7 +2455,7 @@ ct_ip6_dst(); # ct_tp_dst() reg1[[0..15]] = ct_tp_dst(); - encodes as set_field:0/0xffff->reg8,resubmit(,OFTABLE_CT_ORIG_TP_DST_LOAD),move:NXM_NX_REG8[[0..15]]->NXM_NX_XXREG0[[64..79]] + encodes as set_field:0/0xffff->reg2,resubmit(,OFTABLE_CT_ORIG_TP_DST_LOAD),move:NXM_NX_REG2[[0..15]]->NXM_NX_XXREG0[[64..79]] reg1 = ct_tp_dst(); Cannot use 32-bit field reg1[[0..31]] where 16-bit field is required.