tun.c (eb0fb363f920e4d8c70d30b712f9dd433271218c) | tun.c (5d097109257c03a71845729f8db6b5770c4bbedc) |
---|---|
1/* 2 * TUN - Universal TUN/TAP device driver. 3 * Copyright (C) 1999-2002 Maxim Krasnyansky <maxk@qualcomm.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 676 unchanged lines hidden (view full) --- 685 if (tfile->socket.sk->sk_filter && 686 sk_filter(tfile->socket.sk, skb)) 687 goto drop; 688 689 /* Limit the number of packets queued by dividing txq length with the 690 * number of queues. 691 */ 692 if (skb_queue_len(&tfile->socket.sk->sk_receive_queue) | 1/* 2 * TUN - Universal TUN/TAP device driver. 3 * Copyright (C) 1999-2002 Maxim Krasnyansky <maxk@qualcomm.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 676 unchanged lines hidden (view full) --- 685 if (tfile->socket.sk->sk_filter && 686 sk_filter(tfile->socket.sk, skb)) 687 goto drop; 688 689 /* Limit the number of packets queued by dividing txq length with the 690 * number of queues. 691 */ 692 if (skb_queue_len(&tfile->socket.sk->sk_receive_queue) |
693 >= dev->tx_queue_len / tun->numqueues){ 694 if (!(tun->flags & TUN_ONE_QUEUE)) { 695 /* Normal queueing mode. */ 696 /* Packet scheduler handles dropping of further packets. */ 697 netif_stop_subqueue(dev, txq); | 693 >= dev->tx_queue_len / tun->numqueues) 694 goto drop; |
698 | 695 |
699 /* We won't see all dropped packets individually, so overrun 700 * error is more appropriate. */ 701 dev->stats.tx_fifo_errors++; 702 } else { 703 /* Single queue mode. 704 * Driver handles dropping of all packets itself. */ 705 goto drop; 706 } 707 } 708 | |
709 /* Orphan the skb - required as we might hang on to it 710 * for indefinite time. */ 711 if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) 712 goto drop; 713 skb_orphan(skb); 714 715 /* Enqueue packet */ 716 skb_queue_tail(&tfile->socket.sk->sk_receive_queue, skb); --- 597 unchanged lines hidden (view full) --- 1314 ret = -EIO; 1315 break; 1316 } 1317 1318 /* Nothing to read, let's sleep */ 1319 schedule(); 1320 continue; 1321 } | 696 /* Orphan the skb - required as we might hang on to it 697 * for indefinite time. */ 698 if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) 699 goto drop; 700 skb_orphan(skb); 701 702 /* Enqueue packet */ 703 skb_queue_tail(&tfile->socket.sk->sk_receive_queue, skb); --- 597 unchanged lines hidden (view full) --- 1301 ret = -EIO; 1302 break; 1303 } 1304 1305 /* Nothing to read, let's sleep */ 1306 schedule(); 1307 continue; 1308 } |
1322 netif_wake_subqueue(tun->dev, tfile->queue_index); | |
1323 1324 ret = tun_put_user(tun, tfile, skb, iv, len); 1325 kfree_skb(skb); 1326 break; 1327 } 1328 1329 current->state = TASK_RUNNING; 1330 if (unlikely(!noblock)) --- 146 unchanged lines hidden (view full) --- 1477 if (tun->flags & TUN_TUN_DEV) 1478 flags |= IFF_TUN; 1479 else 1480 flags |= IFF_TAP; 1481 1482 if (tun->flags & TUN_NO_PI) 1483 flags |= IFF_NO_PI; 1484 | 1309 1310 ret = tun_put_user(tun, tfile, skb, iv, len); 1311 kfree_skb(skb); 1312 break; 1313 } 1314 1315 current->state = TASK_RUNNING; 1316 if (unlikely(!noblock)) --- 146 unchanged lines hidden (view full) --- 1463 if (tun->flags & TUN_TUN_DEV) 1464 flags |= IFF_TUN; 1465 else 1466 flags |= IFF_TAP; 1467 1468 if (tun->flags & TUN_NO_PI) 1469 flags |= IFF_NO_PI; 1470 |
1471 /* This flag has no real effect. We track the value for backwards 1472 * compatibility. 1473 */ |
|
1485 if (tun->flags & TUN_ONE_QUEUE) 1486 flags |= IFF_ONE_QUEUE; 1487 1488 if (tun->flags & TUN_VNET_HDR) 1489 flags |= IFF_VNET_HDR; 1490 1491 if (tun->flags & TUN_TAP_MQ) 1492 flags |= IFF_MULTI_QUEUE; --- 134 unchanged lines hidden (view full) --- 1627 1628 tun_debug(KERN_INFO, tun, "tun_set_iff\n"); 1629 1630 if (ifr->ifr_flags & IFF_NO_PI) 1631 tun->flags |= TUN_NO_PI; 1632 else 1633 tun->flags &= ~TUN_NO_PI; 1634 | 1474 if (tun->flags & TUN_ONE_QUEUE) 1475 flags |= IFF_ONE_QUEUE; 1476 1477 if (tun->flags & TUN_VNET_HDR) 1478 flags |= IFF_VNET_HDR; 1479 1480 if (tun->flags & TUN_TAP_MQ) 1481 flags |= IFF_MULTI_QUEUE; --- 134 unchanged lines hidden (view full) --- 1616 1617 tun_debug(KERN_INFO, tun, "tun_set_iff\n"); 1618 1619 if (ifr->ifr_flags & IFF_NO_PI) 1620 tun->flags |= TUN_NO_PI; 1621 else 1622 tun->flags &= ~TUN_NO_PI; 1623 |
1624 /* This flag has no real effect. We track the value for backwards 1625 * compatibility. 1626 */ |
|
1635 if (ifr->ifr_flags & IFF_ONE_QUEUE) 1636 tun->flags |= TUN_ONE_QUEUE; 1637 else 1638 tun->flags &= ~TUN_ONE_QUEUE; 1639 1640 if (ifr->ifr_flags & IFF_VNET_HDR) 1641 tun->flags |= TUN_VNET_HDR; 1642 else --- 611 unchanged lines hidden --- | 1627 if (ifr->ifr_flags & IFF_ONE_QUEUE) 1628 tun->flags |= TUN_ONE_QUEUE; 1629 else 1630 tun->flags &= ~TUN_ONE_QUEUE; 1631 1632 if (ifr->ifr_flags & IFF_VNET_HDR) 1633 tun->flags |= TUN_VNET_HDR; 1634 else --- 611 unchanged lines hidden --- |