Hi! On 20:08 Fri 24 Jul , ?ukasz Jachymczyk wrote: > Hello > > I'm working on virtual ethernet driver which sends and receives > frames through physical device. It has to deal with high speed > transfers (1Gb/s). > > I've already registered new packet_type with dev_add_pack. That way, > my function (let's call it skb_recv) gets all received packets of > given type. > > My question is, since driver needs to handle congestions and there > is no longer cng_level variable available in kernel, how to check > whether I'm loosing packets? > > I might check net_device_stats->rx_dropped of physical device but > sadly it's 0 all the time (even though I'm sure packets are > dropped). Maybe it's because I'm testing on VMware and they haven't > implemented it correctly? > > Another thing: where exactly packets are dropped? Does dropping > depends on how many work I do in my skb_recv function? I know it's > called from softirq context... Should I implement any additional > packet buffers in skb_recv? > > Thanks for all tips 1) Congestion handling is usually done by the sender and not the receiver. 2) packets are dropped either when entering the qdisc, which is triggered by dev_queue_xmit or lost during transmission (e.g. a switch is overloaded and does not do XON/XOFF). If it is dropped by the qdisc, NET_XMIT_DROP as defined in include/linux/netdevice.h is returned dev dev_queue_xmit. 3) If all you do is providing virtual interfaces on top of physical interfaces, you do not need to bother about congestion handling. Protocols on top (e.g. TCP) will do this. However, if should return NET_XMIT_DROP or whatever dev_queue_xmit returns, if you can. But .f you do not, it should run anyway. -Michi -- programing a layer 3+4 network protocol for mesh networks see http://michaelblizek.twilightparadox.com -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ