Changeset 12633 in vbox
- Timestamp:
- Sep 22, 2008 12:02:48 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 36913
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c ¶
r12622 r12633 194 194 ddi_prop_op, /* property ops */ 195 195 &g_VBoxNetFltSolarisStreamTab, 196 D_NEW | D_MP | D_MTPER MOD,/* compat. flag */196 D_NEW | D_MP | D_MTPERQ, /* compat. flag */ 197 197 CB_REV /* revision */ 198 198 }; … … 303 303 queue_t *pReadQueue; /* read side queue */ 304 304 struct vboxnetflt_stream_t *pNext; /* next stream in list */ 305 PVBOXNETFLTINS pThis;/* the backend instance */305 PVBOXNETFLTINS volatile pThis; /* the backend instance */ 306 306 VBOXNETFLTSTREAMTYPE Type; /* the type of the stream Ip/Arp */ 307 307 } vboxnetflt_stream_t; … … 701 701 * the one that we will associate this stream with. 702 702 */ 703 pStream->pThis = pThis;703 ASMAtomicUoWritePtr((void * volatile *)&pStream->pThis, pThis); 704 704 pStream->Type = pState->CurType; 705 705 switch (pStream->Type) 706 706 { 707 case kIpStream: ASMAtomicUoWritePtr( &pThis->u.s.pvIpStream, pStream); break;708 case kArpStream: ASMAtomicUoWritePtr( &pThis->u.s.pvArpStream, pStream); break;709 case kPromiscStream: ASMAtomicUoWritePtr( &pThis->u.s.pvPromiscStream, pStream); break;707 case kIpStream: ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pvIpStream, pStream); break; 708 case kArpStream: ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pvArpStream, pStream); break; 709 case kPromiscStream: ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pvPromiscStream, pStream); break; 710 710 default: /* Heh. */ 711 711 { … … 806 806 807 807 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 808 PVBOXNETFLTINS pThis = pStream->pThis;808 PVBOXNETFLTINS pThis = ASMAtomicUoReadPtr((void * volatile *)&pStream->pThis); 809 809 RTSpinlockAcquire(pThis->hSpinlock, &Tmp); 810 810 … … 871 871 bool fSendUpstream = true; 872 872 bool fActive = false; 873 bool fRetained = false; 873 874 vboxnetflt_stream_t *pStream = pQueue->q_ptr; 874 875 PVBOXNETFLTINS pThis = NULL; … … 881 882 && pStream->Type == kPromiscStream) 882 883 { 883 pThis = vboxNetFltSolarisFindInstance(pStream);884 pThis = ASMAtomicUoReadPtr((void * volatile *)&pStream->pThis); 884 885 if (RT_LIKELY(pThis)) 885 886 { … … 890 891 RTSpinlockAcquire(pThis->hSpinlock, &Tmp); 891 892 fActive = ASMAtomicUoReadBool(&pThis->fActive); 892 if (fActive)893 vboxNetFltRetain(pThis, true);893 vboxNetFltRetain(pThis, true); 894 fRetained = true; 894 895 RTSpinlockRelease(pThis->hSpinlock, &Tmp); 895 896 … … 1035 1036 } 1036 1037 1037 if (f Active)1038 if (fRetained) 1038 1039 vboxNetFltRelease(pThis, true); 1039 1040 … … 1774 1775 RTSpinlockAcquire(pThis->hSpinlock, &Tmp); 1775 1776 1776 vboxnetflt_promisc_stream_t *pPromiscStream = pThis->u.s.pvPromiscStream;1777 vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream); 1777 1778 if (pPromiscStream) 1778 1779 { … … 2377 2378 * 2378 2379 * @returns VBox status code. 2379 * @param pThis The instance.2380 * @param pThis The instance. 2380 2381 * @param pPromiscStream Pointer to the promiscuous stream. 2381 * @param pMsg Pointer to the message.2382 * @param pMsg Pointer to the message. 2382 2383 */ 2383 2384 static int vboxNetFltSolarisQueueLoopback(PVBOXNETFLTINS pThis, vboxnetflt_promisc_stream_t *pPromiscStream, mblk_t *pMsg) … … 2390 2391 LogFlow((DEVICE_NAME ":vboxNetFltSolarisQueueLoopback pThis=%p pPromiscStream=%p pMsg=%p\n", pThis, pPromiscStream, pMsg)); 2391 2392 2393 if (RT_UNLIKELY(pMsg->b_cont)) 2394 { 2395 /* 2396 * We don't currently make chained messages in on Xmit 2397 * so this only needs to be supported when we do that. 2398 */ 2399 return VERR_NOT_SUPPORTED; 2400 } 2401 2392 2402 size_t cbMsg = MBLKL(pMsg); 2393 if ( cbMsg < sizeof(RTNETETHERHDR))2403 if (RT_UNLIKELY(cbMsg < sizeof(RTNETETHERHDR))) 2394 2404 return VERR_NET_MSG_SIZE; 2395 2396 if (pMsg->b_cont)2397 {2398 /* @todo -XXX- handle chained messages */2399 return VERR_NOT_IMPLEMENTED;2400 }2401 2405 2402 2406 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; … … 2502 2506 if (pMsg->b_cont) 2503 2507 { 2504 /** @todo -XXX- implement chained message handling.*/2508 /** Handle this when Xmit makes chained messages */ 2505 2509 return false; 2506 2510 } … … 2510 2514 return false; 2511 2515 2516 PVBOXNETFLTPACKETID pPrev = NULL; 2512 2517 PVBOXNETFLTPACKETID pCur = pPromiscStream->pHead; 2513 2518 bool fIsOur = false; 2514 2519 while (pCur) 2515 2520 { 2516 if (pCur->cbPacket != cbMsg)2517 {2518 pCur = pCur->pNext;2519 continue;2520 }2521 2522 2521 PCRTNETETHERHDR pEthHdr = (PCRTNETETHERHDR)pMsg->b_rptr; 2523 if ( pCur->SrcMac.au8[0] != pEthHdr->SrcMac.au8[0] 2522 if ( pCur->cbPacket != cbMsg 2523 || pCur->SrcMac.au8[0] != pEthHdr->SrcMac.au8[0] 2524 2524 || pCur->SrcMac.au8[1] != pEthHdr->SrcMac.au8[1] 2525 2525 || pCur->SrcMac.au8[2] != pEthHdr->SrcMac.au8[2] … … 2534 2534 || pCur->DstMac.au8[5] != pEthHdr->DstMac.au8[5]) 2535 2535 { 2536 pPrev = pCur; 2536 2537 pCur = pCur->pNext; 2537 2538 continue; … … 2541 2542 if (pCur->Checksum != Checksum) 2542 2543 { 2544 pPrev = pCur; 2543 2545 pCur = pCur->pNext; 2544 2546 continue; … … 2547 2549 /* 2548 2550 * Yes, it really is our own packet, mark it as handled 2549 * and return it's found.2551 * and move it to the tail and return it's found. 2550 2552 */ 2551 2553 pCur->cbPacket = 0; 2554 if (pPrev) 2555 { 2556 pPrev->pNext = pCur->pNext; 2557 pPromiscStream->pTail->pNext = pCur; 2558 pPromiscStream->pTail = pCur; 2559 pCur->pNext = NULL; 2560 } 2561 2552 2562 LogFlow((DEVICE_NAME ":vboxNetFltSolarisIsOurMBlk found packet %p cLoopback=%d\n", pMsg, pPromiscStream->cLoopback)); 2553 2563 return true; … … 2578 2588 * Don't loopback packets we transmit to the wire. 2579 2589 */ 2580 vboxnetflt_promisc_stream_t *pPromiscStream = pThis->u.s.pvPromiscStream;2590 vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream); 2581 2591 if (vboxNetFltSolarisIsOurMBlk(pThis, pPromiscStream, pMsg)) 2582 2592 { … … 2889 2899 * Enable/disable promiscuous mode. 2890 2900 */ 2891 vboxnetflt_stream_t *pStream = pThis->u.s.pvPromiscStream;2901 vboxnetflt_stream_t *pStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream); 2892 2902 if (pStream) 2893 2903 { … … 2961 2971 if (fDst & INTNETTRUNKDIR_WIRE) 2962 2972 { 2963 vboxnetflt_promisc_stream_t *pPromiscStream = pThis->u.s.pvPromiscStream;2973 vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream); 2964 2974 if (!pPromiscStream) 2965 2975 return VERR_INVALID_POINTER; 2966 2976 2967 2977 queue_t *pPromiscWriteQueue = WR(pPromiscStream->Stream.pReadQueue); 2978 Assert(pPromiscWriteQueue); 2968 2979 2969 2980 mblk_t *pMsg = vboxNetFltSolarisMBlkFromSG(pThis, pSG, fDst); … … 3015 3026 * Send message up ARP stream. 3016 3027 */ 3017 vboxnetflt_stream_t *pArpStream = pThis->u.s.pvArpStream;3028 vboxnetflt_stream_t *pArpStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvArpStream); 3018 3029 queue_t *pArpReadQueue = pArpStream->pReadQueue; 3030 Assert(pArpReadQueue); 3031 3019 3032 putnext(pArpReadQueue, pMsg); 3020 3033 } … … 3026 3039 * Send messages up IP stream. 3027 3040 */ 3028 vboxnetflt_stream_t *pIpStream = pThis->u.s.pvIpStream;3041 vboxnetflt_stream_t *pIpStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvIpStream); 3029 3042 queue_t *pIpReadQueue = pIpStream->pReadQueue; 3043 Assert(pIpReadQueue); 3044 3030 3045 putnext(pIpReadQueue, pMsg); 3031 3046 }
Note:
See TracChangeset
for help on using the changeset viewer.