Skip to content

Commit 6c6fbad

Browse files
committed
Merge branch 'sctp-tidyup'
Xin Long says: ==================== sctp: tidy up some ep and asoc feature flags This patchset is to remove some unnecessary feature flags from sctp_assocation and move some others to the right places. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents ccf355e + e55f4b8 commit 6c6fbad

File tree

6 files changed

+39
-46
lines changed

6 files changed

+39
-46
lines changed

include/net/sctp/structs.h

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ struct sctp_sock {
219219
disable_fragments:1,
220220
v4mapped:1,
221221
frag_interleave:1,
222-
strm_interleave:1,
223222
recvrcvinfo:1,
224223
recvnxtinfo:1,
225224
data_ready_signalled:1;
@@ -1324,6 +1323,7 @@ struct sctp_endpoint {
13241323
struct list_head endpoint_shared_keys;
13251324
__u16 active_key_id;
13261325
__u8 auth_enable:1,
1326+
intl_enable:1,
13271327
prsctp_enable:1,
13281328
reconf_enable:1;
13291329

@@ -1679,28 +1679,30 @@ struct sctp_association {
16791679
__be16 addip_disabled_mask;
16801680

16811681
/* These are capabilities which our peer advertised. */
1682-
__u8 ecn_capable:1, /* Can peer do ECN? */
1682+
__u16 ecn_capable:1, /* Can peer do ECN? */
16831683
ipv4_address:1, /* Peer understands IPv4 addresses? */
16841684
ipv6_address:1, /* Peer understands IPv6 addresses? */
16851685
hostname_address:1, /* Peer understands DNS addresses? */
16861686
asconf_capable:1, /* Does peer support ADDIP? */
16871687
prsctp_capable:1, /* Can peer do PR-SCTP? */
16881688
reconf_capable:1, /* Can peer do RE-CONFIG? */
1689-
auth_capable:1; /* Is peer doing SCTP-AUTH? */
1690-
1691-
/* sack_needed : This flag indicates if the next received
1692-
* : packet is to be responded to with a
1693-
* : SACK. This is initialized to 0. When a packet
1694-
* : is received sack_cnt is incremented. If this value
1695-
* : reaches 2 or more, a SACK is sent and the
1696-
* : value is reset to 0. Note: This is used only
1697-
* : when no DATA chunks are received out of
1698-
* : order. When DATA chunks are out of order,
1699-
* : SACK's are not delayed (see Section 6).
1700-
*/
1701-
__u8 sack_needed:1, /* Do we need to sack the peer? */
1689+
intl_capable:1, /* Can peer do INTERLEAVE */
1690+
auth_capable:1, /* Is peer doing SCTP-AUTH? */
1691+
/* sack_needed:
1692+
* This flag indicates if the next received
1693+
* packet is to be responded to with a
1694+
* SACK. This is initialized to 0. When a packet
1695+
* is received sack_cnt is incremented. If this value
1696+
* reaches 2 or more, a SACK is sent and the
1697+
* value is reset to 0. Note: This is used only
1698+
* when no DATA chunks are received out of
1699+
* order. When DATA chunks are out of order,
1700+
* SACK's are not delayed (see Section 6).
1701+
*/
1702+
sack_needed:1, /* Do we need to sack the peer? */
17021703
sack_generation:1,
17031704
zero_window_announced:1;
1705+
17041706
__u32 sack_cnt;
17051707

17061708
__u32 adaptation_ind; /* Adaptation Code point. */
@@ -2049,10 +2051,7 @@ struct sctp_association {
20492051

20502052
__u8 need_ecne:1, /* Need to send an ECNE Chunk? */
20512053
temp:1, /* Is it a temporary association? */
2052-
force_delay:1,
2053-
intl_enable:1,
2054-
prsctp_enable:1,
2055-
reconf_enable:1;
2054+
force_delay:1;
20562055

20572056
__u8 strreset_enable;
20582057
__u8 strreset_outstanding; /* request param count on the fly */

net/sctp/associola.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,6 @@ static struct sctp_association *sctp_association_init(
261261
goto stream_free;
262262

263263
asoc->active_key_id = ep->active_key_id;
264-
asoc->prsctp_enable = ep->prsctp_enable;
265-
asoc->reconf_enable = ep->reconf_enable;
266264
asoc->strreset_enable = ep->strreset_enable;
267265

268266
/* Save the hmacs and chunks list into this association */

net/sctp/sm_make_chunk.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
247247
chunksize += SCTP_PAD4(SCTP_SAT_LEN(num_types));
248248
chunksize += sizeof(ecap_param);
249249

250-
if (asoc->prsctp_enable)
250+
if (asoc->ep->prsctp_enable)
251251
chunksize += sizeof(prsctp_param);
252252

253253
/* ADDIP: Section 4.2.7:
@@ -261,15 +261,15 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
261261
num_ext += 2;
262262
}
263263

264-
if (asoc->reconf_enable) {
264+
if (asoc->ep->reconf_enable) {
265265
extensions[num_ext] = SCTP_CID_RECONF;
266266
num_ext += 1;
267267
}
268268

269269
if (sp->adaptation_ind)
270270
chunksize += sizeof(aiparam);
271271

272-
if (sp->strm_interleave) {
272+
if (asoc->ep->intl_enable) {
273273
extensions[num_ext] = SCTP_CID_I_DATA;
274274
num_ext += 1;
275275
}
@@ -348,7 +348,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
348348
sctp_addto_param(retval, num_ext, extensions);
349349
}
350350

351-
if (asoc->prsctp_enable)
351+
if (asoc->ep->prsctp_enable)
352352
sctp_addto_chunk(retval, sizeof(prsctp_param), &prsctp_param);
353353

354354
if (sp->adaptation_ind) {
@@ -438,7 +438,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
438438
if (sp->adaptation_ind)
439439
chunksize += sizeof(aiparam);
440440

441-
if (asoc->intl_enable) {
441+
if (asoc->peer.intl_capable) {
442442
extensions[num_ext] = SCTP_CID_I_DATA;
443443
num_ext += 1;
444444
}
@@ -2007,12 +2007,11 @@ static void sctp_process_ext_param(struct sctp_association *asoc,
20072007
for (i = 0; i < num_ext; i++) {
20082008
switch (param.ext->chunks[i]) {
20092009
case SCTP_CID_RECONF:
2010-
if (asoc->reconf_enable &&
2011-
!asoc->peer.reconf_capable)
2010+
if (asoc->ep->reconf_enable)
20122011
asoc->peer.reconf_capable = 1;
20132012
break;
20142013
case SCTP_CID_FWD_TSN:
2015-
if (asoc->prsctp_enable && !asoc->peer.prsctp_capable)
2014+
if (asoc->ep->prsctp_enable)
20162015
asoc->peer.prsctp_capable = 1;
20172016
break;
20182017
case SCTP_CID_AUTH:
@@ -2028,8 +2027,8 @@ static void sctp_process_ext_param(struct sctp_association *asoc,
20282027
asoc->peer.asconf_capable = 1;
20292028
break;
20302029
case SCTP_CID_I_DATA:
2031-
if (sctp_sk(asoc->base.sk)->strm_interleave)
2032-
asoc->intl_enable = 1;
2030+
if (asoc->ep->intl_enable)
2031+
asoc->peer.intl_capable = 1;
20332032
break;
20342033
default:
20352034
break;
@@ -2637,7 +2636,7 @@ static int sctp_process_param(struct sctp_association *asoc,
26372636
break;
26382637

26392638
case SCTP_PARAM_FWD_TSN_SUPPORT:
2640-
if (asoc->prsctp_enable) {
2639+
if (asoc->ep->prsctp_enable) {
26412640
asoc->peer.prsctp_capable = 1;
26422641
break;
26432642
}

net/sctp/socket.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,7 @@ static int sctp_sendmsg_to_asoc(struct sctp_association *asoc,
19131913
if (err)
19141914
goto err;
19151915

1916-
if (sp->strm_interleave) {
1916+
if (asoc->ep->intl_enable) {
19171917
timeo = sock_sndtimeo(sk, 0);
19181918
err = sctp_wait_for_connect(asoc, &timeo);
19191919
if (err) {
@@ -3581,7 +3581,7 @@ static int sctp_setsockopt_fragment_interleave(struct sock *sk,
35813581
sctp_sk(sk)->frag_interleave = !!val;
35823582

35833583
if (!sctp_sk(sk)->frag_interleave)
3584-
sctp_sk(sk)->strm_interleave = 0;
3584+
sctp_sk(sk)->ep->intl_enable = 0;
35853585

35863586
return 0;
35873587
}
@@ -4226,10 +4226,7 @@ static int sctp_setsockopt_reconfig_supported(struct sock *sk,
42264226
sctp_style(sk, UDP))
42274227
goto out;
42284228

4229-
if (asoc)
4230-
asoc->reconf_enable = !!params.assoc_value;
4231-
else
4232-
sctp_sk(sk)->ep->reconf_enable = !!params.assoc_value;
4229+
sctp_sk(sk)->ep->reconf_enable = !!params.assoc_value;
42334230

42344231
retval = 0;
42354232

@@ -4487,7 +4484,7 @@ static int sctp_setsockopt_interleaving_supported(struct sock *sk,
44874484
goto out;
44884485
}
44894486

4490-
sp->strm_interleave = !!params.assoc_value;
4487+
sp->ep->intl_enable = !!params.assoc_value;
44914488

44924489
retval = 0;
44934490

@@ -7328,7 +7325,7 @@ static int sctp_getsockopt_pr_supported(struct sock *sk, int len,
73287325
goto out;
73297326
}
73307327

7331-
params.assoc_value = asoc ? asoc->prsctp_enable
7328+
params.assoc_value = asoc ? asoc->peer.prsctp_capable
73327329
: sctp_sk(sk)->ep->prsctp_enable;
73337330

73347331
if (put_user(len, optlen))
@@ -7536,7 +7533,7 @@ static int sctp_getsockopt_reconfig_supported(struct sock *sk, int len,
75367533
goto out;
75377534
}
75387535

7539-
params.assoc_value = asoc ? asoc->reconf_enable
7536+
params.assoc_value = asoc ? asoc->peer.reconf_capable
75407537
: sctp_sk(sk)->ep->reconf_enable;
75417538

75427539
if (put_user(len, optlen))
@@ -7695,8 +7692,8 @@ static int sctp_getsockopt_interleaving_supported(struct sock *sk, int len,
76957692
goto out;
76967693
}
76977694

7698-
params.assoc_value = asoc ? asoc->intl_enable
7699-
: sctp_sk(sk)->strm_interleave;
7695+
params.assoc_value = asoc ? asoc->peer.intl_capable
7696+
: sctp_sk(sk)->ep->intl_enable;
77007697

77017698
if (put_user(len, optlen))
77027699
goto out;

net/sctp/stream_interleave.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,6 @@ void sctp_stream_interleave_init(struct sctp_stream *stream)
13581358
struct sctp_association *asoc;
13591359

13601360
asoc = container_of(stream, struct sctp_association, stream);
1361-
stream->si = asoc->intl_enable ? &sctp_stream_interleave_1
1362-
: &sctp_stream_interleave_0;
1361+
stream->si = asoc->peer.intl_capable ? &sctp_stream_interleave_1
1362+
: &sctp_stream_interleave_0;
13631363
}

net/sctp/stream_sched.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ int sctp_sched_get_value(struct sctp_association *asoc, __u16 sid,
228228
void sctp_sched_dequeue_done(struct sctp_outq *q, struct sctp_chunk *ch)
229229
{
230230
if (!list_is_last(&ch->frag_list, &ch->msg->chunks) &&
231-
!q->asoc->intl_enable) {
231+
!q->asoc->peer.intl_capable) {
232232
struct sctp_stream_out *sout;
233233
__u16 sid;
234234

0 commit comments

Comments
 (0)