From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CF24CA9EBC for ; Fri, 25 Oct 2019 00:28:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 74D3E21929 for ; Fri, 25 Oct 2019 00:28:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SMp3ZpI5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730136AbfJYA2T (ORCPT ); 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-Google-Smtp-Source: APXvYqym7fXeLAILTlm6k1G46RUJImDXCll6Wg9ol9S+dM0yK8R9moFI+ZU3df0ukjTnsrZDz4UD/s6A4arXkCsnm3c= 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