net/mlx5: fix port action resource initialization
authorBing Zhao <bingz@mellanox.com>
Fri, 15 May 2020 11:44:44 +0000 (19:44 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 18 May 2020 18:35:57 +0000 (20:35 +0200)
After memory optimization, the organization of some resources are
changed from pointer based LIST to the index based ILIST. A lot of
code parts are touched due to such change.
Some static code checking and analysis tool will complain and raise
a false warning on the uninitialized value using. E.g. in the port
action registering function, the stack variable will be used as the
right value with some uninitialized field to initialize variable
allocated from heap. But indeed, it is not an error because all the
fields set with the uninitialized value will be overwritten in the
following code part and the macros. All the fields will be used as
the left value explicitly.
It makes no sense to clear the stack variable to 0 in this case,
and the extra memset will introduce some cycles overhead. It just
needs to ignore the false warning from the tool, if any.

Fixes: f3faf9ea1185 ("net/mlx5: convert port id action to indexed")

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Reviewed-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
drivers/net/mlx5/mlx5_flow_dv.c

index 6f58032..e481831 100644 (file)
@@ -7832,7 +7832,6 @@ __flow_dv_translate(struct rte_eth_dev *dev,
                        if (flow_dv_translate_action_port_id(dev, action,
                                                             &port_id, error))
                                return -rte_errno;
-                       memset(&port_id_resource, 0, sizeof(port_id_resource));
                        port_id_resource.port_id = port_id;
                        MLX5_ASSERT(!handle->rix_port_id_action);
                        if (flow_dv_port_id_action_resource_register