Minimize the usage of SCTP_BUF_IS_EXTENDED.

This should help Robert...
This commit is contained in:
Michael Tuexen 2015-01-10 20:49:57 +00:00
parent 13ea8106d9
commit 4be807c4d6
7 changed files with 38 additions and 99 deletions

View File

@ -392,9 +392,7 @@ sctp_get_mbuf_for_msg(unsigned int space_needed, int want_header,
} }
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
if (SCTP_BUF_IS_EXTENDED(m)) { sctp_log_mb(m, SCTP_MBUF_IALLOC);
sctp_log_mb(m, SCTP_MBUF_IALLOC);
}
} }
#endif #endif
return (m); return (m);

View File

@ -1493,13 +1493,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc,
the_len, M_NOWAIT); the_len, M_NOWAIT);
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(dmbuf, SCTP_MBUF_ICOPY);
for (mat = dmbuf; mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_ICOPY);
}
}
} }
#endif #endif
} else { } else {

View File

@ -2443,13 +2443,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset,
} }
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(m_sig, SCTP_MBUF_SPLIT);
for (mat = m_sig; mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_SPLIT);
}
}
} }
#endif #endif
@ -5501,13 +5495,7 @@ process_control_chunks:
} else { } else {
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(SCTP_BUF_NEXT(mm), SCTP_MBUF_ICOPY);
for (mat = SCTP_BUF_NEXT(mm); mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_ICOPY);
}
}
} }
#endif #endif
sctp_queue_op_err(stcb, mm); sctp_queue_op_err(stcb, mm);
@ -5997,13 +5985,7 @@ sctp_input_with_port(struct mbuf *i_pak, int off, uint16_t port)
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
/* Log in any input mbufs */ /* Log in any input mbufs */
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(m, SCTP_MBUF_INPUT);
for (mat = m; mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_INPUT);
}
}
} }
#endif #endif
#ifdef SCTP_PACKET_LOGGING #ifdef SCTP_PACKET_LOGGING

View File

@ -3846,13 +3846,7 @@ sctp_add_cookie(struct mbuf *init, int init_offset,
} }
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(copy_init, SCTP_MBUF_ICOPY);
for (mat = copy_init; mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_ICOPY);
}
}
} }
#endif #endif
copy_initack = SCTP_M_COPYM(initack, initack_offset, M_COPYALL, copy_initack = SCTP_M_COPYM(initack, initack_offset, M_COPYALL,
@ -3864,13 +3858,7 @@ sctp_add_cookie(struct mbuf *init, int init_offset,
} }
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(copy_initack, SCTP_MBUF_ICOPY);
for (mat = copy_initack; mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_ICOPY);
}
}
} }
#endif #endif
/* easy side we just drop it on the end */ /* easy side we just drop it on the end */
@ -6482,13 +6470,7 @@ error_out:
appendchain = SCTP_M_COPYM(clonechain, 0, M_COPYALL, M_NOWAIT); appendchain = SCTP_M_COPYM(clonechain, 0, M_COPYALL, M_NOWAIT);
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(appendchain, SCTP_MBUF_ICOPY);
for (mat = appendchain; mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_ICOPY);
}
}
} }
#endif #endif
} }
@ -6581,13 +6563,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr,
} }
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(m, SCTP_MBUF_ICOPY);
for (mat = m; mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_ICOPY);
}
}
} }
#endif #endif
} else { } else {
@ -7371,13 +7347,7 @@ dont_do_it:
} }
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(chk->data, SCTP_MBUF_ICOPY);
for (mat = chk->data; mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_ICOPY);
}
}
} }
#endif #endif
/* Pull off the data */ /* Pull off the data */
@ -8973,13 +8943,7 @@ sctp_send_cookie_echo(struct mbuf *m,
} }
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(cookie, SCTP_MBUF_ICOPY);
for (mat = cookie; mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_ICOPY);
}
}
} }
#endif #endif
break; break;
@ -9045,13 +9009,7 @@ sctp_send_heartbeat_ack(struct sctp_tcb *stcb,
} }
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(outchain, SCTP_MBUF_ICOPY);
for (mat = outchain; mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_ICOPY);
}
}
} }
#endif #endif
chdr = mtod(outchain, struct sctp_chunkhdr *); chdr = mtod(outchain, struct sctp_chunkhdr *);
@ -9330,13 +9288,7 @@ sctp_send_asconf_ack(struct sctp_tcb *stcb)
} }
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(m_ack, SCTP_MBUF_ICOPY);
for (mat = m_ack; mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_ICOPY);
}
}
} }
#endif #endif

View File

@ -217,6 +217,7 @@ sctp_log_fr(uint32_t biggest_tsn, uint32_t biggest_new_tsn, uint32_t tsn, int fr
sctp_clog.x.misc.log4); sctp_clog.x.misc.log4);
} }
#ifdef SCTP_MBUF_LOGGING
void void
sctp_log_mb(struct mbuf *m, int from) sctp_log_mb(struct mbuf *m, int from)
{ {
@ -242,6 +243,18 @@ sctp_log_mb(struct mbuf *m, int from)
sctp_clog.x.misc.log4); sctp_clog.x.misc.log4);
} }
void
sctp_log_mbc(struct mbuf *m, int from)
{
struct mbuf *mat;
for (mat = m; mat; mat = SCTP_BUF_NEXT(mat)) {
sctp_log_mb(mat, from);
}
}
#endif
void void
sctp_log_strm_del(struct sctp_queued_to_read *control, struct sctp_queued_to_read *poschk, int from) sctp_log_strm_del(struct sctp_queued_to_read *control, struct sctp_queued_to_read *poschk, int from)
{ {
@ -413,7 +426,8 @@ sctp_log_rwnd_set(uint8_t from, uint32_t peers_rwnd, uint32_t flight_size, uint3
sctp_clog.x.misc.log4); sctp_clog.x.misc.log4);
} }
void #ifdef SCTP_MBCNT_LOGGING
static void
sctp_log_mbcnt(uint8_t from, uint32_t total_oq, uint32_t book, uint32_t total_mbcnt_q, uint32_t mbcnt) sctp_log_mbcnt(uint8_t from, uint32_t total_oq, uint32_t book, uint32_t total_mbcnt_q, uint32_t mbcnt)
{ {
struct sctp_cwnd_log sctp_clog; struct sctp_cwnd_log sctp_clog;
@ -431,6 +445,8 @@ sctp_log_mbcnt(uint8_t from, uint32_t total_oq, uint32_t book, uint32_t total_mb
sctp_clog.x.misc.log4); sctp_clog.x.misc.log4);
} }
#endif
void void
sctp_misc_ints(uint8_t from, uint32_t a, uint32_t b, uint32_t c, uint32_t d) sctp_misc_ints(uint8_t from, uint32_t a, uint32_t b, uint32_t c, uint32_t d)
{ {
@ -6157,9 +6173,7 @@ struct mbuf *
sctp_m_free(struct mbuf *m) sctp_m_free(struct mbuf *m)
{ {
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
if (SCTP_BUF_IS_EXTENDED(m)) { sctp_log_mb(m, SCTP_MBUF_IFREE);
sctp_log_mb(m, SCTP_MBUF_IFREE);
}
} }
return (m_free(m)); return (m_free(m));
} }

View File

@ -349,9 +349,15 @@ void sctp_log_strm_del_alt(struct sctp_tcb *stcb, uint32_t, uint16_t, uint16_t,
void sctp_log_nagle_event(struct sctp_tcb *stcb, int action); void sctp_log_nagle_event(struct sctp_tcb *stcb, int action);
#ifdef SCTP_MBUF_LOGGING
void void
sctp_log_mb(struct mbuf *m, int from); sctp_log_mb(struct mbuf *m, int from);
void
sctp_log_mbc(struct mbuf *m, int from);
#endif
void void
sctp_sblog(struct sockbuf *sb, sctp_sblog(struct sockbuf *sb,
struct sctp_tcb *stcb, int from, int incr); struct sctp_tcb *stcb, int from, int incr);
@ -369,7 +375,6 @@ void sctp_log_lock(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint8_t from);
void sctp_log_maxburst(struct sctp_tcb *stcb, struct sctp_nets *, int, int, uint8_t); void sctp_log_maxburst(struct sctp_tcb *stcb, struct sctp_nets *, int, int, uint8_t);
void sctp_log_block(uint8_t, struct sctp_association *, int); void sctp_log_block(uint8_t, struct sctp_association *, int);
void sctp_log_rwnd(uint8_t, uint32_t, uint32_t, uint32_t); void sctp_log_rwnd(uint8_t, uint32_t, uint32_t, uint32_t);
void sctp_log_mbcnt(uint8_t, uint32_t, uint32_t, uint32_t, uint32_t);
void sctp_log_rwnd_set(uint8_t, uint32_t, uint32_t, uint32_t, uint32_t); void sctp_log_rwnd_set(uint8_t, uint32_t, uint32_t, uint32_t, uint32_t);
int sctp_fill_stat_log(void *, size_t *); int sctp_fill_stat_log(void *, size_t *);
void sctp_log_fr(uint32_t, uint32_t, uint32_t, int); void sctp_log_fr(uint32_t, uint32_t, uint32_t, int);

View File

@ -94,13 +94,7 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port)
#ifdef SCTP_MBUF_LOGGING #ifdef SCTP_MBUF_LOGGING
/* Log in any input mbufs */ /* Log in any input mbufs */
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
struct mbuf *mat; sctp_log_mbc(m, SCTP_MBUF_INPUT);
for (mat = m; mat; mat = SCTP_BUF_NEXT(mat)) {
if (SCTP_BUF_IS_EXTENDED(mat)) {
sctp_log_mb(mat, SCTP_MBUF_INPUT);
}
}
} }
#endif #endif
#ifdef SCTP_PACKET_LOGGING #ifdef SCTP_PACKET_LOGGING