Skip to content

Commit be78cfc

Browse files
wangweidongdavem330
authored andcommitted
sctp: Reorder 'struc association' members to reduce its size
Members of 'struct association' are not in appropriate order to reuse compiler added padding on 64bit architectures. In this patch we reorder those struct members and help reduce the size of the structure from 2776 bytes to 2720 bytes on 64 bit architectures. Signed-off-by: Wang Weidong <wangweidong1@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e437931 commit be78cfc

1 file changed

Lines changed: 29 additions & 30 deletions

File tree

‎include/net/sctp/structs.h‎

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,12 +1360,6 @@ struct sctp_association {
13601360

13611361
/* This is all information about our peer. */
13621362
struct {
1363-
/* rwnd
1364-
*
1365-
* Peer Rwnd : Current calculated value of the peer's rwnd.
1366-
*/
1367-
__u32 rwnd;
1368-
13691363
/* transport_addr_list
13701364
*
13711365
* Peer : A list of SCTP transport addresses that the
@@ -1383,6 +1377,12 @@ struct sctp_association {
13831377
*/
13841378
struct list_head transport_addr_list;
13851379

1380+
/* rwnd
1381+
*
1382+
* Peer Rwnd : Current calculated value of the peer's rwnd.
1383+
*/
1384+
__u32 rwnd;
1385+
13861386
/* transport_count
13871387
*
13881388
* Peer : A count of the number of peer addresses
@@ -1465,6 +1465,20 @@ struct sctp_association {
14651465
*/
14661466
struct sctp_tsnmap tsn_map;
14671467

1468+
/* This mask is used to disable sending the ASCONF chunk
1469+
* with specified parameter to peer.
1470+
*/
1471+
__be16 addip_disabled_mask;
1472+
1473+
/* These are capabilities which our peer advertised. */
1474+
__u8 ecn_capable:1, /* Can peer do ECN? */
1475+
ipv4_address:1, /* Peer understands IPv4 addresses? */
1476+
ipv6_address:1, /* Peer understands IPv6 addresses? */
1477+
hostname_address:1, /* Peer understands DNS addresses? */
1478+
asconf_capable:1, /* Does peer support ADDIP? */
1479+
prsctp_capable:1, /* Can peer do PR-SCTP? */
1480+
auth_capable:1; /* Is peer doing SCTP-AUTH? */
1481+
14681482
/* Ack State : This flag indicates if the next received
14691483
* : packet is to be responded to with a
14701484
* : SACK. This is initializedto 0. When a packet
@@ -1479,25 +1493,11 @@ struct sctp_association {
14791493
__u32 sack_cnt;
14801494
__u32 sack_generation;
14811495

1482-
/* These are capabilities which our peer advertised. */
1483-
__u8 ecn_capable:1, /* Can peer do ECN? */
1484-
ipv4_address:1, /* Peer understands IPv4 addresses? */
1485-
ipv6_address:1, /* Peer understands IPv6 addresses? */
1486-
hostname_address:1, /* Peer understands DNS addresses? */
1487-
asconf_capable:1, /* Does peer support ADDIP? */
1488-
prsctp_capable:1, /* Can peer do PR-SCTP? */
1489-
auth_capable:1; /* Is peer doing SCTP-AUTH? */
1490-
14911496
__u32 adaptation_ind; /* Adaptation Code point. */
14921497

1493-
/* This mask is used to disable sending the ASCONF chunk
1494-
* with specified parameter to peer.
1495-
*/
1496-
__be16 addip_disabled_mask;
1497-
14981498
struct sctp_inithdr_host i;
1499-
int cookie_len;
15001499
void *cookie;
1500+
int cookie_len;
15011501

15021502
/* ADDIP Section 4.2 Upon reception of an ASCONF Chunk.
15031503
* C1) ... "Peer-Serial-Number'. This value MUST be initialized to the
@@ -1529,14 +1529,14 @@ struct sctp_association {
15291529
*/
15301530
sctp_state_t state;
15311531

1532-
/* The cookie life I award for any cookie. */
1533-
ktime_t cookie_life;
1534-
15351532
/* Overall : The overall association error count.
15361533
* Error Count : [Clear this any time I get something.]
15371534
*/
15381535
int overall_error_count;
15391536

1537+
/* The cookie life I award for any cookie. */
1538+
ktime_t cookie_life;
1539+
15401540
/* These are the association's initial, max, and min RTO values.
15411541
* These values will be initialized by system defaults, but can
15421542
* be modified via the SCTP_RTOINFO socket option.
@@ -1591,23 +1591,22 @@ struct sctp_association {
15911591
/* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
15921592
__u32 param_flags;
15931593

1594+
__u32 sackfreq;
15941595
/* SACK delay timeout */
15951596
unsigned long sackdelay;
1596-
__u32 sackfreq;
1597-
15981597

15991598
unsigned long timeouts[SCTP_NUM_TIMEOUT_TYPES];
16001599
struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES];
16011600

16021601
/* Transport to which SHUTDOWN chunk was last sent. */
16031602
struct sctp_transport *shutdown_last_sent_to;
16041603

1605-
/* How many times have we resent a SHUTDOWN */
1606-
int shutdown_retries;
1607-
16081604
/* Transport to which INIT chunk was last sent. */
16091605
struct sctp_transport *init_last_sent_to;
16101606

1607+
/* How many times have we resent a SHUTDOWN */
1608+
int shutdown_retries;
1609+
16111610
/* Next TSN : The next TSN number to be assigned to a new
16121611
* : DATA chunk. This is sent in the INIT or INIT
16131612
* : ACK chunk to the peer and incremented each
@@ -1818,8 +1817,8 @@ struct sctp_association {
18181817
* after reaching 4294967295.
18191818
*/
18201819
__u32 addip_serial;
1821-
union sctp_addr *asconf_addr_del_pending;
18221820
int src_out_of_asoc_ok;
1821+
union sctp_addr *asconf_addr_del_pending;
18231822
struct sctp_transport *new_transport;
18241823

18251824
/* SCTP AUTH: list of the endpoint shared keys. These

0 commit comments

Comments
 (0)