ice: Correctly initialize queue context values
authorJacob Keller <jacob.e.keller@intel.com>
Tue, 20 Jun 2023 22:18:45 +0000 (15:18 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 27 Jul 2023 17:56:32 +0000 (10:56 -0700)
commitf3fbda3396f39c9849ea31c19c9b188905b1691d
treec04cc06c06fd75b71adf77e49a93110675eea355
parent9d0cd5d25f7d45bce01bbb3193b54ac24b3a60f3
ice: Correctly initialize queue context values

The ice_alloc_lan_q_ctx function allocates the queue context array for a
given traffic class. This function uses devm_kcalloc which will
zero-allocate the structure. Thus, prior to any queue being setup by
ice_ena_vsi_txq, the q_ctx structure will have a q_handle of 0 and a q_teid
of 0. These are potentially valid values.

Modify the ice_alloc_lan_q_ctx function to initialize every member of the
q_ctx array to have invalid values. Modify ice_dis_vsi_txq to ensure that
it assigns q_teid to an invalid value when it assigns q_handle to the
invalid value as well.

This will allow other code to check whether the queue context is currently
valid before operating on it.

Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_common.c
drivers/net/ethernet/intel/ice/ice_sched.c