diff options
author | Barak Witkowski <barak@broadcom.com> | 2011-12-05 16:52:23 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-06 13:06:04 -0500 |
commit | 50f0a562f8cc9ed9d9f7f7380434c3c8646172d5 (patch) | |
tree | 46dac0a263d322ec15a75d13cbbc7aa1d8b731e7 /drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |
parent | 0e898dd7a820c258270af36074427e0bed48c8db (diff) |
bnx2x: add fcoe statistics
Add FCoE statistics support for FCoE capable devices.
Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 052ab9996b56..552c564d4ca4 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -2624,15 +2624,6 @@ u32 bnx2x_fw_command(struct bnx2x *bp, u32 command, u32 param) | |||
2624 | return rc; | 2624 | return rc; |
2625 | } | 2625 | } |
2626 | 2626 | ||
2627 | static u8 stat_counter_valid(struct bnx2x *bp, struct bnx2x_fastpath *fp) | ||
2628 | { | ||
2629 | #ifdef BCM_CNIC | ||
2630 | /* Statistics are not supported for CNIC Clients at the moment */ | ||
2631 | if (IS_FCOE_FP(fp)) | ||
2632 | return false; | ||
2633 | #endif | ||
2634 | return true; | ||
2635 | } | ||
2636 | 2627 | ||
2637 | void bnx2x_func_init(struct bnx2x *bp, struct bnx2x_func_init_params *p) | 2628 | void bnx2x_func_init(struct bnx2x *bp, struct bnx2x_func_init_params *p) |
2638 | { | 2629 | { |
@@ -2676,11 +2667,11 @@ static inline unsigned long bnx2x_get_common_flags(struct bnx2x *bp, | |||
2676 | * parent connection). The statistics are zeroed when the parent | 2667 | * parent connection). The statistics are zeroed when the parent |
2677 | * connection is initialized. | 2668 | * connection is initialized. |
2678 | */ | 2669 | */ |
2679 | if (stat_counter_valid(bp, fp)) { | 2670 | |
2680 | __set_bit(BNX2X_Q_FLG_STATS, &flags); | 2671 | __set_bit(BNX2X_Q_FLG_STATS, &flags); |
2681 | if (zero_stats) | 2672 | if (zero_stats) |
2682 | __set_bit(BNX2X_Q_FLG_ZERO_STATS, &flags); | 2673 | __set_bit(BNX2X_Q_FLG_ZERO_STATS, &flags); |
2683 | } | 2674 | |
2684 | 2675 | ||
2685 | return flags; | 2676 | return flags; |
2686 | } | 2677 | } |
@@ -6848,13 +6839,16 @@ void bnx2x_free_mem(struct bnx2x *bp) | |||
6848 | static inline int bnx2x_alloc_fw_stats_mem(struct bnx2x *bp) | 6839 | static inline int bnx2x_alloc_fw_stats_mem(struct bnx2x *bp) |
6849 | { | 6840 | { |
6850 | int num_groups; | 6841 | int num_groups; |
6842 | int is_fcoe_stats = NO_FCOE(bp) ? 0 : 1; | ||
6851 | 6843 | ||
6852 | /* number of eth_queues */ | 6844 | /* number of queues for statistics is number of eth queues + FCoE */ |
6853 | u8 num_queue_stats = BNX2X_NUM_ETH_QUEUES(bp); | 6845 | u8 num_queue_stats = BNX2X_NUM_ETH_QUEUES(bp) + is_fcoe_stats; |
6854 | 6846 | ||
6855 | /* Total number of FW statistics requests = | 6847 | /* Total number of FW statistics requests = |
6856 | * 1 for port stats + 1 for PF stats + num_eth_queues */ | 6848 | * 1 for port stats + 1 for PF stats + potential 1 for FCoE stats + |
6857 | bp->fw_stats_num = 2 + num_queue_stats; | 6849 | * num of queues |
6850 | */ | ||
6851 | bp->fw_stats_num = 2 + is_fcoe_stats + num_queue_stats; | ||
6858 | 6852 | ||
6859 | 6853 | ||
6860 | /* Request is built from stats_query_header and an array of | 6854 | /* Request is built from stats_query_header and an array of |
@@ -6862,8 +6856,8 @@ static inline int bnx2x_alloc_fw_stats_mem(struct bnx2x *bp) | |||
6862 | * STATS_QUERY_CMD_COUNT rules. The real number or requests is | 6856 | * STATS_QUERY_CMD_COUNT rules. The real number or requests is |
6863 | * configured in the stats_query_header. | 6857 | * configured in the stats_query_header. |
6864 | */ | 6858 | */ |
6865 | num_groups = (2 + num_queue_stats) / STATS_QUERY_CMD_COUNT + | 6859 | num_groups = ((bp->fw_stats_num) / STATS_QUERY_CMD_COUNT) + |
6866 | (((2 + num_queue_stats) % STATS_QUERY_CMD_COUNT) ? 1 : 0); | 6860 | (((bp->fw_stats_num) % STATS_QUERY_CMD_COUNT) ? 1 : 0); |
6867 | 6861 | ||
6868 | bp->fw_stats_req_sz = sizeof(struct stats_query_header) + | 6862 | bp->fw_stats_req_sz = sizeof(struct stats_query_header) + |
6869 | num_groups * sizeof(struct stats_query_cmd_group); | 6863 | num_groups * sizeof(struct stats_query_cmd_group); |
@@ -6872,9 +6866,13 @@ static inline int bnx2x_alloc_fw_stats_mem(struct bnx2x *bp) | |||
6872 | * | 6866 | * |
6873 | * stats_counter holds per-STORM counters that are incremented | 6867 | * stats_counter holds per-STORM counters that are incremented |
6874 | * when STORM has finished with the current request. | 6868 | * when STORM has finished with the current request. |
6869 | * | ||
6870 | * memory for FCoE offloaded statistics are counted anyway, | ||
6871 | * even if they will not be sent. | ||
6875 | */ | 6872 | */ |
6876 | bp->fw_stats_data_sz = sizeof(struct per_port_stats) + | 6873 | bp->fw_stats_data_sz = sizeof(struct per_port_stats) + |
6877 | sizeof(struct per_pf_stats) + | 6874 | sizeof(struct per_pf_stats) + |
6875 | sizeof(struct fcoe_statistics_params) + | ||
6878 | sizeof(struct per_queue_stats) * num_queue_stats + | 6876 | sizeof(struct per_queue_stats) * num_queue_stats + |
6879 | sizeof(struct stats_counter); | 6877 | sizeof(struct stats_counter); |
6880 | 6878 | ||