3

I have detected drops on my tun0 interface.

They seem to have been caused by low txqueuelen setting. Now as I increased the txqueuelen value for the network device and there are no more drops yet - I am wondering is there any way to get actual current usage of network device buffer?

2 Answers 2

0

Try checking with tc:

# tc -s qdisc show dev tun0
qdisc mq 0: root 
 Sent 889257959003266 bytes 478800964 pkt (dropped 162977296, overlimits 0 requeues 1784154649) 
 backlog 0b 0p requeues 1784154649 

The important part is backlog 0b 0p which tells you how filled the TX queue is in packets and bytes.

Tc gets this information from kernel using netlink interface.

2

For TCP Buffer,you can use

       netstat -nt 

and look for second and third column for receive and send buffer(Recv-Q,Send-Q)

For UDP

       netstat -nua

Same way you can look inside /proc/net/{tcp,udp} and look for tx_queue & rx_queue

Same way you can use

          ethtool -S <nic card name>  (driver need to support)


                NIC statistics:
                rx_packets: 445
                tx_packets: 48
                rx_bytes: 56015
                tx_bytes: 5938
                rx_broadcast: 336
                tx_broadcast: 2
                rx_multicast: 89
                tx_multicast: 28
                rx_errors: 0
                tx_errors: 0
                tx_dropped: 0

Also just want to add there is one network parameter "tcp_moderate_rcvbuf" which is enabled by default,performs receive buffer auto-tuning.As per kernel-doc

     If set, TCP performs receive buffer auto-tuning, attempting to
     automatically size the buffer (no greater than tcp_rmem[2]) to
     match the size required by the path for full throughput
1
  • 3
    As far as I understand, netstat shows the socket buffer aka SO_RSVBUF/SO_SNDBUF which are controled by tcp_mem/udp_mem etc. I am talking about device-specific buffer that operates with skb and controls starvation when network hardware needs data (in my case it is tun driver which serves as virtual nic
    – grandrew
    Sep 24, 2014 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.