Lines Matching refs:sp
109 * sp stream
114 void CheckRecvSeq(sp, f) /* (CCBPtr sp, ADSP_FRAMEPtr f) */
115 register CCBPtr sp;
125 sp->sendDataAck = 1;
126 sp->callSend = 1;
136 if (GT(pktNextRecvSeq, sp->maxSendSeq)) /* We've never sent this seq #! */
139 if (GTE(pktNextRecvSeq, sp->timerSeq) && sp->waitingAck) {
141 sp->waitingAck = 0; /* Allow sending more */
142 sp->pktSendCnt = 0; /* Reset packet count */
144 RemoveTimerElem(&adspGlobal.fastTimers, &sp->RetryTimer);
146 if (!sp->resentData) { /* Data sent without retries */
155 diff = (((word)(SysTicks() - sp->sendStamp)) / (word)10) -
156 sp->roundTrip + 1;
158 sp->roundTrip += diff >> 3; /* Update average */
162 sp->deviation += (diff - sp->deviation) >> 2; /* Update deviation*/
164 sp->rtmtInterval = sp->roundTrip +
165 ((short)2 * (short)sp->deviation);
167 if (!sp->noXmitFlow &&
168 sp->pktSendMax < 50) /* Bump # of sequential */
169 sp->pktSendMax++; /* Packets we'll send */
171 sp->noXmitFlow = 0;
174 sp->resentData = 0;
179 sp->firstRtmtSeq)) /* Was duplicate ack, so ignore */
182 if (!sp->sData) /* If nothing in send queue, ignore */
187 if ((mp = sp->sbuf_mb)) { /* Get ptr to oldest data header */
188 sp->sbuf_mb = gbuf_next(mp); /* unlink it from send queue */
191 mp = sp->csbuf_mb;
192 sp->csbuf_mb = 0;
197 sp->sData = 0;
203 if (LTE((sp->firstRtmtSeq + eom + (hlen = gbuf_msgsize(mp))),
209 sp->firstRtmtSeq += eom + hlen;
211 if ((sp->sbuf_mb == 0) && (sp->csbuf_mb == 0)) {
213 sp->sData = 0; /* ... no data in queue */
214 sp->writeFlush = 0;
215 if (sp->state == sClosing) /* this may allow us to close... */
216 CheckOkToClose(sp);
217 atalk_enablew(sp->gref);
225 acked = (pktNextRecvSeq - sp->firstRtmtSeq);
229 gbuf_next(mp) = sp->sbuf_mb;
230 sp->sbuf_mb = mp;
233 sp->csbuf_mb = mp;
235 sp->firstRtmtSeq = pktNextRecvSeq; /* Update seq # oldest byte */
238 } while (LT(sp->firstRtmtSeq, pktNextRecvSeq));
240 if (sp->sData) /* We've got stuff to send */
241 sp->callSend = 1;
246 if (GT(sendWdwSeq, sp->sendWdwSeq)) /* Don't make send window smaller */
248 sp->callSend = 1; /* His recv wdw opened, so see */
250 sp->sendWdwSeq = sendWdwSeq;
271 int RXData(sp, mp, f, len) /* (CCBPtr sp, ADSP_FRAMEPtr f, word len) */
272 CCBPtr sp;
288 ("RXData: sp=0x%x, mbuf=0x%x, f=0x%x, len=%d, eom=%d\n",
289 (unsigned)sp, (unsigned)mp, (unsigned)f, len, eom));
291 KERNEL_DEBUG(DBG_ADSP_RCV, 1, sp, mp, len, eom);
297 if (GT(PktFirstByteSeq, sp->recvSeq)) /* missed a packet (out of order) */
299 if (sp->badSeqCnt++ > sp->badSeqCnt) /* Need to send rexmit advice */
300 sp->sendCtl |= B_CTL_RETRANSMIT;
301 CheckRecvSeq(sp, f); /* Will set send ACK flag if requested */
302 CheckReadQueue(sp);
305 KERNEL_DEBUG(DBG_ADSP_RCV, 2, sp, 0, 0, 0);
306 trace_mbufs(D_M_ADSP, " exRXD m", sp->rbuf_mb);
312 if (LTE(PktFirstByteSeq + len + eom, sp->recvSeq)) { /* duplicate data? */
313 CheckRecvSeq(sp, f); /* Will set send ACK flag if requested */
314 CheckReadQueue(sp);
317 KERNEL_DEBUG(DBG_ADSP_RCV, 3, sp, 0, 0, 0);
318 trace_mbufs(D_M_ADSP, " exRXD m", sp->rbuf_mb);
324 sp->badSeqCnt = 0; /* reset out of sequence pckt counter */
326 cnt = sp->recvSeq - PktFirstByteSeq; /* # bytes we've seen already */
336 if (!sp->rData) /* Recv bfr is empty */
338 sp->rData = 1; /* Not empty any more */
340 if ((sp->rpb)->ioc == (caddr_t)mp) {
343 KERNEL_DEBUG(DBG_ADSP_RCV, 4, sp, sp->rpb, 0, 0);
346 sp->rbuf_mb = mp;
348 sp->crbuf_mb = mp;
360 if (sp->crbuf_mb) {
361 gbuf_linkb(sp->crbuf_mb, mp);
362 mp = sp->crbuf_mb;
363 sp->crbuf_mb = 0;
365 if ((rmp = sp->rbuf_mb)) {
373 sp->rbuf_mb = mp;
374 } else if (sp->crbuf_mb)
375 gbuf_linkb(sp->crbuf_mb, mp);
377 sp->crbuf_mb = mp;
379 sp->recvSeq += (cnt + eom); /* We've got these bytes */
387 CheckRecvSeq(sp, f); /* Will set send ACK flag if requested */
388 CheckReadQueue(sp);
389 KERNEL_DEBUG(DBG_ADSP_RCV, 5, sp, sp->rbuf_mb, 0, 0);
390 trace_mbufs(D_M_ADSP, " eRXD m", sp->rbuf_mb);