diff options
author | Sathya Perla <sathya.perla@emulex.com> | 2011-07-25 21:10:14 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-01 09:11:59 +0200 |
commit | ac124ff973e2780279774a30dd924affef758a51 (patch) | |
tree | 1df7efa8c135ee686860c3c296e30fbd2ce652e2 /drivers/net/benet/be_cmds.h | |
parent | Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net (diff) | |
download | linux-ac124ff973e2780279774a30dd924affef758a51.tar.xz linux-ac124ff973e2780279774a30dd924affef758a51.zip |
be2net: cleanup and refactor stats code
In preparation for 64-bit stats interface, the following cleanups help
streamline the code:
1) made some more rx/tx stats stored by driver 64 bit
2) made some HW stas (err/drop counters) stored in be_drv_stats 32 bit to
keep the code simple as BE provides 32-bit counters only.
3) removed duplication of netdev stats in ethtool
4) removed some un-necessary stats and fixed some names
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_cmds.h')
-rw-r--r-- | drivers/net/benet/be_cmds.h | 53 |
1 files changed, 5 insertions, 48 deletions
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h index 8e4d48824fe9..d3342c452c6b 100644 --- a/drivers/net/benet/be_cmds.h +++ b/drivers/net/benet/be_cmds.h @@ -693,8 +693,7 @@ struct be_cmd_resp_get_stats_v0 { struct be_hw_stats_v0 hw_stats; }; -#define make_64bit_val(hi_32, lo_32) (((u64)hi_32<<32) | lo_32) -struct lancer_cmd_pport_stats { +struct lancer_pport_stats { u32 tx_packets_lo; u32 tx_packets_hi; u32 tx_unicast_packets_lo; @@ -871,16 +870,16 @@ struct lancer_cmd_req_pport_stats { struct be_cmd_req_hdr hdr; union { struct pport_stats_params params; - u8 rsvd[sizeof(struct lancer_cmd_pport_stats)]; + u8 rsvd[sizeof(struct lancer_pport_stats)]; } cmd_params; }; struct lancer_cmd_resp_pport_stats { struct be_cmd_resp_hdr hdr; - struct lancer_cmd_pport_stats pport_stats; + struct lancer_pport_stats pport_stats; }; -static inline struct lancer_cmd_pport_stats* +static inline struct lancer_pport_stats* pport_stats_from_cmd(struct be_adapter *adapter) { struct lancer_cmd_resp_pport_stats *cmd = adapter->stats_cmd.va; @@ -1383,8 +1382,7 @@ struct be_cmd_resp_get_stats_v1 { struct be_hw_stats_v1 hw_stats; }; -static inline void * -hw_stats_from_cmd(struct be_adapter *adapter) +static inline void *hw_stats_from_cmd(struct be_adapter *adapter) { if (adapter->generation == BE_GEN3) { struct be_cmd_resp_get_stats_v1 *cmd = adapter->stats_cmd.va; @@ -1397,34 +1395,6 @@ hw_stats_from_cmd(struct be_adapter *adapter) } } -static inline void *be_port_rxf_stats_from_cmd(struct be_adapter *adapter) -{ - if (adapter->generation == BE_GEN3) { - struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); - struct be_rxf_stats_v1 *rxf_stats = &hw_stats->rxf; - - return &rxf_stats->port[adapter->port_num]; - } else { - struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); - struct be_rxf_stats_v0 *rxf_stats = &hw_stats->rxf; - - return &rxf_stats->port[adapter->port_num]; - } -} - -static inline void *be_rxf_stats_from_cmd(struct be_adapter *adapter) -{ - if (adapter->generation == BE_GEN3) { - struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); - - return &hw_stats->rxf; - } else { - struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); - - return &hw_stats->rxf; - } -} - static inline void *be_erx_stats_from_cmd(struct be_adapter *adapter) { if (adapter->generation == BE_GEN3) { @@ -1438,19 +1408,6 @@ static inline void *be_erx_stats_from_cmd(struct be_adapter *adapter) } } -static inline void *be_pmem_stats_from_cmd(struct be_adapter *adapter) -{ - if (adapter->generation == BE_GEN3) { - struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); - - return &hw_stats->pmem; - } else { - struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); - - return &hw_stats->pmem; - } -} - extern int be_pci_fnum_get(struct be_adapter *adapter); extern int be_cmd_POST(struct be_adapter *adapter); extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, |