net/mlx5e: Add CONFIG_MLX5_EN_ARFS for accelerated flow steering support
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / en.h
index d9e24fbe6a28cf865e6586ff37e0b47436a5fb68..8743bbe1baa21a075e3d593f801dba35d4c86f0f 100644 (file)
@@ -52,6 +52,7 @@
 #include "wq.h"
 #include "mlx5_core.h"
 #include "en_stats.h"
+#include "en/fs.h"
 
 struct page_pool;
 
@@ -344,6 +345,7 @@ enum {
        MLX5E_SQ_STATE_IPSEC,
        MLX5E_SQ_STATE_AM,
        MLX5E_SQ_STATE_TLS,
+       MLX5E_SQ_STATE_REDIRECT,
 };
 
 struct mlx5e_sq_wqe_info {
@@ -364,16 +366,14 @@ struct mlx5e_txqsq {
 
        struct mlx5e_cq            cq;
 
-       /* write@xmit, read@completion */
-       struct {
-               struct mlx5e_sq_dma       *dma_fifo;
-               struct mlx5e_tx_wqe_info  *wqe_info;
-       } db;
-
        /* read only */
        struct mlx5_wq_cyc         wq;
        u32                        dma_fifo_mask;
        struct mlx5e_sq_stats     *stats;
+       struct {
+               struct mlx5e_sq_dma       *dma_fifo;
+               struct mlx5e_tx_wqe_info  *wqe_info;
+       } db;
        void __iomem              *uar_map;
        struct netdev_queue       *txq;
        u32                        sqn;
@@ -409,22 +409,22 @@ struct mlx5e_xdp_info {
 struct mlx5e_xdpsq {
        /* data path */
 
-       /* dirtied @rx completion */
+       /* dirtied @completion */
        u16                        cc;
-       u16                        pc;
+       bool                       redirect_flush;
 
-       struct mlx5e_cq            cq;
+       /* dirtied @xmit */
+       u16                        pc ____cacheline_aligned_in_smp;
+       bool                       doorbell;
 
-       /* write@xmit, read@completion */
-       struct {
-               struct mlx5e_xdp_info     *xdpi;
-               bool                       doorbell;
-               bool                       redirect_flush;
-       } db;
+       struct mlx5e_cq            cq;
 
        /* read only */
        struct mlx5_wq_cyc         wq;
        struct mlx5e_xdpsq_stats  *stats;
+       struct {
+               struct mlx5e_xdp_info     *xdpi;
+       } db;
        void __iomem              *uar_map;
        u32                        sqn;
        struct device             *pdev;
@@ -598,6 +598,9 @@ struct mlx5e_channel {
        __be32                     mkey_be;
        u8                         num_tc;
 
+       /* XDP_REDIRECT */
+       struct mlx5e_xdpsq         xdpsq;
+
        /* data path - accessed per napi poll */
        struct irq_desc *irq_desc;
        struct mlx5e_ch_stats     *stats;
@@ -621,6 +624,7 @@ struct mlx5e_channel_stats {
        struct mlx5e_sq_stats sq[MLX5E_MAX_NUM_TC];
        struct mlx5e_rq_stats rq;
        struct mlx5e_xdpsq_stats rq_xdpsq;
+       struct mlx5e_xdpsq_stats xdpsq;
 } ____cacheline_aligned_in_smp;
 
 enum mlx5e_traffic_types {
@@ -651,22 +655,11 @@ enum {
        MLX5E_STATE_DESTROYING,
 };
 
-struct mlx5e_vxlan_db {
-       spinlock_t                      lock; /* protect vxlan table */
-       struct radix_tree_root          tree;
-};
-
 struct mlx5e_l2_rule {
        u8  addr[ETH_ALEN + 2];
        struct mlx5_flow_handle *rule;
 };
 
-struct mlx5e_flow_table {
-       int num_groups;
-       struct mlx5_flow_table *t;
-       struct mlx5_flow_group **g;
-};
-
 #define MLX5E_L2_ADDR_HASH_SIZE BIT(BITS_PER_BYTE)
 
 struct mlx5e_tc_table {
@@ -709,38 +702,15 @@ struct mlx5e_ttc_table {
        struct mlx5_flow_handle  *tunnel_rules[MLX5E_NUM_TUNNEL_TT];
 };
 
-#define ARFS_HASH_SHIFT BITS_PER_BYTE
-#define ARFS_HASH_SIZE BIT(BITS_PER_BYTE)
-struct arfs_table {
-       struct mlx5e_flow_table  ft;
-       struct mlx5_flow_handle  *default_rule;
-       struct hlist_head        rules_hash[ARFS_HASH_SIZE];
-};
-
-enum  arfs_type {
-       ARFS_IPV4_TCP,
-       ARFS_IPV6_TCP,
-       ARFS_IPV4_UDP,
-       ARFS_IPV6_UDP,
-       ARFS_NUM_TYPES,
-};
-
-struct mlx5e_arfs_tables {
-       struct arfs_table arfs_tables[ARFS_NUM_TYPES];
-       /* Protect aRFS rules list */
-       spinlock_t                     arfs_lock;
-       struct list_head               rules;
-       int                            last_filter_id;
-       struct workqueue_struct        *wq;
-};
-
 /* NIC prio FTS */
 enum {
        MLX5E_VLAN_FT_LEVEL = 0,
        MLX5E_L2_FT_LEVEL,
        MLX5E_TTC_FT_LEVEL,
        MLX5E_INNER_TTC_FT_LEVEL,
+#ifdef CONFIG_MLX5_EN_ARFS
        MLX5E_ARFS_FT_LEVEL
+#endif
 };
 
 enum {
@@ -748,30 +718,19 @@ enum {
        MLX5E_TC_TTC_FT_LEVEL,
 };
 
-struct mlx5e_ethtool_table {
-       struct mlx5_flow_table *ft;
-       int                    num_rules;
-};
-
-#define ETHTOOL_NUM_L3_L4_FTS 7
-#define ETHTOOL_NUM_L2_FTS 4
-
-struct mlx5e_ethtool_steering {
-       struct mlx5e_ethtool_table      l3_l4_ft[ETHTOOL_NUM_L3_L4_FTS];
-       struct mlx5e_ethtool_table      l2_ft[ETHTOOL_NUM_L2_FTS];
-       struct list_head                rules;
-       int                             tot_num_rules;
-};
-
 struct mlx5e_flow_steering {
        struct mlx5_flow_namespace      *ns;
+#ifdef CONFIG_MLX5_EN_RXNFC
        struct mlx5e_ethtool_steering   ethtool;
+#endif
        struct mlx5e_tc_table           tc;
        struct mlx5e_vlan_table         vlan;
        struct mlx5e_l2_table           l2;
        struct mlx5e_ttc_table          ttc;
        struct mlx5e_ttc_table          inner_ttc;
+#ifdef CONFIG_MLX5_EN_ARFS
        struct mlx5e_arfs_tables        arfs;
+#endif
 };
 
 struct mlx5e_rqt {
@@ -813,7 +772,6 @@ struct mlx5e_priv {
        u32                        tx_rates[MLX5E_MAX_NUM_SQS];
 
        struct mlx5e_flow_steering fs;
-       struct mlx5e_vxlan_db      vxlan;
 
        struct workqueue_struct    *wq;
        struct work_struct         update_carrier_work;
@@ -861,8 +819,6 @@ struct mlx5e_profile {
                mlx5e_fp_handle_rx_cqe handle_rx_cqe;
                mlx5e_fp_handle_rx_cqe handle_rx_cqe_mpwqe;
        } rx_handlers;
-       void    (*netdev_registered_init)(struct mlx5e_priv *priv);
-       void    (*netdev_registered_remove)(struct mlx5e_priv *priv);
        int     max_tc;
 };
 
@@ -917,16 +873,6 @@ void mlx5e_destroy_flow_table(struct mlx5e_flow_table *ft);
 int mlx5e_self_test_num(struct mlx5e_priv *priv);
 void mlx5e_self_test(struct net_device *ndev, struct ethtool_test *etest,
                     u64 *buf);
-int mlx5e_ethtool_get_flow(struct mlx5e_priv *priv, struct ethtool_rxnfc *info,
-                          int location);
-int mlx5e_ethtool_get_all_flows(struct mlx5e_priv *priv,
-                               struct ethtool_rxnfc *info, u32 *rule_locs);
-int mlx5e_ethtool_flow_replace(struct mlx5e_priv *priv,
-                              struct ethtool_rx_flow_spec *fs);
-int mlx5e_ethtool_flow_remove(struct mlx5e_priv *priv,
-                             int location);
-void mlx5e_ethtool_init_steering(struct mlx5e_priv *priv);
-void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv);
 void mlx5e_set_rx_mode_work(struct work_struct *work);
 
 int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr);
@@ -1055,32 +1001,6 @@ void mlx5e_dcbnl_init_app(struct mlx5e_priv *priv);
 void mlx5e_dcbnl_delete_app(struct mlx5e_priv *priv);
 #endif
 
-#ifndef CONFIG_RFS_ACCEL
-static inline int mlx5e_arfs_create_tables(struct mlx5e_priv *priv)
-{
-       return 0;
-}
-
-static inline void mlx5e_arfs_destroy_tables(struct mlx5e_priv *priv) {}
-
-static inline int mlx5e_arfs_enable(struct mlx5e_priv *priv)
-{
-       return -EOPNOTSUPP;
-}
-
-static inline int mlx5e_arfs_disable(struct mlx5e_priv *priv)
-{
-       return -EOPNOTSUPP;
-}
-#else
-int mlx5e_arfs_create_tables(struct mlx5e_priv *priv);
-void mlx5e_arfs_destroy_tables(struct mlx5e_priv *priv);
-int mlx5e_arfs_enable(struct mlx5e_priv *priv);
-int mlx5e_arfs_disable(struct mlx5e_priv *priv);
-int mlx5e_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
-                       u16 rxq_index, u32 flow_id);
-#endif
-
 int mlx5e_create_tir(struct mlx5_core_dev *mdev,
                     struct mlx5e_tir *tir, u32 *in, int inlen);
 void mlx5e_destroy_tir(struct mlx5_core_dev *mdev,