[etherlab-users] EoE communication problems

Sergej.Stepanov at ids.de Sergej.Stepanov at ids.de
Fri Feb 10 16:21:40 CET 2012


Hallo Florian,

thanks your tips we could fix a problem on our slave.

Could you please take a look at the diff?
This patch fixed the oops problem 1. I described you.
It is from 1.5-stable branch and should be the same as 1.5.1

Thank you
Best regards
Sergej.

Index: master/ethernet.h
===================================================================
--- master/ethernet.h	(Revision 70081)
+++ master/ethernet.h	(Revision 70114)
@@ -92,7 +97,7 @@
     unsigned int tx_queue_size; /**< Transmit queue size. */
     unsigned int tx_queue_active; /**< kernel netif queue started */
     unsigned int tx_queued_frames; /**< number of frames in the queue */
-    struct semaphore tx_queue_sem; /**< Semaphore for the send queue. */
+    spinlock_t tx_queue_sem; /**< Spinlock for the send queue. */
     ec_eoe_frame_t *tx_frame; /**< current TX frame */
     uint8_t tx_frame_number; /**< number of the transmitted frame */
     uint8_t tx_fragment_number; /**< number of the fragment */

Index: master/ethernet.c
===================================================================
--- master/ethernet.c	(Revision 70081)
+++ master/ethernet.c	(Revision 70114)
@@ -122,7 +122,7 @@
     eoe->tx_queue_size = EC_EOE_TX_QUEUE_SIZE;
     eoe->tx_queued_frames = 0;
 
-    sema_init(&eoe->tx_queue_sem, 1);
+    spin_lock_init(&eoe->tx_queue_sem);
     eoe->tx_frame_number = 0xFF;
     memset(&eoe->stats, 0, sizeof(struct net_device_stats));
 
@@ -231,7 +231,7 @@
 {
     ec_eoe_frame_t *frame, *next;
 
-    down(&eoe->tx_queue_sem);
+    spin_lock_bh(&eoe->tx_queue_sem);
 
     list_for_each_entry_safe(frame, next, &eoe->tx_queue, queue) {
         list_del(&frame->queue);
@@ -240,7 +240,7 @@
     }
     eoe->tx_queued_frames = 0;
 
-    up(&eoe->tx_queue_sem);
+    spin_unlock_bh(&eoe->tx_queue_sem);
 }
 
 /*****************************************************************************/
@@ -620,10 +625,10 @@
         return;
     }
 
-    down(&eoe->tx_queue_sem);
+    spin_lock_bh(&eoe->tx_queue_sem);
 
     if (!eoe->tx_queued_frames || list_empty(&eoe->tx_queue)) {
-        up(&eoe->tx_queue_sem);
+        spin_unlock_bh(&eoe->tx_queue_sem);
         eoe->tx_idle = 1;
         // no data available.
         // start a new receive immediately.
@@ -644,7 +649,7 @@
     }
 
     eoe->tx_queued_frames--;
-    up(&eoe->tx_queue_sem);
+    spin_unlock_bh(&eoe->tx_queue_sem);
 
     eoe->tx_idle = 0;
 
@@ -812,14 +817,14 @@
 
     frame->skb = skb;
 
-    down(&eoe->tx_queue_sem);
+    spin_lock(&eoe->tx_queue_sem);
     list_add_tail(&frame->queue, &eoe->tx_queue);
     eoe->tx_queued_frames++;
     if (eoe->tx_queued_frames == eoe->tx_queue_size) {
         netif_stop_queue(dev);
         eoe->tx_queue_active = 0;
     }
-    up(&eoe->tx_queue_sem);
+    spin_unlock(&eoe->tx_queue_sem);
 
 #if EOE_DEBUG_LEVEL >= 2
     EC_SLAVE_DBG(eoe->slave, 0, "EoE %s TX queued frame"




More information about the Etherlab-users mailing list