summaryrefslogtreecommitdiff
path: root/ztd-eth.c
diff options
context:
space:
mode:
Diffstat (limited to 'ztd-eth.c')
-rw-r--r--ztd-eth.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/ztd-eth.c b/ztd-eth.c
index 41cc896..88d21da 100644
--- a/ztd-eth.c
+++ b/ztd-eth.c
@@ -56,6 +56,8 @@ static DEFINE_SPINLOCK(zlock);
static spinlock_t zlock = SPIN_LOCK_UNLOCKED;
#endif
+static struct sk_buff_head skbs;
+
static struct ztdeth {
unsigned char addr[ETH_ALEN];
unsigned short subaddr; /* Network byte order */
@@ -171,7 +173,7 @@ static int ztdeth_transmit(void *pvt, unsigned char *msg, int msglen)
skb->dev = dev;
if (dev->hard_header)
dev->hard_header(skb, dev, ETH_P_ZTDETH, addr, dev->dev_addr, skb->len);
- dev_queue_xmit(skb);
+ skb_queue_tail(&skbs, skb);
}
}
else
@@ -179,6 +181,18 @@ static int ztdeth_transmit(void *pvt, unsigned char *msg, int msglen)
return 0;
}
+
+static int ztdeth_flush(void)
+{
+ struct sk_buff *skb;
+
+ /* Handle all transmissions now */
+ while ((skb = skb_dequeue(&skbs))) {
+ dev_queue_xmit(skb);
+ }
+ return 0;
+}
+
static struct packet_type ztdeth_ptype = {
type: __constant_htons(ETH_P_ZTDETH), /* Protocol */
dev: NULL, /* Device (NULL = wildcard) */
@@ -381,7 +395,8 @@ static struct zt_dynamic_driver ztd_eth = {
"Ethernet",
ztdeth_create,
ztdeth_destroy,
- ztdeth_transmit
+ ztdeth_transmit,
+ ztdeth_flush
};
static struct notifier_block ztdeth_nblock = {
@@ -393,6 +408,9 @@ static int __init ztdeth_init(void)
dev_add_pack(&ztdeth_ptype);
register_netdevice_notifier(&ztdeth_nblock);
zt_dynamic_register(&ztd_eth);
+
+ skb_queue_head_init(&skbs);
+
return 0;
}