[ovs-dev] [statistics 1/2] netdev-linux: New functions for converting netdev stats formats.

Ben Pfaff blp at nicira.com
Mon May 2 16:37:03 UTC 2011


On Fri, Apr 29, 2011 at 03:35:12PM -0700, Ethan Jackson wrote:
> > +#define COPY_NETDEV_STATS ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> > + ? ?dst->rx_packets = src->rx_packets; ? ? ? ? ? ? ? ? ? ? ?\
> > + ? ?dst->tx_packets = src->tx_packets; ? ? ? ? ? ? ? ? ? ? ?\
> > + ? ?dst->rx_bytes = src->rx_bytes; ? ? ? ? ? ? ? ? ? ? ? ? ?\
> > + ? ?dst->tx_bytes = src->tx_bytes; ? ? ? ? ? ? ? ? ? ? ? ? ?\
> > + ? ?dst->rx_errors = src->rx_errors; ? ? ? ? ? ? ? ? ? ? ? ?\
> > + ? ?dst->tx_errors = src->tx_errors; ? ? ? ? ? ? ? ? ? ? ? ?\
> > + ? ?dst->rx_dropped = src->rx_dropped; ? ? ? ? ? ? ? ? ? ? ?\
> > + ? ?dst->tx_dropped = src->tx_dropped; ? ? ? ? ? ? ? ? ? ? ?\
> > + ? ?dst->multicast = src->multicast; ? ? ? ? ? ? ? ? ? ? ? ?\
> > + ? ?dst->collisions = src->collisions; ? ? ? ? ? ? ? ? ? ? ?\
> > + ? ?dst->rx_length_errors = src->rx_length_errors; ? ? ? ? ?\
> > + ? ?dst->rx_over_errors = src->rx_over_errors; ? ? ? ? ? ? ?\
> > + ? ?dst->rx_crc_errors = src->rx_crc_errors; ? ? ? ? ? ? ? ?\
> > + ? ?dst->rx_frame_errors = src->rx_frame_errors; ? ? ? ? ? ?\
> > + ? ?dst->rx_fifo_errors = src->rx_fifo_errors; ? ? ? ? ? ? ?\
> > + ? ?dst->rx_missed_errors = src->rx_missed_errors; ? ? ? ? ?\
> > + ? ?dst->tx_aborted_errors = src->tx_aborted_errors; ? ? ? ?\
> > + ? ?dst->tx_carrier_errors = src->tx_carrier_errors; ? ? ? ?\
> > + ? ?dst->tx_fifo_errors = src->tx_fifo_errors; ? ? ? ? ? ? ?\
> > + ? ?dst->tx_heartbeat_errors = src->tx_heartbeat_errors; ? ?\
> > + ? ?dst->tx_window_errors = src->tx_window_errors
> 
> This gets my spidey sense tingling but I think it's fine.  I
> understand the desire to avoid duplicating all that code.  I haven't
> memorized the C spec, so I can't comment on whether this is the best
> approach for the macro or not, I will trust you on this one.

Thanks.  I think it's OK, especially localized like this.



More information about the dev mailing list