Commit 07cd6e39 authored by Claes Sjofors's avatar Claes Sjofors

Qcom monitor, mutex for link sendqueue added

parent c17d981b
......@@ -197,6 +197,7 @@ struct sLink {
pwr_tDeltaTime ack_delay;
unsigned int exp_buf_quota;
sIseg tmo;
thread_sMutex eseg_mutex;
};
......@@ -555,6 +556,7 @@ clean_insert (
if ((!pending) && (esp->head.flags.b.first)) {
thread_MutexLock(&esp->lp->eseg_mutex);
for (sp = lst_Succ(NULL, le, &se); se != le; sp = nsp) {
li = se;
nsp = lst_Succ(NULL, se, &se);
......@@ -576,12 +578,14 @@ clean_insert (
break;
}
}
thread_MutexUnlock(&esp->lp->eseg_mutex);
if (!esp->head.flags.b.last && first) ret_pend = TRUE;
if (!first) li = le;
}
else if (pending) {
thread_MutexLock(&esp->lp->eseg_mutex);
for (sp = lst_Succ(NULL, le, &se); se != le; sp = nsp) {
li = se;
nsp = lst_Succ(NULL, se, &se);
......@@ -598,6 +602,7 @@ clean_insert (
break;
}
}
thread_MutexUnlock(&esp->lp->eseg_mutex);
if (!first) li = le;
ret_pend = !esp->head.flags.b.last;
......@@ -618,7 +623,9 @@ clean_insert (
}
}
#endif
thread_MutexLock(&esp->lp->eseg_mutex);
lst_InsertPred(NULL, li, &esp->c.le, esp);
thread_MutexUnlock(&esp->lp->eseg_mutex);
return ret_pend;
......@@ -877,7 +884,7 @@ eseg_free (
{
pwr_tBoolean bcast = sp->head.flags.b.bcast;
if (bcast) thread_MutexLock(&l.bcast);
if (bcast) thread_MutexLock(&l.bcast);
export_alloc_sub(sp);
......@@ -973,16 +980,18 @@ export_thread ()
thread_MutexLock(&l.bcast);
esp = sp;
thread_MutexLock(&sp->lp->eseg_mutex);
esp = sp;
do {
ssp = esp;
do {
ssp = esp;
do {
ssp->c.action = eAction_export;
que_Put(NULL, &ssp->lp->q_in, &ssp->c.le, ssp);
ssp = lst_Succ(NULL, &ssp->le_seg, NULL) ;
} while (ssp != esp);
esp = lst_Succ(NULL, &ssp->le_bcast, NULL) ;
} while (esp != sp);
ssp->c.action = eAction_export;
que_Put(NULL, &ssp->lp->q_in, &ssp->c.le, ssp);
ssp = lst_Succ(NULL, &ssp->le_seg, NULL) ;
} while (ssp != esp);
esp = lst_Succ(NULL, &ssp->le_bcast, NULL) ;
} while (esp != sp);
thread_MutexUnlock(&sp->lp->eseg_mutex);
thread_MutexUnlock(&l.bcast);
}
......@@ -1279,6 +1288,7 @@ lack (
lst_sEntry *se;
int diff;
sEseg *sp, *nsp;
thread_sMutex *mx;
for (sp = lst_Succ(NULL, &lp->lh_win, &se); se != &lp->lh_win; sp = nsp) {
nsp = lst_Succ(NULL, se, &se);
......@@ -1294,7 +1304,10 @@ lack (
window_remove(lp, sp);
mx = &sp->lp->eseg_mutex;
thread_MutexLock(mx);
eseg_free(sp);
thread_MutexUnlock(mx);
} else {
/* This is the oldest not acked segment. */
lp->np->link.lack = sp->head.lack;
......@@ -1381,6 +1394,7 @@ link_disconnect (
/* Empty send list */
thread_MutexLock(&lp->eseg_mutex);
for (
sp = lst_Succ(NULL, &lp->lh_send, NULL);
sp != NULL;
......@@ -1400,6 +1414,7 @@ link_disconnect (
lst_Remove(NULL, &sp->c.le);
eseg_free(sp);
}
thread_MutexUnlock(&lp->eseg_mutex);
lp->np->link.win_count = 0;
......@@ -1440,6 +1455,7 @@ link_purge (
/* Purge send list */
int i = 0;
thread_MutexLock(&lp->eseg_mutex);
for (
sp = lst_Succ(NULL, &lp->lh_send, NULL);
sp != NULL;
......@@ -1456,6 +1472,7 @@ link_purge (
alloc_cnt += sp->size;
i++;
}
thread_MutexUnlock(&lp->eseg_mutex);
printf( "link_purge: %d cnt %d (%d)\n", i, lp->np->link.export_alloc_cnt, alloc_cnt);
lp->np->link.export_alloc_cnt = alloc_cnt;
lp->np->link.export_purge_cnt++;
......@@ -1693,6 +1710,7 @@ new_link (
lp->np->link.rtt_rxmax = rtt_rxmax;
lp->np->link.rtt_rxmin = rtt_rxmin;
lp->tmo.c.action = eAction_tmo;
sts = thread_MutexInit(&lp->eseg_mutex);
if (mp != NULL) {
#if defined OS_VMS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment