if (hctx->ccid3hctx_t_ipi > (hctx->ccid3hctx_t_nom).tv_usec) { hctx->ccid3hctx_t_nom.tv_usec += USEC_PER_SEC; (hctx->ccid3hctx_t_nom).tv_sec--; } /* FIXME - if no feedback then t_ipi can go > 1 second */ (hctx->ccid3hctx_t_nom).tv_usec -= hctx->ccid3hctx_t_ipi; 
timeval_sub_usecs(&hctx->ccid3hctx_t_nom, hctx->ccid3hctx_t_ipi); 
static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb){	struct dccp_sock *dp = dccp_sk(sk);	struct ccid3_hc_tx_sock *hctx = dp->dccps_hc_tx_ccid_private;	struct ccid3_options_received *opt_recv;	struct dccp_tx_hist_entry *packet;	unsigned long next_tmout; 	u32 t_elapsed;	u32 pinv;	u32 x_recv;	u32 r_sample;	if (hctx == NULL)		return;	if (hctx->ccid3hctx_state == TFRC_SSTATE_TERM) {		ccid3_pr_debug("%s, sk=%p, received a packet when "			       "terminating!\n", dccp_role(sk), sk);		return;	}	/* we are only interested in ACKs */	if (!(DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_ACK ||	      DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_DATAACK))		return;	opt_recv = &hctx->ccid3hctx_options_received;	t_elapsed = dp->dccps_options_received.dccpor_elapsed_time;	x_recv = opt_recv->ccid3or_receive_rate;	pinv = opt_recv->ccid3or_loss_event_rate;	switch (hctx->ccid3hctx_state) {	case TFRC_SSTATE_NO_SENT:		/* FIXME: what to do here? */		return;	case TFRC_SSTATE_NO_FBACK:	case TFRC_SSTATE_FBACK:		/* Calculate new round trip sample by		 * R_sample = (now - t_recvdata) - t_delay */		/* get t_recvdata from history */		packet = dccp_tx_hist_find_entry(&hctx->ccid3hctx_hist,						 DCCP_SKB_CB(skb)->dccpd_ack_seq);		if (packet == NULL) {			ccid3_pr_debug("%s, sk=%p, seqno %llu(%s) does't "				       "exist in history!\n",				       dccp_role(sk), sk,				       DCCP_SKB_CB(skb)->dccpd_ack_seq,				       dccp_packet_name(DCCP_SKB_CB(skb)->dccpd_type));			return;		}		/* Update RTT */		r_sample = now_delta(packet->dccphtx_tstamp);		/* FIXME: */		// r_sample -= usecs_to_jiffies(t_elapsed * 10);		/* Update RTT estimate by 		 * If (No feedback recv)		 *    R = R_sample;		 * Else		 *    R = q * R + (1 - q) * R_sample;		 *		 * q is a constant, RFC 3448 recomments 0.9		 */		if (hctx->ccid3hctx_state == TFRC_SSTATE_NO_FBACK) {			ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK);			hctx->ccid3hctx_rtt = r_sample;		} else			hctx->ccid3hctx_rtt = (hctx->ccid3hctx_rtt * 9) / 10 +					      r_sample / 10;		/*		 * XXX: this is to avoid a division by zero in ccid3_hc_tx_packet_sent		 *      implemention of the new window count.		 */		if (hctx->ccid3hctx_rtt < 4)			hctx->ccid3hctx_rtt = 4;		ccid3_pr_debug("%s, sk=%p, New RTT estimate=%uus, "			       "r_sample=%us\n", dccp_role(sk), sk,			       hctx->ccid3hctx_rtt, r_sample);		/* Update timeout interval */		hctx->ccid3hctx_t_rto = max_t(u32, 4 * hctx->ccid3hctx_rtt,					      USEC_PER_SEC);		/* Update receive rate */		hctx->ccid3hctx_x_recv = x_recv;/* X_recv in bytes per sec */		/* Update loss event rate */		if (pinv == ~0 || pinv == 0)			hctx->ccid3hctx_p = 0;		else {			hctx->ccid3hctx_p = 1000000 / pinv;			if (hctx->ccid3hctx_p < TFRC_SMALLEST_P) {				hctx->ccid3hctx_p = TFRC_SMALLEST_P;				ccid3_pr_debug("%s, sk=%p, Smallest p used!\n",					       dccp_role(sk), sk);			}		}		/* unschedule no feedback timer */		sk_stop_timer(sk, &hctx->ccid3hctx_no_feedback_timer);		/* Update sending rate */		ccid3_hc_tx_update_x(sk);		/* Update next send time */		if (hctx->ccid3hctx_t_ipi > (hctx->ccid3hctx_t_nom).tv_usec) {			hctx->ccid3hctx_t_nom.tv_usec += USEC_PER_SEC;			(hctx->ccid3hctx_t_nom).tv_sec--;		}		/* FIXME - if no feedback then t_ipi can go > 1 second */		(hctx->ccid3hctx_t_nom).tv_usec -= hctx->ccid3hctx_t_ipi;		ccid3_calc_new_t_ipi(hctx);		(hctx->ccid3hctx_t_nom).tv_usec += hctx->ccid3hctx_t_ipi;		timeval_fix(&(hctx->ccid3hctx_t_nom));		ccid3_calc_new_delta(hctx);		/* remove all packets older than the one acked from history */		dccp_tx_hist_purge_older(ccid3_tx_hist,					 &hctx->ccid3hctx_hist, packet);		if (hctx->ccid3hctx_x < 10) {			ccid3_pr_debug("ccid3_hc_tx_packet_recv hctx_x < 10\n");			hctx->ccid3hctx_x = 10;		}		/* to prevent divide by zero below */		/*		 * Schedule no feedback timer to expire in		 * max(4 * R, 2 * s / X)		 */		next_tmout = max(hctx->ccid3hctx_t_rto,				 (2 * (hctx->ccid3hctx_s * 100000) /				  (hctx->ccid3hctx_x / 10)));		/* maths with 100000 and 10 is to prevent overflow with 32 bit */		ccid3_pr_debug("%s, sk=%p, Scheduled no feedback timer to "			       "expire in %lu jiffies (%luus)\n",			       dccp_role(sk), sk,			       usecs_to_jiffies(next_tmout), next_tmout); 		sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, 			       jiffies + max_t(u32, 1, usecs_to_jiffies(next_tmout)));		/* set idle flag */		hctx->ccid3hctx_idle = 1;   		break;	default:		printk(KERN_CRIT "%s: %s, sk=%p, Illegal state (%d)!\n",		       __FUNCTION__, dccp_role(sk), sk, hctx->ccid3hctx_state);		dump_stack();		break;	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b6ee3d4ada4e85d9b9b9164c1327ef0850c79d5e/ccid3.c/clean/net/dccp/ccids/ccid3.c