Commit 0027d70c authored by Chris Mi's avatar Chris Mi Committed by Saeed Mahameed

net/mlx5e: Move esw/sample to en/tc/sample

Module sample belongs to en/tc instead of esw. Move it and rename
accordingly.
Signed-off-by: default avatarChris Mi <cmi@nvidia.com>
Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 5024fa95
...@@ -46,6 +46,7 @@ mlx5_core-$(CONFIG_MLX5_CLS_ACT) += en_tc.o en/rep/tc.o en/rep/neigh.o \ ...@@ -46,6 +46,7 @@ mlx5_core-$(CONFIG_MLX5_CLS_ACT) += en_tc.o en/rep/tc.o en/rep/neigh.o \
en/tc_tun_vxlan.o en/tc_tun_gre.o en/tc_tun_geneve.o \ en/tc_tun_vxlan.o en/tc_tun_gre.o en/tc_tun_geneve.o \
en/tc_tun_mplsoudp.o diag/en_tc_tracepoint.o en/tc_tun_mplsoudp.o diag/en_tc_tracepoint.o
mlx5_core-$(CONFIG_MLX5_TC_CT) += en/tc_ct.o mlx5_core-$(CONFIG_MLX5_TC_CT) += en/tc_ct.o
mlx5_core-$(CONFIG_MLX5_TC_SAMPLE) += en/tc/sample.o
# #
# Core extra # Core extra
...@@ -56,7 +57,6 @@ mlx5_core-$(CONFIG_MLX5_ESWITCH) += esw/acl/helper.o \ ...@@ -56,7 +57,6 @@ mlx5_core-$(CONFIG_MLX5_ESWITCH) += esw/acl/helper.o \
esw/acl/egress_lgcy.o esw/acl/egress_ofld.o \ esw/acl/egress_lgcy.o esw/acl/egress_ofld.o \
esw/acl/ingress_lgcy.o esw/acl/ingress_ofld.o \ esw/acl/ingress_lgcy.o esw/acl/ingress_ofld.o \
esw/devlink_port.o esw/vporttbl.o esw/devlink_port.o esw/vporttbl.o
mlx5_core-$(CONFIG_MLX5_TC_SAMPLE) += esw/sample.o
mlx5_core-$(CONFIG_MLX5_BRIDGE) += esw/bridge.o en/rep/bridge.o mlx5_core-$(CONFIG_MLX5_BRIDGE) += esw/bridge.o en/rep/bridge.o
mlx5_core-$(CONFIG_MLX5_MPFS) += lib/mpfs.o mlx5_core-$(CONFIG_MLX5_MPFS) += lib/mpfs.o
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "en/mapping.h" #include "en/mapping.h"
#include "en/tc_tun.h" #include "en/tc_tun.h"
#include "lib/port_tun.h" #include "lib/port_tun.h"
#include "esw/sample.h" #include "en/tc/sample.h"
struct mlx5e_rep_indr_block_priv { struct mlx5e_rep_indr_block_priv {
struct net_device *netdev; struct net_device *netdev;
...@@ -677,7 +677,7 @@ bool mlx5e_rep_tc_update_skb(struct mlx5_cqe64 *cqe, ...@@ -677,7 +677,7 @@ bool mlx5e_rep_tc_update_skb(struct mlx5_cqe64 *cqe,
#endif /* CONFIG_NET_TC_SKB_EXT */ #endif /* CONFIG_NET_TC_SKB_EXT */
#if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE) #if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE)
if (mapped_obj.type == MLX5_MAPPED_OBJ_SAMPLE) { if (mapped_obj.type == MLX5_MAPPED_OBJ_SAMPLE) {
mlx5_esw_sample_skb(skb, &mapped_obj); mlx5e_tc_sample_skb(skb, &mapped_obj);
return false; return false;
} }
#endif /* CONFIG_MLX5_TC_SAMPLE */ #endif /* CONFIG_MLX5_TC_SAMPLE */
......
...@@ -7,34 +7,34 @@ ...@@ -7,34 +7,34 @@
#include "eswitch.h" #include "eswitch.h"
struct mlx5_flow_attr; struct mlx5_flow_attr;
struct mlx5_esw_psample; struct mlx5e_tc_psample;
struct mlx5_sample_attr { struct mlx5e_sample_attr {
u32 group_num; u32 group_num;
u32 rate; u32 rate;
u32 trunc_size; u32 trunc_size;
u32 restore_obj_id; u32 restore_obj_id;
u32 sampler_id; u32 sampler_id;
struct mlx5_flow_table *sample_default_tbl; struct mlx5_flow_table *sample_default_tbl;
struct mlx5_sample_flow *sample_flow; struct mlx5e_sample_flow *sample_flow;
}; };
void mlx5_esw_sample_skb(struct sk_buff *skb, struct mlx5_mapped_obj *mapped_obj); void mlx5e_tc_sample_skb(struct sk_buff *skb, struct mlx5_mapped_obj *mapped_obj);
struct mlx5_flow_handle * struct mlx5_flow_handle *
mlx5_esw_sample_offload(struct mlx5_esw_psample *sample_priv, mlx5e_tc_sample_offload(struct mlx5e_tc_psample *sample_priv,
struct mlx5_flow_spec *spec, struct mlx5_flow_spec *spec,
struct mlx5_flow_attr *attr); struct mlx5_flow_attr *attr);
void void
mlx5_esw_sample_unoffload(struct mlx5_esw_psample *sample_priv, mlx5e_tc_sample_unoffload(struct mlx5e_tc_psample *sample_priv,
struct mlx5_flow_handle *rule, struct mlx5_flow_handle *rule,
struct mlx5_flow_attr *attr); struct mlx5_flow_attr *attr);
struct mlx5_esw_psample * struct mlx5e_tc_psample *
mlx5_esw_sample_init(struct mlx5_eswitch *esw); mlx5e_tc_sample_init(struct mlx5_eswitch *esw);
void void
mlx5_esw_sample_cleanup(struct mlx5_esw_psample *esw_psample); mlx5e_tc_sample_cleanup(struct mlx5e_tc_psample *tc_psample);
#endif /* __MLX5_EN_TC_SAMPLE_H__ */ #endif /* __MLX5_EN_TC_SAMPLE_H__ */
...@@ -89,7 +89,7 @@ struct mlx5_rep_uplink_priv { ...@@ -89,7 +89,7 @@ struct mlx5_rep_uplink_priv {
struct mapping_ctx *tunnel_enc_opts_mapping; struct mapping_ctx *tunnel_enc_opts_mapping;
struct mlx5_tc_ct_priv *ct_priv; struct mlx5_tc_ct_priv *ct_priv;
struct mlx5_esw_psample *esw_psample; struct mlx5e_tc_psample *tc_psample;
/* support eswitch vports bonding */ /* support eswitch vports bonding */
struct mlx5e_rep_bond *bond; struct mlx5e_rep_bond *bond;
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
#include "en/mod_hdr.h" #include "en/mod_hdr.h"
#include "en/tc_priv.h" #include "en/tc_priv.h"
#include "en/tc_tun_encap.h" #include "en/tc_tun_encap.h"
#include "esw/sample.h" #include "en/tc/sample.h"
#include "lib/devcom.h" #include "lib/devcom.h"
#include "lib/geneve.h" #include "lib/geneve.h"
#include "lib/fs_chains.h" #include "lib/fs_chains.h"
...@@ -246,7 +246,7 @@ get_ct_priv(struct mlx5e_priv *priv) ...@@ -246,7 +246,7 @@ get_ct_priv(struct mlx5e_priv *priv)
} }
#if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE) #if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE)
static struct mlx5_esw_psample * static struct mlx5e_tc_psample *
get_sample_priv(struct mlx5e_priv *priv) get_sample_priv(struct mlx5e_priv *priv)
{ {
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
...@@ -257,7 +257,7 @@ get_sample_priv(struct mlx5e_priv *priv) ...@@ -257,7 +257,7 @@ get_sample_priv(struct mlx5e_priv *priv)
uplink_rpriv = mlx5_eswitch_get_uplink_priv(esw, REP_ETH); uplink_rpriv = mlx5_eswitch_get_uplink_priv(esw, REP_ETH);
uplink_priv = &uplink_rpriv->uplink_priv; uplink_priv = &uplink_rpriv->uplink_priv;
return uplink_priv->esw_psample; return uplink_priv->tc_psample;
} }
return NULL; return NULL;
...@@ -1147,7 +1147,7 @@ mlx5e_tc_offload_fdb_rules(struct mlx5_eswitch *esw, ...@@ -1147,7 +1147,7 @@ mlx5e_tc_offload_fdb_rules(struct mlx5_eswitch *esw,
mod_hdr_acts); mod_hdr_acts);
#if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE) #if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE)
} else if (flow_flag_test(flow, SAMPLE)) { } else if (flow_flag_test(flow, SAMPLE)) {
rule = mlx5_esw_sample_offload(get_sample_priv(flow->priv), spec, attr); rule = mlx5e_tc_sample_offload(get_sample_priv(flow->priv), spec, attr);
#endif #endif
} else { } else {
rule = mlx5_eswitch_add_offloaded_rule(esw, spec, attr); rule = mlx5_eswitch_add_offloaded_rule(esw, spec, attr);
...@@ -1186,7 +1186,7 @@ void mlx5e_tc_unoffload_fdb_rules(struct mlx5_eswitch *esw, ...@@ -1186,7 +1186,7 @@ void mlx5e_tc_unoffload_fdb_rules(struct mlx5_eswitch *esw,
#if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE) #if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE)
if (flow_flag_test(flow, SAMPLE)) { if (flow_flag_test(flow, SAMPLE)) {
mlx5_esw_sample_unoffload(get_sample_priv(flow->priv), flow->rule[0], attr); mlx5e_tc_sample_unoffload(get_sample_priv(flow->priv), flow->rule[0], attr);
return; return;
} }
#endif #endif
...@@ -3722,7 +3722,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, ...@@ -3722,7 +3722,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
bool ft_flow = mlx5e_is_ft_flow(flow); bool ft_flow = mlx5e_is_ft_flow(flow);
const struct flow_action_entry *act; const struct flow_action_entry *act;
struct mlx5_esw_flow_attr *esw_attr; struct mlx5_esw_flow_attr *esw_attr;
struct mlx5_sample_attr sample = {}; struct mlx5e_sample_attr sample = {};
bool encap = false, decap = false; bool encap = false, decap = false;
u32 action = attr->action; u32 action = attr->action;
int err, i, if_count = 0; int err, i, if_count = 0;
...@@ -4976,7 +4976,7 @@ int mlx5e_tc_esw_init(struct rhashtable *tc_ht) ...@@ -4976,7 +4976,7 @@ int mlx5e_tc_esw_init(struct rhashtable *tc_ht)
MLX5_FLOW_NAMESPACE_FDB); MLX5_FLOW_NAMESPACE_FDB);
#if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE) #if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE)
uplink_priv->esw_psample = mlx5_esw_sample_init(esw); uplink_priv->tc_psample = mlx5e_tc_sample_init(esw);
#endif #endif
mapping_id = mlx5_query_nic_system_image_guid(esw->dev); mapping_id = mlx5_query_nic_system_image_guid(esw->dev);
...@@ -5022,7 +5022,7 @@ int mlx5e_tc_esw_init(struct rhashtable *tc_ht) ...@@ -5022,7 +5022,7 @@ int mlx5e_tc_esw_init(struct rhashtable *tc_ht)
mapping_destroy(uplink_priv->tunnel_mapping); mapping_destroy(uplink_priv->tunnel_mapping);
err_tun_mapping: err_tun_mapping:
#if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE) #if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE)
mlx5_esw_sample_cleanup(uplink_priv->esw_psample); mlx5e_tc_sample_cleanup(uplink_priv->tc_psample);
#endif #endif
mlx5_tc_ct_clean(uplink_priv->ct_priv); mlx5_tc_ct_clean(uplink_priv->ct_priv);
netdev_warn(priv->netdev, netdev_warn(priv->netdev,
...@@ -5043,7 +5043,7 @@ void mlx5e_tc_esw_cleanup(struct rhashtable *tc_ht) ...@@ -5043,7 +5043,7 @@ void mlx5e_tc_esw_cleanup(struct rhashtable *tc_ht)
mapping_destroy(uplink_priv->tunnel_mapping); mapping_destroy(uplink_priv->tunnel_mapping);
#if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE) #if IS_ENABLED(CONFIG_MLX5_TC_SAMPLE)
mlx5_esw_sample_cleanup(uplink_priv->esw_psample); mlx5e_tc_sample_cleanup(uplink_priv->tc_psample);
#endif #endif
mlx5_tc_ct_clean(uplink_priv->ct_priv); mlx5_tc_ct_clean(uplink_priv->ct_priv);
} }
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#include "lib/fs_chains.h" #include "lib/fs_chains.h"
#include "sf/sf.h" #include "sf/sf.h"
#include "en/tc_ct.h" #include "en/tc_ct.h"
#include "esw/sample.h" #include "en/tc/sample.h"
enum mlx5_mapped_obj_type { enum mlx5_mapped_obj_type {
MLX5_MAPPED_OBJ_CHAIN, MLX5_MAPPED_OBJ_CHAIN,
...@@ -469,7 +469,7 @@ struct mlx5_esw_flow_attr { ...@@ -469,7 +469,7 @@ struct mlx5_esw_flow_attr {
} dests[MLX5_MAX_FLOW_FWD_VPORTS]; } dests[MLX5_MAX_FLOW_FWD_VPORTS];
struct mlx5_rx_tun_attr *rx_tun_attr; struct mlx5_rx_tun_attr *rx_tun_attr;
struct mlx5_pkt_reformat *decap_pkt_reformat; struct mlx5_pkt_reformat *decap_pkt_reformat;
struct mlx5_sample_attr *sample; struct mlx5e_sample_attr *sample;
}; };
int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode, int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment