summaryrefslogtreecommitdiff
path: root/cleopatre/devkit/plcdrv/arm/src/linux_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'cleopatre/devkit/plcdrv/arm/src/linux_drv.c')
-rw-r--r--cleopatre/devkit/plcdrv/arm/src/linux_drv.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/cleopatre/devkit/plcdrv/arm/src/linux_drv.c b/cleopatre/devkit/plcdrv/arm/src/linux_drv.c
index 53850ad8ba..9db887f145 100644
--- a/cleopatre/devkit/plcdrv/arm/src/linux_drv.c
+++ b/cleopatre/devkit/plcdrv/arm/src/linux_drv.c
@@ -45,6 +45,7 @@
#include "linux_drv.h"
#include "processing.h"
#include "mailbox.h"
+#include "hal.h"
#include "registers.h"
#else
#include "common.h"
@@ -73,6 +74,9 @@ MODULE_LICENSE("SPiDCOM Technologies 2009");
#define DEFAULT_NB_MME_BUFFERS 1
#define DEFAULT_NB_INTERFACE_BUFFERS 2
+/** Max allowed TX message in the same time */
+#define MBX_TX_POOL (L2A_RING_SIZE / MAX_MSG_SIZE / 2)
+
/** These identify the driver base version */
static char version[] __devinitdata = DRV_NAME " PLC driver v" DRV_VERSION " (" DRV_RELDATE ")\n";
@@ -809,10 +813,15 @@ int free_buffer(void *packet, enum free_reason reason)
case RX_DROP: priv->stats.rx_dropped++;
break;
case TX_DROP: priv->stats.tx_dropped++;
+ priv->plc_stats.tx_pool--;
+ if(netif_queue_stopped(plcdrv_device))
+ netif_wake_queue(plcdrv_device);
break;
case TX_COMPLETE: priv->stats.tx_packets++;
priv->stats.tx_bytes += skb->len;
priv->plc_stats.tx_pool--;
+ if(netif_queue_stopped(plcdrv_device))
+ netif_wake_queue(plcdrv_device);
break;
default:
break;
@@ -970,11 +979,12 @@ int plcdrv_tx(struct sk_buff *skb, struct net_device *dev)
status = processing_send((void *)skb->data, skb->len);
//Tx queue is nearly full we must stop it
- if(status == NEARLY_FULL)
+ if(status == NEARLY_FULL ||
+ priv->plc_stats.tx_pool == MBX_TX_POOL - 1)
{
netif_stop_queue(dev);
priv->plc_stats.tx_pool++; // update plc stats
- printk(KERN_WARNING DRV_NAME ": %s: TX queue nearly Full\n", dev->name);
+ TRACE("TX queue nearly Full\n");
}
//Tx queue is full drop the frame
else if(status == FULL)