patch-2.3.44 linux/drivers/net/tokenring/smctr.c

Next file: linux/drivers/net/tokenring/tms380tr.c
Previous file: linux/drivers/net/tokenring/olympic.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.43/linux/drivers/net/tokenring/smctr.c linux/drivers/net/tokenring/smctr.c
@@ -131,7 +131,6 @@
 /* H */
 static int smctr_hardware_send_packet(struct net_device *dev,
         struct net_local *tp);
-
 /* I */
 static int smctr_init_acbs(struct net_device *dev);
 static int smctr_init_adapter(struct net_device *dev);
@@ -282,6 +281,7 @@
 static int smctr_status_chg(struct net_device *dev);
 
 /* T */
+static void smctr_timeout(struct net_device *dev);
 static int smctr_trc_send_packet(struct net_device *dev, FCBlock *fcb,
         __u16 queue);
 static __u16 smctr_tx_complete(struct net_device *dev, __u16 queue);
@@ -730,9 +730,8 @@
         struct sk_buff *skb;
         int err;
 
-        dev->tbusy = 1;
-        dev->start = 0;
-
+	netif_stop_queue(dev);
+	
 #ifdef MODULE
         MOD_DEC_USE_COUNT;
 #endif
@@ -2030,13 +2029,9 @@
                 return;
         }
 
-        dev->interrupt = 1;
-
         ioaddr = dev->base_addr;
         tp = (struct net_local *)dev->priv;
 
-        dev->interrupt = 0;
-
         if(tp->status == NOT_INITIALIZED)
                 return;
 
@@ -3749,6 +3744,8 @@
         dev->open               = smctr_open;
         dev->stop               = smctr_close;
         dev->hard_start_xmit    = smctr_send_packet;
+        dev->tx_timeout		= smctr_timeout;
+        dev->watchdog_timeo	= HZ;
         dev->get_stats          = smctr_get_stats;
         dev->set_multicast_list = &smctr_set_multicast_list;
 
@@ -4723,6 +4720,20 @@
         return (0);
 }
 
+static void smctr_timeout(struct net_device *dev)
+{
+	/*
+         * If we get here, some higher level has decided we are broken.
+         * There should really be a "kick me" function call instead.
+         *
+         * Resetting the token ring adapter takes a long time so just
+         * fake transmission time and go on trying. Our own timeout
+         * routine is in sktr_timer_chk()
+         */
+        dev->trans_start = jiffies;
+        netif_wake_queue(dev);
+}
+
 /*
  * Gets skb from system, queues it and checks if it can be sent
  */
@@ -4733,37 +4744,11 @@
         if(smctr_debug > 10)
                 printk("%s: smctr_send_packet\n", dev->name);
 
-        if(dev->tbusy)
-        {
-                /*
-                 * If we get here, some higher level has decided we are broken.
-                 * There should really be a "kick me" function call instead.
-                 *
-                 * Resetting the token ring adapter takes a long time so just
-                 * fake transmission time and go on trying. Our own timeout
-                 * routine is in sktr_timer_chk()
-                 */
-                dev->tbusy       = 0;
-                dev->trans_start = jiffies;
-                return (1);
-        }
-
-        /*
-         * If some higher layer thinks we've missed an tx-done interrupt we
-         * are passed NULL.
-         */
-        if(skb == NULL)
-                return (0);
-
         /*
-         * Block a timer-based transmit from overlapping. This could better be
-         * done with atomic_swap(1, dev->tbusy), but set_bit() works as well.
+         * Block a transmit overlap
          */
-        if(test_and_set_bit(0, (void*)&dev->tbusy) != 0)
-        {
-                printk("%s: Transmitter access conflict.\n", dev->name);
-                return (1);
-        }
+         
+        netif_stop_queue(dev);
 
         if(tp->QueueSkb == 0)
                 return (1);     /* Return with tbusy set: queue full */
@@ -4772,8 +4757,8 @@
         skb_queue_tail(&tp->SendSkbQueue, skb);
         smctr_hardware_send_packet(dev, tp);
         if(tp->QueueSkb > 0)
-                dev->tbusy = 0;
-
+		netif_wake_queue(dev);
+		
         return (0);
 }
 
@@ -5749,7 +5734,7 @@
                 tp->num_tx_fcbs_used[queue]--;
                 fcb->frame_status = 0;
                 tp->tx_fcb_end[queue] = fcb->next_ptr;
-
+		netif_wake_queue(dev);
                 return (0);
         }
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)