Merge branch 'mlx5-misc-fixes-2025-01-15'
Tariq Toukan says: ==================== mlx5 misc fixes 2025-01-15 This patchset provides misc bug fixes from the team to the mlx5 core and Eth drivers. ==================== Link: https://patch.msgid.link/20250115113910.1990174-1-tariqt@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
@@ -724,6 +724,12 @@ static int mlx5e_xfrm_add_state(struct xfrm_state *x,
|
||||
/* check esn */
|
||||
if (x->props.flags & XFRM_STATE_ESN)
|
||||
mlx5e_ipsec_update_esn_state(sa_entry);
|
||||
else
|
||||
/* According to RFC4303, section "3.3.3. Sequence Number Generation",
|
||||
* the first packet sent using a given SA will contain a sequence
|
||||
* number of 1.
|
||||
*/
|
||||
sa_entry->esn_state.esn = 1;
|
||||
|
||||
mlx5e_ipsec_build_accel_xfrm_attrs(sa_entry, &sa_entry->attrs);
|
||||
|
||||
@@ -768,9 +774,12 @@ static int mlx5e_xfrm_add_state(struct xfrm_state *x,
|
||||
MLX5_IPSEC_RESCHED);
|
||||
|
||||
if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET &&
|
||||
x->props.mode == XFRM_MODE_TUNNEL)
|
||||
xa_set_mark(&ipsec->sadb, sa_entry->ipsec_obj_id,
|
||||
MLX5E_IPSEC_TUNNEL_SA);
|
||||
x->props.mode == XFRM_MODE_TUNNEL) {
|
||||
xa_lock_bh(&ipsec->sadb);
|
||||
__xa_set_mark(&ipsec->sadb, sa_entry->ipsec_obj_id,
|
||||
MLX5E_IPSEC_TUNNEL_SA);
|
||||
xa_unlock_bh(&ipsec->sadb);
|
||||
}
|
||||
|
||||
out:
|
||||
x->xso.offload_handle = (unsigned long)sa_entry;
|
||||
@@ -797,7 +806,6 @@ err_xfrm:
|
||||
static void mlx5e_xfrm_del_state(struct xfrm_state *x)
|
||||
{
|
||||
struct mlx5e_ipsec_sa_entry *sa_entry = to_ipsec_sa_entry(x);
|
||||
struct mlx5_accel_esp_xfrm_attrs *attrs = &sa_entry->attrs;
|
||||
struct mlx5e_ipsec *ipsec = sa_entry->ipsec;
|
||||
struct mlx5e_ipsec_sa_entry *old;
|
||||
|
||||
@@ -806,12 +814,6 @@ static void mlx5e_xfrm_del_state(struct xfrm_state *x)
|
||||
|
||||
old = xa_erase_bh(&ipsec->sadb, sa_entry->ipsec_obj_id);
|
||||
WARN_ON(old != sa_entry);
|
||||
|
||||
if (attrs->mode == XFRM_MODE_TUNNEL &&
|
||||
attrs->type == XFRM_DEV_OFFLOAD_PACKET)
|
||||
/* Make sure that no ARP requests are running in parallel */
|
||||
flush_workqueue(ipsec->wq);
|
||||
|
||||
}
|
||||
|
||||
static void mlx5e_xfrm_free_state(struct xfrm_state *x)
|
||||
|
||||
@@ -1718,23 +1718,21 @@ static int tx_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry)
|
||||
goto err_alloc;
|
||||
}
|
||||
|
||||
if (attrs->family == AF_INET)
|
||||
setup_fte_addr4(spec, &attrs->saddr.a4, &attrs->daddr.a4);
|
||||
else
|
||||
setup_fte_addr6(spec, attrs->saddr.a6, attrs->daddr.a6);
|
||||
|
||||
setup_fte_no_frags(spec);
|
||||
setup_fte_upper_proto_match(spec, &attrs->upspec);
|
||||
|
||||
switch (attrs->type) {
|
||||
case XFRM_DEV_OFFLOAD_CRYPTO:
|
||||
if (attrs->family == AF_INET)
|
||||
setup_fte_addr4(spec, &attrs->saddr.a4, &attrs->daddr.a4);
|
||||
else
|
||||
setup_fte_addr6(spec, attrs->saddr.a6, attrs->daddr.a6);
|
||||
setup_fte_spi(spec, attrs->spi, false);
|
||||
setup_fte_esp(spec);
|
||||
setup_fte_reg_a(spec);
|
||||
break;
|
||||
case XFRM_DEV_OFFLOAD_PACKET:
|
||||
if (attrs->reqid)
|
||||
setup_fte_reg_c4(spec, attrs->reqid);
|
||||
setup_fte_reg_c4(spec, attrs->reqid);
|
||||
err = setup_pkt_reformat(ipsec, attrs, &flow_act);
|
||||
if (err)
|
||||
goto err_pkt_reformat;
|
||||
|
||||
@@ -91,8 +91,9 @@ u32 mlx5_ipsec_device_caps(struct mlx5_core_dev *mdev)
|
||||
EXPORT_SYMBOL_GPL(mlx5_ipsec_device_caps);
|
||||
|
||||
static void mlx5e_ipsec_packet_setup(void *obj, u32 pdn,
|
||||
struct mlx5_accel_esp_xfrm_attrs *attrs)
|
||||
struct mlx5e_ipsec_sa_entry *sa_entry)
|
||||
{
|
||||
struct mlx5_accel_esp_xfrm_attrs *attrs = &sa_entry->attrs;
|
||||
void *aso_ctx;
|
||||
|
||||
aso_ctx = MLX5_ADDR_OF(ipsec_obj, obj, ipsec_aso);
|
||||
@@ -120,8 +121,12 @@ static void mlx5e_ipsec_packet_setup(void *obj, u32 pdn,
|
||||
* active.
|
||||
*/
|
||||
MLX5_SET(ipsec_obj, obj, aso_return_reg, MLX5_IPSEC_ASO_REG_C_4_5);
|
||||
if (attrs->dir == XFRM_DEV_OFFLOAD_OUT)
|
||||
if (attrs->dir == XFRM_DEV_OFFLOAD_OUT) {
|
||||
MLX5_SET(ipsec_aso, aso_ctx, mode, MLX5_IPSEC_ASO_INC_SN);
|
||||
if (!attrs->replay_esn.trigger)
|
||||
MLX5_SET(ipsec_aso, aso_ctx, mode_parameter,
|
||||
sa_entry->esn_state.esn);
|
||||
}
|
||||
|
||||
if (attrs->lft.hard_packet_limit != XFRM_INF) {
|
||||
MLX5_SET(ipsec_aso, aso_ctx, remove_flow_pkt_cnt,
|
||||
@@ -175,7 +180,7 @@ static int mlx5_create_ipsec_obj(struct mlx5e_ipsec_sa_entry *sa_entry)
|
||||
|
||||
res = &mdev->mlx5e_res.hw_objs;
|
||||
if (attrs->type == XFRM_DEV_OFFLOAD_PACKET)
|
||||
mlx5e_ipsec_packet_setup(obj, res->pdn, attrs);
|
||||
mlx5e_ipsec_packet_setup(obj, res->pdn, sa_entry);
|
||||
|
||||
err = mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out));
|
||||
if (!err)
|
||||
|
||||
@@ -2709,6 +2709,7 @@ struct mlx5_flow_namespace *mlx5_get_flow_namespace(struct mlx5_core_dev *dev,
|
||||
break;
|
||||
case MLX5_FLOW_NAMESPACE_RDMA_TX:
|
||||
root_ns = steering->rdma_tx_root_ns;
|
||||
prio = RDMA_TX_BYPASS_PRIO;
|
||||
break;
|
||||
case MLX5_FLOW_NAMESPACE_RDMA_RX_COUNTERS:
|
||||
root_ns = steering->rdma_rx_root_ns;
|
||||
|
||||
@@ -530,7 +530,7 @@ int mlx5_lag_port_sel_create(struct mlx5_lag *ldev,
|
||||
set_tt_map(port_sel, hash_type);
|
||||
err = mlx5_lag_create_definers(ldev, hash_type, ports);
|
||||
if (err)
|
||||
return err;
|
||||
goto clear_port_sel;
|
||||
|
||||
if (port_sel->tunnel) {
|
||||
err = mlx5_lag_create_inner_ttc_table(ldev);
|
||||
@@ -549,6 +549,8 @@ destroy_inner:
|
||||
mlx5_destroy_ttc_table(port_sel->inner.ttc);
|
||||
destroy_definers:
|
||||
mlx5_lag_destroy_definers(ldev);
|
||||
clear_port_sel:
|
||||
memset(port_sel, 0, sizeof(*port_sel));
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
@@ -257,6 +257,7 @@ static int mlx5_sf_add(struct mlx5_core_dev *dev, struct mlx5_sf_table *table,
|
||||
return 0;
|
||||
|
||||
esw_err:
|
||||
mlx5_sf_function_id_erase(table, sf);
|
||||
mlx5_sf_free(table, sf);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -382,6 +382,7 @@ err_alloc_bfreg:
|
||||
|
||||
bool mlx5_wc_support_get(struct mlx5_core_dev *mdev)
|
||||
{
|
||||
struct mutex *wc_state_lock = &mdev->wc_state_lock;
|
||||
struct mlx5_core_dev *parent = NULL;
|
||||
|
||||
if (!MLX5_CAP_GEN(mdev, bf)) {
|
||||
@@ -400,32 +401,31 @@ bool mlx5_wc_support_get(struct mlx5_core_dev *mdev)
|
||||
*/
|
||||
goto out;
|
||||
|
||||
mutex_lock(&mdev->wc_state_lock);
|
||||
#ifdef CONFIG_MLX5_SF
|
||||
if (mlx5_core_is_sf(mdev)) {
|
||||
parent = mdev->priv.parent_mdev;
|
||||
wc_state_lock = &parent->wc_state_lock;
|
||||
}
|
||||
#endif
|
||||
|
||||
mutex_lock(wc_state_lock);
|
||||
|
||||
if (mdev->wc_state != MLX5_WC_STATE_UNINITIALIZED)
|
||||
goto unlock;
|
||||
|
||||
#ifdef CONFIG_MLX5_SF
|
||||
if (mlx5_core_is_sf(mdev))
|
||||
parent = mdev->priv.parent_mdev;
|
||||
#endif
|
||||
|
||||
if (parent) {
|
||||
mutex_lock(&parent->wc_state_lock);
|
||||
|
||||
mlx5_core_test_wc(parent);
|
||||
|
||||
mlx5_core_dbg(mdev, "parent set wc_state=%d\n",
|
||||
parent->wc_state);
|
||||
mdev->wc_state = parent->wc_state;
|
||||
|
||||
mutex_unlock(&parent->wc_state_lock);
|
||||
} else {
|
||||
mlx5_core_test_wc(mdev);
|
||||
}
|
||||
|
||||
mlx5_core_test_wc(mdev);
|
||||
|
||||
unlock:
|
||||
mutex_unlock(&mdev->wc_state_lock);
|
||||
mutex_unlock(wc_state_lock);
|
||||
out:
|
||||
mlx5_core_dbg(mdev, "wc_state=%d\n", mdev->wc_state);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user