- Timestamp:
- Oct 2, 2008 10:09:58 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
r12863 r12921 611 611 * Check for the VirtualBox instance. 612 612 */ 613 if (RT_UNLIKELY(!g_VBoxNetFltSolarisInstance)) 613 PVBOXNETFLTINS pThis = g_VBoxNetFltSolarisInstance; 614 if (!pThis) 614 615 { 615 616 LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen failed to get VirtualBox instance.\n")); … … 617 618 } 618 619 619 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;620 PVBOXNETFLTINS pThis = g_VBoxNetFltSolarisInstance;621 RTSpinlockAcquire(pThis->hSpinlock, &Tmp);622 623 620 /* 624 621 * Check VirtualBox stream type. … … 627 624 { 628 625 LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen failed due to undefined VirtualBox open mode.\n")); 629 630 RTSpinlockRelease(pThis->hSpinlock, &Tmp);631 626 return ENOENT; 632 627 } … … 657 652 { 658 653 LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen failed to allocate promiscuous stream data.\n")); 659 660 RTSpinlockRelease(pThis->hSpinlock, &Tmp);661 654 return ENOMEM; 662 655 } … … 679 672 { 680 673 LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen failed to allocate stream data.\n")); 681 682 RTSpinlockRelease(pThis->hSpinlock, &Tmp);683 674 return ENOMEM; 684 675 } … … 700 691 default: /* Heh. */ 701 692 { 702 RTSpinlockRelease(pThis->hSpinlock, &Tmp);703 693 AssertRelease(pStream->Type); 704 694 break; … … 715 705 *ppPrevStream = pStream; 716 706 717 RTSpinlockRelease(pThis->hSpinlock, &Tmp);718 707 qprocson(pQueue); 719 708 … … 783 772 vboxnetflt_stream_t **ppPrevStream = NULL; 784 773 785 qprocsoff(pQueue);786 787 774 /* 788 775 * Get instance data. … … 795 782 } 796 783 797 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 798 PVBOXNETFLTINS pThis = ASMAtomicUoReadPtr((void * volatile *)&pStream->pThis); 799 RTSpinlockAcquire(pThis->hSpinlock, &Tmp); 784 if (pStream->Type == kPromiscStream) 785 { 786 flushq(pQueue, FLUSHALL); 787 flushq(WR(pQueue), FLUSHALL); 788 } 789 790 qprocsoff(pQueue); 791 792 if (pStream->Type == kPromiscStream) 793 { 794 vboxnetflt_promisc_stream_t *pPromiscStream = (vboxnetflt_promisc_stream_t *)pStream; 795 796 int rc = RTSemFastMutexRequest(pStream->pThis->u.s.hFastMtx); 797 AssertRCReturn(rc, rc); 798 799 /* 800 * Free-up loopback buffers. 801 */ 802 PVBOXNETFLTPACKETID pCur = pPromiscStream->pHead; 803 while (pCur) 804 { 805 PVBOXNETFLTPACKETID pNext = pCur->pNext; 806 RTMemFree(pCur); 807 pCur = pNext; 808 } 809 pPromiscStream->pHead = NULL; 810 pPromiscStream->pTail = NULL; 811 pPromiscStream->cLoopback = 0; 812 813 RTSemFastMutexRelease(pStream->pThis->u.s.hFastMtx); 814 } 800 815 801 816 /* … … 817 832 default: /* Heh. */ 818 833 { 819 RTSpinlockRelease(pThis->hSpinlock, &Tmp);820 834 AssertRelease(pStream->Type); 821 835 break; … … 830 844 NOREF(pCred); 831 845 832 RTSpinlockRelease(pThis->hSpinlock, &Tmp);833 834 846 return 0; 835 847 } … … 846 858 static int VBoxNetFltSolarisModReadPut(queue_t *pQueue, mblk_t *pMsg) 847 859 { 860 if (!pMsg) 861 return 0; 862 848 863 LogFlow((DEVICE_NAME ":VBoxNetFltSolarisModReadPut pQueue=%p pMsg=%p\n", pQueue, pMsg)); 849 864 … … 856 871 * is somehow still in the host stream we must try not to panic the host. 857 872 */ 858 if ( pMsg 859 && pStream 873 if ( pStream 860 874 && pStream->Type == kPromiscStream) 861 875 { … … 977 991 } 978 992 979 vboxNetFltRelease(pThis, true); 993 vboxNetFltRelease(pThis, true); 980 994 } 981 995 else … … 1567 1581 static void vboxNetFltSolarisCloseStream(PVBOXNETFLTINS pThis) 1568 1582 { 1569 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;1570 RTSpinlockAcquire(pThis->hSpinlock, &Tmp);1571 1572 vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream);1573 if (pPromiscStream)1574 {1575 /*1576 * Free-up loopback buffers.1577 */1578 PVBOXNETFLTPACKETID pCur = pPromiscStream->pHead;1579 while (pCur)1580 {1581 PVBOXNETFLTPACKETID pNext = pCur->pNext;1582 RTMemFree(pCur);1583 pCur = pNext;1584 }1585 pPromiscStream->pHead = NULL;1586 pPromiscStream->pTail = NULL;1587 pPromiscStream->cLoopback = 0;1588 }1589 1590 RTSpinlockRelease(pThis->hSpinlock, &Tmp);1591 1583 ldi_close(pThis->u.s.hIface, FREAD | FWRITE, kcred); 1592 1584 } … … 2369 2361 fIsOurPacket = true; 2370 2362 2371 LogFlow((DEVICE_NAME ":vboxNetFltSolarisIsOurMBlk found packet %p cLoopback=%d\n", pMsg, pPromiscStream->cLoopback)); 2363 LogFlow((DEVICE_NAME ":vboxNetFltSolarisIsOurMBlk found packet %p Checksum=%u cLoopbackQ=%d\n", pMsg, Checksum, 2364 pPromiscStream->cLoopback)); 2372 2365 break; 2373 2366 } … … 2707 2700 if (pStream) 2708 2701 { 2709 int rc = vboxNetFltSolarisPromiscReq(pStream->pReadQueue, fActive); 2710 if (RT_FAILURE(rc)) 2711 LogRel((DEVICE_NAME ":vboxNetFltPortOsSetActive failed to request promiscuous mode! rc=%d\n", rc)); 2702 if (pStream->pReadQueue) 2703 { 2704 int rc = vboxNetFltSolarisPromiscReq(pStream->pReadQueue, fActive); 2705 if (RT_FAILURE(rc)) 2706 LogRel((DEVICE_NAME ":vboxNetFltPortOsSetActive failed to request promiscuous mode! rc=%d\n", rc)); 2707 } 2708 else 2709 LogRel((DEVICE_NAME ":vboxNetFltPortOsSetActive queue not found!\n")); 2712 2710 } 2713 2711 else
Note:
See TracChangeset
for help on using the changeset viewer.