Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 112159
b: refs/heads/master
c: 8e1ee18
h: refs/heads/master
i:
  112157: 9c590d0
  112155: 1d604b8
  112151: 7ffb9ab
  112143: d0922a5
  112127: 4241a0d
v: v3
  • Loading branch information
Vlad Yasevich authored and David S. Miller committed Oct 8, 2008
1 parent 62747aa commit 9a28de9
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 225 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3c689b7320ae6f20dba6a8b71806a6c6fd604ee8
refs/heads/master: 8e1ee18c332e08bee9d8bd66e63cd564fbf17fc2
4 changes: 3 additions & 1 deletion trunk/include/net/sctp/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ enum { SCTP_ARBITRARY_COOKIE_ECHO_LEN = 200 };
* must be less than 65535 (2^16 - 1), or we will have overflow
* problems creating SACK's.
*/
#define SCTP_TSN_MAP_SIZE 2048
#define SCTP_TSN_MAP_INITIAL BITS_PER_LONG
#define SCTP_TSN_MAP_INCREMENT SCTP_TSN_MAP_INITIAL
#define SCTP_TSN_MAP_SIZE 4096
#define SCTP_TSN_MAX_GAP 65535

/* We will not record more than this many duplicate TSNs between two
Expand Down
1 change: 0 additions & 1 deletion trunk/include/net/sctp/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,6 @@ struct sctp_association {
* in tsn_map--we get it by calling sctp_tsnmap_get_ctsn().
*/
struct sctp_tsnmap tsn_map;
__u8 _map[sctp_tsnmap_storage_size(SCTP_TSN_MAP_SIZE)];

/* Ack State : This flag indicates if the next received
* : packet is to be responded to with a
Expand Down
39 changes: 9 additions & 30 deletions trunk/include/net/sctp/tsnmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,7 @@ struct sctp_tsnmap {
* It points at one of the two buffers with which we will
* ping-pong between.
*/
__u8 *tsn_map;

/* This marks the tsn which overflows the tsn_map, when the
* cumulative ack point reaches this point we know we can switch
* maps (tsn_map and overflow_map swap).
*/
__u32 overflow_tsn;

/* This is the overflow array for tsn_map.
* It points at one of the other ping-pong buffers.
*/
__u8 *overflow_map;
unsigned long *tsn_map;

/* This is the TSN at tsn_map[0]. */
__u32 base_tsn;
Expand All @@ -89,15 +78,15 @@ struct sctp_tsnmap {
*/
__u32 cumulative_tsn_ack_point;

/* This is the highest TSN we've marked. */
__u32 max_tsn_seen;

/* This is the minimum number of TSNs we can track. This corresponds
* to the size of tsn_map. Note: the overflow_map allows us to
* potentially track more than this quantity.
*/
__u16 len;

/* This is the highest TSN we've marked. */
__u32 max_tsn_seen;

/* Data chunks pending receipt. used by SCTP_STATUS sockopt */
__u16 pending_data;

Expand All @@ -110,24 +99,17 @@ struct sctp_tsnmap {

/* Record gap ack block information here. */
struct sctp_gap_ack_block gabs[SCTP_MAX_GABS];

int malloced;

__u8 raw_map[0];
};

struct sctp_tsnmap_iter {
__u32 start;
};

/* This macro assists in creation of external storage for variable length
* internal buffers. We double allocate so the overflow map works.
*/
#define sctp_tsnmap_storage_size(count) (sizeof(__u8) * (count) * 2)

/* Initialize a block of memory as a tsnmap. */
struct sctp_tsnmap *sctp_tsnmap_init(struct sctp_tsnmap *, __u16 len,
__u32 initial_tsn);
__u32 initial_tsn, gfp_t gfp);

void sctp_tsnmap_free(struct sctp_tsnmap *map);

/* Test the tracking state of this TSN.
* Returns:
Expand All @@ -138,7 +120,7 @@ struct sctp_tsnmap *sctp_tsnmap_init(struct sctp_tsnmap *, __u16 len,
int sctp_tsnmap_check(const struct sctp_tsnmap *, __u32 tsn);

/* Mark this TSN as seen. */
void sctp_tsnmap_mark(struct sctp_tsnmap *, __u32 tsn);
int sctp_tsnmap_mark(struct sctp_tsnmap *, __u32 tsn);

/* Mark this TSN and all lower as seen. */
void sctp_tsnmap_skip(struct sctp_tsnmap *map, __u32 tsn);
Expand Down Expand Up @@ -183,10 +165,7 @@ static inline struct sctp_gap_ack_block *sctp_tsnmap_get_gabs(struct sctp_tsnmap
/* Is there a gap in the TSN map? */
static inline int sctp_tsnmap_has_gap(const struct sctp_tsnmap *map)
{
int has_gap;

has_gap = (map->cumulative_tsn_ack_point != map->max_tsn_seen);
return has_gap;
return (map->cumulative_tsn_ack_point != map->max_tsn_seen);
}

/* Mark a duplicate TSN. Note: limit the storage of duplicate TSN
Expand Down
9 changes: 5 additions & 4 deletions trunk/net/sctp/associola.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
if (!sctp_ulpq_init(&asoc->ulpq, asoc))
goto fail_init;

/* Set up the tsn tracking. */
sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_SIZE, 0);
memset(&asoc->peer.tsn_map, 0, sizeof(struct sctp_tsnmap));

asoc->need_ecne = 0;

Expand Down Expand Up @@ -402,6 +401,8 @@ void sctp_association_free(struct sctp_association *asoc)
/* Dispose of any pending chunks on the inqueue. */
sctp_inq_free(&asoc->base.inqueue);

sctp_tsnmap_free(&asoc->peer.tsn_map);

/* Free ssnmap storage. */
sctp_ssnmap_free(asoc->ssnmap);

Expand Down Expand Up @@ -1122,8 +1123,8 @@ void sctp_assoc_update(struct sctp_association *asoc,
asoc->peer.rwnd = new->peer.rwnd;
asoc->peer.sack_needed = new->peer.sack_needed;
asoc->peer.i = new->peer.i;
sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_SIZE,
asoc->peer.i.initial_tsn);
sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_INITIAL,
asoc->peer.i.initial_tsn, GFP_ATOMIC);

/* Remove any peer addresses not present in the new association. */
list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
Expand Down
5 changes: 3 additions & 2 deletions trunk/net/sctp/sm_make_chunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2288,8 +2288,9 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid,
}

/* Set up the TSN tracking pieces. */
sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_SIZE,
asoc->peer.i.initial_tsn);
if (!sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_INITIAL,
asoc->peer.i.initial_tsn, gfp))
goto clean_up;

/* RFC 2960 6.5 Stream Identifier and Stream Sequence Number
*
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/sctp/sm_sideeffect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,

case SCTP_CMD_REPORT_TSN:
/* Record the arrival of a TSN. */
sctp_tsnmap_mark(&asoc->peer.tsn_map, cmd->obj.u32);
error = sctp_tsnmap_mark(&asoc->peer.tsn_map,
cmd->obj.u32);
break;

case SCTP_CMD_REPORT_FWDTSN:
Expand Down
Loading

0 comments on commit 9a28de9

Please sign in to comment.