Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4030148ybg; Fri, 25 Oct 2019 12:19:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjaUOVMMank0G40tVeUGWw+87TE6oo277K9nDfhazi4Rskk5q5Ck/52W+znL5La5+r9KMm X-Received: by 2002:a17:906:19d9:: with SMTP id h25mr5184120ejd.60.1572031154738; Fri, 25 Oct 2019 12:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572031154; cv=none; d=google.com; s=arc-20160816; b=xCGQOhb3N50k56EGWXUv+CwT45Or8t/Csy+F5EsgUyAZZyxxgX087vgQiKGC+jcGkF 1hvj8/HyJ6TQ/l5wpqkcfBUu7vtz0aTPEIoP/XuLmk+3BstWONS7HPJImHfonDOhX9yi 8cxNy/kFX1Yn/OIiVe1dIZ3xOT6C3o4dzgDl8AS1XRSaoXpefI1mT6orUpCEgmonM4Eh Fvu6U9dxaElTAF/lJ7lzaLjhXkRRZqIEXnGJEXT4wM1ArO22tCARkUYdZ0Ye/95c/gHt aQ6xQDu+NVnq0fR8SkgOxTXaK5Pog4QuTKRPgvTdVSiwPn4gbEWiBTTiR8W28Lq0yINH qUBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=u/ZOKafSqcbNjqFdVZXED/KJXRu4OrJLpD9UUq91aWI=; b=Zm31LrPKVf4GocNsw2Vu05f3iym47veI+K6LaY6mgjb8F8ez/GMEH4bVj9ygGfL8kA OXgACyRaI0dFIhhyTaA13mOt6P7MKMwm//5EGCgkqL+Vb5RIH3lolL3hj0/DrPnrtyYL HvlWHERbOXtw192ygzfRgBvo84FGuUtV9jEE9lH/JWN2bMoSAp6dyFRzX+2NTcaXlK2X ryexSNk4RVTMkPAVc/+zCScIVoMOfyWDL63HKvKH5Z7GMBjkEXgEJS+Iu+FYtD+/zROA E7bOiuNB/pSxgPBwu08LxpYE6u8iW54KYyztLg6gYXCNWy2/i4Lwx4cevqwSOPBwe6P6 ZJtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SMp3ZpI5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fi30si1823691ejb.257.2019.10.25.12.18.51; Fri, 25 Oct 2019 12:19:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SMp3ZpI5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729898AbfJYA2T (ORCPT + 99 others); Thu, 24 Oct 2019 20:28:19 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40722 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726164AbfJYA2S (ORCPT ); Thu, 24 Oct 2019 20:28:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571963297; 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=u/ZOKafSqcbNjqFdVZXED/KJXRu4OrJLpD9UUq91aWI=; b=SMp3ZpI5ar/bAtyGT1SHFnpN7PAvHCa7qdb3grBS77MWuLkRIlzbwbtC8U9YW7Ci8uaVH1 mslVVlVfXewOqnnJXTi8cegffA2Igu1IU+jp5VugcJHii1VYG4H0kQSGBDVn/xh/6LsAdW XqVmhfssZgbFNL+sTPW9KV1fMwXfPEE= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-135-VX937yK2O8WYHiayHRwYBA-1; Thu, 24 Oct 2019 20:28:07 -0400 Received: by mail-lj1-f199.google.com with SMTP id y12so37349ljc.8 for ; Thu, 24 Oct 2019 17:28:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f/h48WimOkxwuWTFiUpPnQ+AjLWqpj9bNjA3x7P2LxY=; b=GOgklHxcKsjlzMgevoQGueyw6EWw+bJ2telR2dQfK0Utd4rm8t+IG9b3wDZ5IcffLb ATf86CiW7rRp5Amln5F+9q8hnt5pcPf8LWdjgimMrwZkh/7uWKK8q8st7i5C+FP5Rz17 8gvHEHwW/B4dUeNvVQdGAM/d/mewyveNa+CDo6IDR9ZJg4l30yJPv4+oGubzOBtxYAu6 7tni376HxBaNSriiAGGM8DrhvdJvfPhpnev+3r9j9ABU5MwzGmrf5/jNNCumV3Y6lTK1 IjgL/nZuiT4VBzC7uvBJ3Gj+2IXpLUQdzxS+gHxOifnzVVyArqKkEpxe6MXn0E5QEAfc LU8Q== X-Gm-Message-State: APjAAAV4i+o52hSvUPApOPtfgTXG8wJW8oZ+l8GoGw6OD549w2MHp+JW EzWawhar80q16XOJ2KYOzZmtpFoeqdvnfkemlPI+3H4DcpzNXdKFM1HpdYdiozkitchJkgjTvZx A1B0Xm0hMRUzjz5JNFWvxbzOAi7W9yYt5BqJnVRZo X-Received: by 2002:a19:22c4:: with SMTP id i187mr501156lfi.152.1571963286002; Thu, 24 Oct 2019 17:28:06 -0700 (PDT) X-Received: by 2002:a19:22c4:: with SMTP id i187mr501098lfi.152.1571963284768; Thu, 24 Oct 2019 17:28:04 -0700 (PDT) MIME-Version: 1.0 References: <20191021200948.23775-1-mcroce@redhat.com> <20191021200948.23775-4-mcroce@redhat.com> <20191023100009.GC8732@netronome.com> <20191023175522.GB28355@netronome.com> In-Reply-To: <20191023175522.GB28355@netronome.com> From: Matteo Croce Date: Fri, 25 Oct 2019 02:27:28 +0200 Message-ID: Subject: Re: [PATCH net-next 3/4] flow_dissector: extract more ICMP information To: Simon Horman Cc: netdev , Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S . Miller" , Stanislav Fomichev , Daniel Borkmann , Song Liu , Alexei Starovoitov , Paul Blakey , LKML X-MC-Unique: VX937yK2O8WYHiayHRwYBA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 23, 2019 at 7:55 PM Simon Horman w= rote: > > On Wed, Oct 23, 2019 at 12:53:37PM +0200, Matteo Croce wrote: > > On Wed, Oct 23, 2019 at 12:00 PM Simon Horman > > wrote: > > > On Mon, Oct 21, 2019 at 10:09:47PM +0200, Matteo Croce wrote: > > > > + switch (ih->type) { > > > > + case ICMP_ECHO: > > > > + case ICMP_ECHOREPLY: > > > > + case ICMP_TIMESTAMP: > > > > + case ICMP_TIMESTAMPREPLY: > > > > + case ICMPV6_ECHO_REQUEST: > > > > + case ICMPV6_ECHO_REPLY: > > > > + /* As we use 0 to signal that the Id field is not pre= sent, > > > > + * avoid confusion with packets without such field > > > > + */ > > > > + key_icmp->id =3D ih->un.echo.id ? : 1; > > > > > > Its not obvious to me why the kernel should treat id-zero as a specia= l > > > value if it is not special on the wire. > > > > > > Perhaps a caller who needs to know if the id is present can > > > check the ICMP type as this code does, say using a helper. > > > > > > > Hi, > > > > The problem is that the 0-0 Type-Code pair identifies the echo replies. > > So instead of adding a bool is_present value I hardcoded the info in > > the ID field making it always non null, at the expense of a possible > > collision, which is harmless. > > Sorry, I feel that I'm missing something here. > > My reading of the code above is that for the cased types above > (echo, echo reply, ...) the id is present. Otherwise it is not. > My idea would be to put a check for those types in a helper. > Something like icmp_has_id(), I like it. > I do agree that the override you have used is harmless enough > in the context of the only user of the id which appears in > the following patch of this series. > > > Some other things I noticed in this patch on a second pass: > > * I think you can remove the icmp field from struct flow_dissector_key_po= rts > You mean flow_dissector_key_icmp maybe? > * I think that adding icmp to struct flow_keys should be accompanied by > adding ICMP to flow_keys_dissector_symmetric_keys. But I think this is > not desirable outside of the bonding use-case and rather > the bonding driver should define its own structures that > includes the keys it needs - basically copies of struct flow_keys > and flow_keys_dissector_symmetric_keys with some modifications. > Just flow_keys_dissector_symmetric_keys or flow_keys_dissector_keys too? Anyway, it seems that the bonding uses the flow_dissector only when using encap2+3 or encap3+4 hashing, which means decap some known tunnels (mpls and gre and pppoe I think). For the other modes it just uses iph_to_flow_copy_v{4,6}addrs() and skb_flow_get_ports(), so maybe we can avoid copying that structure. > * Modifying flow_keys_have_l4 affects the behaviour of > skb_get_hash_flowi6() but there is not a corresponding update > to flow_keys_have_l4(). I didn't look at all the other call sites > but it strikes me that this is a) a wide-spread behavioural change > and b) is perhaps not required for the bond-use case. Right, no need to alter flow_keys_have_l4() at all. I'll send a v2 with those suggestions. Thanks, -- Matteo Croce per aspera ad upstream