diff options
author | David S. Miller | 2019-08-18 23:13:23 +0200 |
---|---|---|
committer | David S. Miller | 2019-08-18 23:13:23 +0200 |
commit | 5cbe9102ae2398c0f410fd4f832d9f038e751a29 (patch) | |
tree | 717dbcde06dcd1d5e1f672e3235a190037315c70 /net/netfilter/nf_tables_offload.c | |
parent | wimax/i2400m: fix a memory leak bug (diff) | |
parent | netfilter: nf_tables: map basechain priority to hardware priority (diff) | |
download | kernel-qcow2-linux-5cbe9102ae2398c0f410fd4f832d9f038e751a29.tar.gz kernel-qcow2-linux-5cbe9102ae2398c0f410fd4f832d9f038e751a29.tar.xz kernel-qcow2-linux-5cbe9102ae2398c0f410fd4f832d9f038e751a29.zip |
Merge branch 'flow_offload-hardware-priority-fixes'
Pablo Neira Ayuso says:
====================
flow_offload hardware priority fixes
This patchset contains two updates for the flow_offload users:
1) Pass the major tc priority to drivers so they do not have to
lshift it. This is a preparation patch for the fix coming in
patch #2.
2) Set the hardware priority from the netfilter basechain priority,
some drivers break when using the existing hardware priority
number that is set to zero.
v5: fix patch 2/2 to address a clang warning and to simplify
the priority mapping.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netfilter/nf_tables_offload.c')
-rw-r--r-- | net/netfilter/nf_tables_offload.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c index 64f5fd5f240e..c0d18c1d77ac 100644 --- a/net/netfilter/nf_tables_offload.c +++ b/net/netfilter/nf_tables_offload.c @@ -103,10 +103,11 @@ void nft_offload_update_dependency(struct nft_offload_ctx *ctx, } static void nft_flow_offload_common_init(struct flow_cls_common_offload *common, - __be16 proto, - struct netlink_ext_ack *extack) + __be16 proto, int priority, + struct netlink_ext_ack *extack) { common->protocol = proto; + common->prio = priority; common->extack = extack; } @@ -124,6 +125,15 @@ static int nft_setup_cb_call(struct nft_base_chain *basechain, return 0; } +int nft_chain_offload_priority(struct nft_base_chain *basechain) +{ + if (basechain->ops.priority <= 0 || + basechain->ops.priority > USHRT_MAX) + return -1; + + return 0; +} + static int nft_flow_offload_rule(struct nft_trans *trans, enum flow_cls_command command) { @@ -142,7 +152,8 @@ static int nft_flow_offload_rule(struct nft_trans *trans, if (flow) proto = flow->proto; - nft_flow_offload_common_init(&cls_flow.common, proto, &extack); + nft_flow_offload_common_init(&cls_flow.common, proto, + basechain->ops.priority, &extack); cls_flow.command = command; cls_flow.cookie = (unsigned long) rule; if (flow) |