X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/8ad349bb6ed4a0be06e34c92be0d98b92e078db4..e2fac8b15b12a7979f72090454d850e612fc5b13:/bsd/netat/adsp_RxData.c?ds=sidebyside diff --git a/bsd/netat/adsp_RxData.c b/bsd/netat/adsp_RxData.c index 0536cd277..267e8c313 100644 --- a/bsd/netat/adsp_RxData.c +++ b/bsd/netat/adsp_RxData.c @@ -1,31 +1,29 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. + * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the - * License may not be used to create, or enable the creation or - * redistribution of, unlawful or unlicensed copies of an Apple operating - * system, or to circumvent, violate, or enable the circumvention or - * violation of, any terms of an Apple operating system software license - * agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and * limitations under the License. - * - * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * RxData.c @@ -60,6 +58,8 @@ #include #include +gbuf_t *releaseData(gbuf_t *, int); + gbuf_t *releaseData(mp, len) gbuf_t *mp; int len; @@ -115,20 +115,18 @@ void CheckRecvSeq(sp, f) /* (CCBPtr sp, ADSP_FRAMEPtr f) */ register CCBPtr sp; register ADSP_FRAMEPtr f; { - int s; int pktNextRecvSeq; int sendWdwSeq; int eom; int hlen; register gbuf_t *mp; - ATDISABLE(s, sp->lock); if (f->descriptor & ADSP_ACK_REQ_BIT) { /* He wants an Ack */ sp->sendDataAck = 1; sp->callSend = 1; } - pktNextRecvSeq = netdw(UAL_VALUE(f->pktNextRecvSeq)); /* Local copy */ + pktNextRecvSeq = UAL_VALUE_NTOH(f->pktNextRecvSeq); /* Local copy */ /* * Make sure the sequence number corresponds to reality -- i.e. for @@ -186,7 +184,7 @@ void CheckRecvSeq(sp, f) /* (CCBPtr sp, ADSP_FRAMEPtr f) */ do { /* This acks bytes in our buffer */ - if (mp = sp->sbuf_mb) { /* Get ptr to oldest data header */ + if ((mp = sp->sbuf_mb)) { /* Get ptr to oldest data header */ sp->sbuf_mb = gbuf_next(mp); /* unlink it from send queue */ eom = 1; } else { @@ -243,7 +241,7 @@ void CheckRecvSeq(sp, f) /* (CCBPtr sp, ADSP_FRAMEPtr f) */ sp->callSend = 1; noack: - sendWdwSeq = netw(UAS_VALUE(f->pktRecvWdw)) - 1 + pktNextRecvSeq; + sendWdwSeq = UAS_VALUE_NTOH(f->pktRecvWdw) - 1 + pktNextRecvSeq; if (GT(sendWdwSeq, sp->sendWdwSeq)) /* Don't make send window smaller */ { @@ -251,7 +249,6 @@ noack: /* if we can send more data */ sp->sendWdwSeq = sendWdwSeq; } - ATENABLE(s, sp->lock); } /* @@ -277,7 +274,7 @@ int RXData(sp, mp, f, len) /* (CCBPtr sp, ADSP_FRAMEPtr f, word len) */ ADSP_FRAMEPtr f; int len; { - int s, offset; + int offset; int PktFirstByteSeq; short cnt; char eom; @@ -295,14 +292,12 @@ int RXData(sp, mp, f, len) /* (CCBPtr sp, ADSP_FRAMEPtr f, word len) */ trace_mbufs(D_M_ADSP, " mp", mp); - PktFirstByteSeq = netdw(UAL_VALUE(f->pktFirstByteSeq)); /* Local copy */ + PktFirstByteSeq = UAL_VALUE_NTOH(f->pktFirstByteSeq); /* Local copy */ - ATDISABLE(s, sp->lock); if (GT(PktFirstByteSeq, sp->recvSeq)) /* missed a packet (out of order) */ { if (sp->badSeqCnt++ > sp->badSeqCnt) /* Need to send rexmit advice */ sp->sendCtl |= B_CTL_RETRANSMIT; - ATENABLE(s, sp->lock); CheckRecvSeq(sp, f); /* Will set send ACK flag if requested */ CheckReadQueue(sp); gbuf_freem(mp); @@ -315,7 +310,6 @@ int RXData(sp, mp, f, len) /* (CCBPtr sp, ADSP_FRAMEPtr f, word len) */ } if (LTE(PktFirstByteSeq + len + eom, sp->recvSeq)) { /* duplicate data? */ - ATENABLE(s, sp->lock); CheckRecvSeq(sp, f); /* Will set send ACK flag if requested */ CheckReadQueue(sp); gbuf_freem(mp); @@ -368,7 +362,7 @@ int RXData(sp, mp, f, len) /* (CCBPtr sp, ADSP_FRAMEPtr f, word len) */ mp = sp->crbuf_mb; sp->crbuf_mb = 0; } - if (rmp = sp->rbuf_mb) { + if ((rmp = sp->rbuf_mb)) { /* * Add it to the end */ @@ -390,7 +384,6 @@ int RXData(sp, mp, f, len) /* (CCBPtr sp, ADSP_FRAMEPtr f, word len) */ * doing anything that might take a long while */ - ATENABLE(s, sp->lock); CheckRecvSeq(sp, f); /* Will set send ACK flag if requested */ CheckReadQueue(sp); KERNEL_DEBUG(DBG_ADSP_RCV, 5, sp, sp->rbuf_mb, 0, 0);