Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4136481ybg; Fri, 25 Oct 2019 13:55:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSQJDjT2LEuADXTY20hSfNpl2VQNLw4ZXGjn9X6JZ2mnVsH3ffeGfEZPJ3/r1MUitnAb03 X-Received: by 2002:a50:ec0f:: with SMTP id g15mr6251217edr.59.1572036928590; Fri, 25 Oct 2019 13:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572036928; cv=none; d=google.com; s=arc-20160816; b=C5LMpTb/Sc6kAIVfusmlks6mDtW6iGcnKUjxjjahC/WdOHVgwt2LKjxnMFFPmopmfB 87b8ZTsOLZvbMx1fPowFrQ+GofpE6TuLf3VORCTlyh1Mq6zrh17ZE2Soa3pScjgHiKcA 3W3phtyZKQx0AoKz2QB7cPm2i1tx8ZnZgIhuGBxpDrEKNR8Pooa9H24oZbPHvAmCBXMs WEoNrVEqXXvsgkLRID63+WqF4C4VIPw69jYdYlCHHLuW3baiNJBu97PbvBqBNf75djwk 3299ajbchS3rzdzmkaxNYlZ9W/o01AaEai1WdxlGBNDvKSgJW16FpQ0jRABp0l2O6JqN 4XdQ== 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=gpL0tiZ7ZvTpKHYqeVvtPVaneT6iyxgClaTwMuQnmiY=; b=tCzjmHg/apI2vQ3k6VgfO9ovp/qTF/5jpKRhrHt/6X94wwS7XRMG4YpLLYLK7OhTn0 JAT+pq91i6ckjsnr5UnIi7OiCeD8PaBp5MyKICMqRE2UC/zoALa4q/Vo7kH77vzePiJ3 J6tp3d19M8A0pBIHLYncNofQgFpZe2vTJcJkYXgujSZun5YJ9QUiv9TIzJguXhCh5nuF lQor2UTqICSMi+tlyOpquTEsNVskAeNceTukH9D03fd+I9HEhO+vLiKAeUE3oDcl0UkC zGL6iyvYyue2J/PMmghlTHpPxYauT5WfiuBIPXW+gFiYvgahj8fHrfiFnX43zzbXpMYp AS0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B1dD3S04; 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 lc14si1801206ejb.208.2019.10.25.13.55.02; Fri, 25 Oct 2019 13:55:28 -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=B1dD3S04; 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 S2388754AbfJYSZH (ORCPT + 99 others); Fri, 25 Oct 2019 14:25:07 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:36888 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731017AbfJYSZH (ORCPT ); Fri, 25 Oct 2019 14:25:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572027905; 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=gpL0tiZ7ZvTpKHYqeVvtPVaneT6iyxgClaTwMuQnmiY=; b=B1dD3S04DTromfKmu65Ahd4t7SLbF1TjXgyGffRhOnw+gtw/6ODs/f/nAboUoZbgrrlVzd ZYxZgMfgNbuJv7OE4HgGqYNjW0e1nmxILUF7Yp/A3rLnwbYbpmViAz9OCX69GbSlF+joGk 90dw5iuNfSKgH8wvFZ76k6+kk/XD2KE= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-157-UQs4Ref-NFGAcWa3E8gUMg-1; Fri, 25 Oct 2019 14:24:58 -0400 Received: by mail-lf1-f70.google.com with SMTP id y188so735449lfc.6 for ; Fri, 25 Oct 2019 11:24:58 -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=hwxwHUFldaHiw/ve54tXNOQDx8dDdKblWoTuR69Lalw=; b=NGZXDdpUiF86kxaxPv2zU60NfgtsRysAlSLe9yrNoO82iCZaSN3flFVFCaiYkW3Jh/ 9XuQMGDqFYui8K/DUIbezrJaodG3y22pS1eAEobQsgkMxcI+mre/hh/oA69vO76p8wFD mIOjNauoZyuwEC61ekWeOoQA/zFZPFU7mHoGcYZtbTMO2YlDYSFeDLQXiBQIlQC9hbOa vfwAk5qXdFADhRl37GdAFV6J4B2v2VAyS7m9qE2c8HTIATI3VXli5Rg2Vv/gfbTw1gbw xAb2LXLQ3WI55jhumOmT+z3Y+oJzlMypT5vxBWxXc/4c+mAD7diJrG+R2fMzig1sLGdz 3prg== X-Gm-Message-State: APjAAAWtaTNejNYfnHhugvXd5mv7v376+/RHlAFrCIey3XAoBL/ulnI5 4qcZCXIDOfh5BeujKcfaFflfkSyJT1GelKelumvt0CSs99CWh8cy7RS23NGD23Xjjm64ql2BfRN 5pfy0jcFxxLOxi5tDhdnesoydwVug1mQpurw6RCcF X-Received: by 2002:ac2:4184:: with SMTP id z4mr3703652lfh.46.1572027897099; Fri, 25 Oct 2019 11:24:57 -0700 (PDT) X-Received: by 2002:ac2:4184:: with SMTP id z4mr3703622lfh.46.1572027896700; Fri, 25 Oct 2019 11:24:56 -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> <20191025062856.GB7325@netronome.com> In-Reply-To: <20191025062856.GB7325@netronome.com> From: Matteo Croce Date: Fri, 25 Oct 2019 20:24:20 +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: UQs4Ref-NFGAcWa3E8gUMg-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 Fri, Oct 25, 2019 at 8:29 AM Simon Horman w= rote: > > On Fri, Oct 25, 2019 at 02:27:28AM +0200, Matteo Croce wrote: > > On Wed, Oct 23, 2019 at 7:55 PM Simon Horman wrote: > > > > > > 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= present, > > > > > > + * avoid confusion with packets without such fiel= d > > > > > > + */ > > > > > > + key_icmp->id =3D ih->un.echo.id ? : 1; > > > > > > > > > > Its not obvious to me why the kernel should treat id-zero as a sp= ecial > > > > > 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 repl= ies. > > > > So instead of adding a bool is_present value I hardcoded the info i= n > > > > the ID field making it always non null, at the expense of a possibl= e > > > > 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_ke= y_ports > > > > > > > You mean flow_dissector_key_icmp maybe? > > Yes, sorry for the misinformation. > > > > * 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). > > That is the use case I noticed. > > In that case it uses skb_flow_dissect_flow_keys() which in turn > uses struct flow_keys and flow_keys_basic_dissector_keys (which is > assigned to flow_keys_dissector_keys. > > Sorry about mentioning flow_keys_dissector_symmetric_keys, I think > that was a copy-paste-error on my side. > np > In any case, my point is that if you update struct flow_keys then likely > some corresponding change should also be made to one or more of > *__dissector_keys. But such a change would have scope outside of bonding, > which is perhaps undesirable. So it might be better to make local > structures and call __skb_flow_dissect from within the bonding code. > What drawbacks will it have to have the ICMP dissector enabled with flow_keys_dissector_keys? I see three options here: 1. add the ICMP key in flow_keys_dissector_keys and change the flow_dissector behaviour, when dealing with echoes 2. do a local copy in the bonding code 3. leave flow_keys_dissector_keys as is, so the bonding will balance echoes only when not decapping tunnels I don't really know if option 1 could be a bug or a feature, sure option 2 is safer. That can be changed later easily anyway. > > As for other use cases, that do not currently use the dissector, > I think you will need to update them too to get then desired new > feature introduced in patch 4 for those use-cases, which I assume is > desired. Perhaps converting those use-cases to use the flow dissector > is a good way forwards. Perhaps not. > I don't really know why the bonding doesn't use the dissector. Performance? Anyway, maybe converting the bonding to the flow_dissector would make sense, this can be done in the future. I have to talk with the bonding maintainers to understand what's behind this choice. --=20 Matteo Croce per aspera ad upstream