Commit 8fed7565 authored by David S. Miller's avatar David S. Miller

Merge tag 'mlx5-fixes-2023-01-09' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

mlx5-fixes-2023-01-09
parents cb3e9864 9828994a
...@@ -2176,15 +2176,9 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) ...@@ -2176,15 +2176,9 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev)
return -EINVAL; return -EINVAL;
} }
cmd->stats = kvcalloc(MLX5_CMD_OP_MAX, sizeof(*cmd->stats), GFP_KERNEL);
if (!cmd->stats)
return -ENOMEM;
cmd->pool = dma_pool_create("mlx5_cmd", mlx5_core_dma_dev(dev), size, align, 0); cmd->pool = dma_pool_create("mlx5_cmd", mlx5_core_dma_dev(dev), size, align, 0);
if (!cmd->pool) { if (!cmd->pool)
err = -ENOMEM; return -ENOMEM;
goto dma_pool_err;
}
err = alloc_cmd_page(dev, cmd); err = alloc_cmd_page(dev, cmd);
if (err) if (err)
...@@ -2268,8 +2262,6 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) ...@@ -2268,8 +2262,6 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev)
err_free_pool: err_free_pool:
dma_pool_destroy(cmd->pool); dma_pool_destroy(cmd->pool);
dma_pool_err:
kvfree(cmd->stats);
return err; return err;
} }
...@@ -2282,7 +2274,6 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev) ...@@ -2282,7 +2274,6 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev)
destroy_msg_cache(dev); destroy_msg_cache(dev);
free_cmd_page(dev, cmd); free_cmd_page(dev, cmd);
dma_pool_destroy(cmd->pool); dma_pool_destroy(cmd->pool);
kvfree(cmd->stats);
} }
void mlx5_cmd_set_state(struct mlx5_core_dev *dev, void mlx5_cmd_set_state(struct mlx5_core_dev *dev,
......
...@@ -34,12 +34,6 @@ static int police_act_validate(const struct flow_action_entry *act, ...@@ -34,12 +34,6 @@ static int police_act_validate(const struct flow_action_entry *act,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (act->police.rate_pkt_ps) {
NL_SET_ERR_MSG_MOD(extack,
"QoS offload not support packets per second");
return -EOPNOTSUPP;
}
return 0; return 0;
} }
......
...@@ -127,6 +127,7 @@ mlx5e_post_meter_add_rule(struct mlx5e_priv *priv, ...@@ -127,6 +127,7 @@ mlx5e_post_meter_add_rule(struct mlx5e_priv *priv,
attr->counter = act_counter; attr->counter = act_counter;
attr->flags |= MLX5_ATTR_FLAG_NO_IN_PORT; attr->flags |= MLX5_ATTR_FLAG_NO_IN_PORT;
attr->inner_match_level = MLX5_MATCH_NONE;
attr->outer_match_level = MLX5_MATCH_NONE; attr->outer_match_level = MLX5_MATCH_NONE;
attr->chain = 0; attr->chain = 0;
attr->prio = 0; attr->prio = 0;
......
...@@ -88,6 +88,8 @@ static int mlx5e_gen_ip_tunnel_header_vxlan(char buf[], ...@@ -88,6 +88,8 @@ static int mlx5e_gen_ip_tunnel_header_vxlan(char buf[],
struct udphdr *udp = (struct udphdr *)(buf); struct udphdr *udp = (struct udphdr *)(buf);
struct vxlanhdr *vxh; struct vxlanhdr *vxh;
if (tun_key->tun_flags & TUNNEL_VXLAN_OPT)
return -EOPNOTSUPP;
vxh = (struct vxlanhdr *)((char *)udp + sizeof(struct udphdr)); vxh = (struct vxlanhdr *)((char *)udp + sizeof(struct udphdr));
*ip_proto = IPPROTO_UDP; *ip_proto = IPPROTO_UDP;
......
...@@ -62,6 +62,7 @@ struct mlx5e_macsec_sa { ...@@ -62,6 +62,7 @@ struct mlx5e_macsec_sa {
u32 enc_key_id; u32 enc_key_id;
u32 next_pn; u32 next_pn;
sci_t sci; sci_t sci;
ssci_t ssci;
salt_t salt; salt_t salt;
struct rhash_head hash; struct rhash_head hash;
...@@ -358,7 +359,6 @@ static int mlx5e_macsec_init_sa(struct macsec_context *ctx, ...@@ -358,7 +359,6 @@ static int mlx5e_macsec_init_sa(struct macsec_context *ctx,
struct mlx5_core_dev *mdev = priv->mdev; struct mlx5_core_dev *mdev = priv->mdev;
struct mlx5_macsec_obj_attrs obj_attrs; struct mlx5_macsec_obj_attrs obj_attrs;
union mlx5e_macsec_rule *macsec_rule; union mlx5e_macsec_rule *macsec_rule;
struct macsec_key *key;
int err; int err;
obj_attrs.next_pn = sa->next_pn; obj_attrs.next_pn = sa->next_pn;
...@@ -368,13 +368,9 @@ static int mlx5e_macsec_init_sa(struct macsec_context *ctx, ...@@ -368,13 +368,9 @@ static int mlx5e_macsec_init_sa(struct macsec_context *ctx,
obj_attrs.aso_pdn = macsec->aso.pdn; obj_attrs.aso_pdn = macsec->aso.pdn;
obj_attrs.epn_state = sa->epn_state; obj_attrs.epn_state = sa->epn_state;
key = (is_tx) ? &ctx->sa.tx_sa->key : &ctx->sa.rx_sa->key;
if (sa->epn_state.epn_enabled) { if (sa->epn_state.epn_enabled) {
obj_attrs.ssci = (is_tx) ? cpu_to_be32((__force u32)ctx->sa.tx_sa->ssci) : obj_attrs.ssci = cpu_to_be32((__force u32)sa->ssci);
cpu_to_be32((__force u32)ctx->sa.rx_sa->ssci); memcpy(&obj_attrs.salt, &sa->salt, sizeof(sa->salt));
memcpy(&obj_attrs.salt, &key->salt, sizeof(key->salt));
} }
obj_attrs.replay_window = ctx->secy->replay_window; obj_attrs.replay_window = ctx->secy->replay_window;
...@@ -499,10 +495,11 @@ mlx5e_macsec_get_macsec_device_context(const struct mlx5e_macsec *macsec, ...@@ -499,10 +495,11 @@ mlx5e_macsec_get_macsec_device_context(const struct mlx5e_macsec *macsec,
} }
static void update_macsec_epn(struct mlx5e_macsec_sa *sa, const struct macsec_key *key, static void update_macsec_epn(struct mlx5e_macsec_sa *sa, const struct macsec_key *key,
const pn_t *next_pn_halves) const pn_t *next_pn_halves, ssci_t ssci)
{ {
struct mlx5e_macsec_epn_state *epn_state = &sa->epn_state; struct mlx5e_macsec_epn_state *epn_state = &sa->epn_state;
sa->ssci = ssci;
sa->salt = key->salt; sa->salt = key->salt;
epn_state->epn_enabled = 1; epn_state->epn_enabled = 1;
epn_state->epn_msb = next_pn_halves->upper; epn_state->epn_msb = next_pn_halves->upper;
...@@ -550,7 +547,8 @@ static int mlx5e_macsec_add_txsa(struct macsec_context *ctx) ...@@ -550,7 +547,8 @@ static int mlx5e_macsec_add_txsa(struct macsec_context *ctx)
tx_sa->assoc_num = assoc_num; tx_sa->assoc_num = assoc_num;
if (secy->xpn) if (secy->xpn)
update_macsec_epn(tx_sa, &ctx_tx_sa->key, &ctx_tx_sa->next_pn_halves); update_macsec_epn(tx_sa, &ctx_tx_sa->key, &ctx_tx_sa->next_pn_halves,
ctx_tx_sa->ssci);
err = mlx5_create_encryption_key(mdev, ctx->sa.key, secy->key_len, err = mlx5_create_encryption_key(mdev, ctx->sa.key, secy->key_len,
MLX5_ACCEL_OBJ_MACSEC_KEY, MLX5_ACCEL_OBJ_MACSEC_KEY,
...@@ -945,7 +943,8 @@ static int mlx5e_macsec_add_rxsa(struct macsec_context *ctx) ...@@ -945,7 +943,8 @@ static int mlx5e_macsec_add_rxsa(struct macsec_context *ctx)
rx_sa->fs_id = rx_sc->sc_xarray_element->fs_id; rx_sa->fs_id = rx_sc->sc_xarray_element->fs_id;
if (ctx->secy->xpn) if (ctx->secy->xpn)
update_macsec_epn(rx_sa, &ctx_rx_sa->key, &ctx_rx_sa->next_pn_halves); update_macsec_epn(rx_sa, &ctx_rx_sa->key, &ctx_rx_sa->next_pn_halves,
ctx_rx_sa->ssci);
err = mlx5_create_encryption_key(mdev, ctx->sa.key, ctx->secy->key_len, err = mlx5_create_encryption_key(mdev, ctx->sa.key, ctx->secy->key_len,
MLX5_ACCEL_OBJ_MACSEC_KEY, MLX5_ACCEL_OBJ_MACSEC_KEY,
......
...@@ -4084,6 +4084,9 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev, ...@@ -4084,6 +4084,9 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
struct mlx5e_vlan_table *vlan; struct mlx5e_vlan_table *vlan;
struct mlx5e_params *params; struct mlx5e_params *params;
if (!netif_device_present(netdev))
return features;
vlan = mlx5e_fs_get_vlan(priv->fs); vlan = mlx5e_fs_get_vlan(priv->fs);
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
params = &priv->channels.params; params = &priv->channels.params;
......
...@@ -191,7 +191,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vport_rep) ...@@ -191,7 +191,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vport_rep)
if (err) { if (err) {
netdev_warn(priv->netdev, "vport %d error %d reading stats\n", netdev_warn(priv->netdev, "vport %d error %d reading stats\n",
rep->vport, err); rep->vport, err);
return; goto out;
} }
#define MLX5_GET_CTR(p, x) \ #define MLX5_GET_CTR(p, x) \
...@@ -241,6 +241,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vport_rep) ...@@ -241,6 +241,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vport_rep)
rep_stats->tx_vport_rdma_multicast_bytes = rep_stats->tx_vport_rdma_multicast_bytes =
MLX5_GET_CTR(out, received_ib_multicast.octets); MLX5_GET_CTR(out, received_ib_multicast.octets);
out:
kvfree(out); kvfree(out);
} }
......
...@@ -2419,7 +2419,7 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq, ...@@ -2419,7 +2419,7 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,
priv = mlx5i_epriv(netdev); priv = mlx5i_epriv(netdev);
tstamp = &priv->tstamp; tstamp = &priv->tstamp;
stats = rq->stats; stats = &priv->channel_stats[rq->ix]->rq;
flags_rqpn = be32_to_cpu(cqe->flags_rqpn); flags_rqpn = be32_to_cpu(cqe->flags_rqpn);
g = (flags_rqpn >> 28) & 3; g = (flags_rqpn >> 28) & 3;
......
...@@ -1301,7 +1301,6 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv, ...@@ -1301,7 +1301,6 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) { if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) {
err = mlx5e_attach_mod_hdr(priv, flow, parse_attr); err = mlx5e_attach_mod_hdr(priv, flow, parse_attr);
mlx5e_mod_hdr_dealloc(&parse_attr->mod_hdr_acts);
if (err) if (err)
return err; return err;
} }
...@@ -1359,8 +1358,10 @@ static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv, ...@@ -1359,8 +1358,10 @@ static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
} }
mutex_unlock(&tc->t_lock); mutex_unlock(&tc->t_lock);
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) {
mlx5e_mod_hdr_dealloc(&attr->parse_attr->mod_hdr_acts);
mlx5e_detach_mod_hdr(priv, flow); mlx5e_detach_mod_hdr(priv, flow);
}
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_COUNT) if (attr->action & MLX5_FLOW_CONTEXT_ACTION_COUNT)
mlx5_fc_destroy(priv->mdev, attr->counter); mlx5_fc_destroy(priv->mdev, attr->counter);
......
...@@ -143,7 +143,7 @@ mlx5_eswitch_set_rule_source_port(struct mlx5_eswitch *esw, ...@@ -143,7 +143,7 @@ mlx5_eswitch_set_rule_source_port(struct mlx5_eswitch *esw,
if (mlx5_esw_indir_table_decap_vport(attr)) if (mlx5_esw_indir_table_decap_vport(attr))
vport = mlx5_esw_indir_table_decap_vport(attr); vport = mlx5_esw_indir_table_decap_vport(attr);
if (attr && !attr->chain && esw_attr->int_port) if (!attr->chain && esw_attr && esw_attr->int_port)
metadata = metadata =
mlx5e_tc_int_port_get_metadata_for_match(esw_attr->int_port); mlx5e_tc_int_port_get_metadata_for_match(esw_attr->int_port);
else else
...@@ -4143,8 +4143,6 @@ int mlx5_devlink_port_fn_migratable_set(struct devlink_port *port, bool enable, ...@@ -4143,8 +4143,6 @@ int mlx5_devlink_port_fn_migratable_set(struct devlink_port *port, bool enable,
} }
hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability); hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability);
memcpy(hca_caps, MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability),
MLX5_UN_SZ_BYTES(hca_cap_union));
MLX5_SET(cmd_hca_cap_2, hca_caps, migratable, 1); MLX5_SET(cmd_hca_cap_2, hca_caps, migratable, 1);
err = mlx5_vport_set_other_func_cap(esw->dev, hca_caps, vport->vport, err = mlx5_vport_set_other_func_cap(esw->dev, hca_caps, vport->vport,
...@@ -4236,8 +4234,6 @@ int mlx5_devlink_port_fn_roce_set(struct devlink_port *port, bool enable, ...@@ -4236,8 +4234,6 @@ int mlx5_devlink_port_fn_roce_set(struct devlink_port *port, bool enable,
} }
hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability); hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability);
memcpy(hca_caps, MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability),
MLX5_UN_SZ_BYTES(hca_cap_union));
MLX5_SET(cmd_hca_cap, hca_caps, roce, enable); MLX5_SET(cmd_hca_cap, hca_caps, roce, enable);
err = mlx5_vport_set_other_func_cap(esw->dev, hca_caps, vport_num, err = mlx5_vport_set_other_func_cap(esw->dev, hca_caps, vport_num,
......
...@@ -90,9 +90,21 @@ static void mlx5i_get_ringparam(struct net_device *dev, ...@@ -90,9 +90,21 @@ static void mlx5i_get_ringparam(struct net_device *dev,
static int mlx5i_set_channels(struct net_device *dev, static int mlx5i_set_channels(struct net_device *dev,
struct ethtool_channels *ch) struct ethtool_channels *ch)
{ {
struct mlx5e_priv *priv = mlx5i_epriv(dev); struct mlx5i_priv *ipriv = netdev_priv(dev);
struct mlx5e_priv *epriv = mlx5i_epriv(dev);
/* rtnl lock protects from race between this ethtool op and sub
* interface ndo_init/uninit.
*/
ASSERT_RTNL();
if (ipriv->num_sub_interfaces > 0) {
mlx5_core_warn(epriv->mdev,
"can't change number of channels for interfaces with sub interfaces (%u)\n",
ipriv->num_sub_interfaces);
return -EINVAL;
}
return mlx5e_ethtool_set_channels(priv, ch); return mlx5e_ethtool_set_channels(epriv, ch);
} }
static void mlx5i_get_channels(struct net_device *dev, static void mlx5i_get_channels(struct net_device *dev,
......
...@@ -160,6 +160,44 @@ void mlx5i_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats) ...@@ -160,6 +160,44 @@ void mlx5i_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
stats->tx_dropped = sstats->tx_queue_dropped; stats->tx_dropped = sstats->tx_queue_dropped;
} }
struct net_device *mlx5i_parent_get(struct net_device *netdev)
{
struct mlx5e_priv *priv = mlx5i_epriv(netdev);
struct mlx5i_priv *ipriv, *parent_ipriv;
struct net_device *parent_dev;
int parent_ifindex;
ipriv = priv->ppriv;
parent_ifindex = netdev->netdev_ops->ndo_get_iflink(netdev);
parent_dev = dev_get_by_index(dev_net(netdev), parent_ifindex);
if (!parent_dev)
return NULL;
parent_ipriv = netdev_priv(parent_dev);
ASSERT_RTNL();
parent_ipriv->num_sub_interfaces++;
ipriv->parent_dev = parent_dev;
return parent_dev;
}
void mlx5i_parent_put(struct net_device *netdev)
{
struct mlx5e_priv *priv = mlx5i_epriv(netdev);
struct mlx5i_priv *ipriv, *parent_ipriv;
ipriv = priv->ppriv;
parent_ipriv = netdev_priv(ipriv->parent_dev);
ASSERT_RTNL();
parent_ipriv->num_sub_interfaces--;
dev_put(ipriv->parent_dev);
}
int mlx5i_init_underlay_qp(struct mlx5e_priv *priv) int mlx5i_init_underlay_qp(struct mlx5e_priv *priv)
{ {
struct mlx5_core_dev *mdev = priv->mdev; struct mlx5_core_dev *mdev = priv->mdev;
......
...@@ -54,9 +54,11 @@ struct mlx5i_priv { ...@@ -54,9 +54,11 @@ struct mlx5i_priv {
struct rdma_netdev rn; /* keep this first */ struct rdma_netdev rn; /* keep this first */
u32 qpn; u32 qpn;
bool sub_interface; bool sub_interface;
u32 num_sub_interfaces;
u32 qkey; u32 qkey;
u16 pkey_index; u16 pkey_index;
struct mlx5i_pkey_qpn_ht *qpn_htbl; struct mlx5i_pkey_qpn_ht *qpn_htbl;
struct net_device *parent_dev;
char *mlx5e_priv[]; char *mlx5e_priv[];
}; };
...@@ -117,5 +119,9 @@ void mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb, ...@@ -117,5 +119,9 @@ void mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
struct mlx5_av *av, u32 dqpn, u32 dqkey, bool xmit_more); struct mlx5_av *av, u32 dqpn, u32 dqkey, bool xmit_more);
void mlx5i_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats); void mlx5i_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats);
/* Reference management for child to parent interfaces. */
struct net_device *mlx5i_parent_get(struct net_device *netdev);
void mlx5i_parent_put(struct net_device *netdev);
#endif /* CONFIG_MLX5_CORE_IPOIB */ #endif /* CONFIG_MLX5_CORE_IPOIB */
#endif /* __MLX5E_IPOB_H__ */ #endif /* __MLX5E_IPOB_H__ */
...@@ -158,21 +158,28 @@ static int mlx5i_pkey_dev_init(struct net_device *dev) ...@@ -158,21 +158,28 @@ static int mlx5i_pkey_dev_init(struct net_device *dev)
struct mlx5e_priv *priv = mlx5i_epriv(dev); struct mlx5e_priv *priv = mlx5i_epriv(dev);
struct mlx5i_priv *ipriv, *parent_ipriv; struct mlx5i_priv *ipriv, *parent_ipriv;
struct net_device *parent_dev; struct net_device *parent_dev;
int parent_ifindex;
ipriv = priv->ppriv; ipriv = priv->ppriv;
/* Get QPN to netdevice hash table from parent */ /* Link to parent */
parent_ifindex = dev->netdev_ops->ndo_get_iflink(dev); parent_dev = mlx5i_parent_get(dev);
parent_dev = dev_get_by_index(dev_net(dev), parent_ifindex);
if (!parent_dev) { if (!parent_dev) {
mlx5_core_warn(priv->mdev, "failed to get parent device\n"); mlx5_core_warn(priv->mdev, "failed to get parent device\n");
return -EINVAL; return -EINVAL;
} }
if (dev->num_rx_queues < parent_dev->real_num_rx_queues) {
mlx5_core_warn(priv->mdev,
"failed to create child device with rx queues [%d] less than parent's [%d]\n",
dev->num_rx_queues,
parent_dev->real_num_rx_queues);
mlx5i_parent_put(dev);
return -EINVAL;
}
/* Get QPN to netdevice hash table from parent */
parent_ipriv = netdev_priv(parent_dev); parent_ipriv = netdev_priv(parent_dev);
ipriv->qpn_htbl = parent_ipriv->qpn_htbl; ipriv->qpn_htbl = parent_ipriv->qpn_htbl;
dev_put(parent_dev);
return mlx5i_dev_init(dev); return mlx5i_dev_init(dev);
} }
...@@ -184,6 +191,7 @@ static int mlx5i_pkey_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -184,6 +191,7 @@ static int mlx5i_pkey_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
static void mlx5i_pkey_dev_cleanup(struct net_device *netdev) static void mlx5i_pkey_dev_cleanup(struct net_device *netdev)
{ {
mlx5i_parent_put(netdev);
return mlx5i_dev_cleanup(netdev); return mlx5i_dev_cleanup(netdev);
} }
......
...@@ -681,7 +681,7 @@ static int mlx5_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin, ...@@ -681,7 +681,7 @@ static int mlx5_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
static const struct ptp_clock_info mlx5_ptp_clock_info = { static const struct ptp_clock_info mlx5_ptp_clock_info = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "mlx5_ptp", .name = "mlx5_ptp",
.max_adj = 100000000, .max_adj = 50000000,
.n_alarm = 0, .n_alarm = 0,
.n_ext_ts = 0, .n_ext_ts = 0,
.n_per_out = 0, .n_per_out = 0,
......
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
#include "dr_types.h" #include "dr_types.h"
#if defined(CONFIG_FRAME_WARN) && (CONFIG_FRAME_WARN < 2048)
/* don't try to optimize STE allocation if the stack is too constaraining */
#define DR_RULE_MAX_STES_OPTIMIZED 0
#else
#define DR_RULE_MAX_STES_OPTIMIZED 5 #define DR_RULE_MAX_STES_OPTIMIZED 5
#endif
#define DR_RULE_MAX_STE_CHAIN_OPTIMIZED (DR_RULE_MAX_STES_OPTIMIZED + DR_ACTION_MAX_STES) #define DR_RULE_MAX_STE_CHAIN_OPTIMIZED (DR_RULE_MAX_STES_OPTIMIZED + DR_ACTION_MAX_STES)
static int dr_rule_append_to_miss_list(struct mlx5dr_domain *dmn, static int dr_rule_append_to_miss_list(struct mlx5dr_domain *dmn,
...@@ -1218,10 +1223,7 @@ dr_rule_create_rule_nic(struct mlx5dr_rule *rule, ...@@ -1218,10 +1223,7 @@ dr_rule_create_rule_nic(struct mlx5dr_rule *rule,
mlx5dr_domain_nic_unlock(nic_dmn); mlx5dr_domain_nic_unlock(nic_dmn);
if (unlikely(!hw_ste_arr_is_opt)) goto out;
kfree(hw_ste_arr);
return 0;
free_rule: free_rule:
dr_rule_clean_rule_members(rule, nic_rule); dr_rule_clean_rule_members(rule, nic_rule);
...@@ -1238,6 +1240,7 @@ dr_rule_create_rule_nic(struct mlx5dr_rule *rule, ...@@ -1238,6 +1240,7 @@ dr_rule_create_rule_nic(struct mlx5dr_rule *rule,
free_hw_ste: free_hw_ste:
mlx5dr_domain_nic_unlock(nic_dmn); mlx5dr_domain_nic_unlock(nic_dmn);
out:
if (unlikely(!hw_ste_arr_is_opt)) if (unlikely(!hw_ste_arr_is_opt))
kfree(hw_ste_arr); kfree(hw_ste_arr);
......
...@@ -315,7 +315,7 @@ struct mlx5_cmd { ...@@ -315,7 +315,7 @@ struct mlx5_cmd {
struct mlx5_cmd_debug dbg; struct mlx5_cmd_debug dbg;
struct cmd_msg_cache cache[MLX5_NUM_COMMAND_CACHES]; struct cmd_msg_cache cache[MLX5_NUM_COMMAND_CACHES];
int checksum_disabled; int checksum_disabled;
struct mlx5_cmd_stats *stats; struct mlx5_cmd_stats stats[MLX5_CMD_OP_MAX];
}; };
struct mlx5_cmd_mailbox { struct mlx5_cmd_mailbox {
......
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