sctp: more sb_cc related cleanups
No functional change intended. It allows a simpler patch for PR 260116. MFC after: 3 days
This commit is contained in:
parent
2d896da92a
commit
5cebd8305a
@ -85,7 +85,7 @@ extern struct pr_usrreqs sctp_usrreqs;
|
||||
|
||||
#define sctp_sbspace(asoc, sb) ((long) ((sctp_maxspace(sb) > (asoc)->sb_cc) ? (sctp_maxspace(sb) - (asoc)->sb_cc) : 0))
|
||||
|
||||
#define sctp_sbspace_failedmsgs(sb) ((long) ((sctp_maxspace(sb) > (sb)->sb_cc) ? (sctp_maxspace(sb) - (sb)->sb_cc) : 0))
|
||||
#define sctp_sbspace_failedmsgs(sb) ((long) ((sctp_maxspace(sb) > SCTP_SBAVAIL(sb)) ? (sctp_maxspace(sb) - SCTP_SBAVAIL(sb)) : 0))
|
||||
|
||||
#define sctp_sbspace_sub(a,b) (((a) > (b)) ? ((a) - (b)) : 0)
|
||||
|
||||
|
@ -5003,7 +5003,6 @@ sctp_generate_no_user_data_cause(uint32_t tsn)
|
||||
return (m);
|
||||
}
|
||||
|
||||
#ifdef SCTP_MBCNT_LOGGING
|
||||
void
|
||||
sctp_free_bufspace(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
||||
struct sctp_tmit_chunk *tp1, int chk_cnt)
|
||||
@ -5011,7 +5010,8 @@ sctp_free_bufspace(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
||||
if (tp1->data == NULL) {
|
||||
return;
|
||||
}
|
||||
asoc->chunks_on_out_queue -= chk_cnt;
|
||||
atomic_subtract_int(&asoc->chunks_on_out_queue, chk_cnt);
|
||||
#ifdef SCTP_MBCNT_LOGGING
|
||||
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBCNT_LOGGING_ENABLE) {
|
||||
sctp_log_mbcnt(SCTP_LOG_MBCNT_DECREASE,
|
||||
asoc->total_output_queue_size,
|
||||
@ -5019,24 +5019,23 @@ sctp_free_bufspace(struct sctp_tcb *stcb, struct sctp_association *asoc,
|
||||
0,
|
||||
tp1->mbcnt);
|
||||
}
|
||||
#endif
|
||||
if (asoc->total_output_queue_size >= tp1->book_size) {
|
||||
atomic_add_int(&asoc->total_output_queue_size, -tp1->book_size);
|
||||
atomic_subtract_int(&asoc->total_output_queue_size, tp1->book_size);
|
||||
} else {
|
||||
asoc->total_output_queue_size = 0;
|
||||
}
|
||||
|
||||
if (stcb->sctp_socket && (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) ||
|
||||
if ((stcb->sctp_socket != NULL) &&
|
||||
(((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) ||
|
||||
((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE)))) {
|
||||
if (stcb->sctp_socket->so_snd.sb_cc >= tp1->book_size) {
|
||||
stcb->sctp_socket->so_snd.sb_cc -= tp1->book_size;
|
||||
atomic_subtract_int(&((stcb)->sctp_socket->so_snd.sb_cc), tp1->book_size);
|
||||
} else {
|
||||
stcb->sctp_socket->so_snd.sb_cc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1,
|
||||
uint8_t sent, int so_locked)
|
||||
|
@ -239,34 +239,10 @@ sctp_bindx_delete_address(struct sctp_inpcb *inp, struct sockaddr *sa,
|
||||
|
||||
int sctp_local_addr_count(struct sctp_tcb *stcb);
|
||||
|
||||
#ifdef SCTP_MBCNT_LOGGING
|
||||
void
|
||||
sctp_free_bufspace(struct sctp_tcb *, struct sctp_association *,
|
||||
struct sctp_tmit_chunk *, int);
|
||||
|
||||
#else
|
||||
#define sctp_free_bufspace(stcb, asoc, tp1, chk_cnt) \
|
||||
do { \
|
||||
if (tp1->data != NULL) { \
|
||||
atomic_subtract_int(&((asoc)->chunks_on_out_queue), chk_cnt); \
|
||||
if ((asoc)->total_output_queue_size >= tp1->book_size) { \
|
||||
atomic_subtract_int(&((asoc)->total_output_queue_size), tp1->book_size); \
|
||||
} else { \
|
||||
(asoc)->total_output_queue_size = 0; \
|
||||
} \
|
||||
if (stcb->sctp_socket && ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || \
|
||||
(stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) { \
|
||||
if (stcb->sctp_socket->so_snd.sb_cc >= tp1->book_size) { \
|
||||
atomic_subtract_int(&((stcb)->sctp_socket->so_snd.sb_cc), tp1->book_size); \
|
||||
} else { \
|
||||
stcb->sctp_socket->so_snd.sb_cc = 0; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
#define sctp_free_spbufspace(stcb, asoc, sp) \
|
||||
do { \
|
||||
if (sp->data != NULL) { \
|
||||
|
Loading…
Reference in New Issue
Block a user