Lines Matching +full:master +full:- +full:stats
1 // SPDX-License-Identifier: GPL-2.0-or-later
24 ----------------
36 --------------
42 f.e. it will equalize 9600baud line and 100Mb ethernet perfectly :-)
69 #define NEXT_SLAVE(q) (((struct teql_sched_data *)qdisc_priv(q))->next)
81 if (q->q.qlen < READ_ONCE(dev->tx_queue_len)) { in teql_enqueue()
82 __skb_queue_tail(&q->q, skb); in teql_enqueue()
97 skb = __skb_dequeue(&dat->q); in teql_dequeue()
98 dat_queue = netdev_get_tx_queue(dat->m->dev, 0); in teql_dequeue()
99 q = rcu_dereference_bh(dat_queue->qdisc); in teql_dequeue()
104 dat->m->slaves = sch; in teql_dequeue()
110 sch->q.qlen = dat->q.qlen + q->q.qlen; in teql_dequeue()
126 skb_queue_purge(&dat->q); in teql_reset()
134 struct teql_master *master = dat->m; in teql_destroy() local
136 if (!master) in teql_destroy()
139 prev = master->slaves; in teql_destroy()
145 if (q == master->slaves) { in teql_destroy()
146 master->slaves = NEXT_SLAVE(q); in teql_destroy()
147 if (q == master->slaves) { in teql_destroy()
151 txq = netdev_get_tx_queue(master->dev, 0); in teql_destroy()
152 master->slaves = NULL; in teql_destroy()
154 root_lock = qdisc_root_sleeping_lock(rtnl_dereference(txq->qdisc)); in teql_destroy()
156 qdisc_reset(rtnl_dereference(txq->qdisc)); in teql_destroy()
160 skb_queue_purge(&dat->q); in teql_destroy()
164 } while ((prev = q) != master->slaves); in teql_destroy()
172 struct teql_master *m = (struct teql_master *)sch->ops; in teql_qdisc_init()
175 if (dev->hard_header_len > m->dev->hard_header_len) in teql_qdisc_init()
176 return -EINVAL; in teql_qdisc_init()
178 if (m->dev == dev) in teql_qdisc_init()
179 return -ELOOP; in teql_qdisc_init()
181 q->m = m; in teql_qdisc_init()
183 skb_queue_head_init(&q->q); in teql_qdisc_init()
185 if (m->slaves) { in teql_qdisc_init()
186 if (m->dev->flags & IFF_UP) { in teql_qdisc_init()
187 if ((m->dev->flags & IFF_POINTOPOINT && in teql_qdisc_init()
188 !(dev->flags & IFF_POINTOPOINT)) || in teql_qdisc_init()
189 (m->dev->flags & IFF_BROADCAST && in teql_qdisc_init()
190 !(dev->flags & IFF_BROADCAST)) || in teql_qdisc_init()
191 (m->dev->flags & IFF_MULTICAST && in teql_qdisc_init()
192 !(dev->flags & IFF_MULTICAST)) || in teql_qdisc_init()
193 dev->mtu < m->dev->mtu) in teql_qdisc_init()
194 return -EINVAL; in teql_qdisc_init()
196 if (!(dev->flags&IFF_POINTOPOINT)) in teql_qdisc_init()
197 m->dev->flags &= ~IFF_POINTOPOINT; in teql_qdisc_init()
198 if (!(dev->flags&IFF_BROADCAST)) in teql_qdisc_init()
199 m->dev->flags &= ~IFF_BROADCAST; in teql_qdisc_init()
200 if (!(dev->flags&IFF_MULTICAST)) in teql_qdisc_init()
201 m->dev->flags &= ~IFF_MULTICAST; in teql_qdisc_init()
202 if (dev->mtu < m->dev->mtu) in teql_qdisc_init()
203 m->dev->mtu = dev->mtu; in teql_qdisc_init()
205 q->next = NEXT_SLAVE(m->slaves); in teql_qdisc_init()
206 NEXT_SLAVE(m->slaves) = sch; in teql_qdisc_init()
208 q->next = sch; in teql_qdisc_init()
209 m->slaves = sch; in teql_qdisc_init()
210 m->dev->mtu = dev->mtu; in teql_qdisc_init()
211 m->dev->flags = (m->dev->flags&~FMASK)|(dev->flags&FMASK); in teql_qdisc_init()
227 return -ENOENT; in __teql_resolve()
229 if (dst->dev != dev) { in __teql_resolve()
232 mn = __neigh_lookup_errno(n->tbl, n->primary_key, dev); in __teql_resolve()
245 haddr, NULL, skb->len); in __teql_resolve()
248 err = -EINVAL; in __teql_resolve()
250 err = (skb_res == NULL) ? -EAGAIN : 1; in __teql_resolve()
264 if (rcu_access_pointer(txq->qdisc) == &noop_qdisc) in teql_resolve()
265 return -ENODEV; in teql_resolve()
267 if (!dev->header_ops || !dst) in teql_resolve()
279 struct teql_master *master = netdev_priv(dev); in teql_master_xmit() local
286 start = master->slaves; in teql_master_xmit()
300 if (rcu_access_pointer(slave_txq->qdisc_sleeping) != q) in teql_master_xmit()
317 master->slaves = NEXT_SLAVE(q); in teql_master_xmit()
319 master->tx_packets++; in teql_master_xmit()
320 master->tx_bytes += length; in teql_master_xmit()
329 master->slaves = NEXT_SLAVE(q); in teql_master_xmit()
347 master->tx_errors++; in teql_master_xmit()
350 master->tx_dropped++; in teql_master_xmit()
362 if (m->slaves == NULL) in teql_master_open()
363 return -EUNATCH; in teql_master_open()
367 q = m->slaves; in teql_master_open()
372 return -EUNATCH; in teql_master_open()
374 if (slave->mtu < mtu) in teql_master_open()
375 mtu = slave->mtu; in teql_master_open()
376 if (slave->hard_header_len > LL_MAX_HEADER) in teql_master_open()
377 return -EINVAL; in teql_master_open()
379 /* If all the slaves are BROADCAST, master is BROADCAST in teql_master_open()
380 If all the slaves are PtP, master is PtP in teql_master_open()
381 Otherwise, master is NBMA. in teql_master_open()
383 if (!(slave->flags&IFF_POINTOPOINT)) in teql_master_open()
385 if (!(slave->flags&IFF_BROADCAST)) in teql_master_open()
387 if (!(slave->flags&IFF_MULTICAST)) in teql_master_open()
389 } while ((q = NEXT_SLAVE(q)) != m->slaves); in teql_master_open()
391 m->dev->mtu = mtu; in teql_master_open()
392 m->dev->flags = (m->dev->flags&~FMASK) | flags; in teql_master_open()
393 netif_start_queue(m->dev); in teql_master_open()
404 struct rtnl_link_stats64 *stats) in teql_master_stats64() argument
408 stats->tx_packets = m->tx_packets; in teql_master_stats64()
409 stats->tx_bytes = m->tx_bytes; in teql_master_stats64()
410 stats->tx_errors = m->tx_errors; in teql_master_stats64()
411 stats->tx_dropped = m->tx_dropped; in teql_master_stats64()
419 q = m->slaves; in teql_master_mtu()
422 if (new_mtu > qdisc_dev(q)->mtu) in teql_master_mtu()
423 return -EINVAL; in teql_master_mtu()
424 } while ((q = NEXT_SLAVE(q)) != m->slaves); in teql_master_mtu()
427 WRITE_ONCE(dev->mtu, new_mtu); in teql_master_mtu()
441 struct teql_master *master = netdev_priv(dev); in teql_master_setup() local
442 struct Qdisc_ops *ops = &master->qops; in teql_master_setup()
444 master->dev = dev; in teql_master_setup()
445 ops->priv_size = sizeof(struct teql_sched_data); in teql_master_setup()
447 ops->enqueue = teql_enqueue; in teql_master_setup()
448 ops->dequeue = teql_dequeue; in teql_master_setup()
449 ops->peek = teql_peek; in teql_master_setup()
450 ops->init = teql_qdisc_init; in teql_master_setup()
451 ops->reset = teql_reset; in teql_master_setup()
452 ops->destroy = teql_destroy; in teql_master_setup()
453 ops->owner = THIS_MODULE; in teql_master_setup()
455 dev->netdev_ops = &teql_netdev_ops; in teql_master_setup()
456 dev->type = ARPHRD_VOID; in teql_master_setup()
457 dev->mtu = 1500; in teql_master_setup()
458 dev->min_mtu = 68; in teql_master_setup()
459 dev->max_mtu = 65535; in teql_master_setup()
460 dev->tx_queue_len = 100; in teql_master_setup()
461 dev->flags = IFF_NOARP; in teql_master_setup()
462 dev->hard_header_len = LL_MAX_HEADER; in teql_master_setup()
474 int err = -ENODEV; in teql_init()
478 struct teql_master *master; in teql_init() local
483 err = -ENOMEM; in teql_init()
492 master = netdev_priv(dev); in teql_init()
494 strscpy(master->qops.id, dev->name, IFNAMSIZ); in teql_init()
495 err = register_qdisc(&master->qops); in teql_init()
503 list_add_tail(&master->master_list, &master_dev_list); in teql_init()
510 struct teql_master *master, *nxt; in teql_exit() local
512 list_for_each_entry_safe(master, nxt, &master_dev_list, master_list) { in teql_exit()
514 list_del(&master->master_list); in teql_exit()
516 unregister_qdisc(&master->qops); in teql_exit()
517 unregister_netdev(master->dev); in teql_exit()
518 free_netdev(master->dev); in teql_exit()