On Mon, 2025-10-27 at 17:00 -0700, Daniel Zahka wrote:
> @@ -670,9 +813,57 @@ static int accel_psp_fs_init_tx(struct
> mlx5e_psp_fs *fs)
> return -ENOMEM;
>
> mutex_init(&tx_fs->mutex);
> + flow_counter = mlx5_fc_create(mdev, false);
> + if (IS_ERR(flow_counter)) {
> + mlx5_core_warn(mdev,
> + "fail to create psp tx flow counter
> err=%pe\n",
> + flow_counter);
> + err = PTR_ERR(flow_counter);
> + goto out_err;
> + }
> + tx_fs->tx_counter = flow_counter;
Nit: Moving the flow counter init before the mutex init would simplify
cleanup a bit (simple return instead of goto out_err).
> +static void
> +mlx5e_accel_psp_fs_get_stats_fill(struct mlx5e_priv *priv, void
> *psp_stats)
> +{
> + struct mlx5e_psp_stats *stats = (struct mlx5e_psp_stats
> *)psp_stats;
Why can't this function receive an mlx5e_psp_stats pointer directly? It
would avoid the boilerplate cast.
> +static void
> +mlx5e_psp_get_stats(struct psp_dev *psd, struct psp_dev_stats
> *stats)
> +{
> + struct mlx5e_priv *priv = netdev_priv(psd->main_netdev);
> + struct mlx5e_psp_stats nstats;
> +
> + mlx5e_accel_psp_fs_get_stats_fill(priv, &nstats);
I don't see the point of the intermediate struct mlx5e_psp_stats, this
function could query counters directly into stats.
>
> +struct mlx5e_psp_stats {
> + u64 psp_rx_pkts;
> + u64 psp_rx_bytes;
> + u64 psp_rx_pkts_auth_fail;
> + u64 psp_rx_bytes_auth_fail;
> + u64 psp_rx_pkts_frame_err;
> + u64 psp_rx_bytes_frame_err;
> + u64 psp_rx_pkts_drop;
> + u64 psp_rx_bytes_drop;
> + u64 psp_tx_pkts;
> + u64 psp_tx_bytes;
> + u64 psp_tx_pkts_drop;
> + u64 psp_tx_bytes_drop;
> +};
> +
> struct mlx5e_psp {
> struct psp_dev *psp;
> struct psp_dev_caps caps;
> struct mlx5e_psp_fs *fs;
> atomic_t tx_key_cnt;
> + atomic_t tx_drop;
> + /* Stats manage */
> + struct mlx5e_psp_stats stats;
This does not appear written anywhere. Is it planned to be used in a
future patch?
Cosmin.