Merge branches 'acpi-resources', 'acpi-battery', 'acpi-doc' and 'acpi-pnp'
[linux-2.6-block.git] / drivers / net / ethernet / mellanox / mlx4 / mlx4_en.h
index ebbe244e80dde55068d924905e08d1d631821811..d021f079f181b06bb6ec73250ea8493ad87d1cee 100644 (file)
@@ -55,6 +55,7 @@
 #include <linux/mlx4/cmd.h>
 
 #include "en_port.h"
+#include "mlx4_stats.h"
 
 #define DRV_NAME       "mlx4_en"
 #define DRV_VERSION    "2.2-1"
@@ -171,7 +172,6 @@ enum {
 /* Number of samples to 'average' */
 #define AVG_SIZE                       128
 #define AVG_FACTOR                     1024
-#define NUM_PERF_STATS                 NUM_PERF_COUNTERS
 
 #define INC_PERF_COUNTER(cnt)          (++(cnt))
 #define ADD_PERF_COUNTER(cnt, add)     ((cnt) += (add))
@@ -182,7 +182,6 @@ enum {
 
 #else
 
-#define NUM_PERF_STATS                 0
 #define INC_PERF_COUNTER(cnt)          do {} while (0)
 #define ADD_PERF_COUNTER(cnt, add)     do {} while (0)
 #define AVG_PERF_COUNTER(cnt, sample)  do {} while (0)
@@ -435,37 +434,6 @@ struct mlx4_en_port_state {
        u32 flags;
 };
 
-struct mlx4_en_pkt_stats {
-       unsigned long broadcast;
-       unsigned long rx_prio[8];
-       unsigned long tx_prio[8];
-#define NUM_PKT_STATS          17
-};
-
-struct mlx4_en_port_stats {
-       unsigned long tso_packets;
-       unsigned long xmit_more;
-       unsigned long queue_stopped;
-       unsigned long wake_queue;
-       unsigned long tx_timeout;
-       unsigned long rx_alloc_failed;
-       unsigned long rx_chksum_good;
-       unsigned long rx_chksum_none;
-       unsigned long rx_chksum_complete;
-       unsigned long tx_chksum_offload;
-#define NUM_PORT_STATS         10
-};
-
-struct mlx4_en_perf_stats {
-       u32 tx_poll;
-       u64 tx_pktsz_avg;
-       u32 inflight_avg;
-       u16 tx_coal_avg;
-       u16 rx_coal_avg;
-       u32 napi_quota;
-#define NUM_PERF_COUNTERS              6
-};
-
 enum mlx4_en_mclist_act {
        MCLIST_NONE,
        MCLIST_REM,
@@ -514,9 +482,15 @@ enum {
        MLX4_EN_FLAG_RX_CSUM_NON_TCP_UDP        = (1 << 5),
 };
 
+#define PORT_BEACON_MAX_LIMIT (65535)
 #define MLX4_EN_MAC_HASH_SIZE (1 << BITS_PER_BYTE)
 #define MLX4_EN_MAC_HASH_IDX 5
 
+struct mlx4_en_stats_bitmap {
+       DECLARE_BITMAP(bitmap, NUM_ALL_STATS);
+       struct mutex mutex; /* for mutual access to stats bitmap */
+};
+
 struct mlx4_en_priv {
        struct mlx4_en_dev *mdev;
        struct mlx4_en_port_profile *prof;
@@ -592,8 +566,12 @@ struct mlx4_en_priv {
 #endif
        struct mlx4_en_perf_stats pstats;
        struct mlx4_en_pkt_stats pkstats;
+       struct mlx4_en_flow_stats_rx rx_priority_flowstats[MLX4_NUM_PRIORITIES];
+       struct mlx4_en_flow_stats_tx tx_priority_flowstats[MLX4_NUM_PRIORITIES];
+       struct mlx4_en_flow_stats_rx rx_flowstats;
+       struct mlx4_en_flow_stats_tx tx_flowstats;
        struct mlx4_en_port_stats port_stats;
-       u64 stats_bitmap;
+       struct mlx4_en_stats_bitmap stats_bitmap;
        struct list_head mc_list;
        struct list_head curr_list;
        u64 broadcast_id;
@@ -608,6 +586,7 @@ struct mlx4_en_priv {
 #ifdef CONFIG_MLX4_EN_DCB
        struct ieee_ets ets;
        u16 maxrate[IEEE_8021QAZ_MAX_TCS];
+       enum dcbnl_cndd_states cndd_state[IEEE_8021QAZ_MAX_TCS];
 #endif
 #ifdef CONFIG_RFS_ACCEL
        spinlock_t filters_lock;
@@ -761,6 +740,11 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 int mlx4_en_start_port(struct net_device *dev);
 void mlx4_en_stop_port(struct net_device *dev, int detach);
 
+void mlx4_en_set_stats_bitmap(struct mlx4_dev *dev,
+                             struct mlx4_en_stats_bitmap *stats_bitmap,
+                             u8 rx_ppp, u8 rx_pause,
+                             u8 tx_ppp, u8 tx_pause);
+
 void mlx4_en_free_resources(struct mlx4_en_priv *priv);
 int mlx4_en_alloc_resources(struct mlx4_en_priv *priv);
 
@@ -790,6 +774,7 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
 void mlx4_en_deactivate_tx_ring(struct mlx4_en_priv *priv,
                                struct mlx4_en_tx_ring *ring);
 void mlx4_en_set_num_rx_rings(struct mlx4_en_dev *mdev);
+void mlx4_en_recover_from_oom(struct mlx4_en_priv *priv);
 int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
                           struct mlx4_en_rx_ring **pring,
                           u32 size, u16 stride, int node);
@@ -846,7 +831,10 @@ void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev);
 int mlx4_en_reset_config(struct net_device *dev,
                         struct hwtstamp_config ts_config,
                         netdev_features_t new_features);
-
+void mlx4_en_update_pfc_stats_bitmap(struct mlx4_dev *dev,
+                                    struct mlx4_en_stats_bitmap *stats_bitmap,
+                                    u8 rx_ppp, u8 rx_pause,
+                                    u8 tx_ppp, u8 tx_pause);
 int mlx4_en_netdev_event(struct notifier_block *this,
                         unsigned long event, void *ptr);