Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[netdrvrs] Use netif_carrier_* instead of IFF_RUNNING

authored by

and committed by
Jeff Garzik
7d17c1d6 88d7bd8c

+13 -32
+2 -8
drivers/net/au1000_eth.c
··· 1681 1681 control |= MAC_FULL_DUPLEX; 1682 1682 } 1683 1683 1684 - /* fix for startup without cable */ 1685 - if (!link) 1686 - dev->flags &= ~IFF_RUNNING; 1687 - 1688 1684 aup->mac->control = control; 1689 1685 aup->mac->vlan1_tag = 0x8100; /* activate vlan support */ 1690 1686 au_sync(); ··· 1705 1709 if_port = dev->if_port; 1706 1710 if (aup->phy_ops->phy_status(dev, aup->phy_addr, &link, &speed) == 0) { 1707 1711 if (link) { 1708 - if (!(dev->flags & IFF_RUNNING)) { 1712 + if (!netif_carrier_ok(dev)) { 1709 1713 netif_carrier_on(dev); 1710 - dev->flags |= IFF_RUNNING; 1711 1714 printk(KERN_INFO "%s: link up\n", dev->name); 1712 1715 } 1713 1716 } 1714 1717 else { 1715 - if (dev->flags & IFF_RUNNING) { 1718 + if (netif_carrier_ok(dev)) { 1716 1719 netif_carrier_off(dev); 1717 - dev->flags &= ~IFF_RUNNING; 1718 1720 dev->if_port = 0; 1719 1721 printk(KERN_INFO "%s: link down\n", dev->name); 1720 1722 }
-2
drivers/net/bmac.c
··· 1412 1412 bp->opened = 1; 1413 1413 bmac_reset_and_enable(dev); 1414 1414 enable_irq(dev->irq); 1415 - dev->flags |= IFF_RUNNING; 1416 1415 return 0; 1417 1416 } 1418 1417 ··· 1424 1425 int i; 1425 1426 1426 1427 bp->sleeping = 1; 1427 - dev->flags &= ~(IFF_UP | IFF_RUNNING); 1428 1428 1429 1429 /* disable rx and tx */ 1430 1430 config = bmread(dev, RXCFG);
+3 -5
drivers/net/sk98lin/skge.c
··· 4212 4212 Flags); 4213 4213 4214 4214 SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_HARD_RST); 4215 - pAC->dev[Param.Para32[0]]->flags &= ~IFF_RUNNING; 4215 + netif_carrier_off(pAC->dev[Param.Para32[0]]); 4216 4216 spin_unlock_irqrestore( 4217 4217 &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, 4218 4218 Flags); ··· 4355 4355 } 4356 4356 4357 4357 /* Inform the world that link protocol is up. */ 4358 - pAC->dev[Param.Para32[0]]->flags |= IFF_RUNNING; 4358 + netif_carrier_on(pAC->dev[Param.Para32[0]]); 4359 4359 4360 4360 break; 4361 4361 case SK_DRV_NET_DOWN: /* SK_U32 Reason */ ··· 4368 4368 } else { 4369 4369 DoPrintInterfaceChange = SK_TRUE; 4370 4370 } 4371 - pAC->dev[Param.Para32[1]]->flags &= ~IFF_RUNNING; 4371 + netif_carrier_off(pAC->dev[Param.Para32[1]]); 4372 4372 break; 4373 4373 case SK_DRV_SWITCH_HARD: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */ 4374 4374 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, ··· 4961 4961 #ifdef CONFIG_NET_POLL_CONTROLLER 4962 4962 dev->poll_controller = &SkGePollController; 4963 4963 #endif 4964 - dev->flags &= ~IFF_RUNNING; 4965 4964 SET_NETDEV_DEV(dev, &pdev->dev); 4966 4965 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps); 4967 4966 ··· 5034 5035 dev->set_mac_address = &SkGeSetMacAddr; 5035 5036 dev->do_ioctl = &SkGeIoctl; 5036 5037 dev->change_mtu = &SkGeChangeMtu; 5037 - dev->flags &= ~IFF_RUNNING; 5038 5038 SET_NETDEV_DEV(dev, &pdev->dev); 5039 5039 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps); 5040 5040
+2 -2
drivers/net/tlan.c
··· 2807 2807 if (priv->link) { 2808 2808 priv->link = 0; 2809 2809 printk(KERN_DEBUG "TLAN: %s has lost link\n", dev->name); 2810 - dev->flags &= ~IFF_RUNNING; 2810 + netif_carrier_off(dev); 2811 2811 TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_LINK_BEAT ); 2812 2812 return; 2813 2813 } ··· 2817 2817 if ((phy_status & MII_GS_LINK) && !priv->link) { 2818 2818 priv->link = 1; 2819 2819 printk(KERN_DEBUG "TLAN: %s has reestablished link\n", dev->name); 2820 - dev->flags |= IFF_RUNNING; 2820 + netif_carrier_on(dev); 2821 2821 } 2822 2822 2823 2823 /* Setup a new monitor */
+3 -8
drivers/net/tokenring/ibmtr.c
··· 888 888 ti->sap_status = CLOSED; /* CLOSED or OPEN */ 889 889 ti->open_failure = NO; /* NO or YES */ 890 890 ti->open_mode = MANUAL; /* MANUAL or AUTOMATIC */ 891 - /* 12/2000 not typical Linux, but we can use RUNNING to let us know when 892 - the network has crapped out or cables are disconnected. Useful because 893 - the IFF_UP flag stays up the whole time, until ifconfig tr0 down. 894 - */ 895 - dev->flags &= ~IFF_RUNNING; 896 891 897 892 ti->sram_phys &= ~1; /* to reverse what we do in tok_close */ 898 893 /* init the spinlock */ ··· 1237 1242 ti->open_status = CLOSED; 1238 1243 ti->sap_status = CLOSED; 1239 1244 ti->open_mode = AUTOMATIC; 1240 - dev->flags &= ~IFF_RUNNING; 1245 + netif_carrier_off(dev); 1241 1246 netif_stop_queue(dev); 1242 1247 ti->open_action = RESTART; 1243 1248 outb(0, dev->base_addr + ADAPTRESET); ··· 1318 1323 break; 1319 1324 } 1320 1325 netif_wake_queue(dev); 1321 - dev->flags |= IFF_RUNNING;/*BMS 12/2000*/ 1326 + netif_carrier_on(dev); 1322 1327 break; 1323 1328 case DIR_INTERRUPT: 1324 1329 case DIR_MOD_OPEN_PARAMS: ··· 1422 1427 ring_status); 1423 1428 if(ring_status& (REMOVE_RECV|AUTO_REMOVAL|LOBE_FAULT)){ 1424 1429 netif_stop_queue(dev); 1425 - dev->flags &= ~IFF_RUNNING;/*not typical Linux*/ 1430 + netif_carrier_off(dev); 1426 1431 DPRINTK("Remove received, or Auto-removal error" 1427 1432 ", or Lobe fault\n"); 1428 1433 DPRINTK("We'll try to reopen the closed adapter"
+2 -6
drivers/net/wan/lmc/lmc_main.c
··· 723 723 /* lmc_reset (sc); Why reset??? The link can go down ok */ 724 724 725 725 /* Inform the world that link has been lost */ 726 - dev->flags &= ~IFF_RUNNING; 726 + netif_carrier_off(dev); 727 727 } 728 728 729 729 /* ··· 736 736 /* lmc_reset (sc); Again why reset??? */ 737 737 738 738 /* Inform the world that link protocol is back up. */ 739 - dev->flags |= IFF_RUNNING; 739 + netif_carrier_on(dev); 740 740 741 741 /* Now we have to tell the syncppp that we had an outage 742 742 * and that it should deal. Calling sppp_reopen here ··· 1168 1168 sc->lmc_media->set_link_status (sc, 1); 1169 1169 sc->lmc_media->set_status (sc, NULL); 1170 1170 1171 - //dev->flags |= IFF_RUNNING; 1172 - 1173 1171 netif_wake_queue(dev); 1174 1172 1175 1173 sc->lmc_txfull = 0; ··· 1230 1232 csr6 &= ~LMC_DEC_ST; /* Turn off the Transmission bit */ 1231 1233 csr6 &= ~LMC_DEC_SR; /* Turn off the Receive bit */ 1232 1234 LMC_CSR_WRITE (sc, csr_command, csr6); 1233 - 1234 - dev->flags &= ~IFF_RUNNING; 1235 1235 1236 1236 sc->stats.rx_missed_errors += 1237 1237 LMC_CSR_READ (sc, csr_missed_frames) & 0xffff;
+1 -1
include/linux/if.h
··· 33 33 #define IFF_LOOPBACK 0x8 /* is a loopback net */ 34 34 #define IFF_POINTOPOINT 0x10 /* interface is has p-p link */ 35 35 #define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ 36 - #define IFF_RUNNING 0x40 /* resources allocated */ 36 + #define IFF_RUNNING 0x40 /* interface running and carrier ok */ 37 37 #define IFF_NOARP 0x80 /* no ARP protocol */ 38 38 #define IFF_PROMISC 0x100 /* receive all packets */ 39 39 #define IFF_ALLMULTI 0x200 /* receive all multicast packets*/