Skip to contentSkip to conversation

net/mlx5e: TC, map tc action cookie to a hw counter

bug report Dan Carpenter 2 participants 2 messages Feb 16, 2023 – Feb 21, 2023 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello Oz Shlomo,

The patch d13674b1d14c: "net/mlx5e: TC, map tc action cookie to a hw counter" from Feb 12, 2023, leads to the following Smatch static checker warning:

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:5032 mlx5e_stats_flower() warn: missing error code here? 'mlx5e_tc_get_counter()' failed. 'err' = '0' drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:5019 mlx5e_stats_flower() warn: missing error code here? 'mlx5_devcom_get_peer_data()' failed. 'err' = '0' drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:5379 mlx5e_tc_nic_init() warn: missing error code 'err' drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:5515 mlx5e_tc_esw_init() warn: missing error code 'err'

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

    5375         mlx5e_tc_debugfs_init(tc, mlx5e_fs_get_debugfs_root(priv->fs));
    5376 
    5377         tc->action_stats_handle = mlx5e_tc_act_stats_create();
    5378         if (IS_ERR(tc->action_stats_handle))

--> 5379 goto err_act_stats;

This one is clearly a bug, but I'm not really sure about the first two warnings.

    5380 
    5381         return 0;
    5382 
    5383 err_act_stats:
    5384         unregister_netdevice_notifier_dev_net(priv->netdev,
    5385                                               &tc->netdevice_nb,
    5386                                               &tc->netdevice_nn);
    5387 err_reg:
    5388         mlx5_tc_ct_clean(tc->ct);
    5389         mlx5e_tc_post_act_destroy(tc->post_act);
    5390         mlx5_chains_destroy(tc->chains);
    5391 err_miss:
    5392         mlx5e_tc_nic_destroy_miss_table(priv);
    5393 err_chains:
    5394         mapping_destroy(chains_mapping);
    5395 err_mapping:
    5396         rhashtable_destroy(&tc->ht);
    5397         return err;
    5398 }

regards,
dan carpenter

#1 lore raw

Thanks Dan,

We will send fixes.

Quoted 43 lines · Dan Carpenter

Hello Oz Shlomo,

The patch d13674b1d14c: "net/mlx5e: TC, map tc action cookie to a hw counter" from Feb 12, 2023, leads to the following Smatch static checker warning:

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:5032 mlx5e_stats_flower() warn: missing error code here? 'mlx5e_tc_get_counter()' failed. 'err' = '0' drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:5019 mlx5e_stats_flower() warn: missing error code here? 'mlx5_devcom_get_peer_data()' failed. 'err' = '0' drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:5379 mlx5e_tc_nic_init() warn: missing error code 'err' drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:5515 mlx5e_tc_esw_init() warn: missing error code 'err'

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

     5375         mlx5e_tc_debugfs_init(tc, mlx5e_fs_get_debugfs_root(priv->fs));
     5376
     5377         tc->action_stats_handle = mlx5e_tc_act_stats_create();
     5378         if (IS_ERR(tc->action_stats_handle))

--> 5379 goto err_act_stats;

This one is clearly a bug, but I'm not really sure about the first two warnings.

     5380
     5381         return 0;
     5382
     5383 err_act_stats:
     5384         unregister_netdevice_notifier_dev_net(priv->netdev,
     5385                                               &tc->netdevice_nb,
     5386                                               &tc->netdevice_nn);
     5387 err_reg:
     5388         mlx5_tc_ct_clean(tc->ct);
     5389         mlx5e_tc_post_act_destroy(tc->post_act);
     5390         mlx5_chains_destroy(tc->chains);
     5391 err_miss:
     5392         mlx5e_tc_nic_destroy_miss_table(priv);
     5393 err_chains:
     5394         mapping_destroy(chains_mapping);
     5395 err_mapping:
     5396         rhashtable_destroy(&tc->ht);
     5397         return err;
     5398 }

regards,
dan carpenter