diff options
author | Vlad Yasevich <vladislav.yasevich@hp.com> | 2008-10-08 17:19:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-08 17:19:01 -0400 |
commit | 02015180e2509afd2e3fe3790a333b30708a116b (patch) | |
tree | d2d92b62758f01375602cd7e44cb9ffbb3e44d59 /net/sctp | |
parent | 8e1ee18c332e08bee9d8bd66e63cd564fbf17fc2 (diff) |
sctp: shrink sctp_tsnmap some more by removing gabs array
The gabs array in the sctp_tsnmap structure is only used
in one place, sctp_make_sack(). As such, carrying the
array around in the sctp_tsnmap and thus directly in
the sctp_association is rather pointless since most
of the time it's just taking up space. Now, let
sctp_make_sack create and populate it and then throw
it away when it's done.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/sm_make_chunk.c | 6 | ||||
-rw-r--r-- | net/sctp/tsnmap.c | 15 |
2 files changed, 12 insertions, 9 deletions
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 6dd9b3ef33d0..fd8acb48c3f2 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -702,12 +702,14 @@ struct sctp_chunk *sctp_make_sack(const struct sctp_association *asoc) | |||
702 | __u32 ctsn; | 702 | __u32 ctsn; |
703 | __u16 num_gabs, num_dup_tsns; | 703 | __u16 num_gabs, num_dup_tsns; |
704 | struct sctp_tsnmap *map = (struct sctp_tsnmap *)&asoc->peer.tsn_map; | 704 | struct sctp_tsnmap *map = (struct sctp_tsnmap *)&asoc->peer.tsn_map; |
705 | struct sctp_gap_ack_block gabs[SCTP_MAX_GABS]; | ||
705 | 706 | ||
707 | memset(gabs, 0, sizeof(gabs)); | ||
706 | ctsn = sctp_tsnmap_get_ctsn(map); | 708 | ctsn = sctp_tsnmap_get_ctsn(map); |
707 | SCTP_DEBUG_PRINTK("sackCTSNAck sent: 0x%x.\n", ctsn); | 709 | SCTP_DEBUG_PRINTK("sackCTSNAck sent: 0x%x.\n", ctsn); |
708 | 710 | ||
709 | /* How much room is needed in the chunk? */ | 711 | /* How much room is needed in the chunk? */ |
710 | num_gabs = sctp_tsnmap_num_gabs(map); | 712 | num_gabs = sctp_tsnmap_num_gabs(map, gabs); |
711 | num_dup_tsns = sctp_tsnmap_num_dups(map); | 713 | num_dup_tsns = sctp_tsnmap_num_dups(map); |
712 | 714 | ||
713 | /* Initialize the SACK header. */ | 715 | /* Initialize the SACK header. */ |
@@ -763,7 +765,7 @@ struct sctp_chunk *sctp_make_sack(const struct sctp_association *asoc) | |||
763 | /* Add the gap ack block information. */ | 765 | /* Add the gap ack block information. */ |
764 | if (num_gabs) | 766 | if (num_gabs) |
765 | sctp_addto_chunk(retval, sizeof(__u32) * num_gabs, | 767 | sctp_addto_chunk(retval, sizeof(__u32) * num_gabs, |
766 | sctp_tsnmap_get_gabs(map)); | 768 | gabs); |
767 | 769 | ||
768 | /* Add the duplicate TSN information. */ | 770 | /* Add the duplicate TSN information. */ |
769 | if (num_dup_tsns) | 771 | if (num_dup_tsns) |
diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c index 142ed7ca424d..35c73e82553a 100644 --- a/net/sctp/tsnmap.c +++ b/net/sctp/tsnmap.c | |||
@@ -335,10 +335,11 @@ void sctp_tsnmap_renege(struct sctp_tsnmap *map, __u32 tsn) | |||
335 | } | 335 | } |
336 | 336 | ||
337 | /* How many gap ack blocks do we have recorded? */ | 337 | /* How many gap ack blocks do we have recorded? */ |
338 | __u16 sctp_tsnmap_num_gabs(struct sctp_tsnmap *map) | 338 | __u16 sctp_tsnmap_num_gabs(struct sctp_tsnmap *map, |
339 | struct sctp_gap_ack_block *gabs) | ||
339 | { | 340 | { |
340 | struct sctp_tsnmap_iter iter; | 341 | struct sctp_tsnmap_iter iter; |
341 | int gabs = 0; | 342 | int ngaps = 0; |
342 | 343 | ||
343 | /* Refresh the gap ack information. */ | 344 | /* Refresh the gap ack information. */ |
344 | if (sctp_tsnmap_has_gap(map)) { | 345 | if (sctp_tsnmap_has_gap(map)) { |
@@ -348,14 +349,14 @@ __u16 sctp_tsnmap_num_gabs(struct sctp_tsnmap *map) | |||
348 | &start, | 349 | &start, |
349 | &end)) { | 350 | &end)) { |
350 | 351 | ||
351 | map->gabs[gabs].start = htons(start); | 352 | gabs[ngaps].start = htons(start); |
352 | map->gabs[gabs].end = htons(end); | 353 | gabs[ngaps].end = htons(end); |
353 | gabs++; | 354 | ngaps++; |
354 | if (gabs >= SCTP_MAX_GABS) | 355 | if (ngaps >= SCTP_MAX_GABS) |
355 | break; | 356 | break; |
356 | } | 357 | } |
357 | } | 358 | } |
358 | return gabs; | 359 | return ngaps; |
359 | } | 360 | } |
360 | 361 | ||
361 | static int sctp_tsnmap_grow(struct sctp_tsnmap *map, u16 gap) | 362 | static int sctp_tsnmap_grow(struct sctp_tsnmap *map, u16 gap) |