- 论坛徽章:
- 4
|
5可用积分
本帖最后由 chishanmingshen 于 2013-01-28 11:01 编辑
from 3.6.10
- static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
- struct net_device *dev,
- struct netdev_queue *txq)
- {
- spinlock_t *root_lock = qdisc_lock(q);
- bool contended;
- int rc;
- qdisc_skb_cb(skb)->pkt_len = skb->len;
- qdisc_calculate_pkt_len(skb, q);
- /*
- * Heuristic to force contended enqueues to serialize on a
- * separate lock before trying to get qdisc main lock.
- * This permits __QDISC_STATE_RUNNING owner to get the lock more often
- * and dequeue packets faster.
- */
- contended = qdisc_is_running(q);
- if (unlikely(contended))
- spin_lock(&q->busylock);
- spin_lock(root_lock);
- if (unlikely(test_bit(__QDISC_STATE_DEACTIVATED, &q->state))) {
- kfree_skb(skb);
- rc = NET_XMIT_DROP;
- } else if ((q->flags & TCQ_F_CAN_BYPASS) && !qdisc_qlen(q) &&
- qdisc_run_begin(q)) {
- /*
- * This is a work-conserving queue; there are no old skbs
- * waiting to be sent out; and the qdisc is not running -
- * xmit the skb directly.
- */
- if (!(dev->priv_flags & IFF_XMIT_DST_RELEASE))
- skb_dst_force(skb);
- qdisc_bstats_update(q, skb);
- if (sch_direct_xmit(skb, q, dev, txq, root_lock)) {
- if (unlikely(contended)) {
- spin_unlock(&q->busylock);
- contended = false;
- }
- __qdisc_run(q);<-----------------------------------------第1处
- } else
- qdisc_run_end(q);
- rc = NET_XMIT_SUCCESS;
- } else {
- skb_dst_force(skb);
- rc = q->enqueue(skb, q) & NET_XMIT_MASK;
- if (qdisc_run_begin(q)) {
- if (unlikely(contended)) {
- spin_unlock(&q->busylock);
- contended = false;
- }
- __qdisc_run(q);<----------------------------------------第2处
- }
- }
- spin_unlock(root_lock);
- if (unlikely(contended))
- spin_unlock(&q->busylock);
- return rc;
- }
复制代码 对于__dev_xmit_skb()中调用__qdisc_run()的2种case不理解...
应该全都留在softirq中做__qdisc_run()啊, 怎么要在此处也做__qdisc_run()?
我的理解是__qdisc_run()是个qos的独立处理, 可能比较耗时.
请指点, 谢谢! |
最佳答案
查看完整内容
qdisc_run里面进行了检查啊。如果其他的任务需要调度,会释放cpu并激活软中断进行处理,不会影响的。
|