net/mlx5e: Introducing new statistics rwlock
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / en.h
index 9cc07da09b703698a2573bbd29cfc01e3f9ba0af..c3c79f2835d280ba199b9b4f239bcfe1bd125e86 100644 (file)
@@ -65,6 +65,7 @@ struct page_pool;
 #define MLX5E_HW2SW_MTU(params, hwmtu) ((hwmtu) - ((params)->hard_mtu))
 #define MLX5E_SW2HW_MTU(params, swmtu) ((swmtu) + ((params)->hard_mtu))
 
+#define MLX5E_MAX_PRIORITY      8
 #define MLX5E_MAX_DSCP          64
 #define MLX5E_MAX_NUM_TC       8
 
@@ -182,6 +183,7 @@ static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev)
 struct mlx5e_tx_wqe {
        struct mlx5_wqe_ctrl_seg ctrl;
        struct mlx5_wqe_eth_seg  eth;
+       struct mlx5_wqe_data_seg data[0];
 };
 
 struct mlx5e_rx_wqe {
@@ -275,6 +277,11 @@ struct mlx5e_dcbx {
        /* The only setting that cannot be read from FW */
        u8                         tc_tsa[IEEE_8021QAZ_MAX_TCS];
        u8                         cap;
+
+       /* Buffer configuration */
+       bool                       manual_buffer;
+       u32                        cable_len;
+       u32                        xoff;
 };
 
 struct mlx5e_dcbx_dp {
@@ -288,8 +295,6 @@ enum {
        MLX5E_RQ_STATE_AM,
 };
 
-#define MLX5E_TEST_BIT(state, nr) (state & BIT(nr))
-
 struct mlx5e_cq {
        /* data path - accessed per cqe */
        struct mlx5_cqwq           wq;
@@ -309,7 +314,7 @@ struct mlx5e_cq {
 
        /* control */
        struct mlx5_core_dev      *mdev;
-       struct mlx5_frag_wq_ctrl   wq_ctrl;
+       struct mlx5_wq_ctrl        wq_ctrl;
 } ____cacheline_aligned_in_smp;
 
 struct mlx5e_tx_wqe_info {
@@ -370,7 +375,6 @@ struct mlx5e_txqsq {
        struct netdev_queue       *txq;
        u32                        sqn;
        u8                         min_inline_mode;
-       u16                        edge;
        struct device             *pdev;
        __be32                     mkey_be;
        unsigned long              state;
@@ -435,7 +439,6 @@ struct mlx5e_icosq {
        struct mlx5_wq_cyc         wq;
        void __iomem              *uar_map;
        u32                        sqn;
-       u16                        edge;
        unsigned long              state;
 
        /* control path */
@@ -446,7 +449,7 @@ struct mlx5e_icosq {
 static inline bool
 mlx5e_wqc_has_room_for(struct mlx5_wq_cyc *wq, u16 cc, u16 pc, u16 n)
 {
-       return (((wq->sz_m1 & (cc - pc)) >= n) || (cc == pc));
+       return (mlx5_wq_cyc_ctr2ix(wq, cc - pc) >= n) || (cc == pc);
 }
 
 struct mlx5e_dma_info {
@@ -636,7 +639,6 @@ struct mlx5e_flow_table {
 struct mlx5e_tc_table {
        struct mlx5_flow_table          *t;
 
-       struct rhashtable_params        ht_params;
        struct rhashtable               ht;
 
        DECLARE_HASHTABLE(mod_hdr_tbl, 8);
@@ -769,6 +771,8 @@ struct mlx5e_priv {
        struct mutex               state_lock; /* Protects Interface state */
        struct mlx5e_rq            drop_rq;
 
+       rwlock_t                   stats_lock; /* Protects channels SW stats updates */
+       bool                       channels_active;
        struct mlx5e_channels      channels;
        u32                        tisn[MLX5E_MAX_NUM_TC];
        struct mlx5e_rqt           indir_rqt;
@@ -935,8 +939,6 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv);
 
 void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len,
                                   int num_channels);
-int mlx5e_get_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed);
-
 void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params,
                                 u8 cq_period_mode);
 void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params,
@@ -955,10 +957,9 @@ static inline void mlx5e_sq_fetch_wqe(struct mlx5e_txqsq *sq,
                                      struct mlx5e_tx_wqe **wqe,
                                      u16 *pi)
 {
-       struct mlx5_wq_cyc *wq;
+       struct mlx5_wq_cyc *wq = &sq->wq;
 
-       wq = &sq->wq;
-       *pi = sq->pc & wq->sz_m1;
+       *pi  = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
        *wqe = mlx5_wq_cyc_get_wqe(wq, *pi);
        memset(*wqe, 0, sizeof(**wqe));
 }
@@ -966,7 +967,7 @@ static inline void mlx5e_sq_fetch_wqe(struct mlx5e_txqsq *sq,
 static inline
 struct mlx5e_tx_wqe *mlx5e_post_nop(struct mlx5_wq_cyc *wq, u32 sqn, u16 *pc)
 {
-       u16                         pi   = *pc & wq->sz_m1;
+       u16                         pi   = mlx5_wq_cyc_ctr2ix(wq, *pc);
        struct mlx5e_tx_wqe        *wqe  = mlx5_wq_cyc_get_wqe(wq, pi);
        struct mlx5_wqe_ctrl_seg   *cseg = &wqe->ctrl;
 
@@ -1120,9 +1121,6 @@ int mlx5e_ethtool_get_ts_info(struct mlx5e_priv *priv,
 int mlx5e_ethtool_flash_device(struct mlx5e_priv *priv,
                               struct ethtool_flash *flash);
 
-int mlx5e_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
-                           void *cb_priv);
-
 /* mlx5e generic netdev management API */
 struct net_device*
 mlx5e_create_netdev(struct mlx5_core_dev *mdev, const struct mlx5e_profile *profile,