* RX/dropped counter values for tagged packets
@ 2013-03-25 4:43 Ani Sinha
2013-03-31 3:30 ` Ani Sinha
0 siblings, 1 reply; 8+ messages in thread
From: Ani Sinha @ 2013-03-25 4:43 UTC (permalink / raw)
To: netdev, linuxdev, linux-netdev
hello everyone :
Please bear with me if you think I said something wrong.
I was looking at the netif_receive_skb() code and it seems to me that
for vlan tagged packets, the counters are manipulated at two different
places. One is from vlan_do_receive() where the receive counters are
incremented. The other counter (the dropped counter) is incremented at
the very end of netif_receive_skb() when there are no takers for this
packet. The dropped counts are incremented for skb->dev->rx_dropped
whereas the receive counts are incremented for the vlan device
specific private stat counter values. When the numbers are reported on
/proc/net/dev (from where ifconfig gets the numbers), these two stat
counters are combined together (see dev_get_stats() where rx_dropped
is added to the device private stat numbers). So if no one is
receiving the tagged packets, it will be reported both as received and
dropped! I wonder whether I am analyzing it wrong or whether no one
has noticed this before or whether this is intentional.
Any clarification will be greatly appreciated. Again, I could be
wrong looking at the code, so please bear with me.
Thanks
ani
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RX/dropped counter values for tagged packets
2013-03-25 4:43 RX/dropped counter values for tagged packets Ani Sinha
@ 2013-03-31 3:30 ` Ani Sinha
2013-03-31 5:44 ` Eric Dumazet
0 siblings, 1 reply; 8+ messages in thread
From: Ani Sinha @ 2013-03-31 3:30 UTC (permalink / raw)
To: netdev, linuxdev
Hi guys,
any feedback on this will be highly appreciated.
thanks,
ani
On Sun, Mar 24, 2013 at 9:43 PM, Ani Sinha <ani@aristanetworks.com> wrote:
> hello everyone :
>
> Please bear with me if you think I said something wrong.
>
> I was looking at the netif_receive_skb() code and it seems to me that
> for vlan tagged packets, the counters are manipulated at two different
> places. One is from vlan_do_receive() where the receive counters are
> incremented. The other counter (the dropped counter) is incremented at
> the very end of netif_receive_skb() when there are no takers for this
> packet. The dropped counts are incremented for skb->dev->rx_dropped
> whereas the receive counts are incremented for the vlan device
> specific private stat counter values. When the numbers are reported on
> /proc/net/dev (from where ifconfig gets the numbers), these two stat
> counters are combined together (see dev_get_stats() where rx_dropped
> is added to the device private stat numbers). So if no one is
> receiving the tagged packets, it will be reported both as received and
> dropped! I wonder whether I am analyzing it wrong or whether no one
> has noticed this before or whether this is intentional.
>
> Any clarification will be greatly appreciated. Again, I could be
> wrong looking at the code, so please bear with me.
>
> Thanks
>
> ani
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RX/dropped counter values for tagged packets
2013-03-31 3:30 ` Ani Sinha
@ 2013-03-31 5:44 ` Eric Dumazet
2013-04-01 1:24 ` Ani Sinha
0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2013-03-31 5:44 UTC (permalink / raw)
To: Ani Sinha; +Cc: netdev, linuxdev
On Sat, 2013-03-30 at 20:30 -0700, Ani Sinha wrote:
> On Sun, Mar 24, 2013 at 9:43 PM, Ani Sinha <ani@aristanetworks.com> wrote:
> > hello everyone :
> >
> > Please bear with me if you think I said something wrong.
> >
> > I was looking at the netif_receive_skb() code and it seems to me that
> > for vlan tagged packets, the counters are manipulated at two different
> > places. One is from vlan_do_receive() where the receive counters are
> > incremented. The other counter (the dropped counter) is incremented at
> > the very end of netif_receive_skb() when there are no takers for this
> > packet. The dropped counts are incremented for skb->dev->rx_dropped
> > whereas the receive counts are incremented for the vlan device
> > specific private stat counter values. When the numbers are reported on
> > /proc/net/dev (from where ifconfig gets the numbers), these two stat
> > counters are combined together (see dev_get_stats() where rx_dropped
> > is added to the device private stat numbers). So if no one is
> > receiving the tagged packets, it will be reported both as received and
> > dropped! I wonder whether I am analyzing it wrong or whether no one
> > has noticed this before or whether this is intentional.
> >
> > Any clarification will be greatly appreciated. Again, I could be
> > wrong looking at the code, so please bear with me.
> >
I don't know, I am not reading this code like you, I see no problem.
If vlan_do_receive() return true, we "goto another_round" to deliver the
packt to vlan device.
vlan_do_receive() doesn't deliver the packet at all. It only prepares
the "another_round"
So if packet is delivered to vlan, we don't increment rx_dropped.
Just try by yourself, it is fine.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RX/dropped counter values for tagged packets
2013-03-31 5:44 ` Eric Dumazet
@ 2013-04-01 1:24 ` Ani Sinha
2013-04-01 3:09 ` Eric Dumazet
0 siblings, 1 reply; 8+ messages in thread
From: Ani Sinha @ 2013-04-01 1:24 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Ani Sinha, netdev
On Sat, Mar 30, 2013 at 10:44 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
> I don't know, I am not reading this code like you, I see no problem.
>
> If vlan_do_receive() return true, we "goto another_round" to deliver the
> packt to vlan device.
>
> vlan_do_receive() doesn't deliver the packet at all. It only prepares
> the "another_round"
yes, I am with you on this. But let's focus on this "another_round" code.
>
> So if packet is delivered to vlan, we don't increment rx_dropped.
So in "another_round", if pt_prev is null at the end of the function
(not sure if this can actually happen in reality, but from the code it
looks like a possibility), the dropped counts will get incremented.
Does that make sense?
cheers,
ani
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RX/dropped counter values for tagged packets
2013-04-01 1:24 ` Ani Sinha
@ 2013-04-01 3:09 ` Eric Dumazet
2013-04-01 3:17 ` Ani Sinha
0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2013-04-01 3:09 UTC (permalink / raw)
To: Ani Sinha; +Cc: Ani Sinha, netdev
On Sun, 2013-03-31 at 18:24 -0700, Ani Sinha wrote:
> So in "another_round", if pt_prev is null at the end of the function
> (not sure if this can actually happen in reality, but from the code it
> looks like a possibility), the dropped counts will get incremented.
>
If packets are dropped, we increment rx_dropped.
Nothing special with vlan, its the same with non tagged packets.
So far so good.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RX/dropped counter values for tagged packets
2013-04-01 3:09 ` Eric Dumazet
@ 2013-04-01 3:17 ` Ani Sinha
2013-04-01 3:43 ` Eric Dumazet
0 siblings, 1 reply; 8+ messages in thread
From: Ani Sinha @ 2013-04-01 3:17 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Ani Sinha, netdev
On Sun, Mar 31, 2013 at 8:09 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Sun, 2013-03-31 at 18:24 -0700, Ani Sinha wrote:
>
>> So in "another_round", if pt_prev is null at the end of the function
>> (not sure if this can actually happen in reality, but from the code it
>> looks like a possibility), the dropped counts will get incremented.
>>
>
> If packets are dropped, we increment rx_dropped.
>
> Nothing special with vlan, its the same with non tagged packets.
>
> So far so good.
>
Correct. Now if you combine the two cases, we increment the rx count
for tagged packets in vlan_do_receive() and then in "another_round",
if pt_prev is null, we also increment the rx_dropped.
Now I have no issue with that _except_ it seems that when we report
the counter values in /proc, we do so in a way that for a tagged
packet, it seems that there might be a case where we combine the two
numbers so that the same packet results in a single increment of
receive and dropped counters at the same time (see my very first
email).
Hence my confusion.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RX/dropped counter values for tagged packets
2013-04-01 3:17 ` Ani Sinha
@ 2013-04-01 3:43 ` Eric Dumazet
2013-04-01 4:44 ` Ani Sinha
0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2013-04-01 3:43 UTC (permalink / raw)
To: Ani Sinha; +Cc: Ani Sinha, netdev
On Sun, 2013-03-31 at 20:17 -0700, Ani Sinha wrote:
> Correct. Now if you combine the two cases, we increment the rx count
> for tagged packets in vlan_do_receive() and then in "another_round",
> if pt_prev is null, we also increment the rx_dropped.
>
Thats the way its done in a NIC driver.
We increment rx_{bytes|packets} counters before giving the packet to the
upper stack.
Then the stack might drop the packet and increment rx_dropped.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RX/dropped counter values for tagged packets
2013-04-01 3:43 ` Eric Dumazet
@ 2013-04-01 4:44 ` Ani Sinha
0 siblings, 0 replies; 8+ messages in thread
From: Ani Sinha @ 2013-04-01 4:44 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Ani Sinha, netdev
On Sun, Mar 31, 2013 at 8:43 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Sun, 2013-03-31 at 20:17 -0700, Ani Sinha wrote:
>
>> Correct. Now if you combine the two cases, we increment the rx count
>> for tagged packets in vlan_do_receive() and then in "another_round",
>> if pt_prev is null, we also increment the rx_dropped.
>>
>
> Thats the way its done in a NIC driver.
>
> We increment rx_{bytes|packets} counters before giving the packet to the
> upper stack.
>
> Then the stack might drop the packet and increment rx_dropped.
>
thanks for the clarification. So basically what this means is that
from the numbers reported by ifconfig for example, rx-dropped is the
true rx value.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-04-01 4:44 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-25 4:43 RX/dropped counter values for tagged packets Ani Sinha
2013-03-31 3:30 ` Ani Sinha
2013-03-31 5:44 ` Eric Dumazet
2013-04-01 1:24 ` Ani Sinha
2013-04-01 3:09 ` Eric Dumazet
2013-04-01 3:17 ` Ani Sinha
2013-04-01 3:43 ` Eric Dumazet
2013-04-01 4:44 ` Ani Sinha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).