Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp963748pxp; Wed, 16 Mar 2022 22:48:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFnAIoovC6u+KqZ5DAQIikobRkca0cKcC8ANkRTEU19DSBp2ruwtOIqzuWyxvZjCdTDDI6 X-Received: by 2002:a17:903:20cd:b0:153:aa6e:88de with SMTP id i13-20020a17090320cd00b00153aa6e88demr2927963plb.110.1647496107813; Wed, 16 Mar 2022 22:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647496107; cv=none; d=google.com; s=arc-20160816; b=RBTv5rwv4Dq3daLp8gHcLJfIcLXPwpDWVvObCBmJFRR2FYXprYnaHZ5SeIDpSqkjlA eKDiUSZ7/BN6fNosyjHj7NBC1BJ7wrfkfsQAYet5J7Dqz/6ZEODeIacaT+RLH2exn41j yQ8vD3ipWlMZr9YIA9nIOAVQ/QeN2Uw3nCslvsjgni4z74VWLXVdVUVZ03cTz8+xm5R2 Eoefbnpp8I8thReS3UDe1ND/EKVIED/1zGyLfMS3OAmrv3d3xfuWZdWVtIKrsvxmOlB+ IXR742pQeejtgOquVot3KyqrLyfvvjluMEUR5fu40lp50aPq5mXfRZFGQza5Nsgecbxm mPHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:to:content-language:cc:user-agent:mime-version:date :message-id; bh=bf3Lf5N+oLXMk6/+X6gq+V8l+bbEzEH21LqNjmqgqaw=; b=K4H0vwxzpVZ2koDLcSEgW8m6ROf+jUywe/AOMiXRgKIoo2ZYtbIA4ZBIEBFnpUqXpI HPbC4hpgtM7WJ+CctyFLzgmubnB0z5ueMhXLDsr7XKTSEq6ZxFXYVWb4LTiTRDHNeDzw 8nE9Hv1SFDThbejw/UP3ysBWtB0AxIE9a3Q5cUZQ37hbRYNAusF06i4du6Dn7STw86TT DWuUbS4PAIn14itsxs9x9lTgQdHM8daOVO42x2heJpiKfW80pX4pZYojUkY7PY+D8L2m KNj50GgX0nzSufSqkXvibHc+K8gahD3tYyeJzDoIXhD9cJZKNALkpjXdhhpqc/o4DsgM 803A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a1-20020a170902ecc100b0015384fcab23si3960415plh.349.2022.03.16.22.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:48:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0C42C136653; Wed, 16 Mar 2022 21:44:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244092AbiCNTmC (ORCPT + 99 others); Mon, 14 Mar 2022 15:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232288AbiCNTmA (ORCPT ); Mon, 14 Mar 2022 15:42:00 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBB513C731; Mon, 14 Mar 2022 12:40:49 -0700 (PDT) Received: (Authenticated sender: i.maximets@ovn.org) by mail.gandi.net (Postfix) with ESMTPSA id 7A6D0C0002; Mon, 14 Mar 2022 19:40:45 +0000 (UTC) Message-ID: <1a185332-3693-2750-fef2-f6938bbc8500@ovn.org> Date: Mon, 14 Mar 2022 20:40:43 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Cc: i.maximets@ovn.org, Jakub Kicinski , "David S. Miller" , Pravin B Shelar , Toms Atteka , netdev@vger.kernel.org, dev@openvswitch.org, linux-kernel@vger.kernel.org, Johannes Berg , Maor Dickman Content-Language: en-US To: Roi Dayan , Aaron Conole References: <20220309222033.3018976-1-i.maximets@ovn.org> <44eeb550-3310-d579-91cc-ec18b59966d2@nvidia.com> From: Ilya Maximets Subject: Re: [PATCH net-next v2] net: openvswitch: fix uAPI incompatibility with existing user space In-Reply-To: <44eeb550-3310-d579-91cc-ec18b59966d2@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On 3/14/22 19:33, Roi Dayan wrote: > > > On 2022-03-10 8:44 PM, Aaron Conole wrote: >> Ilya Maximets writes: >> >>> Few years ago OVS user space made a strange choice in the commit [1] >>> to define types only valid for the user space inside the copy of a >>> kernel uAPI header.  '#ifndef __KERNEL__' and another attribute was >>> added later. >>> >>> This leads to the inevitable clash between user space and kernel types >>> when the kernel uAPI is extended.  The issue was unveiled with the >>> addition of a new type for IPv6 extension header in kernel uAPI. >>> >>> When kernel provides the OVS_KEY_ATTR_IPV6_EXTHDRS attribute to the >>> older user space application, application tries to parse it as >>> OVS_KEY_ATTR_PACKET_TYPE and discards the whole netlink message as >>> malformed.  Since OVS_KEY_ATTR_IPV6_EXTHDRS is supplied along with >>> every IPv6 packet that goes to the user space, IPv6 support is fully >>> broken. >>> >>> Fixing that by bringing these user space attributes to the kernel >>> uAPI to avoid the clash.  Strictly speaking this is not the problem >>> of the kernel uAPI, but changing it is the only way to avoid breakage >>> of the older user space applications at this point. >>> >>> These 2 types are explicitly rejected now since they should not be >>> passed to the kernel.  Additionally, OVS_KEY_ATTR_TUNNEL_INFO moved >>> out from the '#ifdef __KERNEL__' as there is no good reason to hide >>> it from the userspace.  And it's also explicitly rejected now, because >>> it's for in-kernel use only. >>> >>> Comments with warnings were added to avoid the problem coming back. >>> >>> (1 << type) converted to (1ULL << type) to avoid integer overflow on >>> OVS_KEY_ATTR_IPV6_EXTHDRS, since it equals 32 now. >>> >>>   [1] beb75a40fdc2 ("userspace: Switching of L3 packets in L2 pipeline") >>> >>> Fixes: 28a3f0601727 ("net: openvswitch: IPv6: Add IPv6 extension header support") >>> Link: https://lore.kernel.org/netdev/3adf00c7-fe65-3ef4-b6d7-6d8a0cad8a5f@nvidia.com >>> Link: https://github.com/openvswitch/ovs/commit/beb75a40fdc295bfd6521b0068b4cd12f6de507c >>> Reported-by: Roi Dayan >>> Signed-off-by: Ilya Maximets >>> --- >> >> Acked-by: Aaron Conole >> > > > > I got to check traffic with the fix and I do get some traffic > but something is broken. I didn't investigate much but the quick > test shows me rules are not offloaded and dumping ovs rules gives > error like this > > recirc_id(0),in_port(enp8s0f0_1),ct_state(-trk),eth(),eth_type(0x86dd),ipv6(frag=no)(bad key length 2, expected -1)(00 00/(bad mask length 2, expected -1)(00 00), packets:2453, bytes:211594, used:0.004s, flags:S., actions:ct,recirc(0x2) Such a dump is expected, because kernel parses fields that current userspace doesn't understand, and at the same time OVS by design is using kernel provided key/mask while installing datapath rules, IIRC. It should be possible to make these dumps a bit more friendly though. For the offloading not working, see my comment in the v2 patch email I sent (top email of this thread). In short, it's a problem in user space and it can not be fixed from the kernel side, unless we revert IPv6 extension header support and never add any new types, which is unreasonable. I didn't test any actual offloading, but I had a successful run of 'make check-offloads' with my quick'n'dirty fix from the top email. Since we're here: Toms, do you plan to submit user space patches for this feature? Best regards, Ilya Maximets.