Changeset 12731 in vbox
- Timestamp:
- Sep 25, 2008 1:35:55 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
r12683 r12731 294 294 typedef struct VBOXNETFLTPACKETID *PVBOXNETFLTPACKETID; 295 295 296 297 296 /** 298 297 * vboxnetflt_stream_t: per-stream data (multiple streams per interface) … … 316 315 bool fRawMode; /* whether raw mode request was successful */ 317 316 uint32_t ModeReqId; /* track MIOCTLs for swallowing our fake request acknowledgements */ 317 size_t cLoopback; /* loopback queue size list */ 318 318 PVBOXNETFLTPACKETID pHead; /* loopback packet identifier head */ 319 319 PVBOXNETFLTPACKETID pTail; /* loopback packet identifier tail */ 320 size_t cLoopback; /* loopback queue size list */321 320 } vboxnetflt_promisc_stream_t; 322 321 … … 710 709 default: /* Heh. */ 711 710 { 712 713 714 711 RTSpinlockRelease(pThis->hSpinlock, &Tmp); 712 AssertRelease(pStream->Type); 713 break; 715 714 } 716 715 } … … 856 855 static int VBoxNetFltSolarisModReadPut(queue_t *pQueue, mblk_t *pMsg) 857 856 { 858 /*859 * Yes, I'm paranoid.860 */861 if (!pMsg)862 {863 LogRel((DEVICE_NAME ":VBoxNetFltSolarisModReadPut huh?? Invalid parameters.\n"));864 return 0;865 }866 867 857 LogFlow((DEVICE_NAME ":VBoxNetFltSolarisModReadPut pQueue=%p pMsg=%p\n", pQueue, pMsg)); 868 858 … … 877 867 * is somehow still in the host stream we must try not to panic the host. 878 868 */ 879 if ( pStream 869 if ( pMsg 870 && pStream 880 871 && pStream->Type == kPromiscStream) 881 872 { … … 906 897 && pPromiscStream->fRawMode) 907 898 { 908 RTSpinlockAcquire(pThis->hSpinlock, &Tmp);909 899 vboxNetFltSolarisRecv(pThis, pStream, pQueue, pMsg); 910 RTSpinlockRelease(pThis->hSpinlock, &Tmp);911 900 fSendUpstream = false; 912 901 } … … 1004 993 } 1005 994 1006 if ( fSendUpstream 1007 && pMsg) 995 if (fSendUpstream) 1008 996 { 1009 997 /* … … 1017 1005 } 1018 1006 else 1019 put q(pQueue, pMsg);1007 putbq(pQueue, pMsg); 1020 1008 } 1021 1009 … … 1225 1213 } 1226 1214 else 1227 put q(pQueue, pMsg);1215 putbq(pQueue, pMsg); 1228 1216 } 1229 1217 … … 2389 2377 return VERR_NET_MSG_SIZE; 2390 2378 2391 PCRTNETETHERHDR pEthHdr = (PCRTNETETHERHDR)pMsg->b_rptr;2392 2379 PVBOXNETFLTPACKETID pCur = NULL; 2393 2380 int rc = VINF_SUCCESS; … … 2426 2413 break; 2427 2414 } 2428 else 2415 else if (pPromiscStream->pTail) 2429 2416 { 2430 Assert(pPromiscStream->pTail);2431 2417 pCur = RTMemAlloc(sizeof(VBOXNETFLTPACKETID)); 2432 2418 if (RT_UNLIKELY(!pCur)) … … 2580 2566 * Don't loopback packets we transmit to the wire. 2581 2567 */ 2582 if (vboxNetFltSolarisIsOurMBlk(pThis, pPromiscStream, pMsg)) 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) 2583 2575 { 2584 2576 LogFlow((DEVICE_NAME ":Avoiding packet loopback.\n")); 2577 freemsg(pMsg); 2578 return VINF_SUCCESS; 2579 } 2580 #endif 2581 if (pMsg->b_flag & MSGNOLOOP) 2582 { 2585 2583 freemsg(pMsg); 2586 2584 return VINF_SUCCESS; … … 2609 2607 } 2610 2608 vboxNetFltSolarisAnalyzeMBlk(pMsg); 2611 2612 2609 #endif 2613 2610 … … 2957 2954 LogFlow((DEVICE_NAME ":vboxNetFltPortOsXmit pThis=%p pSG=%p fDst=%d\n", pThis, pSG, fDst)); 2958 2955 2959 /*2960 * Create a message block and send it down the wire (downstream).2961 */2962 2956 int rc = VINF_SUCCESS; 2963 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;2964 2957 if (fDst & INTNETTRUNKDIR_WIRE) 2965 2958 { 2966 mblk_t *pMsg = vboxNetFltSolarisMBlkFromSG(pThis, pSG, fDst); 2967 if (RT_LIKELY(pMsg)) 2968 { 2969 LogFlow((DEVICE_NAME ":vboxNetFltPortOsXmit INTNETTRUNKDIR_WIRE\n")); 2970 2971 RTSpinlockAcquire(pThis->hSpinlock, &Tmp); 2972 2973 vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream); 2974 queue_t *pPromiscWriteQueue = WR(pPromiscStream->Stream.pReadQueue); 2975 2976 rc = vboxNetFltSolarisQueueLoopback(pThis, pPromiscStream, pMsg); 2977 2978 RTSpinlockRelease(pThis->hSpinlock, &Tmp); 2979 2980 putnext(pPromiscWriteQueue, pMsg); 2981 } 2982 else 2983 rc = VERR_NO_MEMORY; 2959 vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream); 2960 if (RT_LIKELY(pPromiscStream)) 2961 { 2962 mblk_t *pMsg = vboxNetFltSolarisMBlkFromSG(pThis, pSG, fDst); 2963 if (RT_LIKELY(pMsg)) 2964 { 2965 LogFlow((DEVICE_NAME ":vboxNetFltPortOsXmit INTNETTRUNKDIR_WIRE\n")); 2966 2967 #if 0 2968 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 2969 RTSpinlockAcquire(pThis->hSpinlock, &Tmp); 2970 2971 vboxNetFltSolarisQueueLoopback(pThis, pPromiscStream, pMsg); 2972 2973 RTSpinlockRelease(pThis->hSpinlock, &Tmp); 2974 #endif 2975 2976 pMsg->b_flag |= MSGNOLOOP; 2977 putnext(WR(pPromiscStream->Stream.pReadQueue), pMsg); 2978 } 2979 } 2984 2980 } 2985 2981
Note:
See TracChangeset
for help on using the changeset viewer.