示例#1
0
文件: ethtool.c 项目: A-K/linux
	int stat_offset;
};

#define E1000_STAT(str, m) { \
		.stat_string = str, \
		.type = E1000_STATS, \
		.sizeof_stat = sizeof(((struct e1000_adapter *)0)->m), \
		.stat_offset = offsetof(struct e1000_adapter, m) }
#define E1000_NETDEV_STAT(str, m) { \
		.stat_string = str, \
		.type = NETDEV_STATS, \
		.sizeof_stat = sizeof(((struct rtnl_link_stats64 *)0)->m), \
		.stat_offset = offsetof(struct rtnl_link_stats64, m) }

static const struct e1000_stats e1000_gstrings_stats[] = {
	E1000_STAT("rx_packets", stats.gprc),
	E1000_STAT("tx_packets", stats.gptc),
	E1000_STAT("rx_bytes", stats.gorc),
	E1000_STAT("tx_bytes", stats.gotc),
	E1000_STAT("rx_broadcast", stats.bprc),
	E1000_STAT("tx_broadcast", stats.bptc),
	E1000_STAT("rx_multicast", stats.mprc),
	E1000_STAT("tx_multicast", stats.mptc),
	E1000_NETDEV_STAT("rx_errors", rx_errors),
	E1000_NETDEV_STAT("tx_errors", tx_errors),
	E1000_NETDEV_STAT("tx_dropped", tx_dropped),
	E1000_STAT("multicast", stats.mprc),
	E1000_STAT("collisions", stats.colc),
	E1000_NETDEV_STAT("rx_length_errors", rx_length_errors),
	E1000_NETDEV_STAT("rx_over_errors", rx_over_errors),
	E1000_STAT("rx_crc_errors", stats.crcerrs),
示例#2
0
extern int e1000_setup_rx_resources(struct e1000_adapter *adapter);
extern int e1000_setup_tx_resources(struct e1000_adapter *adapter);
extern void e1000_free_rx_resources(struct e1000_adapter *adapter);
extern void e1000_free_tx_resources(struct e1000_adapter *adapter);
extern void e1000_update_stats(struct e1000_adapter *adapter);

struct e1000_stats {
	char stat_string[ETH_GSTRING_LEN];
	int sizeof_stat;
	int stat_offset;
};

#define E1000_STAT(m) sizeof(((struct e1000_adapter *)0)->m), \
		      offsetof(struct e1000_adapter, m)
static const struct e1000_stats e1000_gstrings_stats[] = {
	{ "rx_packets", E1000_STAT(net_stats.rx_packets) },
	{ "tx_packets", E1000_STAT(net_stats.tx_packets) },
	{ "rx_bytes", E1000_STAT(net_stats.rx_bytes) },
	{ "tx_bytes", E1000_STAT(net_stats.tx_bytes) },
	{ "rx_errors", E1000_STAT(net_stats.rx_errors) },
	{ "tx_errors", E1000_STAT(net_stats.tx_errors) },
	{ "rx_dropped", E1000_STAT(net_stats.rx_dropped) },
	{ "tx_dropped", E1000_STAT(net_stats.tx_dropped) },
	{ "multicast", E1000_STAT(net_stats.multicast) },
	{ "collisions", E1000_STAT(net_stats.collisions) },
	{ "rx_length_errors", E1000_STAT(net_stats.rx_length_errors) },
	{ "rx_over_errors", E1000_STAT(net_stats.rx_over_errors) },
	{ "rx_crc_errors", E1000_STAT(net_stats.rx_crc_errors) },
	{ "rx_frame_errors", E1000_STAT(net_stats.rx_frame_errors) },
	{ "rx_fifo_errors", E1000_STAT(net_stats.rx_fifo_errors) },
	{ "rx_missed_errors", E1000_STAT(net_stats.rx_missed_errors) },