Commit 3f22d6c7 authored by Maxim Mikityanskiy's avatar Maxim Mikityanskiy Committed by Saeed Mahameed

net/mlx5e: Move RX resources to a separate struct

This commit moves RQTs and TIRs to a separate struct that is allocated
dynamically in profiles that support these RX resources (all profiles,
except IPoIB PKey). It also allows to remove rqt_enabled flags, as RQTs
are always enabled in profiles that support RX resources.
Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 4ad31849
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
#include "en/qos.h" #include "en/qos.h"
#include "lib/hv_vhca.h" #include "lib/hv_vhca.h"
#include "lib/clock.h" #include "lib/clock.h"
#include "en/rqt.h" #include "en/rx_res.h"
extern const struct net_device_ops mlx5e_netdev_ops; extern const struct net_device_ops mlx5e_netdev_ops;
struct page_pool; struct page_pool;
...@@ -141,7 +141,6 @@ struct page_pool; ...@@ -141,7 +141,6 @@ struct page_pool;
#define MLX5E_PARAMS_DEFAULT_MIN_RX_WQES_MPW 0x2 #define MLX5E_PARAMS_DEFAULT_MIN_RX_WQES_MPW 0x2
#define MLX5E_MIN_NUM_CHANNELS 0x1 #define MLX5E_MIN_NUM_CHANNELS 0x1
#define MLX5E_MAX_NUM_CHANNELS (MLX5E_INDIR_RQT_SIZE / 2)
#define MLX5E_MAX_NUM_SQS (MLX5E_MAX_NUM_CHANNELS * MLX5E_MAX_NUM_TC) #define MLX5E_MAX_NUM_SQS (MLX5E_MAX_NUM_CHANNELS * MLX5E_MAX_NUM_TC)
#define MLX5E_TX_CQ_POLL_BUDGET 128 #define MLX5E_TX_CQ_POLL_BUDGET 128
#define MLX5E_TX_XSK_POLL_BUDGET 64 #define MLX5E_TX_XSK_POLL_BUDGET 64
...@@ -744,25 +743,11 @@ enum { ...@@ -744,25 +743,11 @@ enum {
MLX5E_STATE_XDP_ACTIVE, MLX5E_STATE_XDP_ACTIVE,
}; };
struct mlx5e_tir {
u32 tirn;
struct mlx5e_rqt rqt;
bool rqt_enabled;
struct list_head list;
};
enum { enum {
MLX5E_TC_PRIO = 0, MLX5E_TC_PRIO = 0,
MLX5E_NIC_PRIO MLX5E_NIC_PRIO
}; };
struct mlx5e_rss_params {
struct mlx5e_rss_params_indir indir;
u32 rx_hash_fields[MLX5E_NUM_INDIR_TIRS];
u8 toeplitz_hash_key[40];
u8 hfunc;
};
struct mlx5e_modify_sq_param { struct mlx5e_modify_sq_param {
int curr_state; int curr_state;
int next_state; int next_state;
...@@ -832,14 +817,7 @@ struct mlx5e_priv { ...@@ -832,14 +817,7 @@ struct mlx5e_priv {
struct mlx5e_channels channels; struct mlx5e_channels channels;
u32 tisn[MLX5_MAX_PORTS][MLX5E_MAX_NUM_TC]; u32 tisn[MLX5_MAX_PORTS][MLX5E_MAX_NUM_TC];
struct mlx5e_rqt indir_rqt; struct mlx5e_rx_res *rx_res;
bool indir_rqt_enabled;
struct mlx5e_tir indir_tir[MLX5E_NUM_INDIR_TIRS];
struct mlx5e_tir inner_indir_tir[MLX5E_NUM_INDIR_TIRS];
struct mlx5e_tir direct_tir[MLX5E_MAX_NUM_CHANNELS];
struct mlx5e_tir xsk_tir[MLX5E_MAX_NUM_CHANNELS];
struct mlx5e_tir ptp_tir;
struct mlx5e_rss_params rss_params;
u32 tx_rates[MLX5E_MAX_NUM_SQS]; u32 tx_rates[MLX5E_MAX_NUM_SQS];
struct mlx5e_flow_steering fs; struct mlx5e_flow_steering fs;
......
...@@ -160,6 +160,8 @@ enum { ...@@ -160,6 +160,8 @@ enum {
MLX5E_INNER_TTC_GROUP2_SIZE +\ MLX5E_INNER_TTC_GROUP2_SIZE +\
MLX5E_INNER_TTC_GROUP3_SIZE) MLX5E_INNER_TTC_GROUP3_SIZE)
struct mlx5e_priv;
#ifdef CONFIG_MLX5_EN_RXNFC #ifdef CONFIG_MLX5_EN_RXNFC
struct mlx5e_ethtool_table { struct mlx5e_ethtool_table {
......
...@@ -603,8 +603,8 @@ static void mlx5e_ptp_rx_unset_fs(struct mlx5e_priv *priv) ...@@ -603,8 +603,8 @@ static void mlx5e_ptp_rx_unset_fs(struct mlx5e_priv *priv)
static int mlx5e_ptp_rx_set_fs(struct mlx5e_priv *priv) static int mlx5e_ptp_rx_set_fs(struct mlx5e_priv *priv)
{ {
struct mlx5e_ptp_fs *ptp_fs = priv->fs.ptp_fs; struct mlx5e_ptp_fs *ptp_fs = priv->fs.ptp_fs;
u32 tirn = priv->rx_res->ptp_tir.tirn;
struct mlx5_flow_handle *rule; struct mlx5_flow_handle *rule;
u32 tirn = priv->ptp_tir.tirn;
int err; int err;
if (ptp_fs->valid) if (ptp_fs->valid)
......
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/* Copyright (c) 2021, Mellanox Technologies inc. All rights reserved. */
#ifndef __MLX5_EN_RX_RES_H__
#define __MLX5_EN_RX_RES_H__
#include <linux/kernel.h>
#include "rqt.h"
#include "fs.h"
#define MLX5E_MAX_NUM_CHANNELS (MLX5E_INDIR_RQT_SIZE / 2)
struct mlx5e_rss_params {
struct mlx5e_rss_params_indir indir;
u32 rx_hash_fields[MLX5E_NUM_INDIR_TIRS];
u8 toeplitz_hash_key[40];
u8 hfunc;
};
struct mlx5e_tir {
u32 tirn;
struct mlx5e_rqt rqt;
struct list_head list;
};
struct mlx5e_rx_res {
struct mlx5e_rqt indir_rqt;
struct mlx5e_tir indir_tirs[MLX5E_NUM_INDIR_TIRS];
struct mlx5e_tir inner_indir_tirs[MLX5E_NUM_INDIR_TIRS];
struct mlx5e_tir direct_tirs[MLX5E_MAX_NUM_CHANNELS];
struct mlx5e_tir xsk_tirs[MLX5E_MAX_NUM_CHANNELS];
struct mlx5e_tir ptp_tir;
struct mlx5e_rss_params rss_params;
};
#endif /* __MLX5_EN_RX_RES_H__ */
...@@ -186,12 +186,12 @@ void mlx5e_deactivate_xsk(struct mlx5e_channel *c) ...@@ -186,12 +186,12 @@ void mlx5e_deactivate_xsk(struct mlx5e_channel *c)
int mlx5e_xsk_redirect_rqt_to_channel(struct mlx5e_priv *priv, struct mlx5e_channel *c) int mlx5e_xsk_redirect_rqt_to_channel(struct mlx5e_priv *priv, struct mlx5e_channel *c)
{ {
return mlx5e_rqt_redirect_direct(&priv->xsk_tir[c->ix].rqt, c->xskrq.rqn); return mlx5e_rqt_redirect_direct(&priv->rx_res->xsk_tirs[c->ix].rqt, c->xskrq.rqn);
} }
int mlx5e_xsk_redirect_rqt_to_drop(struct mlx5e_priv *priv, u16 ix) int mlx5e_xsk_redirect_rqt_to_drop(struct mlx5e_priv *priv, u16 ix)
{ {
return mlx5e_rqt_redirect_direct(&priv->xsk_tir[ix].rqt, priv->drop_rq.rqn); return mlx5e_rqt_redirect_direct(&priv->rx_res->xsk_tirs[ix].rqt, priv->drop_rq.rqn);
} }
int mlx5e_xsk_redirect_rqts_to_channels(struct mlx5e_priv *priv, struct mlx5e_channels *chs) int mlx5e_xsk_redirect_rqts_to_channels(struct mlx5e_priv *priv, struct mlx5e_channels *chs)
......
...@@ -635,7 +635,7 @@ int mlx5e_ktls_add_rx(struct net_device *netdev, struct sock *sk, ...@@ -635,7 +635,7 @@ int mlx5e_ktls_add_rx(struct net_device *netdev, struct sock *sk,
priv_rx->sw_stats = &priv->tls->sw_stats; priv_rx->sw_stats = &priv->tls->sw_stats;
mlx5e_set_ktls_rx_priv_ctx(tls_ctx, priv_rx); mlx5e_set_ktls_rx_priv_ctx(tls_ctx, priv_rx);
rqtn = priv->direct_tir[rxq].rqt.rqtn; rqtn = priv->rx_res->direct_tirs[rxq].rqt.rqtn;
err = mlx5e_ktls_create_tir(mdev, &priv_rx->tirn, rqtn); err = mlx5e_ktls_create_tir(mdev, &priv_rx->tirn, rqtn);
if (err) if (err)
......
...@@ -192,7 +192,7 @@ static int arfs_add_default_rule(struct mlx5e_priv *priv, ...@@ -192,7 +192,7 @@ static int arfs_add_default_rule(struct mlx5e_priv *priv,
enum arfs_type type) enum arfs_type type)
{ {
struct arfs_table *arfs_t = &priv->fs.arfs->arfs_tables[type]; struct arfs_table *arfs_t = &priv->fs.arfs->arfs_tables[type];
struct mlx5e_tir *tir = priv->indir_tir; struct mlx5e_tir *tir = priv->rx_res->indir_tirs;
struct mlx5_flow_destination dest = {}; struct mlx5_flow_destination dest = {};
MLX5_DECLARE_FLOW_ACT(flow_act); MLX5_DECLARE_FLOW_ACT(flow_act);
enum mlx5e_traffic_types tt; enum mlx5e_traffic_types tt;
...@@ -553,7 +553,7 @@ static struct mlx5_flow_handle *arfs_add_rule(struct mlx5e_priv *priv, ...@@ -553,7 +553,7 @@ static struct mlx5_flow_handle *arfs_add_rule(struct mlx5e_priv *priv,
16); 16);
} }
dest.type = MLX5_FLOW_DESTINATION_TYPE_TIR; dest.type = MLX5_FLOW_DESTINATION_TYPE_TIR;
dest.tir_num = priv->direct_tir[arfs_rule->rxq].tirn; dest.tir_num = priv->rx_res->direct_tirs[arfs_rule->rxq].tirn;
rule = mlx5_add_flow_rules(ft, spec, &flow_act, &dest, 1); rule = mlx5_add_flow_rules(ft, spec, &flow_act, &dest, 1);
if (IS_ERR(rule)) { if (IS_ERR(rule)) {
err = PTR_ERR(rule); err = PTR_ERR(rule);
...@@ -576,7 +576,7 @@ static void arfs_modify_rule_rq(struct mlx5e_priv *priv, ...@@ -576,7 +576,7 @@ static void arfs_modify_rule_rq(struct mlx5e_priv *priv,
int err = 0; int err = 0;
dst.type = MLX5_FLOW_DESTINATION_TYPE_TIR; dst.type = MLX5_FLOW_DESTINATION_TYPE_TIR;
dst.tir_num = priv->direct_tir[rxq].tirn; dst.tir_num = priv->rx_res->direct_tirs[rxq].tirn;
err = mlx5_modify_rule_destination(rule, &dst, NULL); err = mlx5_modify_rule_destination(rule, &dst, NULL);
if (err) if (err)
netdev_warn(priv->netdev, netdev_warn(priv->netdev,
......
...@@ -1172,7 +1172,7 @@ static int mlx5e_set_link_ksettings(struct net_device *netdev, ...@@ -1172,7 +1172,7 @@ static int mlx5e_set_link_ksettings(struct net_device *netdev,
u32 mlx5e_ethtool_get_rxfh_key_size(struct mlx5e_priv *priv) u32 mlx5e_ethtool_get_rxfh_key_size(struct mlx5e_priv *priv)
{ {
return sizeof(priv->rss_params.toeplitz_hash_key); return sizeof(priv->rx_res->rss_params.toeplitz_hash_key);
} }
static u32 mlx5e_get_rxfh_key_size(struct net_device *netdev) static u32 mlx5e_get_rxfh_key_size(struct net_device *netdev)
...@@ -1198,7 +1198,9 @@ int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, ...@@ -1198,7 +1198,9 @@ int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
u8 *hfunc) u8 *hfunc)
{ {
struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5e_priv *priv = netdev_priv(netdev);
struct mlx5e_rss_params *rss = &priv->rss_params; struct mlx5e_rss_params *rss;
rss = &priv->rx_res->rss_params;
if (indir) if (indir)
memcpy(indir, rss->indir.table, sizeof(rss->indir.table)); memcpy(indir, rss->indir.table, sizeof(rss->indir.table));
...@@ -1217,8 +1219,8 @@ int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, ...@@ -1217,8 +1219,8 @@ int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
const u8 *key, const u8 hfunc) const u8 *key, const u8 hfunc)
{ {
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5e_rss_params *rss = &priv->rss_params;
int inlen = MLX5_ST_SZ_BYTES(modify_tir_in); int inlen = MLX5_ST_SZ_BYTES(modify_tir_in);
struct mlx5e_rss_params *rss;
bool refresh_tirs = false; bool refresh_tirs = false;
bool refresh_rqt = false; bool refresh_rqt = false;
void *in; void *in;
...@@ -1234,6 +1236,8 @@ int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, ...@@ -1234,6 +1236,8 @@ int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
rss = &priv->rx_res->rss_params;
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != rss->hfunc) { if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != rss->hfunc) {
rss->hfunc = hfunc; rss->hfunc = hfunc;
refresh_rqt = true; refresh_rqt = true;
...@@ -1261,7 +1265,8 @@ int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir, ...@@ -1261,7 +1265,8 @@ int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
for (ix = 0; ix < priv->channels.num; ix++) for (ix = 0; ix < priv->channels.num; ix++)
rqns[ix] = priv->channels.c[ix]->rq.rqn; rqns[ix] = priv->channels.c[ix]->rq.rqn;
mlx5e_rqt_redirect_indir(&priv->indir_rqt, rqns, priv->channels.num, mlx5e_rqt_redirect_indir(&priv->rx_res->indir_rqt, rqns,
priv->channels.num,
rss->hfunc, &rss->indir); rss->hfunc, &rss->indir);
kvfree(rqns); kvfree(rqns);
} }
......
...@@ -1320,7 +1320,7 @@ static int mlx5e_create_inner_ttc_table_groups(struct mlx5e_ttc_table *ttc) ...@@ -1320,7 +1320,7 @@ static int mlx5e_create_inner_ttc_table_groups(struct mlx5e_ttc_table *ttc)
void mlx5e_set_ttc_basic_params(struct mlx5e_priv *priv, void mlx5e_set_ttc_basic_params(struct mlx5e_priv *priv,
struct ttc_params *ttc_params) struct ttc_params *ttc_params)
{ {
ttc_params->any_tt_tirn = priv->direct_tir[0].tirn; ttc_params->any_tt_tirn = priv->rx_res->direct_tirs[0].tirn;
ttc_params->inner_ttc = &priv->fs.inner_ttc; ttc_params->inner_ttc = &priv->fs.inner_ttc;
} }
...@@ -1786,7 +1786,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv) ...@@ -1786,7 +1786,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv)
if (mlx5e_tunnel_inner_ft_supported(priv->mdev)) { if (mlx5e_tunnel_inner_ft_supported(priv->mdev)) {
mlx5e_set_inner_ttc_ft_params(&ttc_params); mlx5e_set_inner_ttc_ft_params(&ttc_params);
for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
ttc_params.indir_tirn[tt] = priv->inner_indir_tir[tt].tirn; ttc_params.indir_tirn[tt] = priv->rx_res->inner_indir_tirs[tt].tirn;
err = mlx5e_create_inner_ttc_table(priv, &ttc_params, &priv->fs.inner_ttc); err = mlx5e_create_inner_ttc_table(priv, &ttc_params, &priv->fs.inner_ttc);
if (err) { if (err) {
...@@ -1798,7 +1798,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv) ...@@ -1798,7 +1798,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv)
mlx5e_set_ttc_ft_params(&ttc_params); mlx5e_set_ttc_ft_params(&ttc_params);
for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
ttc_params.indir_tirn[tt] = priv->indir_tir[tt].tirn; ttc_params.indir_tirn[tt] = priv->rx_res->indir_tirs[tt].tirn;
err = mlx5e_create_ttc_table(priv, &ttc_params, &priv->fs.ttc); err = mlx5e_create_ttc_table(priv, &ttc_params, &priv->fs.ttc);
if (err) { if (err) {
......
...@@ -425,7 +425,8 @@ add_ethtool_flow_rule(struct mlx5e_priv *priv, ...@@ -425,7 +425,8 @@ add_ethtool_flow_rule(struct mlx5e_priv *priv,
u16 ix; u16 ix;
mlx5e_qid_get_ch_and_group(params, fs->ring_cookie, &ix, &group); mlx5e_qid_get_ch_and_group(params, fs->ring_cookie, &ix, &group);
tir = group == MLX5E_RQ_GROUP_XSK ? priv->xsk_tir : priv->direct_tir; tir = group == MLX5E_RQ_GROUP_XSK ? priv->rx_res->xsk_tirs :
priv->rx_res->direct_tirs;
dst = kzalloc(sizeof(*dst), GFP_KERNEL); dst = kzalloc(sizeof(*dst), GFP_KERNEL);
if (!dst) { if (!dst) {
...@@ -854,10 +855,10 @@ static int mlx5e_set_rss_hash_opt(struct mlx5e_priv *priv, ...@@ -854,10 +855,10 @@ static int mlx5e_set_rss_hash_opt(struct mlx5e_priv *priv,
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
if (rx_hash_field == priv->rss_params.rx_hash_fields[tt]) if (rx_hash_field == priv->rx_res->rss_params.rx_hash_fields[tt])
goto out; goto out;
priv->rss_params.rx_hash_fields[tt] = rx_hash_field; priv->rx_res->rss_params.rx_hash_fields[tt] = rx_hash_field;
mlx5e_modify_tirs_hash(priv, in); mlx5e_modify_tirs_hash(priv, in);
out: out:
...@@ -876,7 +877,7 @@ static int mlx5e_get_rss_hash_opt(struct mlx5e_priv *priv, ...@@ -876,7 +877,7 @@ static int mlx5e_get_rss_hash_opt(struct mlx5e_priv *priv,
if (tt == MLX5E_NUM_INDIR_TIRS) if (tt == MLX5E_NUM_INDIR_TIRS)
return -EINVAL; return -EINVAL;
hash_field = priv->rss_params.rx_hash_fields[tt]; hash_field = priv->rx_res->rss_params.rx_hash_fields[tt];
nfc->data = 0; nfc->data = 0;
if (hash_field & MLX5_HASH_FIELD_SEL_SRC_IP) if (hash_field & MLX5_HASH_FIELD_SEL_SRC_IP)
......
...@@ -647,6 +647,7 @@ static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv) ...@@ -647,6 +647,7 @@ static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv)
{ {
struct mlx5e_rep_priv *rpriv = priv->ppriv; struct mlx5e_rep_priv *rpriv = priv->ppriv;
struct mlx5_eswitch_rep *rep = rpriv->rep; struct mlx5_eswitch_rep *rep = rpriv->rep;
struct mlx5e_rx_res *res = priv->rx_res;
struct ttc_params ttc_params = {}; struct ttc_params ttc_params = {};
int tt, err; int tt, err;
...@@ -654,7 +655,7 @@ static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv) ...@@ -654,7 +655,7 @@ static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv)
MLX5_FLOW_NAMESPACE_KERNEL); MLX5_FLOW_NAMESPACE_KERNEL);
/* The inner_ttc in the ttc params is intentionally not set */ /* The inner_ttc in the ttc params is intentionally not set */
ttc_params.any_tt_tirn = priv->direct_tir[0].tirn; ttc_params.any_tt_tirn = res->direct_tirs[0].tirn;
mlx5e_set_ttc_ft_params(&ttc_params); mlx5e_set_ttc_ft_params(&ttc_params);
if (rep->vport != MLX5_VPORT_UPLINK) if (rep->vport != MLX5_VPORT_UPLINK)
...@@ -662,7 +663,7 @@ static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv) ...@@ -662,7 +663,7 @@ static int mlx5e_create_rep_ttc_table(struct mlx5e_priv *priv)
ttc_params.ft_attr.level = MLX5E_TTC_FT_LEVEL + 1; ttc_params.ft_attr.level = MLX5E_TTC_FT_LEVEL + 1;
for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
ttc_params.indir_tirn[tt] = priv->indir_tir[tt].tirn; ttc_params.indir_tirn[tt] = res->indir_tirs[tt].tirn;
err = mlx5e_create_ttc_table(priv, &ttc_params, &priv->fs.ttc); err = mlx5e_create_ttc_table(priv, &ttc_params, &priv->fs.ttc);
if (err) { if (err) {
...@@ -760,7 +761,11 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv) ...@@ -760,7 +761,11 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv)
u16 max_nch = priv->max_nch; u16 max_nch = priv->max_nch;
int err; int err;
mlx5e_build_rss_params(&priv->rss_params, priv->channels.params.num_channels); priv->rx_res = kvzalloc(sizeof(*priv->rx_res), GFP_KERNEL);
if (!priv->rx_res)
return -ENOMEM;
mlx5e_build_rss_params(&priv->rx_res->rss_params, priv->channels.params.num_channels);
mlx5e_init_l2_addr(priv); mlx5e_init_l2_addr(priv);
...@@ -774,7 +779,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv) ...@@ -774,7 +779,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv)
if (err) if (err)
goto err_close_drop_rq; goto err_close_drop_rq;
err = mlx5e_create_direct_rqts(priv, priv->direct_tir, max_nch); err = mlx5e_create_direct_rqts(priv, priv->rx_res->direct_tirs, max_nch);
if (err) if (err)
goto err_destroy_indirect_rqts; goto err_destroy_indirect_rqts;
...@@ -782,7 +787,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv) ...@@ -782,7 +787,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv)
if (err) if (err)
goto err_destroy_direct_rqts; goto err_destroy_direct_rqts;
err = mlx5e_create_direct_tirs(priv, priv->direct_tir, max_nch); err = mlx5e_create_direct_tirs(priv, priv->rx_res->direct_tirs, max_nch);
if (err) if (err)
goto err_destroy_indirect_tirs; goto err_destroy_indirect_tirs;
...@@ -807,16 +812,17 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv) ...@@ -807,16 +812,17 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv)
err_destroy_ttc_table: err_destroy_ttc_table:
mlx5e_destroy_ttc_table(priv, &priv->fs.ttc); mlx5e_destroy_ttc_table(priv, &priv->fs.ttc);
err_destroy_direct_tirs: err_destroy_direct_tirs:
mlx5e_destroy_direct_tirs(priv, priv->direct_tir, max_nch); mlx5e_destroy_direct_tirs(priv, priv->rx_res->direct_tirs, max_nch);
err_destroy_indirect_tirs: err_destroy_indirect_tirs:
mlx5e_destroy_indirect_tirs(priv); mlx5e_destroy_indirect_tirs(priv);
err_destroy_direct_rqts: err_destroy_direct_rqts:
mlx5e_destroy_direct_rqts(priv, priv->direct_tir, max_nch); mlx5e_destroy_direct_rqts(priv, priv->rx_res->direct_tirs, max_nch);
err_destroy_indirect_rqts: err_destroy_indirect_rqts:
priv->indir_rqt_enabled = false; mlx5e_rqt_destroy(&priv->rx_res->indir_rqt);
mlx5e_rqt_destroy(&priv->indir_rqt);
err_close_drop_rq: err_close_drop_rq:
mlx5e_close_drop_rq(&priv->drop_rq); mlx5e_close_drop_rq(&priv->drop_rq);
kvfree(priv->rx_res);
priv->rx_res = NULL;
return err; return err;
} }
...@@ -828,12 +834,13 @@ static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv) ...@@ -828,12 +834,13 @@ static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv)
rep_vport_rx_rule_destroy(priv); rep_vport_rx_rule_destroy(priv);
mlx5e_destroy_rep_root_ft(priv); mlx5e_destroy_rep_root_ft(priv);
mlx5e_destroy_ttc_table(priv, &priv->fs.ttc); mlx5e_destroy_ttc_table(priv, &priv->fs.ttc);
mlx5e_destroy_direct_tirs(priv, priv->direct_tir, max_nch); mlx5e_destroy_direct_tirs(priv, priv->rx_res->direct_tirs, max_nch);
mlx5e_destroy_indirect_tirs(priv); mlx5e_destroy_indirect_tirs(priv);
mlx5e_destroy_direct_rqts(priv, priv->direct_tir, max_nch); mlx5e_destroy_direct_rqts(priv, priv->rx_res->direct_tirs, max_nch);
priv->indir_rqt_enabled = false; mlx5e_rqt_destroy(&priv->rx_res->indir_rqt);
mlx5e_rqt_destroy(&priv->indir_rqt);
mlx5e_close_drop_rq(&priv->drop_rq); mlx5e_close_drop_rq(&priv->drop_rq);
kvfree(priv->rx_res);
priv->rx_res = NULL;
} }
static int mlx5e_init_ul_rep_rx(struct mlx5e_priv *priv) static int mlx5e_init_ul_rep_rx(struct mlx5e_priv *priv)
......
...@@ -507,7 +507,7 @@ static int mlx5e_hairpin_create_indirect_rqt(struct mlx5e_hairpin *hp) ...@@ -507,7 +507,7 @@ static int mlx5e_hairpin_create_indirect_rqt(struct mlx5e_hairpin *hp)
mlx5e_build_default_indir_rqt(indir->table, MLX5E_INDIR_RQT_SIZE, hp->num_channels); mlx5e_build_default_indir_rqt(indir->table, MLX5E_INDIR_RQT_SIZE, hp->num_channels);
err = mlx5e_rqt_init_indir(&hp->indir_rqt, mdev, hp->pair->rqn, hp->num_channels, err = mlx5e_rqt_init_indir(&hp->indir_rqt, mdev, hp->pair->rqn, hp->num_channels,
priv->rss_params.hfunc, indir); priv->rx_res->rss_params.hfunc, indir);
kvfree(indir); kvfree(indir);
return err; return err;
...@@ -529,7 +529,8 @@ static int mlx5e_hairpin_create_indirect_tirs(struct mlx5e_hairpin *hp) ...@@ -529,7 +529,8 @@ static int mlx5e_hairpin_create_indirect_tirs(struct mlx5e_hairpin *hp)
MLX5_SET(tirc, tirc, transport_domain, hp->tdn); MLX5_SET(tirc, tirc, transport_domain, hp->tdn);
MLX5_SET(tirc, tirc, disp_type, MLX5_TIRC_DISP_TYPE_INDIRECT); MLX5_SET(tirc, tirc, disp_type, MLX5_TIRC_DISP_TYPE_INDIRECT);
MLX5_SET(tirc, tirc, indirect_table, hp->indir_rqt.rqtn); MLX5_SET(tirc, tirc, indirect_table, hp->indir_rqt.rqtn);
mlx5e_build_indir_tir_ctx_hash(&priv->rss_params, &ttconfig, tirc, false); mlx5e_build_indir_tir_ctx_hash(&priv->rx_res->rss_params, &ttconfig,
tirc, false);
err = mlx5_core_create_tir(hp->func_mdev, in, err = mlx5_core_create_tir(hp->func_mdev, in,
&hp->indir_tirn[tt]); &hp->indir_tirn[tt]);
......
...@@ -333,7 +333,7 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv) ...@@ -333,7 +333,7 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv)
mlx5e_set_ttc_basic_params(priv, &ttc_params); mlx5e_set_ttc_basic_params(priv, &ttc_params);
mlx5e_set_ttc_ft_params(&ttc_params); mlx5e_set_ttc_ft_params(&ttc_params);
for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
ttc_params.indir_tirn[tt] = priv->indir_tir[tt].tirn; ttc_params.indir_tirn[tt] = priv->rx_res->indir_tirs[tt].tirn;
err = mlx5e_create_ttc_table(priv, &ttc_params, &priv->fs.ttc); err = mlx5e_create_ttc_table(priv, &ttc_params, &priv->fs.ttc);
if (err) { if (err) {
...@@ -362,7 +362,11 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv) ...@@ -362,7 +362,11 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv)
u16 max_nch = priv->max_nch; u16 max_nch = priv->max_nch;
int err; int err;
mlx5e_build_rss_params(&priv->rss_params, priv->channels.params.num_channels); priv->rx_res = kvzalloc(sizeof(*priv->rx_res), GFP_KERNEL);
if (!priv->rx_res)
return -ENOMEM;
mlx5e_build_rss_params(&priv->rx_res->rss_params, priv->channels.params.num_channels);
mlx5e_create_q_counters(priv); mlx5e_create_q_counters(priv);
...@@ -376,7 +380,7 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv) ...@@ -376,7 +380,7 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv)
if (err) if (err)
goto err_close_drop_rq; goto err_close_drop_rq;
err = mlx5e_create_direct_rqts(priv, priv->direct_tir, max_nch); err = mlx5e_create_direct_rqts(priv, priv->rx_res->direct_tirs, max_nch);
if (err) if (err)
goto err_destroy_indirect_rqts; goto err_destroy_indirect_rqts;
...@@ -384,7 +388,7 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv) ...@@ -384,7 +388,7 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv)
if (err) if (err)
goto err_destroy_direct_rqts; goto err_destroy_direct_rqts;
err = mlx5e_create_direct_tirs(priv, priv->direct_tir, max_nch); err = mlx5e_create_direct_tirs(priv, priv->rx_res->direct_tirs, max_nch);
if (err) if (err)
goto err_destroy_indirect_tirs; goto err_destroy_indirect_tirs;
...@@ -395,18 +399,19 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv) ...@@ -395,18 +399,19 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv)
return 0; return 0;
err_destroy_direct_tirs: err_destroy_direct_tirs:
mlx5e_destroy_direct_tirs(priv, priv->direct_tir, max_nch); mlx5e_destroy_direct_tirs(priv, priv->rx_res->direct_tirs, max_nch);
err_destroy_indirect_tirs: err_destroy_indirect_tirs:
mlx5e_destroy_indirect_tirs(priv); mlx5e_destroy_indirect_tirs(priv);
err_destroy_direct_rqts: err_destroy_direct_rqts:
mlx5e_destroy_direct_rqts(priv, priv->direct_tir, max_nch); mlx5e_destroy_direct_rqts(priv, priv->rx_res->direct_tirs, max_nch);
err_destroy_indirect_rqts: err_destroy_indirect_rqts:
priv->indir_rqt_enabled = false; mlx5e_rqt_destroy(&priv->rx_res->indir_rqt);
mlx5e_rqt_destroy(&priv->indir_rqt);
err_close_drop_rq: err_close_drop_rq:
mlx5e_close_drop_rq(&priv->drop_rq); mlx5e_close_drop_rq(&priv->drop_rq);
err_destroy_q_counters: err_destroy_q_counters:
mlx5e_destroy_q_counters(priv); mlx5e_destroy_q_counters(priv);
kvfree(priv->rx_res);
priv->rx_res = NULL;
return err; return err;
} }
...@@ -415,13 +420,14 @@ static void mlx5i_cleanup_rx(struct mlx5e_priv *priv) ...@@ -415,13 +420,14 @@ static void mlx5i_cleanup_rx(struct mlx5e_priv *priv)
u16 max_nch = priv->max_nch; u16 max_nch = priv->max_nch;
mlx5i_destroy_flow_steering(priv); mlx5i_destroy_flow_steering(priv);
mlx5e_destroy_direct_tirs(priv, priv->direct_tir, max_nch); mlx5e_destroy_direct_tirs(priv, priv->rx_res->direct_tirs, max_nch);
mlx5e_destroy_indirect_tirs(priv); mlx5e_destroy_indirect_tirs(priv);
mlx5e_destroy_direct_rqts(priv, priv->direct_tir, max_nch); mlx5e_destroy_direct_rqts(priv, priv->rx_res->direct_tirs, max_nch);
priv->indir_rqt_enabled = false; mlx5e_rqt_destroy(&priv->rx_res->indir_rqt);
mlx5e_rqt_destroy(&priv->indir_rqt);
mlx5e_close_drop_rq(&priv->drop_rq); mlx5e_close_drop_rq(&priv->drop_rq);
mlx5e_destroy_q_counters(priv); mlx5e_destroy_q_counters(priv);
kvfree(priv->rx_res);
priv->rx_res = NULL;
} }
/* The stats groups order is opposite to the update_stats() order calls */ /* The stats groups order is opposite to the update_stats() order calls */
......
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