From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: wenxu@ucloud.cn, jiri@resnulli.us, marcelo.leitner@gmail.com,
saeedm@mellanox.com, gerlitz.or@gmail.com, paulb@mellanox.com,
netdev@vger.kernel.org
Subject: Re: [PATCH nf] netfilter: nf_tables: map basechain priority to hardware priority
Date: Tue, 30 Jul 2019 13:18:00 +0200 [thread overview]
Message-ID: <20190730111800.yhtd5pgd32wyfilt@salvia> (raw)
In-Reply-To: <20190730105417.14538-1-pablo@netfilter.org>
On Tue, Jul 30, 2019 at 12:54:17PM +0200, Pablo Neira Ayuso wrote:
[...]
> @@ -180,6 +181,29 @@ static int nft_setup_cb_call(struct nft_base_chain *basechain,
> return 0;
> }
>
> +/* Available priorities for hardware offload range: -8192..8191 */
> +#define NFT_BASECHAIN_OFFLOAD_PRIO_MAX (SHRT_MAX / 4)
> +#define NFT_BASECHAIN_OFFLOAD_PRIO_MIN (SHRT_MIN / 4)
> +#define NFT_BASECHAIN_OFFLOAD_PRIO_RANGE (USHRT_MAX / 4)
> +/* tcf_auto_prio() uses 0xC000 as base, then subtract one for each new chain. */
> +#define NFT_BASECHAIN_OFFLOAD_HW_PRIO_BASE (0xC000 + 1)
> +
> +u16 nft_chain_offload_priority(struct nft_base_chain *basechain)
> +{
> + u16 prio;
> +
> + if (basechain->ops.priority < NFT_BASECHAIN_OFFLOAD_PRIO_MIN ||
> + basechain->ops.priority > NFT_BASECHAIN_OFFLOAD_PRIO_MAX)
> + return 0;
> +
> + /* map netfilter chain priority to hardware priority. */
> + prio = basechain->ops.priority +
> + NFT_BASECHAIN_OFFLOAD_PRIO_MAX +
> + NFT_BASECHAIN_OFFLOAD_HW_PRIO_BASE;
> +
> + return prio;
This function should actually return:
return prio << 16;
> +}
> +
> static int nft_flow_offload_rule(struct nft_trans *trans,
> enum flow_cls_command command)
> {
next prev parent reply other threads:[~2019-07-30 11:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-30 10:54 [PATCH nf] netfilter: nf_tables: map basechain priority to hardware priority Pablo Neira Ayuso
2019-07-30 11:18 ` Pablo Neira Ayuso [this message]
2019-07-30 11:19 ` Pablo Neira Ayuso
2019-07-30 19:08 ` Marcelo Ricardo Leitner
2019-07-31 0:21 ` 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=20190730111800.yhtd5pgd32wyfilt@salvia \
--to=pablo@netfilter.org \
--cc=gerlitz.or@gmail.com \
--cc=jiri@resnulli.us \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=paulb@mellanox.com \
--cc=saeedm@mellanox.com \
--cc=wenxu@ucloud.cn \
/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