From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 12/12] netfilter: slightly optimize nf_inet_addr_mask
Date: Mon, 6 May 2019 01:33:05 +0200 [thread overview]
Message-ID: <20190505233305.13650-13-pablo@netfilter.org> (raw)
In-Reply-To: <20190505233305.13650-1-pablo@netfilter.org>
From: Li RongQing <lirongqing@baidu.com>
using 64bit computation to slightly optimize nf_inet_addr_mask
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/linux/netfilter.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index a7252f3baeb0..996bc247ef6e 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -41,10 +41,19 @@ static inline void nf_inet_addr_mask(const union nf_inet_addr *a1,
union nf_inet_addr *result,
const union nf_inet_addr *mask)
{
+#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
+ const unsigned long *ua = (const unsigned long *)a1;
+ unsigned long *ur = (unsigned long *)result;
+ const unsigned long *um = (const unsigned long *)mask;
+
+ ur[0] = ua[0] & um[0];
+ ur[1] = ua[1] & um[1];
+#else
result->all[0] = a1->all[0] & mask->all[0];
result->all[1] = a1->all[1] & mask->all[1];
result->all[2] = a1->all[2] & mask->all[2];
result->all[3] = a1->all[3] & mask->all[3];
+#endif
}
int netfilter_init(void);
--
2.11.0
next prev parent reply other threads:[~2019-05-05 23:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-05 23:32 [PATCH 00/12] Netfilter updates for net-next Pablo Neira Ayuso
2019-05-05 23:32 ` [PATCH 01/12] netfilter: nf_tables: relocate header content to consumer Pablo Neira Ayuso
2019-05-05 23:32 ` [PATCH 02/12] netfilter: nf_tables: fix implicit include of module.h Pablo Neira Ayuso
2019-05-05 23:32 ` [PATCH 03/12] netfilter: nf_tables: drop include of module.h from nf_tables.h Pablo Neira Ayuso
2019-05-05 23:32 ` [PATCH 04/12] netfilter: conntrack: limit sysctl setting for boolean options Pablo Neira Ayuso
2019-05-05 23:32 ` [PATCH 05/12] netfilter: use macros to create module aliases Pablo Neira Ayuso
2019-05-05 23:32 ` [PATCH 06/12] netfilter: add API to manage NAT helpers Pablo Neira Ayuso
2019-05-05 23:33 ` [PATCH 07/12] netfilter: nf_nat: register " Pablo Neira Ayuso
2019-05-05 23:33 ` [PATCH 08/12] openvswitch: load and reference the NAT helper Pablo Neira Ayuso
2019-05-05 23:33 ` [PATCH 09/12] netfilter: nft_ct: Add ct id support Pablo Neira Ayuso
2019-05-05 23:33 ` [PATCH 10/12] netfilter: connlabels: fix spelling mistake "trackling" -> "tracking" Pablo Neira Ayuso
2019-05-05 23:33 ` [PATCH 11/12] netfilter: xt_hashlimit: use struct_size() helper Pablo Neira Ayuso
2019-05-05 23:33 ` Pablo Neira Ayuso [this message]
2019-05-06 4:35 ` [PATCH 00/12] Netfilter updates for net-next David Miller
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=20190505233305.13650-13-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/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).