forked from Minki/linux
net/mlx5e: Introduce kconfig var for TC support
In order to improve code maintainability and readability, introduce new CONFIG_MLX5_CLS_ACT kconfig variable to control compilation of TC hardware offloads implementation. This allows distinguishing between features that require TC support (MPLSoUDP, etc.) and features that just rely on representor functionality (rep_bond for live migration, etc.). Modify rep_tc.h, rep_neigh.h, en_tc.h and chains.h files to provide stubs for functions that are called from generic code. Signed-off-by: Vlad Buslov <vladbu@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
e2394a61d2
commit
d956873f90
@ -78,9 +78,24 @@ config MLX5_ESWITCH
|
||||
Legacy SRIOV mode (L2 mac vlan steering based).
|
||||
Switchdev mode (eswitch offloads).
|
||||
|
||||
config MLX5_CLS_ACT
|
||||
bool "MLX5 TC classifier action support"
|
||||
depends on MLX5_ESWITCH && NET_CLS_ACT
|
||||
default y
|
||||
help
|
||||
mlx5 ConnectX offloads support for TC classifier action (NET_CLS_ACT),
|
||||
works in both native NIC mdoe and Switchdev SRIOV mode.
|
||||
Actions get attached to a Hardware offloaded classifiers and are
|
||||
invoked after a successful classification. Actions are used to
|
||||
overwrite the classification result, instantly drop or redirect and/or
|
||||
reformat packets in wire speeds without involving the host cpu.
|
||||
|
||||
If set to N, TC offloads in both NIC and switchdev modes will be disabled.
|
||||
If unsure, set to Y
|
||||
|
||||
config MLX5_TC_CT
|
||||
bool "MLX5 TC connection tracking offload support"
|
||||
depends on MLX5_CORE_EN && NET_SWITCHDEV && NF_FLOW_TABLE && NET_ACT_CT && NET_TC_SKB_EXT
|
||||
depends on MLX5_CLS_ACT && NF_FLOW_TABLE && NET_ACT_CT && NET_TC_SKB_EXT
|
||||
default y
|
||||
help
|
||||
Say Y here if you want to support offloading connection tracking rules
|
||||
|
@ -33,18 +33,19 @@ mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \
|
||||
mlx5_core-$(CONFIG_MLX5_EN_ARFS) += en_arfs.o
|
||||
mlx5_core-$(CONFIG_MLX5_EN_RXNFC) += en_fs_ethtool.o
|
||||
mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) += en_dcbnl.o en/port_buffer.o
|
||||
mlx5_core-$(CONFIG_MLX5_ESWITCH) += en_rep.o en_tc.o en/rep/tc.o en/rep/neigh.o en/tc_tun.o lib/port_tun.o \
|
||||
lag_mp.o \
|
||||
lib/geneve.o en/mapping.o en/tc_tun_vxlan.o en/tc_tun_gre.o \
|
||||
en/tc_tun_geneve.o diag/en_tc_tracepoint.o
|
||||
mlx5_core-$(CONFIG_PCI_HYPERV_INTERFACE) += en/hv_vhca_stats.o
|
||||
mlx5_core-$(CONFIG_MLX5_ESWITCH) += en_rep.o lib/geneve.o lib/port_tun.o lag_mp.o
|
||||
mlx5_core-$(CONFIG_MLX5_CLS_ACT) += en_tc.o en/rep/tc.o en/rep/neigh.o \
|
||||
en/mapping.o esw/chains.o en/tc_tun.o \
|
||||
en/tc_tun_vxlan.o en/tc_tun_gre.o en/tc_tun_geneve.o \
|
||||
diag/en_tc_tracepoint.o
|
||||
mlx5_core-$(CONFIG_MLX5_TC_CT) += en/tc_ct.o
|
||||
|
||||
#
|
||||
# Core extra
|
||||
#
|
||||
mlx5_core-$(CONFIG_MLX5_ESWITCH) += eswitch.o eswitch_offloads.o eswitch_offloads_termtbl.o \
|
||||
ecpf.o rdma.o esw/chains.o
|
||||
ecpf.o rdma.o
|
||||
mlx5_core-$(CONFIG_MLX5_MPFS) += lib/mpfs.o
|
||||
mlx5_core-$(CONFIG_VXLAN) += lib/vxlan.o
|
||||
mlx5_core-$(CONFIG_PTP_1588_CLOCK) += lib/clock.o
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "en.h"
|
||||
#include "en_rep.h"
|
||||
|
||||
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
|
||||
|
||||
int mlx5e_rep_neigh_init(struct mlx5e_rep_priv *rpriv);
|
||||
void mlx5e_rep_neigh_cleanup(struct mlx5e_rep_priv *rpriv);
|
||||
|
||||
@ -20,4 +22,13 @@ void mlx5e_rep_neigh_entry_release(struct mlx5e_neigh_hash_entry *nhe);
|
||||
|
||||
void mlx5e_rep_queue_neigh_stats_work(struct mlx5e_priv *priv);
|
||||
|
||||
#else /* CONFIG_MLX5_CLS_ACT */
|
||||
|
||||
static inline int
|
||||
mlx5e_rep_neigh_init(struct mlx5e_rep_priv *rpriv) { return 0; }
|
||||
static inline void
|
||||
mlx5e_rep_neigh_cleanup(struct mlx5e_rep_priv *rpriv) {}
|
||||
|
||||
#endif /* CONFIG_MLX5_CLS_ACT */
|
||||
|
||||
#endif /* __MLX5_EN_REP_NEIGH__ */
|
||||
|
@ -5,11 +5,11 @@
|
||||
#define __MLX5_EN_REP_TC_H__
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
#include "en.h"
|
||||
#include "en_tc.h"
|
||||
#include "en_rep.h"
|
||||
|
||||
struct mlx5e_rep_priv;
|
||||
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
|
||||
|
||||
int mlx5e_rep_tc_init(struct mlx5e_rep_priv *rpriv);
|
||||
void mlx5e_rep_tc_cleanup(struct mlx5e_rep_priv *rpriv);
|
||||
|
||||
@ -21,7 +21,6 @@ void mlx5e_rep_tc_disable(struct mlx5e_priv *priv);
|
||||
|
||||
int mlx5e_rep_tc_event_port_affinity(struct mlx5e_priv *priv);
|
||||
|
||||
struct mlx5e_encap_entry;
|
||||
void mlx5e_rep_update_flows(struct mlx5e_priv *priv,
|
||||
struct mlx5e_encap_entry *e,
|
||||
bool neigh_connected,
|
||||
@ -36,10 +35,47 @@ int mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type,
|
||||
void *type_data);
|
||||
void mlx5e_rep_indr_clean_block_privs(struct mlx5e_rep_priv *rpriv);
|
||||
|
||||
struct mlx5e_tc_update_priv;
|
||||
bool mlx5e_rep_tc_update_skb(struct mlx5_cqe64 *cqe,
|
||||
struct sk_buff *skb,
|
||||
struct mlx5e_tc_update_priv *tc_priv);
|
||||
void mlx5_rep_tc_post_napi_receive(struct mlx5e_tc_update_priv *tc_priv);
|
||||
|
||||
#else /* CONFIG_MLX5_CLS_ACT */
|
||||
|
||||
struct mlx5e_rep_priv;
|
||||
static inline int
|
||||
mlx5e_rep_tc_init(struct mlx5e_rep_priv *rpriv) { return 0; }
|
||||
static inline void
|
||||
mlx5e_rep_tc_cleanup(struct mlx5e_rep_priv *rpriv) {}
|
||||
|
||||
static inline int
|
||||
mlx5e_rep_tc_netdevice_event_register(struct mlx5e_rep_priv *rpriv) { return 0; }
|
||||
static inline void
|
||||
mlx5e_rep_tc_netdevice_event_unregister(struct mlx5e_rep_priv *rpriv) {}
|
||||
|
||||
static inline void
|
||||
mlx5e_rep_tc_enable(struct mlx5e_priv *priv) {}
|
||||
static inline void
|
||||
mlx5e_rep_tc_disable(struct mlx5e_priv *priv) {}
|
||||
|
||||
static inline int
|
||||
mlx5e_rep_tc_event_port_affinity(struct mlx5e_priv *priv) { return NOTIFY_DONE; }
|
||||
|
||||
static inline int
|
||||
mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type,
|
||||
void *type_data) { return -EOPNOTSUPP; }
|
||||
|
||||
static inline void
|
||||
mlx5e_rep_indr_clean_block_privs(struct mlx5e_rep_priv *rpriv) {}
|
||||
|
||||
struct mlx5e_tc_update_priv;
|
||||
static inline bool
|
||||
mlx5e_rep_tc_update_skb(struct mlx5_cqe64 *cqe,
|
||||
struct sk_buff *skb,
|
||||
struct mlx5e_tc_update_priv *tc_priv) { return true; }
|
||||
static inline void
|
||||
mlx5_rep_tc_post_napi_receive(struct mlx5e_tc_update_priv *tc_priv) {}
|
||||
|
||||
#endif /* CONFIG_MLX5_CLS_ACT */
|
||||
|
||||
#endif /* __MLX5_EN_REP_TC_H__ */
|
||||
|
@ -3728,7 +3728,7 @@ static int set_feature_cvlan_filter(struct net_device *netdev, bool enable)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MLX5_ESWITCH
|
||||
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
|
||||
static int set_feature_tc_num_filters(struct net_device *netdev, bool enable)
|
||||
{
|
||||
struct mlx5e_priv *priv = netdev_priv(netdev);
|
||||
@ -3839,7 +3839,7 @@ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features)
|
||||
err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO, set_feature_lro);
|
||||
err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER,
|
||||
set_feature_cvlan_filter);
|
||||
#ifdef CONFIG_MLX5_ESWITCH
|
||||
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
|
||||
err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_TC, set_feature_tc_num_filters);
|
||||
#endif
|
||||
err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXALL, set_feature_rx_all);
|
||||
|
@ -80,9 +80,6 @@ enum {
|
||||
|
||||
#define MLX5_TC_FLAG(flag) BIT(MLX5E_TC_FLAG_##flag##_BIT)
|
||||
|
||||
int mlx5e_tc_nic_init(struct mlx5e_priv *priv);
|
||||
void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv);
|
||||
|
||||
int mlx5e_tc_esw_init(struct rhashtable *tc_ht);
|
||||
void mlx5e_tc_esw_cleanup(struct rhashtable *tc_ht);
|
||||
|
||||
@ -173,9 +170,22 @@ void dealloc_mod_hdr_actions(struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts);
|
||||
struct mlx5e_tc_flow;
|
||||
u32 mlx5e_tc_get_flow_tun_id(struct mlx5e_tc_flow *flow);
|
||||
|
||||
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
|
||||
|
||||
int mlx5e_tc_nic_init(struct mlx5e_priv *priv);
|
||||
void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv);
|
||||
|
||||
int mlx5e_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
|
||||
void *cb_priv);
|
||||
|
||||
#else /* CONFIG_MLX5_CLS_ACT */
|
||||
static inline int mlx5e_tc_nic_init(struct mlx5e_priv *priv) { return 0; }
|
||||
static inline void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv) {}
|
||||
static inline int
|
||||
mlx5e_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv)
|
||||
{ return -EOPNOTSUPP; }
|
||||
#endif /* CONFIG_MLX5_CLS_ACT */
|
||||
|
||||
#else /* CONFIG_MLX5_ESWITCH */
|
||||
static inline int mlx5e_tc_nic_init(struct mlx5e_priv *priv) { return 0; }
|
||||
static inline void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv) {}
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include "eswitch.h"
|
||||
|
||||
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
|
||||
|
||||
bool
|
||||
mlx5_esw_chains_prios_supported(struct mlx5_eswitch *esw);
|
||||
bool
|
||||
@ -46,4 +48,21 @@ void mlx5_esw_chains_destroy(struct mlx5_eswitch *esw);
|
||||
int
|
||||
mlx5_eswitch_get_chain_for_tag(struct mlx5_eswitch *esw, u32 tag, u32 *chain);
|
||||
|
||||
#else /* CONFIG_MLX5_CLS_ACT */
|
||||
|
||||
static inline struct mlx5_flow_table *
|
||||
mlx5_esw_chains_get_table(struct mlx5_eswitch *esw, u32 chain, u32 prio,
|
||||
u32 level) { return ERR_PTR(-EOPNOTSUPP); }
|
||||
static inline void
|
||||
mlx5_esw_chains_put_table(struct mlx5_eswitch *esw, u32 chain, u32 prio,
|
||||
u32 level) {}
|
||||
|
||||
static inline struct mlx5_flow_table *
|
||||
mlx5_esw_chains_get_tc_end_ft(struct mlx5_eswitch *esw) { return ERR_PTR(-EOPNOTSUPP); }
|
||||
|
||||
static inline int mlx5_esw_chains_create(struct mlx5_eswitch *esw) { return 0; }
|
||||
static inline void mlx5_esw_chains_destroy(struct mlx5_eswitch *esw) {}
|
||||
|
||||
#endif /* CONFIG_MLX5_CLS_ACT */
|
||||
|
||||
#endif /* __ML5_ESW_CHAINS_H__ */
|
||||
|
@ -1727,7 +1727,9 @@ static int mlx5_esw_offloads_pair(struct mlx5_eswitch *esw,
|
||||
|
||||
static void mlx5_esw_offloads_unpair(struct mlx5_eswitch *esw)
|
||||
{
|
||||
#if IS_ENABLED(CONFIG_MLX5_CLS_ACT)
|
||||
mlx5e_tc_clean_fdb_peer_flows(esw);
|
||||
#endif
|
||||
esw_del_fdb_peer_miss_rules(esw);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user