From: Michal Kubecek Subject: Re: [PATCH net-next,v4 09/12] ethtool: add basic ethtool_rx_flow_spec to flow_rule structure translator Date: Wed, 5 Dec 2018 14:56:34 +0100 Message-ID: <20181205135634.GA23191@unicorn.suse.cz> References: <20181129022231.2740-1-pablo@netfilter.org> <20181129022231.2740-10-pablo@netfilter.org> <20181129131214.GC21643@unicorn.suse.cz> <20181205131037.gznwi35tkz7pxmge@salvia> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org To: Pablo Neira Ayuso Return-path: Received: from mx2.suse.de ([195.135.220.15]:40952 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727142AbeLEN4h (ORCPT ); Wed, 5 Dec 2018 08:56:37 -0500 Content-Disposition: inline In-Reply-To: <20181205131037.gznwi35tkz7pxmge@salvia> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, Dec 05, 2018 at 02:10:37PM +0100, Pablo Neira Ayuso wrote: > On Thu, Nov 29, 2018 at 02:12:14PM +0100, Michal Kubecek wrote: > > On Thu, Nov 29, 2018 at 03:22:28AM +0100, Pablo Neira Ayuso wrote: > > ... > > > + act = &flow->rule->action.entries[0]; > > > + switch (fs->ring_cookie) { > > > + case RX_CLS_FLOW_DISC: > > > + act->id = FLOW_ACTION_DROP; > > > + break; > > > + case RX_CLS_FLOW_WAKE: > > > + act->id = FLOW_ACTION_WAKE; > > > + break; > > > + default: > > > + act->id = FLOW_ACTION_QUEUE; > > > + act->queue_index = fs->ring_cookie; > > > + break; > > > + } > > > > IMHO it would be cleaner if rules passing packets to RSS contexts were > > also implemented using action, e.g. by using FLOW_ACTION_CONTEXT for > > act->id and reusing act->queue_index for context id (using either an > > anonymous union or more generic name). > > Are refering to FLOW_RSS specifically? Or just rename in this action > and field? My idea is that currently the ethtool interface can apply four types of action to matching packets - put into a specific queue - discard - distribute accross the queues according to a RSS context - use the rule as a wake-on-lan filter What is confusing is that due to lack of extensibility of the ethtool ioctl interface, third option is implemented by setting FLOW_RSS flag in ethtool_rxnfc::fs.flow_type and passing the RSS context id in ethtool_rxnfc::rss_context, i.e. outside struct ethtool_rx_flow_spec. The context id would need to be passed to the conversion function in addition to the struct ethtool_rx_flow_spec pointer. I believe we should use this opportunity to handle this case in a way which would match the other three. In particular by introducing another value for act->id (e.g. FLOW_ACTION_CONTEXT) and passing the target context id in the same structure (e.g. by renaming queue_index to something more generic or by using an anonymous union with it). Michal Kubecek