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 dddd29a3be97c4788ac3c221ba212834b49e7b54..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;
 
@@ -659,12 +660,6 @@ struct mlx5e_l2_rule {
        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 {
@@ -707,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 {
@@ -746,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 {
@@ -912,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);
@@ -1050,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,