Merge branch 'net-mlx5e-psp-cleanups-and-improvements'

Tariq Toukan says:

====================
net/mlx5e: PSP cleanups and improvements

This series by Cosmin refactors mlx5 PSP support in preparation for
HW-GRO support.
There are almost no functionality changes in all but the last two
patches, which address a long-standing TODO in mlx5e_psp_set_config().
====================

Link: https://patch.msgid.link/20260707130858.969928-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2026-07-21 06:57:42 -07:00
commit d4932951a1
9 changed files with 542 additions and 610 deletions

View File

@ -1028,7 +1028,7 @@ struct mlx5e_profile {
void (*cleanup_rx)(struct mlx5e_priv *priv);
int (*init_tx)(struct mlx5e_priv *priv);
void (*cleanup_tx)(struct mlx5e_priv *priv);
void (*enable)(struct mlx5e_priv *priv);
int (*enable)(struct mlx5e_priv *priv);
void (*disable)(struct mlx5e_priv *priv);
int (*update_rx)(struct mlx5e_priv *priv);
void (*update_stats)(struct mlx5e_priv *priv);

View File

@ -88,13 +88,18 @@ enum {
#ifdef CONFIG_MLX5_EN_ARFS
MLX5E_ARFS_FT_LEVEL = MLX5E_INNER_TTC_FT_LEVEL + 1,
#endif
#if defined(CONFIG_MLX5_EN_IPSEC) || defined(CONFIG_MLX5_EN_PSP)
#if defined(CONFIG_MLX5_EN_IPSEC)
MLX5E_ACCEL_FS_ESP_FT_LEVEL = MLX5E_INNER_TTC_FT_LEVEL + 1,
MLX5E_ACCEL_FS_ESP_FT_ERR_LEVEL,
MLX5E_ACCEL_FS_POL_FT_LEVEL,
MLX5E_ACCEL_FS_POL_MISS_FT_LEVEL,
MLX5E_ACCEL_FS_ESP_FT_ROCE_LEVEL,
#endif
#if defined(CONFIG_MLX5_EN_PSP)
MLX5E_ACCEL_FS_PSP_FT_LEVEL = MLX5E_INNER_TTC_FT_LEVEL + 1,
MLX5E_ACCEL_FS_PSP_ERR_FT_LEVEL,
MLX5E_ACCEL_FS_PSP_RX_FT_LEVEL,
#endif
};
struct mlx5e_flow_steering;

View File

@ -220,18 +220,7 @@ static inline void mlx5e_accel_tx_finish(struct mlx5e_txqsq *sq,
static inline int mlx5e_accel_init_rx(struct mlx5e_priv *priv)
{
int err;
err = mlx5_accel_psp_fs_init_rx_tables(priv);
if (err)
goto out;
err = mlx5e_ktls_init_rx(priv);
if (err)
mlx5_accel_psp_fs_cleanup_rx_tables(priv);
out:
return err;
return mlx5e_ktls_init_rx(priv);
}
static inline void mlx5e_accel_cleanup_rx(struct mlx5e_priv *priv)
@ -242,12 +231,6 @@ static inline void mlx5e_accel_cleanup_rx(struct mlx5e_priv *priv)
static inline int mlx5e_accel_init_tx(struct mlx5e_priv *priv)
{
int err;
err = mlx5_accel_psp_fs_init_tx_tables(priv);
if (err)
return err;
return mlx5e_ktls_init_tx(priv);
}

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ struct mlx5e_psp_stats {
};
struct mlx5e_psp {
struct psp_dev *psp;
struct psp_dev *psd;
struct psp_dev_caps caps;
struct mlx5e_psp_fs *fs;
atomic_t tx_key_cnt;
@ -43,33 +43,21 @@ static inline bool mlx5_is_psp_device(struct mlx5_core_dev *mdev)
return true;
}
int mlx5_accel_psp_fs_init_rx_tables(struct mlx5e_priv *priv);
void mlx5_accel_psp_fs_cleanup_rx_tables(struct mlx5e_priv *priv);
int mlx5_accel_psp_fs_init_tx_tables(struct mlx5e_priv *priv);
void mlx5_accel_psp_fs_cleanup_tx_tables(struct mlx5e_priv *priv);
void mlx5e_psp_register(struct mlx5e_priv *priv);
int mlx5e_psp_register(struct mlx5e_priv *priv);
void mlx5e_psp_unregister(struct mlx5e_priv *priv);
int mlx5e_psp_init(struct mlx5e_priv *priv);
void mlx5e_psp_cleanup(struct mlx5e_priv *priv);
#else
static inline int mlx5_accel_psp_fs_init_rx_tables(struct mlx5e_priv *priv)
{
return 0;
}
static inline void mlx5_accel_psp_fs_cleanup_rx_tables(struct mlx5e_priv *priv) { }
static inline int mlx5_accel_psp_fs_init_tx_tables(struct mlx5e_priv *priv)
{
return 0;
}
static inline void mlx5_accel_psp_fs_cleanup_tx_tables(struct mlx5e_priv *priv) { }
static inline bool mlx5_is_psp_device(struct mlx5_core_dev *mdev)
{
return false;
}
static inline void mlx5e_psp_register(struct mlx5e_priv *priv) { }
static inline int mlx5e_psp_register(struct mlx5e_priv *priv) { return 0; }
static inline void mlx5e_psp_unregister(struct mlx5e_priv *priv) { }
static inline int mlx5e_psp_init(struct mlx5e_priv *priv) { return 0; }
static inline void mlx5e_psp_cleanup(struct mlx5e_priv *priv) { }

View File

@ -14,12 +14,6 @@
#include "en_accel/psp_rxtx.h"
#include "en_accel/psp.h"
enum {
MLX5E_PSP_OFFLOAD_RX_SYNDROME_DECRYPTED,
MLX5E_PSP_OFFLOAD_RX_SYNDROME_AUTH_FAILED,
MLX5E_PSP_OFFLOAD_RX_SYNDROME_BAD_TRAILER,
};
static void mlx5e_psp_set_swp(struct sk_buff *skb,
struct mlx5e_accel_tx_psp_state *psp_st,
struct mlx5_wqe_eth_seg *eseg)
@ -122,16 +116,11 @@ static bool mlx5e_psp_set_state(struct mlx5e_priv *priv,
bool mlx5e_psp_offload_handle_rx_skb(struct net_device *netdev, struct sk_buff *skb,
struct mlx5_cqe64 *cqe)
{
u32 psp_meta_data = be32_to_cpu(cqe->ft_metadata);
struct mlx5e_priv *priv = netdev_priv(netdev);
u16 dev_id = priv->psp->psp->id;
u16 dev_id = priv->psp->psd->id;
bool strip_icv = true;
u8 generation = 0;
/* TBD: report errors as SW counters to ethtool, any further handling ? */
if (MLX5_PSP_METADATA_SYNDROME(psp_meta_data) != MLX5E_PSP_OFFLOAD_RX_SYNDROME_DECRYPTED)
goto drop;
if (psp_dev_rcv(skb, dev_id, generation, strip_icv))
goto drop;

View File

@ -10,9 +10,8 @@
#include "en.h"
#include "en/txrx.h"
/* Bit30: PSP marker, Bit29-23: PSP syndrome, Bit22-0: PSP obj id */
/* Bit30: PSP marker, Bit22-0: PSP obj id */
#define MLX5_PSP_METADATA_MARKER(metadata) ((((metadata) >> 30) & 0x3) == 0x3)
#define MLX5_PSP_METADATA_SYNDROME(metadata) (((metadata) >> 23) & GENMASK(6, 0))
#define MLX5_PSP_METADATA_HANDLE(metadata) ((metadata) & GENMASK(22, 0))
struct mlx5e_accel_tx_psp_state {

View File

@ -6193,7 +6193,7 @@ static int mlx5e_init_nic_tx(struct mlx5e_priv *priv)
return 0;
}
static void mlx5e_nic_enable(struct mlx5e_priv *priv)
static int mlx5e_nic_enable(struct mlx5e_priv *priv)
{
struct net_device *netdev = priv->netdev;
struct mlx5_core_dev *mdev = priv->mdev;
@ -6201,7 +6201,9 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
mlx5e_fs_init_l2_addr(priv->fs, netdev);
mlx5e_ipsec_init(priv);
mlx5e_psp_register(priv);
err = mlx5e_psp_register(priv);
if (err)
goto out_ipsec_cleanup;
err = mlx5e_macsec_init(priv);
if (err)
@ -6224,7 +6226,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
mlx5e_pcie_cong_event_init(priv);
mlx5e_hv_vhca_stats_create(priv);
if (netdev->reg_state != NETREG_REGISTERED)
return;
return 0;
mlx5e_dcbnl_init_app(priv);
mlx5e_nic_set_rx_mode(priv);
@ -6237,6 +6239,12 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
netdev_unlock(netdev);
netif_device_attach(netdev);
rtnl_unlock();
return 0;
out_ipsec_cleanup:
mlx5e_ipsec_cleanup(priv);
return err;
}
static void mlx5e_nic_disable(struct mlx5e_priv *priv)
@ -6618,13 +6626,18 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv)
if (err)
goto err_cleanup_tx;
if (profile->enable)
profile->enable(priv);
if (profile->enable) {
err = profile->enable(priv);
if (err)
goto err_cleanup_rx;
}
mlx5e_update_features(priv->netdev);
return 0;
err_cleanup_rx:
profile->cleanup_rx(priv);
err_cleanup_tx:
profile->cleanup_tx(priv);

View File

@ -1262,9 +1262,11 @@ static void mlx5e_cleanup_rep_tx(struct mlx5e_priv *priv)
mlx5e_rep_neigh_cleanup(rpriv);
}
static void mlx5e_rep_enable(struct mlx5e_priv *priv)
static int mlx5e_rep_enable(struct mlx5e_priv *priv)
{
mlx5e_set_netdev_mtu_boundaries(priv);
return 0;
}
static void mlx5e_rep_disable(struct mlx5e_priv *priv)
@ -1322,7 +1324,7 @@ static int uplink_rep_async_event(struct notifier_block *nb, unsigned long event
return NOTIFY_DONE;
}
static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv)
static int mlx5e_uplink_rep_enable(struct mlx5e_priv *priv)
{
struct net_device *netdev = priv->netdev;
struct mlx5_core_dev *mdev = priv->mdev;
@ -1357,6 +1359,8 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv)
netdev_unlock(netdev);
netif_device_attach(netdev);
rtnl_unlock();
return 0;
}
static void mlx5e_uplink_rep_disable(struct mlx5e_priv *priv)