Skip to content

Commit

Permalink
mptcp: shrink mptcp_out_options struct
Browse files Browse the repository at this point in the history
After the previous patch we can alias with a union several
fields in mptcp_out_options. Such struct is stack allocated and
memset() for each plain TCP out packet. Every saved byted counts.

Before:
pahole -EC mptcp_out_options
 # ...
/* size: 136, cachelines: 3, members: 17 */

After:
pahole -EC mptcp_out_options
 # ...
/* size: 56, cachelines: 1, members: 9 */

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Paolo Abeni authored and davem330 committed Aug 25, 2021
1 parent 1bff1e4 commit d7b2690
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions include/net/mptcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,30 @@ struct mptcp_addr_info {
struct mptcp_out_options {
#if IS_ENABLED(CONFIG_MPTCP)
u16 suboptions;
u64 sndr_key;
u64 rcvr_key;
u64 ahmac;
struct mptcp_addr_info addr;
struct mptcp_rm_list rm_list;
u8 join_id;
u8 backup;
u8 reset_reason:4,
reset_transient:1,
csum_reqd:1,
allow_join_id0:1;
u32 nonce;
u64 thmac;
u32 token;
u8 hmac[20];
struct mptcp_ext ext_copy;
union {
struct {
u64 sndr_key;
u64 rcvr_key;
};
struct {
struct mptcp_addr_info addr;
u64 ahmac;
};
struct mptcp_ext ext_copy;
struct {
u32 nonce;
u32 token;
u64 thmac;
u8 hmac[20];
};
};
#endif
};

Expand Down

0 comments on commit d7b2690

Please sign in to comment.