diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-10-31 12:13:10 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-10-31 12:13:10 -0400 |
commit | 7b3b6e42032e94a6132a85642e95106f5346650e (patch) | |
tree | 8b2262291341d8a9f9b1e7e3c63a3289bb6c6de6 /include/net/sctp/tsnmap.h | |
parent | 04172c0b9ea5861e5cba7909da5297b3aedac9e1 (diff) | |
parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) |
Merge commit 'v2.6.28-rc2' into topic/asoc
Diffstat (limited to 'include/net/sctp/tsnmap.h')
-rw-r--r-- | include/net/sctp/tsnmap.h | 53 |
1 files changed, 12 insertions, 41 deletions
diff --git a/include/net/sctp/tsnmap.h b/include/net/sctp/tsnmap.h index 099211bf998d..4aabc5a96cf6 100644 --- a/include/net/sctp/tsnmap.h +++ b/include/net/sctp/tsnmap.h | |||
@@ -60,18 +60,7 @@ struct sctp_tsnmap { | |||
60 | * It points at one of the two buffers with which we will | 60 | * It points at one of the two buffers with which we will |
61 | * ping-pong between. | 61 | * ping-pong between. |
62 | */ | 62 | */ |
63 | __u8 *tsn_map; | 63 | unsigned long *tsn_map; |
64 | |||
65 | /* This marks the tsn which overflows the tsn_map, when the | ||
66 | * cumulative ack point reaches this point we know we can switch | ||
67 | * maps (tsn_map and overflow_map swap). | ||
68 | */ | ||
69 | __u32 overflow_tsn; | ||
70 | |||
71 | /* This is the overflow array for tsn_map. | ||
72 | * It points at one of the other ping-pong buffers. | ||
73 | */ | ||
74 | __u8 *overflow_map; | ||
75 | 64 | ||
76 | /* This is the TSN at tsn_map[0]. */ | 65 | /* This is the TSN at tsn_map[0]. */ |
77 | __u32 base_tsn; | 66 | __u32 base_tsn; |
@@ -89,15 +78,15 @@ struct sctp_tsnmap { | |||
89 | */ | 78 | */ |
90 | __u32 cumulative_tsn_ack_point; | 79 | __u32 cumulative_tsn_ack_point; |
91 | 80 | ||
81 | /* This is the highest TSN we've marked. */ | ||
82 | __u32 max_tsn_seen; | ||
83 | |||
92 | /* This is the minimum number of TSNs we can track. This corresponds | 84 | /* This is the minimum number of TSNs we can track. This corresponds |
93 | * to the size of tsn_map. Note: the overflow_map allows us to | 85 | * to the size of tsn_map. Note: the overflow_map allows us to |
94 | * potentially track more than this quantity. | 86 | * potentially track more than this quantity. |
95 | */ | 87 | */ |
96 | __u16 len; | 88 | __u16 len; |
97 | 89 | ||
98 | /* This is the highest TSN we've marked. */ | ||
99 | __u32 max_tsn_seen; | ||
100 | |||
101 | /* Data chunks pending receipt. used by SCTP_STATUS sockopt */ | 90 | /* Data chunks pending receipt. used by SCTP_STATUS sockopt */ |
102 | __u16 pending_data; | 91 | __u16 pending_data; |
103 | 92 | ||
@@ -105,29 +94,19 @@ struct sctp_tsnmap { | |||
105 | * every SACK. Store up to SCTP_MAX_DUP_TSNS worth of | 94 | * every SACK. Store up to SCTP_MAX_DUP_TSNS worth of |
106 | * information. | 95 | * information. |
107 | */ | 96 | */ |
108 | __be32 dup_tsns[SCTP_MAX_DUP_TSNS]; | ||
109 | __u16 num_dup_tsns; | 97 | __u16 num_dup_tsns; |
110 | 98 | __be32 dup_tsns[SCTP_MAX_DUP_TSNS]; | |
111 | /* Record gap ack block information here. */ | ||
112 | struct sctp_gap_ack_block gabs[SCTP_MAX_GABS]; | ||
113 | |||
114 | int malloced; | ||
115 | |||
116 | __u8 raw_map[0]; | ||
117 | }; | 99 | }; |
118 | 100 | ||
119 | struct sctp_tsnmap_iter { | 101 | struct sctp_tsnmap_iter { |
120 | __u32 start; | 102 | __u32 start; |
121 | }; | 103 | }; |
122 | 104 | ||
123 | /* This macro assists in creation of external storage for variable length | ||
124 | * internal buffers. We double allocate so the overflow map works. | ||
125 | */ | ||
126 | #define sctp_tsnmap_storage_size(count) (sizeof(__u8) * (count) * 2) | ||
127 | |||
128 | /* Initialize a block of memory as a tsnmap. */ | 105 | /* Initialize a block of memory as a tsnmap. */ |
129 | struct sctp_tsnmap *sctp_tsnmap_init(struct sctp_tsnmap *, __u16 len, | 106 | struct sctp_tsnmap *sctp_tsnmap_init(struct sctp_tsnmap *, __u16 len, |
130 | __u32 initial_tsn); | 107 | __u32 initial_tsn, gfp_t gfp); |
108 | |||
109 | void sctp_tsnmap_free(struct sctp_tsnmap *map); | ||
131 | 110 | ||
132 | /* Test the tracking state of this TSN. | 111 | /* Test the tracking state of this TSN. |
133 | * Returns: | 112 | * Returns: |
@@ -138,7 +117,7 @@ struct sctp_tsnmap *sctp_tsnmap_init(struct sctp_tsnmap *, __u16 len, | |||
138 | int sctp_tsnmap_check(const struct sctp_tsnmap *, __u32 tsn); | 117 | int sctp_tsnmap_check(const struct sctp_tsnmap *, __u32 tsn); |
139 | 118 | ||
140 | /* Mark this TSN as seen. */ | 119 | /* Mark this TSN as seen. */ |
141 | void sctp_tsnmap_mark(struct sctp_tsnmap *, __u32 tsn); | 120 | int sctp_tsnmap_mark(struct sctp_tsnmap *, __u32 tsn); |
142 | 121 | ||
143 | /* Mark this TSN and all lower as seen. */ | 122 | /* Mark this TSN and all lower as seen. */ |
144 | void sctp_tsnmap_skip(struct sctp_tsnmap *map, __u32 tsn); | 123 | void sctp_tsnmap_skip(struct sctp_tsnmap *map, __u32 tsn); |
@@ -169,24 +148,16 @@ static inline __be32 *sctp_tsnmap_get_dups(struct sctp_tsnmap *map) | |||
169 | } | 148 | } |
170 | 149 | ||
171 | /* How many gap ack blocks do we have recorded? */ | 150 | /* How many gap ack blocks do we have recorded? */ |
172 | __u16 sctp_tsnmap_num_gabs(struct sctp_tsnmap *map); | 151 | __u16 sctp_tsnmap_num_gabs(struct sctp_tsnmap *map, |
152 | struct sctp_gap_ack_block *gabs); | ||
173 | 153 | ||
174 | /* Refresh the count on pending data. */ | 154 | /* Refresh the count on pending data. */ |
175 | __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map); | 155 | __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map); |
176 | 156 | ||
177 | /* Return pointer to gap ack blocks as needed by SACK. */ | ||
178 | static inline struct sctp_gap_ack_block *sctp_tsnmap_get_gabs(struct sctp_tsnmap *map) | ||
179 | { | ||
180 | return map->gabs; | ||
181 | } | ||
182 | |||
183 | /* Is there a gap in the TSN map? */ | 157 | /* Is there a gap in the TSN map? */ |
184 | static inline int sctp_tsnmap_has_gap(const struct sctp_tsnmap *map) | 158 | static inline int sctp_tsnmap_has_gap(const struct sctp_tsnmap *map) |
185 | { | 159 | { |
186 | int has_gap; | 160 | return (map->cumulative_tsn_ack_point != map->max_tsn_seen); |
187 | |||
188 | has_gap = (map->cumulative_tsn_ack_point != map->max_tsn_seen); | ||
189 | return has_gap; | ||
190 | } | 161 | } |
191 | 162 | ||
192 | /* Mark a duplicate TSN. Note: limit the storage of duplicate TSN | 163 | /* Mark a duplicate TSN. Note: limit the storage of duplicate TSN |