@@ -277,6 +277,7 @@ static void qcc_refresh_timeout(struct qcc *qcc)
277277
278278void  qcc_wakeup (struct  qcc  * qcc )
279279{
280+ 	TRACE_POINT (QMUX_EV_QCC_WAKE , qcc -> conn );
280281	HA_ATOMIC_AND (& qcc -> wait_event .tasklet -> state , ~TASK_F_USR1 );
281282	tasklet_wakeup (qcc -> wait_event .tasklet );
282283
@@ -287,12 +288,23 @@ void qcc_wakeup(struct qcc *qcc)
287288
288289static  void  qcc_wakeup_pacing (struct  qcc  * qcc )
289290{
291+ 	TRACE_POINT (QMUX_EV_QCC_WAKE , qcc -> conn );
292+ 	BUG_ON (LIST_ISEMPTY (& qcc -> tx .pacer .frms ));
290293	HA_ATOMIC_OR (& qcc -> wait_event .tasklet -> state , TASK_F_USR1 );
291294	tasklet_wakeup (qcc -> wait_event .tasklet );
292- 	//qcc->task->expire = qcc->tx.pacer.next; 
293- 	//BUG_ON(tick_is_expired(qcc->task->expire, now_ms)); 
294- 	//task_queue(qcc->task); 
295- 	//TRACE_POINT(QMUX_EV_STRM_WAKE, qcc->conn); 
295+ 
296+ 	qcc -> task -> expire  =  TICK_ETERNITY ;
297+ 	task_queue (qcc -> task );
298+ }
299+ 
300+ static  void  qcc_task_pacing (struct  qcc  * qcc )
301+ {
302+ 	TRACE_POINT (QMUX_EV_QCC_WAKE , qcc -> conn );
303+ 	//HA_ATOMIC_AND(&qcc->wait_event.tasklet->state, ~TASK_F_USR1); 
304+ 	qcc -> task -> expire  =  now_ms  ==  qcc -> tx .pacer .next  ? tick_add (qcc -> tx .pacer .next , 1 ) : qcc -> tx .pacer .next ;
305+ 	BUG_ON (tick_is_expired (qcc -> task -> expire , now_ms ));
306+ 	task_queue (qcc -> task );
307+ 	TRACE_POINT (QMUX_EV_STRM_WAKE , qcc -> conn );
296308}
297309
298310/* Mark a stream as open if it was idle. This can be used on every 
@@ -2176,6 +2188,7 @@ static int qcc_io_send(struct qcc *qcc)
21762188	 */ 
21772189
21782190	quic_pacing_reset (pacer );
2191+ 	//HA_ATOMIC_AND(&qcc->wait_event.tasklet->state, ~TASK_F_USR1); 
21792192
21802193	/* Check for transport error. */ 
21812194	if  (qcc -> flags  &  QC_CF_ERR_CONN  ||  qcc -> conn -> flags  &  CO_FL_ERROR ) {
@@ -2277,9 +2290,17 @@ static int qcc_io_send(struct qcc *qcc)
22772290		}
22782291	}
22792292
2280- 	if  (!LIST_ISEMPTY (frms ) &&  !quic_pacing_expired (& qcc -> tx .pacer )) {
2281- 		qcc_wakeup_pacing (qcc );
2282- 		return  1 ;
2293+ 	//if (!LIST_ISEMPTY(frms) && !quic_pacing_expired(&qcc->tx.pacer)) { 
2294+ 	if  (!LIST_ISEMPTY (frms )) {
2295+ 	       if  (!qcc -> tx .pacer .budget ) {
2296+ 		       qcc -> tx .pacer .next  =  tick_add (now_ms , quic_pacing_next (pacer ));
2297+ 		       //fprintf(stderr, "wait for %ldms\n", qcc->tx.pacer.burst * qcc->tx.pacer.path->loss.srtt * qcc->tx.pacer.path->mtu / qcc->tx.pacer.path->cwnd); 
2298+ 		       qcc_task_pacing (qcc );
2299+ 		       return  1 ;
2300+ 	       }
2301+ 	       //else { 
2302+ 	       //        qcc_wakeup_pacing(qcc); 
2303+ 	       //} 
22832304	}
22842305
22852306	/* Retry sending until no frame to send, data rejected or connection 
@@ -2317,11 +2338,14 @@ static int qcc_io_send(struct qcc *qcc)
23172338
23182339 sent_done :
23192340	if  (ret  ==  1 ) {
2341+ 		qcc -> tx .pacer .next  =  tick_add (now_ms , quic_pacing_next (pacer ));
2342+ 		//fprintf(stderr, "wait for %ldms\n", pacer->burst * pacer->path->loss.srtt * pacer->path->mtu / pacer->path->cwnd); 
23202343		qcc_wakeup_pacing (qcc );
23212344	}
23222345	else  if  (!LIST_ISEMPTY (quic_pacing_frms (pacer ))) {
23232346		/* Deallocate frames that the transport layer has rejected. */ 
23242347		quic_pacing_reset (pacer );
2348+ 		//HA_ATOMIC_AND(&qcc->wait_event.tasklet->state, ~TASK_F_USR1); 
23252349	}
23262350
23272351	/* Re-insert on-error QCS at the end of the send-list. */ 
@@ -2643,6 +2667,7 @@ static void qcc_release(struct qcc *qcc)
26432667	}
26442668
26452669	quic_pacing_reset (& qcc -> tx .pacer );
2670+ 	//HA_ATOMIC_AND(&qcc->wait_event.tasklet->state, ~TASK_F_USR1); 
26462671
26472672	if  (qcc -> app_ops  &&  qcc -> app_ops -> release )
26482673		qcc -> app_ops -> release (qcc -> ctx );
@@ -2679,7 +2704,7 @@ static int qcc_purge_sending(struct qcc *qcc)
26792704	if  (ret  ==  QUIC_TX_ERR_AGAIN ) {
26802705		BUG_ON (LIST_ISEMPTY (quic_pacing_frms (pacer )));
26812706		TRACE_POINT (QMUX_EV_QCC_WAKE , qcc -> conn );
2682- 		qcc_wakeup_pacing (qcc );
2707+ 		// qcc_wakeup_pacing(qcc);
26832708		return  1 ;
26842709	}
26852710	else  if  (ret  ==  QUIC_TX_ERR_FATAL ) {
@@ -2693,6 +2718,8 @@ static int qcc_purge_sending(struct qcc *qcc)
26932718		TRACE_POINT (QMUX_EV_QCC_WAKE , qcc -> conn );
26942719		if  (!LIST_ISEMPTY (quic_pacing_frms (pacer )))
26952720			qcc_subscribe_send (qcc );
2721+ 		//else 
2722+ 		//	HA_ATOMIC_AND(&qcc->wait_event.tasklet->state, ~TASK_F_USR1); 
26962723		return  0 ;
26972724	}
26982725}
@@ -2704,8 +2731,18 @@ struct task *qcc_io_cb(struct task *t, void *ctx, unsigned int status)
27042731	TRACE_ENTER (QMUX_EV_QCC_WAKE , qcc -> conn );
27052732
27062733	if  (status  &  TASK_F_USR1 ) {
2734+ 		++ activity [tid ].ctr0 ;
2735+ 		//HA_ATOMIC_AND(&qcc->wait_event.tasklet->state, ~TASK_F_USR1); 
27072736		//ABORT_NOW(); 
2708- 		qcc_purge_sending (qcc );
2737+ 		if  (qcc_purge_sending (qcc )) {
2738+ 			if  (!qcc -> tx .pacer .budget ) {
2739+ 			       qcc -> tx .pacer .next  =  tick_add (now_ms , quic_pacing_next (& qcc -> tx .pacer ));
2740+ 			       //fprintf(stderr, "wait for %ldms\n", qcc->tx.pacer.burst * qcc->tx.pacer.path->loss.srtt * qcc->tx.pacer.path->mtu / qcc->tx.pacer.path->cwnd); 
2741+ 			       qcc_task_pacing (qcc );
2742+ 			}
2743+ 			else 
2744+ 				qcc_wakeup_pacing (qcc );
2745+ 		}
27092746		return  NULL ;
27102747	}
27112748
@@ -2745,21 +2782,21 @@ static struct task *qcc_timeout_task(struct task *t, void *ctx, unsigned int sta
27452782			goto requeue ;
27462783		}
27472784		//fprintf(stderr, "woken up after %dms\n", now_ms - qcc->tx.pacer.next); 
2748- 
2749- #if  0 
2750- 		if  (!qcc_may_expire (qcc )) {
2751- 			TRACE_DEVEL ("cannot expired" , QMUX_EV_QCC_WAKE , qcc -> conn );
2752- 			t -> expire  =  TICK_ETERNITY ;
2753- 			goto requeue ;
2754- 		}
2755- #endif 
27562785	}
27572786
2787+ 	++ activity [tid ].ctr1 ;
27582788	if  (qcc_purge_sending (qcc )) {
2759- 		qcc -> task -> expire  =  qcc -> tx .pacer .next ;
2760- 		BUG_ON (tick_is_expired (qcc -> task -> expire , now_ms ));
2761- 		TRACE_POINT (QMUX_EV_QCC_WAKE , qcc -> conn );
2762- 		goto requeue ;
2789+ 		//qcc->task->expire = qcc->tx.pacer.next; 
2790+ 		if  (!qcc -> tx .pacer .budget ) {
2791+ 			qcc -> tx .pacer .next  =  tick_add (now_ms , quic_pacing_next (& qcc -> tx .pacer ));
2792+ 			qcc -> task -> expire  =  now_ms  ==  qcc -> tx .pacer .next  ? tick_add (qcc -> tx .pacer .next , 1 ) : qcc -> tx .pacer .next ;
2793+ 			BUG_ON (tick_is_expired (qcc -> task -> expire , now_ms ));
2794+ 			TRACE_POINT (QMUX_EV_QCC_WAKE , qcc -> conn );
2795+ 			goto requeue ;
2796+ 		}
2797+ 		else  {
2798+ 			qcc_wakeup_pacing (qcc );
2799+ 		}
27632800	}
27642801	t -> expire  =  TICK_ETERNITY ;
27652802	goto requeue ;
0 commit comments