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

Ethan Jackson ethan at nicira.com
Fri Apr 29 22:35:12 UTC 2011


> +#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.

Looks Good.
Ethan



More information about the dev mailing list