Changeset 41548 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt/linux
- Timestamp:
- Jun 1, 2012 4:46:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
r40854 r41548 1536 1536 pThis->u.s.PacketType.func = vboxNetFltLinuxPacketHandler; 1537 1537 dev_add_pack(&pThis->u.s.PacketType); 1538 ASMAtomicUoWriteBool(&pThis->u.s.fPacketHandler, true); 1539 Log(("vboxNetFltLinuxAttachToInterface: this=%p: Packet handler installed.\n", pThis)); 1538 1540 1539 1541 #ifdef VBOXNETFLT_WITH_HOST2WIRE_FILTER … … 1560 1562 } 1561 1563 RTSpinlockReleaseNoInts(pThis->hSpinlock); 1562 Log(("vboxNetFltLinuxAttachToInterface: this=%p: Packet handler installed.\n", pThis));1563 1564 1564 1565 /* … … 1604 1605 static int vboxNetFltLinuxUnregisterDevice(PVBOXNETFLTINS pThis, struct net_device *pDev) 1605 1606 { 1607 bool fRegistered; 1606 1608 Assert(!pThis->fDisconnectedFromHost); 1607 1609 … … 1610 1612 #endif 1611 1613 1614 if (ASMAtomicCmpXchgBool(&pThis->u.s.fPacketHandler, false, true)) 1615 { 1616 dev_remove_pack(&pThis->u.s.PacketType); 1617 Log(("vboxNetFltLinuxUnregisterDevice: this=%p: packet handler removed.\n", pThis)); 1618 } 1619 1612 1620 RTSpinlockAcquire(pThis->hSpinlock); 1613 ASMAtomicWriteBool(&pThis->u.s.fRegistered, false); 1614 ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true); 1615 ASMAtomicUoWriteNullPtr(&pThis->u.s.pDev); 1621 fRegistered = ASMAtomicXchgBool(&pThis->u.s.fRegistered, false); 1622 if (fRegistered) 1623 { 1624 ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true); 1625 ASMAtomicUoWriteNullPtr(&pThis->u.s.pDev); 1626 } 1616 1627 RTSpinlockReleaseNoInts(pThis->hSpinlock); 1617 1628 1618 dev_remove_pack(&pThis->u.s.PacketType); 1629 if (fRegistered) 1630 { 1619 1631 #ifndef VBOXNETFLT_LINUX_NO_XMIT_QUEUE 1620 skb_queue_purge(&pThis->u.s.XmitQueue);1621 #endif 1622 Log(("vboxNetFltLinuxUnregisterDevice: this=%p: Packet handler removed,xmit queue purged.\n", pThis));1623 Log(("vboxNetFltLinuxUnregisterDevice: Device %p(%s) released. ref=%d\n",1624 pDev, pDev->name,1632 skb_queue_purge(&pThis->u.s.XmitQueue); 1633 #endif 1634 Log(("vboxNetFltLinuxUnregisterDevice: this=%p: xmit queue purged.\n", pThis)); 1635 Log(("vboxNetFltLinuxUnregisterDevice: Device %p(%s) released. ref=%d\n", 1636 pDev, pDev->name, 1625 1637 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) 1626 netdev_refcnt_read(pDev)1638 netdev_refcnt_read(pDev) 1627 1639 #else 1628 atomic_read(&pDev->refcnt) 1629 #endif 1630 )); 1631 dev_put(pDev); 1640 atomic_read(&pDev->refcnt) 1641 #endif 1642 )); 1643 dev_put(pDev); 1644 } 1632 1645 1633 1646 return NOTIFY_OK; … … 1870 1883 * we don't want the handler to forward packets to disconnected switch. 1871 1884 */ 1872 dev_remove_pack(&pThis->u.s.PacketType); 1885 if (ASMAtomicCmpXchgBool(&pThis->u.s.fPacketHandler, false, true)) 1886 { 1887 dev_remove_pack(&pThis->u.s.PacketType); 1888 Log(("vboxNetFltOsDisconnectIt: this=%p: Packet handler removed.\n", pThis)); 1889 } 1873 1890 return VINF_SUCCESS; 1874 1891 } … … 1917 1934 RTSpinlockAcquire(pThis->hSpinlock); 1918 1935 pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *); 1919 fRegistered = ASMAtomic UoReadBool(&pThis->u.s.fRegistered);1936 fRegistered = ASMAtomicXchgBool(&pThis->u.s.fRegistered, false); 1920 1937 RTSpinlockReleaseNoInts(pThis->hSpinlock); 1921 1938 … … 1927 1944 skb_queue_purge(&pThis->u.s.XmitQueue); 1928 1945 #endif 1929 Log(("vboxNetFltOsDeleteInstance: this=%p: Packet handler removed,xmit queue purged.\n", pThis));1946 Log(("vboxNetFltOsDeleteInstance: this=%p: xmit queue purged.\n", pThis)); 1930 1947 Log(("vboxNetFltOsDeleteInstance: Device %p(%s) released. ref=%d\n", 1931 1948 pDev, pDev->name, … … 1974 1991 */ 1975 1992 ASMAtomicUoWriteNullPtr(&pThis->u.s.pDev); 1976 pThis->u.s.fRegistered = false;1993 pThis->u.s.fRegistered = false; 1977 1994 pThis->u.s.fPromiscuousSet = false; 1995 pThis->u.s.fPacketHandler = false; 1978 1996 memset(&pThis->u.s.PacketType, 0, sizeof(pThis->u.s.PacketType)); 1979 1997 #ifndef VBOXNETFLT_LINUX_NO_XMIT_QUEUE
Note:
See TracChangeset
for help on using the changeset viewer.