On Fri, Dec 02, 2011 at 02:17:04PM -0800, Pravin B Shelar wrote:
> Following patch account packets consumed and composed in userspace
> as received on and transmitted from local port.

It looks good to me, I only have two small comments.

I think that the tx/rx swapping in port_get_stats() is correct, but I
always have trouble figuring this stuff out when I see it, would you
mind adding some comment, maybe something like:

        /* ofproto->stats.tx_packets represents packets that we created
         * internally and sent to some port (e.g. packets sent with
         * send_packet()).  Account for them as if they had come from
         * OFPP_LOCAL and got forwarded. */
        stats->rx_packets += ofproto->stats.tx_packets;
        stats->rx_bytes   += ofproto->stats.tx_bytes;

        /* ofproto->stats.rx_packets represents packets that were received on
         * some port and we processed internally and dropped (e.g. STP).
         * Account fro them as if they had been forwarded to OFPP_LOCAL. */
        stats->tx_packets += ofproto->stats.rx_packets;
        stats->tx_bytes   += ofproto->stats.rx_bytes;

Then maybe I'll be less confused some day in the future.

Also I think we should only do the updates there if each
stats->*_packets is != UINT64_MAX.

Thanks,

Ben.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to