Commit 3cfef195 authored by David S. Miller's avatar David S. Miller

Merge branch 'mlx5-aRFS'

Saeed Mahameed says:

====================
Mellanox 100G mlx5 ethernet aRFS support

This series adds accelerated RFS support for the mlx5e driver.
I have added one patch non-related to aRFS that fixes the rtnl_lock
warning mlx5 driver been getting since b7aade15 ('vxlan: break dependency with netdev drivers')

aRFS support in details:

A direct TIR per RQ is now required in order to have the essential building blocks
for aRFS.  Today the driver has one direct TIR that forwards traffic to RQ[0] (core 0),
and one indirect TIR for RSS indirection table.  For that we've added one direct TIR
per RQ, e.g.: TIR[i] -> RQ[i] (core i).

Publicize Modify flow rule destination and reveal it in flow steering API, to have the
ability to dynamically modify the destination TIR(core) for aRFS rules from the
ethernet driver.

Initializing CPU reverse mapping to notify upper layer on internal receive queue cpu
mappings.

Some design refactoring for mlx5e ethernet driver flow tables and flow steering API.
Now the caller of create_flow_table can choose the level of the flow table, this way
we will create the mlx5e flow tables in a reversed order and connect them as we go,
we create flow table[i+1] before flow table[i] to be able to set flow table[i + 1] as
a destination of flow table[i] once flow table[i] is created.
also we have split the main flow table in the following manner:
    - From before: RX packet had to visit two flow tables until it is delivered to its receive queue:
        RX packet -> vlan filter flow table -> main flow table.
        > vlan filter will check the packet vlan field is allowed.
        > main flow will check if the dest mac is allowed and will check the l3/l4 headers to
        retrieve the RSS hash for steering the packet into its final receive queue.

    - Now main flow table is split into l2 dst mac steering table and ttc (traffic type classifier) table:
        RX packet -> vlan filter -> l2 table -> ttc table
        > vlan filter - same as before
        > L2 filter - filter packets according their destination mac address
        > ttc table - classify packet headers for RSS steering
            - L3/L4 classification rules to steer the packet according to thier headers hash
            - in case of none of the rules applies the packet is steered to RQ[0]

After the above refactoring all left to-do is to create aRFS flow table which will manage
aRFS steering rules to forward traffic to the desired RQ (core) and just connect the ttc
table rules destinations to aRFS flow table.

aRFS flow table in case of a miss will deliver the traffic to the core where the original
ttc hash would have chosen.

TTC table is not initialized and enabled until the user explicitly asks to, i.e. setting the NETIF_F_NTUPLE
to ON.  This way there is no need for ttc table to forward traffic to aRFS table unless required.
When setting back to OFF aRFS flow table is disabled and disconnected.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4b2523c1 45bf454a
...@@ -1438,7 +1438,8 @@ static struct mlx5_ib_flow_prio *get_flow_table(struct mlx5_ib_dev *dev, ...@@ -1438,7 +1438,8 @@ static struct mlx5_ib_flow_prio *get_flow_table(struct mlx5_ib_dev *dev,
if (!ft) { if (!ft) {
ft = mlx5_create_auto_grouped_flow_table(ns, priority, ft = mlx5_create_auto_grouped_flow_table(ns, priority,
num_entries, num_entries,
num_groups); num_groups,
0);
if (!IS_ERR(ft)) { if (!IS_ERR(ft)) {
prio->refcount = 0; prio->refcount = 0;
......
...@@ -9,3 +9,4 @@ mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o eswitch.o \ ...@@ -9,3 +9,4 @@ mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o eswitch.o \
en_txrx.o en_clock.o vxlan.o en_tc.o en_txrx.o en_clock.o vxlan.o en_tc.o
mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) += en_dcbnl.o mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) += en_dcbnl.o
mlx5_core-$(CONFIG_RFS_ACCEL) += en_arfs.o
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
#include "mlx5_core.h" #include "mlx5_core.h"
#include "en_stats.h" #include "en_stats.h"
#define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v)
#define MLX5E_MAX_NUM_TC 8 #define MLX5E_MAX_NUM_TC 8
#define MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE 0x6 #define MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE 0x6
...@@ -385,42 +387,42 @@ enum mlx5e_traffic_types { ...@@ -385,42 +387,42 @@ enum mlx5e_traffic_types {
MLX5E_TT_IPV6, MLX5E_TT_IPV6,
MLX5E_TT_ANY, MLX5E_TT_ANY,
MLX5E_NUM_TT, MLX5E_NUM_TT,
MLX5E_NUM_INDIR_TIRS = MLX5E_TT_ANY,
}; };
#define IS_HASHING_TT(tt) (tt != MLX5E_TT_ANY) enum {
MLX5E_STATE_ASYNC_EVENTS_ENABLE,
MLX5E_STATE_OPENED,
MLX5E_STATE_DESTROYING,
};
enum mlx5e_rqt_ix { struct mlx5e_vxlan_db {
MLX5E_INDIRECTION_RQT, spinlock_t lock; /* protect vxlan table */
MLX5E_SINGLE_RQ_RQT, struct radix_tree_root tree;
MLX5E_NUM_RQT,
}; };
struct mlx5e_eth_addr_info { struct mlx5e_l2_rule {
u8 addr[ETH_ALEN + 2]; u8 addr[ETH_ALEN + 2];
u32 tt_vec; struct mlx5_flow_rule *rule;
struct mlx5_flow_rule *ft_rule[MLX5E_NUM_TT];
}; };
#define MLX5E_ETH_ADDR_HASH_SIZE (1 << BITS_PER_BYTE) struct mlx5e_flow_table {
int num_groups;
struct mlx5e_eth_addr_db { struct mlx5_flow_table *t;
struct hlist_head netdev_uc[MLX5E_ETH_ADDR_HASH_SIZE]; struct mlx5_flow_group **g;
struct hlist_head netdev_mc[MLX5E_ETH_ADDR_HASH_SIZE];
struct mlx5e_eth_addr_info broadcast;
struct mlx5e_eth_addr_info allmulti;
struct mlx5e_eth_addr_info promisc;
bool broadcast_enabled;
bool allmulti_enabled;
bool promisc_enabled;
}; };
enum { #define MLX5E_L2_ADDR_HASH_SIZE BIT(BITS_PER_BYTE)
MLX5E_STATE_ASYNC_EVENTS_ENABLE,
MLX5E_STATE_OPENED, struct mlx5e_tc_table {
MLX5E_STATE_DESTROYING, struct mlx5_flow_table *t;
struct rhashtable_params ht_params;
struct rhashtable ht;
}; };
struct mlx5e_vlan_db { struct mlx5e_vlan_table {
struct mlx5e_flow_table ft;
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
struct mlx5_flow_rule *active_vlans_rule[VLAN_N_VID]; struct mlx5_flow_rule *active_vlans_rule[VLAN_N_VID];
struct mlx5_flow_rule *untagged_rule; struct mlx5_flow_rule *untagged_rule;
...@@ -428,29 +430,74 @@ struct mlx5e_vlan_db { ...@@ -428,29 +430,74 @@ struct mlx5e_vlan_db {
bool filter_disabled; bool filter_disabled;
}; };
struct mlx5e_vxlan_db { struct mlx5e_l2_table {
spinlock_t lock; /* protect vxlan table */ struct mlx5e_flow_table ft;
struct radix_tree_root tree; struct hlist_head netdev_uc[MLX5E_L2_ADDR_HASH_SIZE];
struct hlist_head netdev_mc[MLX5E_L2_ADDR_HASH_SIZE];
struct mlx5e_l2_rule broadcast;
struct mlx5e_l2_rule allmulti;
struct mlx5e_l2_rule promisc;
bool broadcast_enabled;
bool allmulti_enabled;
bool promisc_enabled;
}; };
struct mlx5e_flow_table { /* L3/L4 traffic type classifier */
int num_groups; struct mlx5e_ttc_table {
struct mlx5_flow_table *t; struct mlx5e_flow_table ft;
struct mlx5_flow_group **g; struct mlx5_flow_rule *rules[MLX5E_NUM_TT];
}; };
struct mlx5e_tc_flow_table { #define ARFS_HASH_SHIFT BITS_PER_BYTE
struct mlx5_flow_table *t; #define ARFS_HASH_SIZE BIT(BITS_PER_BYTE)
struct arfs_table {
struct mlx5e_flow_table ft;
struct mlx5_flow_rule *default_rule;
struct hlist_head rules_hash[ARFS_HASH_SIZE];
};
struct rhashtable_params ht_params; enum arfs_type {
struct rhashtable ht; 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_ARFS_FT_LEVEL
};
struct mlx5e_flow_steering {
struct mlx5_flow_namespace *ns;
struct mlx5e_tc_table tc;
struct mlx5e_vlan_table vlan;
struct mlx5e_l2_table l2;
struct mlx5e_ttc_table ttc;
struct mlx5e_arfs_tables arfs;
}; };
struct mlx5e_flow_tables { struct mlx5e_direct_tir {
struct mlx5_flow_namespace *ns; u32 tirn;
struct mlx5e_tc_flow_table tc; u32 rqtn;
struct mlx5e_flow_table vlan; };
struct mlx5e_flow_table main;
enum {
MLX5E_TC_PRIO = 0,
MLX5E_NIC_PRIO
}; };
struct mlx5e_priv { struct mlx5e_priv {
...@@ -470,12 +517,11 @@ struct mlx5e_priv { ...@@ -470,12 +517,11 @@ struct mlx5e_priv {
struct mlx5e_channel **channel; struct mlx5e_channel **channel;
u32 tisn[MLX5E_MAX_NUM_TC]; u32 tisn[MLX5E_MAX_NUM_TC];
u32 rqtn[MLX5E_NUM_RQT]; u32 indir_rqtn;
u32 tirn[MLX5E_NUM_TT]; u32 indir_tirn[MLX5E_NUM_INDIR_TIRS];
struct mlx5e_direct_tir direct_tir[MLX5E_MAX_NUM_CHANNELS];
struct mlx5e_flow_tables fts; struct mlx5e_flow_steering fs;
struct mlx5e_eth_addr_db eth_addr;
struct mlx5e_vlan_db vlan;
struct mlx5e_vxlan_db vxlan; struct mlx5e_vxlan_db vxlan;
struct mlx5e_params params; struct mlx5e_params params;
...@@ -557,9 +603,10 @@ struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq); ...@@ -557,9 +603,10 @@ struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq);
void mlx5e_update_stats(struct mlx5e_priv *priv); void mlx5e_update_stats(struct mlx5e_priv *priv);
int mlx5e_create_flow_tables(struct mlx5e_priv *priv); int mlx5e_create_flow_steering(struct mlx5e_priv *priv);
void mlx5e_destroy_flow_tables(struct mlx5e_priv *priv); void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv);
void mlx5e_init_eth_addr(struct mlx5e_priv *priv); void mlx5e_init_l2_addr(struct mlx5e_priv *priv);
void mlx5e_destroy_flow_table(struct mlx5e_flow_table *ft);
void mlx5e_set_rx_mode_work(struct work_struct *work); void mlx5e_set_rx_mode_work(struct work_struct *work);
void mlx5e_fill_hwstamp(struct mlx5e_tstamp *clock, u64 timestamp, void mlx5e_fill_hwstamp(struct mlx5e_tstamp *clock, u64 timestamp,
...@@ -578,7 +625,7 @@ void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv); ...@@ -578,7 +625,7 @@ void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv);
int mlx5e_modify_rqs_vsd(struct mlx5e_priv *priv, bool vsd); int mlx5e_modify_rqs_vsd(struct mlx5e_priv *priv, bool vsd);
int mlx5e_redirect_rqt(struct mlx5e_priv *priv, enum mlx5e_rqt_ix rqt_ix); int mlx5e_redirect_rqt(struct mlx5e_priv *priv, u32 rqtn, int sz, int ix);
void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv); void mlx5e_build_tir_ctx_hash(void *tirc, struct mlx5e_priv *priv);
int mlx5e_open_locked(struct net_device *netdev); int mlx5e_open_locked(struct net_device *netdev);
...@@ -636,6 +683,32 @@ extern const struct dcbnl_rtnl_ops mlx5e_dcbnl_ops; ...@@ -636,6 +683,32 @@ extern const struct dcbnl_rtnl_ops mlx5e_dcbnl_ops;
int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets); int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets);
#endif #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 -ENOTSUPP;
}
static inline int mlx5e_arfs_disable(struct mlx5e_priv *priv)
{
return -ENOTSUPP;
}
#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
u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev); u16 mlx5e_get_max_inline_cap(struct mlx5_core_dev *mdev);
#endif /* __MLX5_EN_H__ */ #endif /* __MLX5_EN_H__ */
This diff is collapsed.
...@@ -456,6 +456,7 @@ static int mlx5e_set_channels(struct net_device *dev, ...@@ -456,6 +456,7 @@ static int mlx5e_set_channels(struct net_device *dev,
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
int ncv = mlx5e_get_max_num_channels(priv->mdev); int ncv = mlx5e_get_max_num_channels(priv->mdev);
unsigned int count = ch->combined_count; unsigned int count = ch->combined_count;
bool arfs_enabled;
bool was_opened; bool was_opened;
int err = 0; int err = 0;
...@@ -484,13 +485,27 @@ static int mlx5e_set_channels(struct net_device *dev, ...@@ -484,13 +485,27 @@ static int mlx5e_set_channels(struct net_device *dev,
if (was_opened) if (was_opened)
mlx5e_close_locked(dev); mlx5e_close_locked(dev);
arfs_enabled = dev->features & NETIF_F_NTUPLE;
if (arfs_enabled)
mlx5e_arfs_disable(priv);
priv->params.num_channels = count; priv->params.num_channels = count;
mlx5e_build_default_indir_rqt(priv->mdev, priv->params.indirection_rqt, mlx5e_build_default_indir_rqt(priv->mdev, priv->params.indirection_rqt,
MLX5E_INDIR_RQT_SIZE, count); MLX5E_INDIR_RQT_SIZE, count);
if (was_opened) if (was_opened)
err = mlx5e_open_locked(dev); err = mlx5e_open_locked(dev);
if (err)
goto out;
if (arfs_enabled) {
err = mlx5e_arfs_enable(priv);
if (err)
netdev_err(dev, "%s: mlx5e_arfs_enable failed: %d\n",
__func__, err);
}
out:
mutex_unlock(&priv->state_lock); mutex_unlock(&priv->state_lock);
return err; return err;
...@@ -826,9 +841,8 @@ static void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen) ...@@ -826,9 +841,8 @@ static void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen)
MLX5_SET(modify_tir_in, in, bitmask.hash, 1); MLX5_SET(modify_tir_in, in, bitmask.hash, 1);
mlx5e_build_tir_ctx_hash(tirc, priv); mlx5e_build_tir_ctx_hash(tirc, priv);
for (i = 0; i < MLX5E_NUM_TT; i++) for (i = 0; i < MLX5E_NUM_INDIR_TIRS; i++)
if (IS_HASHING_TT(i)) mlx5_core_modify_tir(mdev, priv->indir_tirn[i], in, inlen);
mlx5_core_modify_tir(mdev, priv->tirn[i], in, inlen);
} }
static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
...@@ -850,9 +864,11 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, ...@@ -850,9 +864,11 @@ static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
if (indir) { if (indir) {
u32 rqtn = priv->indir_rqtn;
memcpy(priv->params.indirection_rqt, indir, memcpy(priv->params.indirection_rqt, indir,
sizeof(priv->params.indirection_rqt)); sizeof(priv->params.indirection_rqt));
mlx5e_redirect_rqt(priv, MLX5E_INDIRECTION_RQT); mlx5e_redirect_rqt(priv, rqtn, MLX5E_INDIR_RQT_SIZE, 0);
} }
if (key) if (key)
......
...@@ -46,8 +46,8 @@ struct mlx5e_tc_flow { ...@@ -46,8 +46,8 @@ struct mlx5e_tc_flow {
struct mlx5_flow_rule *rule; struct mlx5_flow_rule *rule;
}; };
#define MLX5E_TC_FLOW_TABLE_NUM_ENTRIES 1024 #define MLX5E_TC_TABLE_NUM_ENTRIES 1024
#define MLX5E_TC_FLOW_TABLE_NUM_GROUPS 4 #define MLX5E_TC_TABLE_NUM_GROUPS 4
static struct mlx5_flow_rule *mlx5e_tc_add_flow(struct mlx5e_priv *priv, static struct mlx5_flow_rule *mlx5e_tc_add_flow(struct mlx5e_priv *priv,
u32 *match_c, u32 *match_v, u32 *match_c, u32 *match_v,
...@@ -55,33 +55,35 @@ static struct mlx5_flow_rule *mlx5e_tc_add_flow(struct mlx5e_priv *priv, ...@@ -55,33 +55,35 @@ static struct mlx5_flow_rule *mlx5e_tc_add_flow(struct mlx5e_priv *priv,
{ {
struct mlx5_flow_destination dest = { struct mlx5_flow_destination dest = {
.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE, .type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE,
{.ft = priv->fts.vlan.t}, {.ft = priv->fs.vlan.ft.t},
}; };
struct mlx5_flow_rule *rule; struct mlx5_flow_rule *rule;
bool table_created = false; bool table_created = false;
if (IS_ERR_OR_NULL(priv->fts.tc.t)) { if (IS_ERR_OR_NULL(priv->fs.tc.t)) {
priv->fts.tc.t = priv->fs.tc.t =
mlx5_create_auto_grouped_flow_table(priv->fts.ns, 0, mlx5_create_auto_grouped_flow_table(priv->fs.ns,
MLX5E_TC_FLOW_TABLE_NUM_ENTRIES, MLX5E_TC_PRIO,
MLX5E_TC_FLOW_TABLE_NUM_GROUPS); MLX5E_TC_TABLE_NUM_ENTRIES,
if (IS_ERR(priv->fts.tc.t)) { MLX5E_TC_TABLE_NUM_GROUPS,
0);
if (IS_ERR(priv->fs.tc.t)) {
netdev_err(priv->netdev, netdev_err(priv->netdev,
"Failed to create tc offload table\n"); "Failed to create tc offload table\n");
return ERR_CAST(priv->fts.tc.t); return ERR_CAST(priv->fs.tc.t);
} }
table_created = true; table_created = true;
} }
rule = mlx5_add_flow_rule(priv->fts.tc.t, MLX5_MATCH_OUTER_HEADERS, rule = mlx5_add_flow_rule(priv->fs.tc.t, MLX5_MATCH_OUTER_HEADERS,
match_c, match_v, match_c, match_v,
action, flow_tag, action, flow_tag,
action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ? &dest : NULL); action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ? &dest : NULL);
if (IS_ERR(rule) && table_created) { if (IS_ERR(rule) && table_created) {
mlx5_destroy_flow_table(priv->fts.tc.t); mlx5_destroy_flow_table(priv->fs.tc.t);
priv->fts.tc.t = NULL; priv->fs.tc.t = NULL;
} }
return rule; return rule;
...@@ -93,8 +95,8 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv, ...@@ -93,8 +95,8 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
mlx5_del_flow_rule(rule); mlx5_del_flow_rule(rule);
if (!mlx5e_tc_num_filters(priv)) { if (!mlx5e_tc_num_filters(priv)) {
mlx5_destroy_flow_table(priv->fts.tc.t); mlx5_destroy_flow_table(priv->fs.tc.t);
priv->fts.tc.t = NULL; priv->fs.tc.t = NULL;
} }
} }
...@@ -310,7 +312,7 @@ static int parse_tc_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -310,7 +312,7 @@ static int parse_tc_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol, int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
struct tc_cls_flower_offload *f) struct tc_cls_flower_offload *f)
{ {
struct mlx5e_tc_flow_table *tc = &priv->fts.tc; struct mlx5e_tc_table *tc = &priv->fs.tc;
u32 *match_c; u32 *match_c;
u32 *match_v; u32 *match_v;
int err = 0; int err = 0;
...@@ -376,7 +378,7 @@ int mlx5e_delete_flower(struct mlx5e_priv *priv, ...@@ -376,7 +378,7 @@ int mlx5e_delete_flower(struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f) struct tc_cls_flower_offload *f)
{ {
struct mlx5e_tc_flow *flow; struct mlx5e_tc_flow *flow;
struct mlx5e_tc_flow_table *tc = &priv->fts.tc; struct mlx5e_tc_table *tc = &priv->fs.tc;
flow = rhashtable_lookup_fast(&tc->ht, &f->cookie, flow = rhashtable_lookup_fast(&tc->ht, &f->cookie,
tc->ht_params); tc->ht_params);
...@@ -401,7 +403,7 @@ static const struct rhashtable_params mlx5e_tc_flow_ht_params = { ...@@ -401,7 +403,7 @@ static const struct rhashtable_params mlx5e_tc_flow_ht_params = {
int mlx5e_tc_init(struct mlx5e_priv *priv) int mlx5e_tc_init(struct mlx5e_priv *priv)
{ {
struct mlx5e_tc_flow_table *tc = &priv->fts.tc; struct mlx5e_tc_table *tc = &priv->fs.tc;
tc->ht_params = mlx5e_tc_flow_ht_params; tc->ht_params = mlx5e_tc_flow_ht_params;
return rhashtable_init(&tc->ht, &tc->ht_params); return rhashtable_init(&tc->ht, &tc->ht_params);
...@@ -418,12 +420,12 @@ static void _mlx5e_tc_del_flow(void *ptr, void *arg) ...@@ -418,12 +420,12 @@ static void _mlx5e_tc_del_flow(void *ptr, void *arg)
void mlx5e_tc_cleanup(struct mlx5e_priv *priv) void mlx5e_tc_cleanup(struct mlx5e_priv *priv)
{ {
struct mlx5e_tc_flow_table *tc = &priv->fts.tc; struct mlx5e_tc_table *tc = &priv->fs.tc;
rhashtable_free_and_destroy(&tc->ht, _mlx5e_tc_del_flow, priv); rhashtable_free_and_destroy(&tc->ht, _mlx5e_tc_del_flow, priv);
if (!IS_ERR_OR_NULL(priv->fts.tc.t)) { if (!IS_ERR_OR_NULL(tc->t)) {
mlx5_destroy_flow_table(priv->fts.tc.t); mlx5_destroy_flow_table(tc->t);
priv->fts.tc.t = NULL; tc->t = NULL;
} }
} }
...@@ -45,7 +45,7 @@ int mlx5e_delete_flower(struct mlx5e_priv *priv, ...@@ -45,7 +45,7 @@ int mlx5e_delete_flower(struct mlx5e_priv *priv,
static inline int mlx5e_tc_num_filters(struct mlx5e_priv *priv) static inline int mlx5e_tc_num_filters(struct mlx5e_priv *priv)
{ {
return atomic_read(&priv->fts.tc.ht.nelems); return atomic_read(&priv->fs.tc.ht.nelems);
} }
#endif /* __MLX5_EN_TC_H__ */ #endif /* __MLX5_EN_TC_H__ */
...@@ -401,7 +401,7 @@ static int esw_create_fdb_table(struct mlx5_eswitch *esw, int nvports) ...@@ -401,7 +401,7 @@ static int esw_create_fdb_table(struct mlx5_eswitch *esw, int nvports)
memset(flow_group_in, 0, inlen); memset(flow_group_in, 0, inlen);
table_size = BIT(MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size)); table_size = BIT(MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size));
fdb = mlx5_create_flow_table(root_ns, 0, table_size); fdb = mlx5_create_flow_table(root_ns, 0, table_size, 0);
if (IS_ERR_OR_NULL(fdb)) { if (IS_ERR_OR_NULL(fdb)) {
err = PTR_ERR(fdb); err = PTR_ERR(fdb);
esw_warn(dev, "Failed to create FDB Table err %d\n", err); esw_warn(dev, "Failed to create FDB Table err %d\n", err);
......
...@@ -107,7 +107,7 @@ struct fs_fte { ...@@ -107,7 +107,7 @@ struct fs_fte {
/* Type of children is mlx5_flow_table/namespace */ /* Type of children is mlx5_flow_table/namespace */
struct fs_prio { struct fs_prio {
struct fs_node node; struct fs_node node;
unsigned int max_ft; unsigned int num_levels;
unsigned int start_level; unsigned int start_level;
unsigned int prio; unsigned int prio;
unsigned int num_ft; unsigned int num_ft;
......
...@@ -48,6 +48,9 @@ ...@@ -48,6 +48,9 @@
#include <linux/kmod.h> #include <linux/kmod.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/mlx5/mlx5_ifc.h> #include <linux/mlx5/mlx5_ifc.h>
#ifdef CONFIG_RFS_ACCEL
#include <linux/cpu_rmap.h>
#endif
#include "mlx5_core.h" #include "mlx5_core.h"
#include "fs_core.h" #include "fs_core.h"
#ifdef CONFIG_MLX5_CORE_EN #ifdef CONFIG_MLX5_CORE_EN
...@@ -665,6 +668,12 @@ static void free_comp_eqs(struct mlx5_core_dev *dev) ...@@ -665,6 +668,12 @@ static void free_comp_eqs(struct mlx5_core_dev *dev)
struct mlx5_eq_table *table = &dev->priv.eq_table; struct mlx5_eq_table *table = &dev->priv.eq_table;
struct mlx5_eq *eq, *n; struct mlx5_eq *eq, *n;
#ifdef CONFIG_RFS_ACCEL
if (dev->rmap) {
free_irq_cpu_rmap(dev->rmap);
dev->rmap = NULL;
}
#endif
spin_lock(&table->lock); spin_lock(&table->lock);
list_for_each_entry_safe(eq, n, &table->comp_eqs_list, list) { list_for_each_entry_safe(eq, n, &table->comp_eqs_list, list) {
list_del(&eq->list); list_del(&eq->list);
...@@ -691,6 +700,11 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev) ...@@ -691,6 +700,11 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev)
INIT_LIST_HEAD(&table->comp_eqs_list); INIT_LIST_HEAD(&table->comp_eqs_list);
ncomp_vec = table->num_comp_vectors; ncomp_vec = table->num_comp_vectors;
nent = MLX5_COMP_EQ_SIZE; nent = MLX5_COMP_EQ_SIZE;
#ifdef CONFIG_RFS_ACCEL
dev->rmap = alloc_irq_cpu_rmap(ncomp_vec);
if (!dev->rmap)
return -ENOMEM;
#endif
for (i = 0; i < ncomp_vec; i++) { for (i = 0; i < ncomp_vec; i++) {
eq = kzalloc(sizeof(*eq), GFP_KERNEL); eq = kzalloc(sizeof(*eq), GFP_KERNEL);
if (!eq) { if (!eq) {
...@@ -698,6 +712,10 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev) ...@@ -698,6 +712,10 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev)
goto clean; goto clean;
} }
#ifdef CONFIG_RFS_ACCEL
irq_cpu_rmap_add(dev->rmap,
dev->priv.msix_arr[i + MLX5_EQ_VEC_COMP_BASE].vector);
#endif
snprintf(name, MLX5_MAX_IRQ_NAME, "mlx5_comp%d", i); snprintf(name, MLX5_MAX_IRQ_NAME, "mlx5_comp%d", i);
err = mlx5_create_map_eq(dev, eq, err = mlx5_create_map_eq(dev, eq,
i + MLX5_EQ_VEC_COMP_BASE, nent, 0, i + MLX5_EQ_VEC_COMP_BASE, nent, 0,
......
...@@ -560,6 +560,9 @@ struct mlx5_core_dev { ...@@ -560,6 +560,9 @@ struct mlx5_core_dev {
struct mlx5_profile *profile; struct mlx5_profile *profile;
atomic_t num_qps; atomic_t num_qps;
u32 issi; u32 issi;
#ifdef CONFIG_RFS_ACCEL
struct cpu_rmap *rmap;
#endif
}; };
struct mlx5_db { struct mlx5_db {
......
...@@ -82,12 +82,14 @@ struct mlx5_flow_table * ...@@ -82,12 +82,14 @@ struct mlx5_flow_table *
mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns, mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
int prio, int prio,
int num_flow_table_entries, int num_flow_table_entries,
int max_num_groups); int max_num_groups,
u32 level);
struct mlx5_flow_table * struct mlx5_flow_table *
mlx5_create_flow_table(struct mlx5_flow_namespace *ns, mlx5_create_flow_table(struct mlx5_flow_namespace *ns,
int prio, int prio,
int num_flow_table_entries); int num_flow_table_entries,
u32 level);
int mlx5_destroy_flow_table(struct mlx5_flow_table *ft); int mlx5_destroy_flow_table(struct mlx5_flow_table *ft);
/* inbox should be set with the following values: /* inbox should be set with the following values:
...@@ -113,4 +115,7 @@ mlx5_add_flow_rule(struct mlx5_flow_table *ft, ...@@ -113,4 +115,7 @@ mlx5_add_flow_rule(struct mlx5_flow_table *ft,
struct mlx5_flow_destination *dest); struct mlx5_flow_destination *dest);
void mlx5_del_flow_rule(struct mlx5_flow_rule *fr); void mlx5_del_flow_rule(struct mlx5_flow_rule *fr);
int mlx5_modify_rule_destination(struct mlx5_flow_rule *rule,
struct mlx5_flow_destination *dest);
#endif #endif
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