Code cleanup, not functional change.
This avoids taking a pointer of a packed structure which allows simpler compilation of the userland stack. MFC after: 1 week
This commit is contained in:
parent
4c30353203
commit
bbb2153a14
@ -97,10 +97,6 @@ __FBSDID("$FreeBSD$");
|
||||
*/
|
||||
#define SCTP_DEFAULT_VRF_SIZE 4
|
||||
|
||||
/* constants for rto calc */
|
||||
#define sctp_align_safe_nocopy 0
|
||||
#define sctp_align_unsafe_makecopy 1
|
||||
|
||||
/* JRS - Values defined for the HTCP algorithm */
|
||||
#define ALPHA_BASE (1<<7) /* 1.0 with shift << 7 */
|
||||
#define BETA_MIN (1<<6) /* 0.5 with shift << 7 */
|
||||
|
@ -3058,7 +3058,6 @@ sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1
|
||||
&stcb->asoc,
|
||||
tp1->whoTo,
|
||||
&tp1->sent_rcv_time,
|
||||
sctp_align_safe_nocopy,
|
||||
SCTP_RTT_FROM_DATA);
|
||||
*rto_ok = 0;
|
||||
}
|
||||
@ -4030,7 +4029,6 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
|
||||
sctp_calculate_rto(stcb,
|
||||
asoc, tp1->whoTo,
|
||||
&tp1->sent_rcv_time,
|
||||
sctp_align_safe_nocopy,
|
||||
SCTP_RTT_FROM_DATA);
|
||||
rto_ok = 0;
|
||||
}
|
||||
@ -4636,7 +4634,6 @@ hopeless_peer:
|
||||
sctp_calculate_rto(stcb,
|
||||
asoc, tp1->whoTo,
|
||||
&tp1->sent_rcv_time,
|
||||
sctp_align_safe_nocopy,
|
||||
SCTP_RTT_FROM_DATA);
|
||||
rto_ok = 0;
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset,
|
||||
asoc->primary_destination, SCTP_FROM_SCTP_INPUT + SCTP_LOC_3);
|
||||
|
||||
/* calculate the RTO */
|
||||
net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, sctp_align_safe_nocopy,
|
||||
net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered,
|
||||
SCTP_RTT_FROM_NON_DATA);
|
||||
retval = sctp_send_cookie_echo(m, offset, stcb, net);
|
||||
if (retval < 0) {
|
||||
@ -639,7 +639,7 @@ sctp_handle_heartbeat_ack(struct sctp_heartbeat_chunk *cp,
|
||||
tv.tv_sec = cp->heartbeat.hb_info.time_value_1;
|
||||
tv.tv_usec = cp->heartbeat.hb_info.time_value_2;
|
||||
/* Now lets do a RTO with this */
|
||||
r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, sctp_align_safe_nocopy,
|
||||
r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv,
|
||||
SCTP_RTT_FROM_NON_DATA);
|
||||
if (!(r_net->dest_state & SCTP_ADDR_REACHABLE)) {
|
||||
r_net->dest_state |= SCTP_ADDR_REACHABLE;
|
||||
@ -1487,6 +1487,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
|
||||
struct sctp_init_ack_chunk *initack_cp, initack_buf;
|
||||
struct sctp_nets *net;
|
||||
struct mbuf *op_err;
|
||||
struct timeval old;
|
||||
int init_offset, initack_offset, i;
|
||||
int retval;
|
||||
int spec_flag = 0;
|
||||
@ -1647,10 +1648,11 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
|
||||
* since we did not send a HB make sure we don't
|
||||
* double things
|
||||
*/
|
||||
old.tv_sec = cookie->time_entered.tv_sec;
|
||||
old.tv_usec = cookie->time_entered.tv_usec;
|
||||
net->hb_responded = 1;
|
||||
net->RTO = sctp_calculate_rto(stcb, asoc, net,
|
||||
&cookie->time_entered,
|
||||
sctp_align_unsafe_makecopy,
|
||||
&old,
|
||||
SCTP_RTT_FROM_NON_DATA);
|
||||
|
||||
if (stcb->asoc.sctp_autoclose_ticks &&
|
||||
@ -2367,10 +2369,13 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
|
||||
}
|
||||
(void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
|
||||
if ((netp != NULL) && (*netp != NULL)) {
|
||||
struct timeval old;
|
||||
|
||||
/* calculate the RTT and set the encaps port */
|
||||
old.tv_sec = cookie->time_entered.tv_sec;
|
||||
old.tv_usec = cookie->time_entered.tv_usec;
|
||||
(*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp,
|
||||
&cookie->time_entered, sctp_align_unsafe_makecopy,
|
||||
SCTP_RTT_FROM_NON_DATA);
|
||||
&old, SCTP_RTT_FROM_NON_DATA);
|
||||
}
|
||||
/* respond with a COOKIE-ACK */
|
||||
sctp_send_cookie_ack(stcb);
|
||||
@ -2936,7 +2941,7 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *cp SCTP_UNUSED,
|
||||
SCTP_STAT_INCR_GAUGE32(sctps_currestab);
|
||||
if (asoc->overall_error_count == 0) {
|
||||
net->RTO = sctp_calculate_rto(stcb, asoc, net,
|
||||
&asoc->time_entered, sctp_align_safe_nocopy,
|
||||
&asoc->time_entered,
|
||||
SCTP_RTT_FROM_NON_DATA);
|
||||
}
|
||||
(void)SCTP_GETTIME_TIMEVAL(&asoc->time_entered);
|
||||
|
@ -5501,6 +5501,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
struct sctp_paramhdr *ph;
|
||||
union sctp_sockstore *over_addr;
|
||||
struct sctp_scoping scp;
|
||||
struct timeval now;
|
||||
#ifdef INET
|
||||
struct sockaddr_in *dst4 = (struct sockaddr_in *)dst;
|
||||
struct sockaddr_in *src4 = (struct sockaddr_in *)src;
|
||||
@ -5601,7 +5602,9 @@ do_a_abort:
|
||||
memset(&stc, 0, sizeof(struct sctp_state_cookie));
|
||||
|
||||
/* the time I built cookie */
|
||||
(void)SCTP_GETTIME_TIMEVAL(&stc.time_entered);
|
||||
(void)SCTP_GETTIME_TIMEVAL(&now);
|
||||
stc.time_entered.tv_sec = now.tv_sec;
|
||||
stc.time_entered.tv_usec = now.tv_usec;
|
||||
|
||||
/* populate any tie tags */
|
||||
if (asoc != NULL) {
|
||||
|
@ -2422,8 +2422,8 @@ uint32_t
|
||||
sctp_calculate_rto(struct sctp_tcb *stcb,
|
||||
struct sctp_association *asoc,
|
||||
struct sctp_nets *net,
|
||||
struct timeval *told,
|
||||
int safe, int rtt_from_sack)
|
||||
struct timeval *old,
|
||||
int rtt_from_sack)
|
||||
{
|
||||
/*-
|
||||
* given an association and the starting time of the current RTT
|
||||
@ -2432,19 +2432,8 @@ sctp_calculate_rto(struct sctp_tcb *stcb,
|
||||
int32_t rtt; /* RTT in ms */
|
||||
uint32_t new_rto;
|
||||
int first_measure = 0;
|
||||
struct timeval now, then, *old;
|
||||
struct timeval now;
|
||||
|
||||
/* Copy it out for sparc64 */
|
||||
if (safe == sctp_align_unsafe_makecopy) {
|
||||
old = &then;
|
||||
memcpy(&then, told, sizeof(struct timeval));
|
||||
} else if (safe == sctp_align_safe_nocopy) {
|
||||
old = told;
|
||||
} else {
|
||||
/* error */
|
||||
SCTP_PRINTF("Huh, bad rto calc call\n");
|
||||
return (0);
|
||||
}
|
||||
/************************/
|
||||
/* 1. calculate new RTT */
|
||||
/************************/
|
||||
|
@ -135,7 +135,7 @@ void
|
||||
|
||||
uint32_t
|
||||
sctp_calculate_rto(struct sctp_tcb *, struct sctp_association *,
|
||||
struct sctp_nets *, struct timeval *, int, int);
|
||||
struct sctp_nets *, struct timeval *, int);
|
||||
|
||||
uint32_t sctp_calculate_len(struct mbuf *);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user