- DF bit was on for COOKIE-ECHO chunks. This is

incorrect and should be OFF letting IP fragment
  large cookie-echos.
- Rename sysctl variable logging to log_level.
- Fix description of sysctl variable stats.
- Add sysctl variable log to make sctp_log readable via sysctl
  mechanism (this is by compile switch and targets non KTR platforms or
  when someone wants to do performance wise tracing).
 - Removed debug code

Approved by:	re@freebsd.org (B Mah)
This commit is contained in:
Randall Stewart 2007-09-13 14:43:54 +00:00
parent 04ee05e815
commit b27a6b7d73
9 changed files with 60 additions and 40 deletions

View File

@ -986,11 +986,9 @@ sctp_move_chunks_from_deleted_prim(struct sctp_tcb *stcb, struct sctp_nets *dst)
struct sctp_stream_queue_pending *sp;
if (dst->dest_state & SCTP_ADDR_UNCONFIRMED) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "move_chunks_from_deleted_prim: specified destination is UNCONFIRMED\n");
return;
}
if (stcb->asoc.deleted_primary == NULL) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "move_chunks_from_deleted_prim: Funny, old primary is not stored\n");
return;
}
asoc = &stcb->asoc;
@ -1028,19 +1026,16 @@ sctp_assoc_immediate_retrans(struct sctp_tcb *stcb, struct sctp_nets *dstnet)
int error;
if (dstnet->dest_state & SCTP_ADDR_UNCONFIRMED) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "assoc_immediate_retrans: specified destination is UNCONFIRMED\n");
return;
}
if (stcb->asoc.deleted_primary == NULL) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "assoc_immediate_retrans: Funny, old primary is not stored\n");
return;
}
if (!TAILQ_EMPTY(&stcb->asoc.sent_queue)) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "Deleted primary is ");
SCTPDBG(SCTP_DEBUG_ASCONF1, "assoc_immediate_retrans: Deleted primary is ");
SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, &stcb->asoc.deleted_primary->ro._l_addr.sa);
SCTPDBG(SCTP_DEBUG_ASCONF1, "Current Primary is ");
SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, &stcb->asoc.primary_destination->ro._l_addr.sa);
SCTPDBG(SCTP_DEBUG_ASCONF1, "Stopping send timer and calling t3rxt_timer\n");
sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb,
stcb->asoc.deleted_primary,
SCTP_FROM_SCTP_TIMER + SCTP_LOC_8);
@ -1053,7 +1048,6 @@ sctp_assoc_immediate_retrans(struct sctp_tcb *stcb, struct sctp_nets *dstnet)
error = sctp_t3rxt_timer(stcb->sctp_ep, stcb,
stcb->asoc.deleted_primary);
if (error) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "t3rxt_timer error\n");
SCTP_INP_DECR_REF(stcb->sctp_ep);
return;
}
@ -1082,8 +1076,7 @@ sctp_net_immediate_retrans(struct sctp_tcb *stcb, struct sctp_nets *net)
{
struct sctp_tmit_chunk *chk;
SCTPDBG(SCTP_DEBUG_ASCONF1, "net_immediate_retrans:\n");
SCTPDBG(SCTP_DEBUG_ASCONF1, "RTO is %d\n", net->RTO);
SCTPDBG(SCTP_DEBUG_ASCONF1, "net_immediate_retrans: RTO is %d\n", net->RTO);
sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net,
SCTP_FROM_SCTP_TIMER + SCTP_LOC_5);
stcb->asoc.cc_functions.sctp_set_initial_cc_param(stcb, net);

View File

@ -229,11 +229,6 @@ __FBSDID("$FreeBSD$");
* logging flag on too in the sysctl (see in sctp.h).
*/
/* For SCTP only logging */
#define SCTP_MAX_LOGGING_SIZE 30000
#define SCTP_TRACE_PARAMS 6
#define SCTP_LOG_EVENT_UNKNOWN 0
#define SCTP_LOG_EVENT_CWND 1
#define SCTP_LOG_EVENT_BLOCK 2

View File

@ -7852,7 +7852,7 @@ sctp_send_cookie_echo(struct mbuf *m,
chk->rec.chunk_id.can_take_data = 0;
chk->sent = SCTP_DATAGRAM_UNSENT;
chk->snd_count = 0;
chk->flags = 0;
chk->flags = CHUNK_FLAGS_FRAGMENT_OK;
chk->asoc = &stcb->asoc;
chk->data = cookie;
chk->whoTo = chk->asoc->primary_destination;
@ -11979,6 +11979,15 @@ sctp_lower_sosend(struct socket *so,
/* We send in a 0, since we do NOT have any locks */
error = sctp_msg_append(stcb, net, top, srcv, 0);
top = NULL;
if (srcv->sinfo_flags & SCTP_EOF) {
/*
* This should only happen for Panda for the mbuf
* send case, which does NOT yet support EEOR mode.
* Thus, we can just set this flag to do the proper
* EOF handling.
*/
got_all_of_the_send = 1;
}
}
if (error) {
goto out;

View File

@ -4911,6 +4911,9 @@ sctp_pcb_init()
sctp_pcb_initialized = 1;
bzero(&sctpstat, sizeof(struct sctpstat));
#if defined(SCTP_LOCAL_TRACE_BUF)
bzero(&sctp_log, sizeof(struct sctp_log));
#endif
(void)SCTP_GETTIME_TIMEVAL(&tv);
sctpstat.sctps_discontinuitytime.tv_sec = (uint32_t) tv.tv_sec;
sctpstat.sctps_discontinuitytime.tv_usec = (uint32_t) tv.tv_usec;

View File

@ -98,6 +98,10 @@ uint32_t sctp_default_frag_interleave = SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DEFAULT;
uint32_t sctp_mobility_base = SCTPCTL_MOBILITY_BASE_DEFAULT;
uint32_t sctp_mobility_fasthandoff = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT;
#if defined(SCTP_LOCAL_TRACE_BUF)
struct sctp_log sctp_log;
#endif
#ifdef SCTP_DEBUG
uint32_t sctp_debug_on = SCTPCTL_DEBUG_DEFAULT;
@ -759,7 +763,7 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, max_retran_chunk, CTLTYPE_INT | CTLFLAG_RW
&sctp_max_retran_chunk, 0, sysctl_sctp_check, "IU",
SCTPCTL_MAX_RETRAN_CHUNK_DESC);
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, logging, CTLTYPE_INT | CTLFLAG_RW,
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, log_level, CTLTYPE_INT | CTLFLAG_RW,
&sctp_logging_level, 0, sysctl_sctp_check, "IU",
SCTPCTL_LOGGING_LEVEL_DESC);
@ -783,6 +787,12 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, mobility_fasthandoff, CTLTYPE_INT | CTLFLA
SCTPCTL_MOBILITY_FASTHANDOFF_DESC);
#endif
#if defined(SCTP_LOCAL_TRACE_BUF)
SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, log, CTLFLAG_RD,
&sctp_log, sctp_log,
"SCTP logging (struct sctp_log)");
#endif
#ifdef SCTP_DEBUG
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW,
&sctp_debug_on, 0, sysctl_sctp_check, "IU",
@ -792,7 +802,7 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW,
SYSCTL_STRUCT(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_RW,
&sctpstat, sctpstat,
"SCTP statistics (struct sctps_stat, netinet/sctp.h");
"SCTP statistics (struct sctp_stat)");
SYSCTL_PROC(_net_inet_sctp, OID_AUTO, assoclist, CTLFLAG_RD,
0, 0, sctp_assoclist,

View File

@ -501,6 +501,10 @@ extern uint32_t sctp_default_frag_interleave;
extern uint32_t sctp_mobility_base;
extern uint32_t sctp_mobility_fasthandoff;
#if defined(SCTP_LOCAL_TRACE_BUF)
extern struct sctp_log sctp_log;
#endif
#if defined(SCTP_DEBUG)
extern uint32_t sctp_debug_on;

View File

@ -1017,6 +1017,22 @@ struct xsctp_raddr {
struct sctp_timeval start_time; /* sctpAssocLocalRemEntry 8 */
};
#define SCTP_MAX_LOGGING_SIZE 30000
#define SCTP_TRACE_PARAMS 6 /* This number MUST be even */
struct sctp_log_entry {
u_int64_t timestamp;
uint32_t subsys;
uint32_t padding;
uint32_t params[SCTP_TRACE_PARAMS];
};
struct sctp_log {
struct sctp_log_entry entry[SCTP_MAX_LOGGING_SIZE];
uint32_t index;
uint32_t padding;
};
/*
* Kernel defined for sctp_send
*/

View File

@ -6459,40 +6459,30 @@ sctp_local_addr_count(struct sctp_tcb *stcb)
#if defined(SCTP_LOCAL_TRACE_BUF)
struct sctp_dump_log {
u_int64_t timestamp;
const char *descr;
uint32_t subsys;
uint32_t params[SCTP_TRACE_PARAMS];
};
int sctp_log_index = 0;
struct sctp_dump_log sctp_log[SCTP_MAX_LOGGING_SIZE];
void
sctp_log_trace(uint32_t subsys, const char *str, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f)
sctp_log_trace(uint32_t subsys, const char *str SCTP_UNUSED, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f)
{
int saveindex, newindex;
uint32_t saveindex, newindex;
do {
saveindex = sctp_log_index;
saveindex = sctp_log.index;
if (saveindex >= SCTP_MAX_LOGGING_SIZE) {
newindex = 1;
} else {
newindex = saveindex + 1;
}
} while (atomic_cmpset_int(&sctp_log_index, saveindex, newindex) == 0);
} while (atomic_cmpset_int(&sctp_log.index, saveindex, newindex) == 0);
if (saveindex >= SCTP_MAX_LOGGING_SIZE) {
saveindex = 0;
}
sctp_log[saveindex].timestamp = SCTP_GET_CYCLECOUNT;
sctp_log[saveindex].subsys = subsys;
sctp_log[saveindex].descr = str;
sctp_log[saveindex].params[0] = a;
sctp_log[saveindex].params[1] = b;
sctp_log[saveindex].params[2] = c;
sctp_log[saveindex].params[3] = d;
sctp_log[saveindex].params[4] = e;
sctp_log[saveindex].params[5] = f;
sctp_log.entry[saveindex].timestamp = SCTP_GET_CYCLECOUNT;
sctp_log.entry[saveindex].subsys = subsys;
sctp_log.entry[saveindex].params[0] = a;
sctp_log.entry[saveindex].params[1] = b;
sctp_log.entry[saveindex].params[2] = c;
sctp_log.entry[saveindex].params[3] = d;
sctp_log.entry[saveindex].params[4] = e;
sctp_log.entry[saveindex].params[5] = f;
}
#endif

View File

@ -56,7 +56,7 @@ void sctp_m_freem(struct mbuf *m);
#if defined(SCTP_LOCAL_TRACE_BUF) || defined(__APPLE__)
void
sctp_log_trace(uint32_t fr, const char *str, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f);
sctp_log_trace(uint32_t fr, const char *str SCTP_UNUSED, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f);
#endif