Changeset 12770 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris
- Timestamp:
- Sep 26, 2008 2:54:09 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
r12731 r12770 858 858 859 859 bool fSendUpstream = true; 860 bool fActive = false;861 bool fRetained = false;862 860 vboxnetflt_stream_t *pStream = pQueue->q_ptr; 863 861 PVBOXNETFLTINS pThis = NULL; … … 881 879 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 882 880 RTSpinlockAcquire(pThis->hSpinlock, &Tmp); 883 fActive = ASMAtomicUoReadBool(&pThis->fActive);881 const bool fActive = ASMAtomicUoReadBool(&pThis->fActive); 884 882 vboxNetFltRetain(pThis, true); 885 fRetained = true;886 883 RTSpinlockRelease(pThis->hSpinlock, &Tmp); 887 884 … … 988 985 } 989 986 } 987 988 vboxNetFltRelease(pThis, true); 990 989 } 991 990 else … … 1007 1006 putbq(pQueue, pMsg); 1008 1007 } 1009 1010 if (fRetained)1011 vboxNetFltRelease(pThis, true);1012 1008 1013 1009 return 0; … … 2377 2373 return VERR_NET_MSG_SIZE; 2378 2374 2375 int rc = RTSemFastMutexRequest(pThis->u.s.hFastMtx); 2376 AssertRCReturn(rc, rc); 2377 2379 2378 PVBOXNETFLTPACKETID pCur = NULL; 2380 int rc = VINF_SUCCESS;2381 2379 if (pPromiscStream->cLoopback < VBOXNETFLT_LOOPBACK_SIZE) 2382 2380 { … … 2446 2444 pPromiscStream->pTail->pNext = pCur; 2447 2445 pPromiscStream->pTail = pCur; 2446 pCur->pNext = NULL; 2447 pCur->cbPacket = 0; 2448 pPromiscStream->cLoopback--; 2448 2449 2449 2450 vboxNetFltSolarisInitPacketId(pCur, pMsg); … … 2451 2452 pPromiscStream->cLoopback)); 2452 2453 } 2454 2455 RTSemFastMutexRelease(pThis->u.s.hFastMtx); 2453 2456 2454 2457 return rc; … … 2483 2486 return false; 2484 2487 2488 int rc = RTSemFastMutexRequest(pThis->u.s.hFastMtx); 2489 AssertRCReturn(rc, rc); 2490 2485 2491 PVBOXNETFLTPACKETID pPrev = NULL; 2486 2492 PVBOXNETFLTPACKETID pCur = pPromiscStream->pHead; 2487 bool fIsOur = false;2493 bool fIsOurPacket = false; 2488 2494 while (pCur) 2489 2495 { … … 2529 2535 } 2530 2536 pPromiscStream->cLoopback--; 2537 fIsOurPacket = true; 2531 2538 2532 2539 LogFlow((DEVICE_NAME ":vboxNetFltSolarisIsOurMBlk found packet %p cLoopback=%d\n", pMsg, pPromiscStream->cLoopback)); 2533 return true;2534 } 2535 2536 NOREF(pThis);2537 return f alse;2540 break; 2541 } 2542 2543 RTSemFastMutexRelease(pThis->u.s.hFastMtx); 2544 return fIsOurPacket; 2538 2545 } 2539 2546 … … 2566 2573 * Don't loopback packets we transmit to the wire. 2567 2574 */ 2568 #if 0 2569 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 2570 RTSpinlockAcquire(pThis->hSpinlock, &Tmp); 2571 bool fOurPacket = vboxNetFltSolarisIsOurMBlk(pThis, pPromiscStream, pMsg); 2572 RTSpinlockRelease(pThis->hSpinlock, &Tmp); 2573 2574 if (fOurPacket) 2575 if (vboxNetFltSolarisIsOurMBlk(pThis, pPromiscStream, pMsg)) 2575 2576 { 2576 2577 LogFlow((DEVICE_NAME ":Avoiding packet loopback.\n")); … … 2578 2579 return VINF_SUCCESS; 2579 2580 } 2580 #endif 2581 2582 #if 0 2583 /* 2584 * Yeah, I wish. 2585 */ 2581 2586 if (pMsg->b_flag & MSGNOLOOP) 2582 2587 { … … 2584 2589 return VINF_SUCCESS; 2585 2590 } 2591 #endif 2586 2592 2587 2593 /* … … 2917 2923 LogFlow((DEVICE_NAME ":vboxNetFltOsDeleteInstance pThis=%p\n")); 2918 2924 vboxNetFltSolarisDetachFromInterface(pThis); 2925 2926 if (pThis->u.s.hFastMtx != NIL_RTSEMFASTMUTEX) 2927 { 2928 RTSemFastMutexDestroy(pThis->u.s.hFastMtx); 2929 pThis->u.s.hFastMtx = NIL_RTSEMFASTMUTEX; 2930 } 2919 2931 } 2920 2932 … … 2923 2935 { 2924 2936 LogFlow((DEVICE_NAME ":vboxNetFltOsInitInstance pThis=%p\n")); 2925 return vboxNetFltSolarisAttachToInterface(pThis); 2937 2938 /* 2939 * Mutex used for loopback lockouts. 2940 */ 2941 int rc = RTSemFastMutexCreate(&pThis->u.s.hFastMtx); 2942 if (RT_SUCCESS(rc)) 2943 { 2944 rc = vboxNetFltSolarisAttachToInterface(pThis); 2945 if (RT_SUCCESS(rc)) 2946 return rc; 2947 2948 LogRel((DEVICE_NAME ":vboxNetFltSolarisAttachToInterface failed. rc=%Vrc\n", rc)); 2949 RTSemFastMutexDestroy(pThis->u.s.hFastMtx); 2950 pThis->u.s.hFastMtx = NIL_RTSEMFASTMUTEX; 2951 } 2952 2953 return rc; 2926 2954 } 2927 2955 … … 2935 2963 pThis->u.s.pvArpStream = NULL; 2936 2964 pThis->u.s.pvPromiscStream = NULL; 2965 pThis->u.s.hFastMtx = NIL_RTSEMFASTMUTEX; 2937 2966 bzero(&pThis->u.s.Mac, sizeof(pThis->u.s.Mac)); 2938 2967 return VINF_SUCCESS; … … 2965 2994 LogFlow((DEVICE_NAME ":vboxNetFltPortOsXmit INTNETTRUNKDIR_WIRE\n")); 2966 2995 2996 vboxNetFltSolarisQueueLoopback(pThis, pPromiscStream, pMsg); 2997 2967 2998 #if 0 2968 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 2969 RTSpinlockAcquire(pThis->hSpinlock, &Tmp); 2970 2971 vboxNetFltSolarisQueueLoopback(pThis, pPromiscStream, pMsg); 2972 2973 RTSpinlockRelease(pThis->hSpinlock, &Tmp); 2999 /* 3000 * Too bad we can't keep this, though it "works".... 3001 */ 3002 pMsg->b_flag |= MSGNOLOOP; 2974 3003 #endif 2975 2976 pMsg->b_flag |= MSGNOLOOP;2977 3004 putnext(WR(pPromiscStream->Stream.pReadQueue), pMsg); 2978 3005 }
Note:
See TracChangeset
for help on using the changeset viewer.