Skip to contentSkip to conversation

IFF_RUNNING related fixes

PATCH In review Thomas Graf 2 participants 11 messages Mar 28, 2005 – Mar 31, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IFF_RUNNING related fixes

Fixes various drivers still relying on IFF_RUNNING. I don't have any of these cards so all patches completely untested.

Unresolved broken users of IFF_RUNNING are:

drivers/wan/syncppp.c
The stats update based on IFF_RUNNING has been broken for a long time. I'm not sure whether it should be changed to check netif_running or carrier_ok so I left it as-is for now.

drivers/s390/net/*
Various usages I'm not sure about the intention of the original code. Authors contacted but no reply so far.

Please do a

bk pull bk://kernel.bkbits.net/tgraf/netdev-2.6-iff_running

This will update the following files:

 drivers/net/au1000_eth.c       |   10 ++--------
 drivers/net/bmac.c             |    2 --
 drivers/net/sk98lin/skge.c     |    8 +++-----
 drivers/net/tlan.c             |    4 ++--
 drivers/net/tokenring/ibmtr.c  |   11 +++--------
 drivers/net/wan/lmc/lmc_main.c |    8 ++------
 include/linux/if.h             |    2 +-
 7 files changed, 13 insertions(+), 32 deletions(-)

through these ChangeSets:

<[email protected]> (05/03/28 1.2039)
[NET]: Change comment to describe the real meaning of IFF_RUNNING

<[email protected]> (05/03/28 1.2038)
[sk98lin]: Use netif_carrier_* instead of IFF_RUNNING and remove obsolete usage of IFF_RUNNING

<[email protected]> (05/03/28 1.2037)
[ibmtr]: Use netif_carrier_* instead of IFF_RUNNING and remove obsolete usage of IFF_RUNNING

<[email protected]> (05/03/28 1.2036)
[lmc]: Use netif_carrier_* instead of IFF_RUNNING

<[email protected]> (05/03/28 1.2035)
[tlan]: Use netif_carrier_* intead of IFF_RUNNING

<[email protected]> (05/03/28 1.2034)
[bmac]: Remove obsolete usage of IFF_RUNING

<[email protected]> (05/03/28 1.2033)
[au1000]: Use netif_carrier_* instead of IFF_RUNNING

#1 lore raw

PATCH 1/7 : Use netif_carrier_* instead of IFF_RUNNING

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2005/03/28 00:06:22+02:00 [email protected]
# [au1000]: Use netif_carrier_* instead of IFF_RUNNING
#
# Signed-off-by: Thomas Graf <[email protected]>
#

# drivers/net/au1000_eth.c
#   2005/03/28 00:06:10+02:00 [email protected] +2 -8
#   [au1000]: Use netif_carrier_* instead of IFF_RUNNING
# 
diff -Nru a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
--- a/drivers/net/au1000_eth.c	2005-03-28 01:08:16 +02:00
+++ b/drivers/net/au1000_eth.c	2005-03-28 01:08:16 +02:00
@@ -1681,10 +1681,6 @@
 		control |= MAC_FULL_DUPLEX;
 	}

- /* fix for startup without cable */
- if (!link)
- dev->flags &= ~IFF_RUNNING;
-
aup->mac->control = control;
aup->mac->vlan1_tag = 0x8100; /* activate vlan support */ au_sync();
@@ -1709,16 +1705,14 @@
if_port = dev->if_port;
if (aup->phy_ops->phy_status(dev, aup->phy_addr, &link, &speed) == 0) {
if (link) {
- if (!(dev->flags & IFF_RUNNING)) {
+ if (!netif_carrier_ok) {
netif_carrier_on(dev);
- dev->flags |= IFF_RUNNING;
printk(KERN_INFO "%s: link up\n", dev->name);
}
}
else {
- if (dev->flags & IFF_RUNNING) {
+ if (netif_carrier_ok) {
netif_carrier_off(dev);
- dev->flags &= ~IFF_RUNNING;
dev->if_port = 0;
printk(KERN_INFO "%s: link down\n", dev->name);
}

#2 lore raw

Re: [PATCH 1/7] [au1000]: Use netif_carrier_* instead of IFF_RUNNING

Correct patch checked-in this time.

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2005/03/28 02:43:27+02:00 [email protected]
# [au1000]: Use netif_carrier_* instead of IFF_RUNNING
#
# Signed-off-by: Thomas Graf <[email protected]>
#

# drivers/net/au1000_eth.c
#   2005/03/28 02:43:16+02:00 [email protected] +2 -8
#   [au1000]: Use netif_carrier_* instead of IFF_RUNNING
# 
diff -Nru a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
--- a/drivers/net/au1000_eth.c	2005-03-28 03:15:43 +02:00
+++ b/drivers/net/au1000_eth.c	2005-03-28 03:15:43 +02:00
@@ -1681,10 +1681,6 @@
 		control |= MAC_FULL_DUPLEX;
 	}

- /* fix for startup without cable */
- if (!link)
- dev->flags &= ~IFF_RUNNING;
-
aup->mac->control = control;
aup->mac->vlan1_tag = 0x8100; /* activate vlan support */ au_sync();
@@ -1709,16 +1705,14 @@
if_port = dev->if_port;
if (aup->phy_ops->phy_status(dev, aup->phy_addr, &link, &speed) == 0) {
if (link) {
- if (!(dev->flags & IFF_RUNNING)) {
+ if (!netif_carrier_ok(dev)) {
netif_carrier_on(dev);
- dev->flags |= IFF_RUNNING;
printk(KERN_INFO "%s: link up\n", dev->name);
}
}
else {
- if (dev->flags & IFF_RUNNING) {
+ if (netif_carrier_ok(dev)) {
netif_carrier_off(dev);
- dev->flags &= ~IFF_RUNNING;
dev->if_port = 0;
printk(KERN_INFO "%s: link down\n", dev->name);
}

#3 lore raw

Re: [PATCH 1/7] [au1000]: Use netif_carrier_* instead of IFF_RUNNING

Applied patches 1-7 with two notes:

1) Include signed-off-by line with ALL patches in the future.

2) I'll let these patches hang out in netdev-2.6 (and thus -mm) for a little while. If you can solicit testers, that would be most helpful.

Jeff

#4 lore raw

PATCH 2/7 : Remove obsolete usage of IFF_RUNING

In reply to Thomas Graf

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2005/03/28 00:10:11+02:00 [email protected]
# [bmac]: Remove obsolete usage of IFF_RUNING
#
# Signed-off-by: Thomas Graf <[email protected]>
#

# drivers/net/bmac.c
#   2005/03/28 00:09:27+02:00 [email protected] +0 -2
#   [bmac]: Remove obsolete usage of IFF_RUNING
# 
diff -Nru a/drivers/net/bmac.c b/drivers/net/bmac.c
--- a/drivers/net/bmac.c	2005-03-28 01:08:09 +02:00
+++ b/drivers/net/bmac.c	2005-03-28 01:08:09 +02:00
@@ -1412,7 +1412,6 @@
 	bp->opened = 1;
 	bmac_reset_and_enable(dev);
 	enable_irq(dev->irq);
-	dev->flags |= IFF_RUNNING;
 	return 0;
 }

@@ -1425,7 +1424,6 @@
int i;

bp->sleeping = 1;
- dev->flags &= ~(IFF_UP | IFF_RUNNING);

/* disable rx and tx */
config = bmread(dev, RXCFG);

#5 lore raw

PATCH 3/7 : Use netif_carrier_* intead of IFF_RUNNING

In reply to Thomas Graf

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2005/03/28 00:13:23+02:00 [email protected]
# [tlan]: Use netif_carrier_* intead of IFF_RUNNING
#
# Signed-off-by: Thomas Graf <[email protected]>
#

# drivers/net/tlan.c
#   2005/03/28 00:13:12+02:00 [email protected] +2 -2
#   [tlan]: Use netif_carrier_* intead of IFF_RUNNING
# 
diff -Nru a/drivers/net/tlan.c b/drivers/net/tlan.c
--- a/drivers/net/tlan.c	2005-03-28 01:08:02 +02:00
+++ b/drivers/net/tlan.c	2005-03-28 01:08:02 +02:00
@@ -2807,7 +2807,7 @@
  	       if (priv->link) {
 		      priv->link = 0;
 	              printk(KERN_DEBUG "TLAN: %s has lost link\n", dev->name);
-	              dev->flags &= ~IFF_RUNNING;
+		      netif_carrier_off(dev);
 		      TLan_SetTimer( dev, (2*HZ), TLAN_TIMER_LINK_BEAT );
 		      return;
 		}
@@ -2817,7 +2817,7 @@
         if ((phy_status & MII_GS_LINK) && !priv->link) {
  		priv->link = 1;
         	printk(KERN_DEBUG "TLAN: %s has reestablished link\n", dev->name);
-        	dev->flags |= IFF_RUNNING;
+		netif_carrier_on(dev);
         }

/* Setup a new monitor */

#6 lore raw

PATCH 4/7 : Use netif_carrier_* instead of IFF_RUNNING

In reply to Thomas Graf

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2005/03/28 00:15:07+02:00 [email protected]
# [lmc]: Use netif_carrier_* instead of IFF_RUNNING
#
# Signed-off-by: Thomas Graf <[email protected]>
#

# drivers/net/wan/lmc/lmc_main.c
#   2005/03/28 00:14:55+02:00 [email protected] +2 -6
#   [lmc]: Use netif_carrier_* instead of IFF_RUNNING
# 
diff -Nru a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
--- a/drivers/net/wan/lmc/lmc_main.c	2005-03-28 01:07:55 +02:00
+++ b/drivers/net/wan/lmc/lmc_main.c	2005-03-28 01:07:55 +02:00
@@ -723,7 +723,7 @@
         /* lmc_reset (sc); Why reset??? The link can go down ok */
         /* Inform the world that link has been lost */
-        dev->flags &= ~IFF_RUNNING;
+	netif_carrier_off(dev);
     }
 
     /*
@@ -736,7 +736,7 @@
          /* lmc_reset (sc); Again why reset??? */
 
          /* Inform the world that link protocol is back up. */

- dev->flags |= IFF_RUNNING;
+ netif_carrier_on(dev);

/* Now we have to tell the syncppp that we had an outage
* and that it should deal. Calling sppp_reopen here
@@ -1168,8 +1168,6 @@

     sc->lmc_media->set_link_status (sc, 1);
     sc->lmc_media->set_status (sc, NULL);

- //dev->flags |= IFF_RUNNING;
-

     netif_wake_queue(dev);
 
     sc->lmc_txfull = 0;

@@ -1232,8 +1230,6 @@
csr6 &= ~LMC_DEC_ST; /* Turn off the Transmission bit */
csr6 &= ~LMC_DEC_SR; /* Turn off the Receive bit */
LMC_CSR_WRITE (sc, csr_command, csr6);
-
- dev->flags &= ~IFF_RUNNING;

     sc->stats.rx_missed_errors +=
         LMC_CSR_READ (sc, csr_missed_frames) & 0xffff;
#7 lore raw

PATCH 5/7 : Use netif_carrier_* instead of IFF_RUNNING and remove obsolete usage of IFF_RUNNING

In reply to Thomas Graf

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2005/03/28 00:16:54+02:00 [email protected]
# [ibmtr]: Use netif_carrier_* instead of IFF_RUNNING and remove obsolete usage of IFF_RUNNING
#
# Signed-off-by: Thomas Graf <[email protected]>
#

# drivers/net/tokenring/ibmtr.c
#   2005/03/28 00:16:44+02:00 [email protected] +3 -8
#   [ibmtr]: Use netif_carrier_* instead of IFF_RUNNING and remove obsolete usage of IFF_RUNNING
# 
diff -Nru a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
--- a/drivers/net/tokenring/ibmtr.c	2005-03-28 01:07:47 +02:00
+++ b/drivers/net/tokenring/ibmtr.c	2005-03-28 01:07:47 +02:00
@@ -888,11 +888,6 @@
 	ti->sap_status   = CLOSED; /* CLOSED or OPEN      */
 	ti->open_failure =     NO; /* NO     or YES       */
 	ti->open_mode    = MANUAL; /* MANUAL or AUTOMATIC */
-	/* 12/2000 not typical Linux, but we can use RUNNING to let us know when
-	the network has crapped out or cables are disconnected. Useful because
-	the IFF_UP flag stays up the whole time, until ifconfig tr0 down.
-	*/
-	dev->flags &= ~IFF_RUNNING;

ti->sram_phys &= ~1; /* to reverse what we do in tok_close */ /* init the spinlock */
@@ -1242,7 +1237,7 @@
ti->open_status = CLOSED;
ti->sap_status = CLOSED;
ti->open_mode = AUTOMATIC;
- dev->flags &= ~IFF_RUNNING;
+ netif_carrier_off(dev);
netif_stop_queue(dev);
ti->open_action = RESTART;
outb(0, dev->base_addr + ADAPTRESET);
@@ -1323,7 +1318,7 @@
break;
}
netif_wake_queue(dev);
- dev->flags |= IFF_RUNNING;/*BMS 12/2000*/
+ netif_carrier_on(dev);
break;
case DIR_INTERRUPT:
case DIR_MOD_OPEN_PARAMS:
@@ -1427,7 +1422,7 @@
ring_status);
if(ring_status& (REMOVE_RECV|AUTO_REMOVAL|LOBE_FAULT)){
netif_stop_queue(dev);
- dev->flags &= ~IFF_RUNNING;/*not typical Linux*/
+ netif_carrier_off(dev);
DPRINTK("Remove received, or Auto-removal error"
", or Lobe fault\n");
DPRINTK("We'll try to reopen the closed adapter"

#8 lore raw

PATCH 6/7 : Use netif_carrier_* instead of IFF_RUNNING and remove obsolete usage of IFF_RUNNING

In reply to Thomas Graf

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2005/03/28 00:18:49+02:00 [email protected]
# [sk98lin]: Use netif_carrier_* instead of IFF_RUNNING and remove obsolete usage of IFF_RUNNING
#
# Signed-off-by: Thomas Graf <[email protected]>
#

# drivers/net/sk98lin/skge.c
#   2005/03/28 00:18:37+02:00 [email protected] +3 -5
#   [sk98lin]: Use netif_carrier_* instead of IFF_RUNNING and remove obsolete usage of IFF_RUNNING
# 
diff -Nru a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
--- a/drivers/net/sk98lin/skge.c	2005-03-28 01:07:40 +02:00
+++ b/drivers/net/sk98lin/skge.c	2005-03-28 01:07:40 +02:00
@@ -4212,7 +4212,7 @@
 			Flags);

SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_HARD_RST);
- pAC->dev[Param.Para32[0]]->flags &= ~IFF_RUNNING;
+ netif_carrier_off(pAC->dev[Param.Para32[0]]);
spin_unlock_irqrestore(
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, Flags);
@@ -4355,7 +4355,7 @@
}

/* Inform the world that link protocol is up. */
- pAC->dev[Param.Para32[0]]->flags |= IFF_RUNNING;
+ netif_carrier_on(pAC->dev[Param.Para32[0]]);

break;
case SK_DRV_NET_DOWN: /* SK_U32 Reason */
@@ -4368,7 +4368,7 @@
} else {
DoPrintInterfaceChange = SK_TRUE;
}
- pAC->dev[Param.Para32[1]]->flags &= ~IFF_RUNNING;
+ netif_carrier_off(pAC->dev[Param.Para32[1]]);
break;
case SK_DRV_SWITCH_HARD: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
@@ -4961,7 +4961,6 @@
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = &SkGePollController;
#endif
- dev->flags &= ~IFF_RUNNING;
SET_NETDEV_DEV(dev, &pdev->dev);
SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps);

@@ -5035,7 +5034,6 @@

 		dev->set_mac_address    = &SkGeSetMacAddr;
 		dev->do_ioctl           = &SkGeIoctl;
 		dev->change_mtu         = &SkGeChangeMtu;

- dev->flags &= ~IFF_RUNNING;
SET_NETDEV_DEV(dev, &pdev->dev); SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps);

#9 lore raw

PATCH 7/7 : Change comment to describe the real meaning of IFF_RUNNING

In reply to Thomas Graf

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2005/03/28 00:46:34+02:00 [email protected]
# [NET]: Change comment to describe the real meaning of IFF_RUNNING
#
# Signed-off-by: Thomas Graf <[email protected]>
#

# include/linux/if.h
#   2005/03/28 00:46:23+02:00 [email protected] +1 -1
#   [NET]: Change comment to describe the real meaning of IFF_RUNNING
# 
diff -Nru a/include/linux/if.h b/include/linux/if.h
--- a/include/linux/if.h	2005-03-28 01:07:33 +02:00
+++ b/include/linux/if.h	2005-03-28 01:07:33 +02:00
@@ -33,7 +33,7 @@
 #define	IFF_LOOPBACK	0x8		/* is a loopback net		*/
 #define	IFF_POINTOPOINT	0x10		/* interface is has p-p link	*/
 #define	IFF_NOTRAILERS	0x20		/* avoid use of trailers	*/
-#define	IFF_RUNNING	0x40		/* resources allocated		*/
+#define	IFF_RUNNING	0x40		/* interface running and carrier ok */
 #define	IFF_NOARP	0x80		/* no ARP protocol		*/
 #define	IFF_PROMISC	0x100		/* receive all packets		*/
 #define	IFF_ALLMULTI	0x200		/* receive all multicast packets*/
#10 lore raw
In reply to Thomas Graf

* Thomas Graf <[email protected]> 2005-03-28 02:06

Quoted 2 lines

Fixes various drivers still relying on IFF_RUNNING. I don't have any of these cards so all patches completely untested.

Oops, one of the changesets has a wrong patch checked in which will not compile. Let me fix this up first.