netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: davem@davemloft.net, jiri@resnulli.us, dsahern@gmail.com,
	netdev@vger.kernel.org, oss-drivers@netronome.com
Subject: Re: [PATCH net-next 1/8] pkt_cls: add new tc cls helper to check offload flag and chain index
Date: Thu, 25 Jan 2018 13:41:58 -0200	[thread overview]
Message-ID: <20180125154158.GA14290@localhost.localdomain> (raw)
In-Reply-To: <20180125001753.30408-2-jakub.kicinski@netronome.com>

On Wed, Jan 24, 2018 at 04:17:46PM -0800, Jakub Kicinski wrote:
...
> +static inline bool
> +tc_cls_can_offload_and_chain0(const struct net_device *dev,
> +			      struct tc_cls_common_offload *common)
> +{
> +	if (common->chain_index) {
> +		NL_SET_ERR_MSG(common->extack,
> +			       "Driver supports only offload of chain 0");
> +		return false;
> +	}
> +	return tc_can_offload_extack(dev, common->extack);

I know that most of the drivers updated in this patchset checks it
this way, but considering both checks end up being done anyway in the
success case and that performance POV on error path is irrelevant
here, wouldn't it be better to swap both conditions here? I.e., first
check if the device can offload, to only then check what is being
offloaded?

Otherwise the first error would be implying that the device can
offload, just not the specified chain.

> +}
> +
>  static inline bool tc_skip_hw(u32 flags)
>  {
>  	return (flags & TCA_CLS_FLAGS_SKIP_HW) ? true : false;
> -- 
> 2.15.1
> 

  parent reply	other threads:[~2018-01-25 15:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25  0:17 [PATCH net-next 0/8] use tc_cls_can_offload_and_chain0() throughout the drivers Jakub Kicinski
2018-01-25  0:17 ` [PATCH net-next 1/8] pkt_cls: add new tc cls helper to check offload flag and chain index Jakub Kicinski
2018-01-25  8:03   ` Jiri Pirko
2018-01-25 19:26     ` Jakub Kicinski
2018-01-25 15:41   ` Marcelo Ricardo Leitner [this message]
2018-01-25 19:25     ` Jakub Kicinski
2018-01-25  0:17 ` [PATCH net-next 2/8] cxgb4: use tc_cls_can_offload_and_chain0() Jakub Kicinski
2018-01-25  0:17 ` [PATCH net-next 3/8] mlx5: " Jakub Kicinski
2018-01-25 14:12   ` Or Gerlitz
2018-01-25  0:17 ` [PATCH net-next 4/8] bnxt: " Jakub Kicinski
2018-01-25  0:17 ` [PATCH net-next 5/8] nfp: flower: " Jakub Kicinski
2018-01-25  0:17 ` [PATCH net-next 6/8] ixgbe: " Jakub Kicinski
2018-01-25  0:17 ` [PATCH net-next 7/8] mlxsw: " Jakub Kicinski
2018-01-25  0:17 ` [PATCH net-next 8/8] selftests/bpf: check for spurious extacks from the driver Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180125154158.GA14290@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).