Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp268992yba; Wed, 24 Apr 2019 00:27:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxD4LId9vn1psC7OEKuM0Gtj1fItbg0MBKb1hqgv7nqabEe4QoPlAoxj9xLib9ndZ3TLyY X-Received: by 2002:a17:902:2a6a:: with SMTP id i97mr31743705plb.332.1556090864115; Wed, 24 Apr 2019 00:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556090864; cv=none; d=google.com; s=arc-20160816; b=nSeVGolR9e2RCRFbbZfFj/wgskSPnL96h7NUiOhB3Mj7bX/BUC4eaJbghagST2Viu8 dThNuH7LC8G6udzio/h9zS9hgHMNsw2vlGTISkInuLCWoLdshZjkvX6mi/2jWZA/OEug rkxROZGmDmTOIXqF1AxPTcMVYjuXd9czlat5TOQsMg2Po5+d+GKHssThaoqX49mXrQX9 nddqpdDR3g0hMNRtFs9Ikz6C2nSmNSJCzE20EQF1fpD3RWyHfCBlc9xZB71GSMxiFCtV YUvCiXUgER41U1+FgnMLg61IBtBgTfoBzC5P03BnnkjJkx/to/17YeOe0uwJ0JRkwwW9 WSbQ== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=4QrLieRrLQCWK5DDDStP8XanSEx3/9sz/EXho2IY160=; b=faJw1I5n9HpBY54KPoBbmEWDW9zy2fZ1jzDPU37iCyg4ZrFbAuAYnin/I8/moR9HDH GG8KpemvalnOua/dcd5FT5XL0EZMsO+dsH/o+NxpgnEoYdA/2L+6BT9syBavdsJfgiO4 8zSBTHYtGqPHGrxSf+mwLQKfm1KafiiotuqCtlCdZusmfTRu/IlSldoOoE4HMw0h4xIH LjxtkyJTPgundaVU5vm7LV75R7c9NtTrtL0b1jaLChJIaitehDBue/WWy3vnGSLndoLb H4yZZ3ZNEgesWgcTwnIMpSXjjIofy3LTm31mfcOis2PSQFX6LBi7j1eq//GfKsVtXgxX DGXw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ba5si17628699plb.24.2019.04.24.00.27.29; Wed, 24 Apr 2019 00:27:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729892AbfDXHB3 (ORCPT + 99 others); Wed, 24 Apr 2019 03:01:29 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:50011 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725919AbfDXHB2 (ORCPT ); Wed, 24 Apr 2019 03:01:28 -0400 X-Originating-IP: 90.88.147.33 Received: from bootlin.com (aaubervilliers-681-1-27-33.w90-88.abo.wanadoo.fr [90.88.147.33]) (Authenticated sender: maxime.chevallier@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 09DB520019; Wed, 24 Apr 2019 07:01:23 +0000 (UTC) Date: Wed, 24 Apr 2019 09:01:23 +0200 From: Maxime Chevallier To: Saeed Mahameed Cc: "davem@davemloft.net" , "miquel.raynal@bootlin.com" , "linux-kernel@vger.kernel.org" , "linux@armlinux.org.uk" , "thomas.petazzoni@bootlin.com" , "mw@semihalf.com" , "gregory.clement@bootlin.com" , "netdev@vger.kernel.org" , "stefanc@marvell.com" , "nadavh@marvell.com" , "linux-arm-kernel@lists.infradead.org" , "antoine.tenart@bootlin.com" Subject: Re: [PATCH net-next v2] net: mvpp2: cls: Add Classification offload support Message-ID: <20190424090123.5089586c@bootlin.com> In-Reply-To: References: <20190423075031.26074-1-maxime.chevallier@bootlin.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Saeed, Thanks for the review, >> When inserting a rule in a given flow, the location given is relative >> to >> the flow : >> >> ethtool -N eth0 flow-type udp4 dst-port 1234 action 2 loc 0 >> >> ethtool -N eth0 flow-type tcp4 dst-port 1234 action 3 loc 0 >> >> However when removing a rule, the global location is to be used. This >> location can be retrieved by using ethtool -n . >> > >I am not sure what you mean by "the location given is relative to the >flow", it seems like the rule will end up in a different location than >the user intended, but looking at ethtool documentation it clearly says >that the location the user provides is an absolute rule id/location, >which will be used to delete this rule. > >from "man ethtool": >loc N: >Specify the location/ID to insert the rule. This will overwrite any >rule present in that location and will not go through any of the rule >ordering process. > >delete N >Deletes the RX classification rule with the given ID. I was unsure about this, so I'm glad you commented. One thing that made me think what I did could be okay is that the documentation for ETHTOOL_SRXCLSRLINS in ethtool.h says : "For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update. @fs.@location either specifies the location to use or is a special location value with %RX_CLS_LOC_SPECIAL flag set. On return, @fs.@location is the actual rule location." I interpreted the "On return [...]" part as if we could rewrite the location if needed when inserting a rule (although it seems ethtool doesn't do anything with this return value) The point for doing so is that we have a clear separation in our classification tables between different traffic classes, so we have a range of entries for tcp4, one for udp4, one for tcp6, etc. Having a "global" location numbering scheme would, I think, also be confusing, since it would make the user use loc 0->7 for tcp4, loc 8->15 for udp4 and so on. Maybe in this case I should stick with insertions thay rely on RX_CLS_LOC_SPECIAL (such as "first", "last", "any") and have a scheme where priorisation is based strictly on the rule insertion order ? >So the above example should result in one flow rule in your hardware. >but according the code below the calculated index in >mvpp2_ethtool_cls_rule_ins might end up different than the requested >location, which will confuse the user. I'm also working on writing a proper documentation for this driver, including the behaviour of the classifier implementation, hopefully this would help. Thanks again for the review, Maxime