11 #include <linux/module.h>
12 #include <linux/types.h>
13 #include <linux/kernel.h>
14 #include <linux/slab.h>
15 #include <linux/string.h>
16 #include <linux/errno.h>
17 #include <linux/if_arp.h>
18 #include <linux/netdevice.h>
73 #define NEXT_SLAVE(q) (((struct teql_sched_data *)qdisc_priv(q))->next)
75 #define FMASK (IFF_BROADCAST | IFF_POINTOPOINT)
86 __skb_queue_tail(&q->
q, skb);
90 return qdisc_drop(skb, sch);
100 skb = __skb_dequeue(&dat->
q);
101 dat_queue = netdev_get_tx_queue(dat->
m->dev, 0);
105 dat->
m->slaves =
sch;
109 qdisc_bstats_update(sch, skb);
111 sch->
q.qlen = dat->
q.qlen + dat_queue->
qdisc->q.qlen;
116 teql_peek(
struct Qdisc *sch)
130 teql_reset(
struct Qdisc *sch)
139 teql_destroy(
struct Qdisc *sch)
151 if (q == master->
slaves) {
153 if (q == master->
slaves) {
157 txq = netdev_get_tx_queue(master->
dev, 0);
160 root_lock = qdisc_root_sleeping_lock(txq->
qdisc);
161 spin_lock_bh(root_lock);
163 spin_unlock_bh(root_lock);
170 }
while ((prev = q) != master->
slaves);
188 skb_queue_head_init(&q->
q);
207 if (dev->
mtu < m->
dev->mtu)
230 n = dst_neigh_lookup_skb(dst, skb);
234 if (dst->
dev != dev) {
244 if (neigh_event_send(n, skb_res) == 0) {
248 neigh_ha_snapshot(haddr, n, dev);
261 static inline int teql_resolve(
struct sk_buff *skb,
276 res = __teql_resolve(skb, skb_res, dev, txq, dst);
288 int subq = skb_get_queue_mapping(skb);
303 struct netdev_queue *slave_txq = netdev_get_tx_queue(slave, 0);
308 if (netif_xmit_stopped(netdev_get_tx_queue(slave, subq)) ||
309 !netif_running(slave)) {
314 switch (teql_resolve(skb, skb_res, slave, slave_txq)) {
316 if (__netif_tx_trylock(slave_txq)) {
317 unsigned int length = qdisc_pkt_len(skb);
319 if (!netif_xmit_frozen_or_stopped(slave_txq) &&
321 txq_trans_update(slave_txq);
322 __netif_tx_unlock(slave_txq);
324 netif_wake_queue(dev);
329 __netif_tx_unlock(slave_txq);
331 if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)))
341 __skb_pull(skb, skb_network_offset(skb));
344 if (nores && skb_res ==
NULL) {
350 netif_stop_queue(dev);
361 static int teql_master_open(
struct net_device *dev)
380 if (slave->
mtu < mtu)
399 netif_start_queue(m->
dev);
403 static int teql_master_close(
struct net_device *dev)
405 netif_stop_queue(dev);
421 static int teql_master_mtu(
struct net_device *dev,
int new_mtu)
432 if (new_mtu > qdisc_dev(q)->mtu)
442 .ndo_open = teql_master_open,
443 .ndo_stop = teql_master_close,
444 .ndo_start_xmit = teql_master_xmit,
445 .ndo_get_stats64 = teql_master_stats64,
446 .ndo_change_mtu = teql_master_mtu,
459 ops->
peek = teql_peek;
460 ops->
init = teql_qdisc_init;
461 ops->
reset = teql_reset;
475 static int max_equalizers = 1;
479 static int __init teql_init(
void)
484 for (i = 0; i < max_equalizers; i++) {
489 "teql%d", teql_master_setup);
500 master = netdev_priv(dev);
516 static void __exit teql_exit(
void)