From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, andrew@lunn.ch,
johannes@sipsolutions.net, jiri@resnulli.us, mkubecek@suse.cz,
dsahern@kernel.org, pablo@netfilter.org,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next v2 01/10] genetlink: reorg struct genl_family
Date: Thu, 1 Oct 2020 15:59:24 -0700 [thread overview]
Message-ID: <20201001225933.1373426-2-kuba@kernel.org> (raw)
In-Reply-To: <20201001225933.1373426-1-kuba@kernel.org>
There are holes and oversized members in struct genl_family.
Before: /* size: 104, cachelines: 2, members: 16 */
After: /* size: 88, cachelines: 2, members: 16 */
The command field in struct genlmsghdr is a u8, so no point
in the operation count being 32 bit. Also operation 0 is
usually undefined, so we only need 255 entries.
netnsok and parallel_ops are only ever initialized to true.
We can grow the fields as needed, compiler should warn us
if someone tries to assign larger constants.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
---
include/net/genetlink.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index b9eb92f3fe86..5cd9ab0c6bd9 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -48,8 +48,11 @@ struct genl_family {
char name[GENL_NAMSIZ];
unsigned int version;
unsigned int maxattr;
- bool netnsok;
- bool parallel_ops;
+ unsigned int mcgrp_offset; /* private */
+ u8 netnsok:1;
+ u8 parallel_ops:1;
+ u8 n_ops;
+ u8 n_mcgrps;
const struct nla_policy *policy;
int (*pre_doit)(const struct genl_ops *ops,
struct sk_buff *skb,
@@ -59,9 +62,6 @@ struct genl_family {
struct genl_info *info);
const struct genl_ops * ops;
const struct genl_multicast_group *mcgrps;
- unsigned int n_ops;
- unsigned int n_mcgrps;
- unsigned int mcgrp_offset; /* private */
struct module *module;
};
--
2.26.2
next prev parent reply other threads:[~2020-10-01 22:59 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-01 22:59 [PATCH net-next v2 00/10] genetlink: support per-command policy dump Jakub Kicinski
2020-10-01 22:59 ` Jakub Kicinski [this message]
2020-10-01 22:59 ` [PATCH net-next v2 02/10] genetlink: add small version of ops Jakub Kicinski
2020-10-01 22:59 ` [PATCH net-next v2 03/10] genetlink: move to smaller ops wherever possible Jakub Kicinski
2020-10-01 22:59 ` [PATCH net-next v2 04/10] genetlink: add a structure for dump state Jakub Kicinski
2020-10-01 22:59 ` [PATCH net-next v2 05/10] genetlink: use .start callback for dumppolicy Jakub Kicinski
2020-10-01 22:59 ` [PATCH net-next v2 06/10] genetlink: bring back per op policy Jakub Kicinski
2020-10-01 22:59 ` [PATCH net-next v2 07/10] taskstats: move specifying netlink policy back to ops Jakub Kicinski
2020-10-01 22:59 ` [PATCH net-next v2 08/10] genetlink: use parsed attrs in dumppolicy Jakub Kicinski
2020-10-02 6:30 ` Johannes Berg
2020-10-01 22:59 ` [PATCH net-next v2 09/10] genetlink: switch control commands to per-op policies Jakub Kicinski
2020-10-02 6:33 ` Johannes Berg
2020-10-01 22:59 ` [PATCH net-next v2 10/10] genetlink: allow dumping command-specific policy Jakub Kicinski
2020-10-02 6:34 ` Johannes Berg
2020-10-02 0:36 ` [PATCH net-next v2 00/10] genetlink: support per-command policy dump Jakub Kicinski
2020-10-02 6:29 ` Johannes Berg
2020-10-02 14:40 ` Jakub Kicinski
2020-10-02 14:42 ` Johannes Berg
2020-10-02 14:55 ` Jakub Kicinski
2020-10-02 14:58 ` Johannes Berg
2020-10-02 15:03 ` Jakub Kicinski
2020-10-02 15:04 ` Johannes Berg
2020-10-02 15:09 ` Jakub Kicinski
2020-10-02 15:13 ` Johannes Berg
2020-10-02 15:25 ` Jakub Kicinski
2020-10-02 15:28 ` Johannes Berg
2020-10-02 16:55 ` Michal Kubecek
2020-10-02 20:07 ` David Miller
2020-10-02 20:27 ` Johannes Berg
2020-10-02 20:50 ` Jakub Kicinski
2020-10-02 20:59 ` Johannes Berg
2020-10-02 21:00 ` Johannes Berg
2020-10-02 21:17 ` Jakub Kicinski
2020-10-02 21:22 ` Jakub Kicinski
2020-10-02 21:52 ` 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=20201001225933.1373426-2-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=jiri@resnulli.us \
--cc=johannes@sipsolutions.net \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.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).