]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/net/ethernet/mellanox/mlx5/core/en.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[mirror_ubuntu-artful-kernel.git] / drivers / net / ethernet / mellanox / mlx5 / core / en.h
index d5ecb8f53fd43684f185d590c8dc5553a4f25ab4..9b52c58cd528a906db9c61b0e6685449d6c9a62d 100644 (file)
@@ -51,6 +51,9 @@
 
 #define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v)
 
+#define MLX5E_HW2SW_MTU(hwmtu) ((hwmtu) - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN))
+#define MLX5E_SW2HW_MTU(swmtu) ((swmtu) + (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN))
+
 #define MLX5E_MAX_NUM_TC       8
 
 #define MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE                0x6
 
 #define MLX5E_LOG_INDIR_RQT_SIZE       0x7
 #define MLX5E_INDIR_RQT_SIZE           BIT(MLX5E_LOG_INDIR_RQT_SIZE)
+#define MLX5E_MIN_NUM_CHANNELS         0x1
 #define MLX5E_MAX_NUM_CHANNELS         (MLX5E_INDIR_RQT_SIZE >> 1)
 #define MLX5E_MAX_NUM_SQS              (MLX5E_MAX_NUM_CHANNELS * MLX5E_MAX_NUM_TC)
 #define MLX5E_TX_CQ_POLL_BUDGET        128
@@ -259,6 +263,7 @@ struct mlx5e_tstamp {
        struct mlx5_core_dev      *mdev;
        struct ptp_clock          *ptp;
        struct ptp_clock_info      ptp_info;
+       u8                        *pps_pin_caps;
 };
 
 enum {
@@ -369,6 +374,7 @@ struct mlx5e_rq {
 
        unsigned long          state;
        int                    ix;
+       u16                    rx_headroom;
 
        struct mlx5e_rx_am     am; /* Adaptive Moderation */
        struct bpf_prog       *xdp_prog;
@@ -465,7 +471,6 @@ struct mlx5e_sq {
        /* read only */
        struct mlx5_wq_cyc         wq;
        u32                        dma_fifo_mask;
-       void __iomem              *uar_map;
        struct netdev_queue       *txq;
        u32                        sqn;
        u16                        bf_buf_size;
@@ -479,7 +484,7 @@ struct mlx5e_sq {
 
        /* control path */
        struct mlx5_wq_ctrl        wq_ctrl;
-       struct mlx5_uar            uar;
+       struct mlx5_sq_bfreg       bfreg;
        struct mlx5e_channel      *channel;
        int                        tc;
        u32                        rate_limit;
@@ -568,8 +573,9 @@ struct mlx5e_vlan_table {
        unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
        struct mlx5_flow_handle *active_vlans_rule[VLAN_N_VID];
        struct mlx5_flow_handle *untagged_rule;
-       struct mlx5_flow_handle *any_vlan_rule;
-       bool            filter_disabled;
+       struct mlx5_flow_handle *any_cvlan_rule;
+       struct mlx5_flow_handle *any_svlan_rule;
+       bool                    filter_disabled;
 };
 
 struct mlx5e_l2_table {
@@ -777,9 +783,11 @@ void mlx5e_fill_hwstamp(struct mlx5e_tstamp *clock, u64 timestamp,
                        struct skb_shared_hwtstamps *hwts);
 void mlx5e_timestamp_init(struct mlx5e_priv *priv);
 void mlx5e_timestamp_cleanup(struct mlx5e_priv *priv);
+void mlx5e_pps_event_handler(struct mlx5e_priv *priv,
+                            struct ptp_clock_event *event);
 int mlx5e_hwstamp_set(struct net_device *dev, struct ifreq *ifr);
 int mlx5e_hwstamp_get(struct net_device *dev, struct ifreq *ifr);
-void mlx5e_modify_rx_cqe_compression(struct mlx5e_priv *priv, bool val);
+void mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val);
 
 int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto,
                          u16 vid);
@@ -807,7 +815,7 @@ void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params,
 static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
                                      struct mlx5_wqe_ctrl_seg *ctrl, int bf_sz)
 {
-       u16 ofst = MLX5_BF_OFFSET + sq->bf_offset;
+       u16 ofst = sq->bf_offset;
 
        /* ensure wqe is visible to device before updating doorbell record */
        dma_wmb();
@@ -819,9 +827,9 @@ static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
         */
        wmb();
        if (bf_sz)
-               __iowrite64_copy(sq->uar_map + ofst, ctrl, bf_sz);
+               __iowrite64_copy(sq->bfreg.map + ofst, ctrl, bf_sz);
        else
-               mlx5_write64((__be32 *)ctrl, sq->uar_map + ofst, NULL);
+               mlx5_write64((__be32 *)ctrl, sq->bfreg.map + ofst, NULL);
        /* flush the write-combining mapped buffer */
        wmb();
 
@@ -833,7 +841,7 @@ static inline void mlx5e_cq_arm(struct mlx5e_cq *cq)
        struct mlx5_core_cq *mcq;
 
        mcq = &cq->mcq;
-       mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, NULL, cq->wq.cc);
+       mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, cq->wq.cc);
 }
 
 static inline u32 mlx5e_get_wqe_mtt_offset(struct mlx5e_rq *rq, u16 wqe_ix)
@@ -841,12 +849,6 @@ static inline u32 mlx5e_get_wqe_mtt_offset(struct mlx5e_rq *rq, u16 wqe_ix)
        return wqe_ix * ALIGN(MLX5_MPWRQ_PAGES_PER_WQE, 8);
 }
 
-static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev)
-{
-       return min_t(int, mdev->priv.eq_table.num_comp_vectors,
-                    MLX5E_MAX_NUM_CHANNELS);
-}
-
 extern const struct ethtool_ops mlx5e_ethtool_ops;
 #ifdef CONFIG_MLX5_CORE_EN_DCB
 extern const struct dcbnl_rtnl_ops mlx5e_dcbnl_ops;