Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp947512rwb; Tue, 29 Nov 2022 07:13:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ogF7E61oZwQ7uzxiJthCl/0gbCAdUTPeySPeYQld3WWbVGQOoKdcPO5Ep7R3pxqYo9M4p X-Received: by 2002:aa7:d556:0:b0:45c:6467:94e2 with SMTP id u22-20020aa7d556000000b0045c646794e2mr51660069edr.295.1669734829940; Tue, 29 Nov 2022 07:13:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669734829; cv=none; d=google.com; s=arc-20160816; b=qckj1pL3rP2y0Ws0Qz/SFbBhGQgTUJVWRRCgXEstmcswz+mXtp9ueG/E9sH7/SbhcD //hL/OdU6nGjRSMtykZkCKLLEo4hWs4A3wA8/jjBRkn+JjR5nvAFSSTU0kmMgzLWzMcf k+EOnEq5kOt7ZfTl0ruJLPd4TtOV4dAP+7B2PxxkPsQ98aTfbpAN9s3Tvdfk/LylpYV6 E82rI91qJoWo/wUVgh1VOKQ/iPAik6L1l8Kf8rl2FUJyvmLSbXO/l9nNG9XMp8hn6c10 wQ3RyMI6bxZGGGhDj9YRKXT+fOB7gGI/Kfiq1KLUNuD/tTEHkPdG2GZFMxGXzg75sCN/ /aSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature; bh=4AEq8/e4uJ/4ykggQax+wHLvQuwMyqFr7ojK3DGvdTA=; b=pvNpDd5uhfjlyBpwxTA1HyUNL4gYHp0uWummmc3YrKQkveYrybaFBgivIPr6+Ws1cx abxiHOg9/ZPVjf6kQS97S6x0lCzAF+N2SC0fySwDWHsRY1mIDv8YWlOzaRmB2RfuX+hh Xfq/rO4ie3Dp/ms36h0yFWy1Pk6NbBeRNEOU60lgHwC5c0c+ENDi9X6IdoD2cGdX5ynz yD5PtkHwq+mOM8abOCFBHxX06X5aTnfzaz1Cq22Smwrl1qYctOvdbfcYjG+U3TF/6iD1 QXGyp35ZUgT2Ji9FWhaF13Cf/xOzNnfR92g9r0BHb+BNmdwczMQgSY3cFsmsErJrQaJG 2i/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AkcSdyia; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn2-20020a17090794c200b007877eb5687csi13328218ejc.249.2022.11.29.07.13.28; Tue, 29 Nov 2022 07:13:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AkcSdyia; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230119AbiK2O1j (ORCPT + 84 others); Tue, 29 Nov 2022 09:27:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233479AbiK2O1a (ORCPT ); Tue, 29 Nov 2022 09:27:30 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E9755C0E0 for ; Tue, 29 Nov 2022 06:26:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669731988; 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=4AEq8/e4uJ/4ykggQax+wHLvQuwMyqFr7ojK3DGvdTA=; b=AkcSdyiaj4HVwm2jNfYaP1CTrD61NjisetmpWT6cg0WyfXdkcmNppn1SdB0DjkpB0Zteli J2etCNOJH5fu+3rVClaOT1nkl5wSwZRxIsElzIBRE6BtoRA1pg4MQp2s8Jqsl+wM4hco5B HRlYPbniql5tsEYXuLgCw1taoUtl4E0= 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-539-4u3ekesANO6myoqiLy0qIg-1; Tue, 29 Nov 2022 09:26:25 -0500 X-MC-Unique: 4u3ekesANO6myoqiLy0qIg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AB340185A7AA; Tue, 29 Nov 2022 14:26:24 +0000 (UTC) Received: from RHTPC1VM0NT (unknown [10.22.34.89]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A3D8492B07; Tue, 29 Nov 2022 14:26:24 +0000 (UTC) From: Aaron Conole To: Adrian Moreno Cc: Ilya Maximets , netdev@vger.kernel.org, dev@openvswitch.org, linux-kernel@vger.kernel.org, Eric Dumazet , linux-kselftest@vger.kernel.org, Jakub Kicinski , Paolo Abeni , Shuah Khan , "David S. Miller" Subject: Re: [ovs-dev] [RFC net-next 1/6] openvswitch: exclude kernel flow key from upcalls References: <20221122140307.705112-1-aconole@redhat.com> <20221122140307.705112-2-aconole@redhat.com> <83a0b3e4-1327-c1c4-4eb4-9a25ff533d1d@redhat.com> <753d995d-d4f4-bf2e-994d-435a36414127@redhat.com> Date: Tue, 29 Nov 2022 09:26:22 -0500 In-Reply-To: <753d995d-d4f4-bf2e-994d-435a36414127@redhat.com> (Adrian Moreno's message of "Mon, 28 Nov 2022 10:12:21 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adrian Moreno writes: > On 11/25/22 16:51, Ilya Maximets wrote: >> On 11/25/22 16:29, Adrian Moreno wrote: >>> >>> >>> On 11/23/22 22:22, Ilya Maximets wrote: >>>> On 11/22/22 15:03, Aaron Conole wrote: >>>>> When processing upcall commands, two groups of data are available to >>>>> userspace for processing: the actual packet data and the kernel >>>>> sw flow key data.=C2=A0 The inclusion of the flow key allows the user= space >>>>> avoid running through the dissection again. >>>>> >>>>> However, the userspace can choose to ignore the flow key data, as is >>>>> the case in some ovs-vswitchd upcall processing.=C2=A0 For these mess= ages, >>>>> having the flow key data merely adds additional data to the upcall >>>>> pipeline without any actual gain.=C2=A0 Userspace simply throws the d= ata >>>>> away anyway. >>>> >>>> Hi, Aaron.=C2=A0 While it's true that OVS in userpsace is re-parsing t= he >>>> packet from scratch and using the newly parsed key for the OpenFlow >>>> translation, the kernel-porvided key is still used in a few important >>>> places.=C2=A0 Mainly for the compatibility checking.=C2=A0 The use is = described >>>> here in more details: >>>> =C2=A0=C2=A0 https://docs.kernel.org/networking/openvswitch.html#flow= -key-compatibility >>>> >>>> We need to compare the key generated in userspace with the key >>>> generated by the kernel to know if it's safe to install the new flow >>>> to the kernel, i.e. if the kernel and OVS userpsace are parsing the >>>> packet in the same way. >>>> >>> >>> Hi Ilya, >>> >>> Do we need to do that for every packet? >>> Could we send a bitmask of supported fields to userspace at feature >>> negotiation and let OVS slowpath flows that it knows the kernel won't >>> be able to handle properly? >> It's not that simple, because supported fields in a packet depend >> on previous fields in that same packet. For example, parsing TCP >> header is generally supported, but it won't be parsed for IPv6 >> fragments (even the first one), number of vlan headers will affect >> the parsing as we do not parse deeper than 2 vlan headers, etc. >> So, I'm afraid we have to have a per-packet information, unless we >> can somehow probe all the possible valid combinations of packet >> headers. >>=20 > > Surely. I understand that we'd need more than just a bit per > field. Things like L4 on IPv6 frags would need another bit and the > number of VLAN headers would need some more. But, are these a handful > of exceptions or do we really need all the possible combinations of > headers? If it's a matter of naming a handful of corner cases I think > we could consider expressing them at initialization time and safe some > buffer space plus computation time both in kernel and userspace. I will take a bit more of a look here - there must surely be a way to express this when pulling information via DP_GET command so that we don't need to wait for a packet to come in to figure out whether we can parse it.