Skip to content

Commit

Permalink
common/sfc_efx/base: fix MAE match spec validation helper
Browse files Browse the repository at this point in the history
[ upstream commit 40f94ce ]

A particular FW version is aware of some set of match fields.
Depending on FW configuration and match specification type, a
known field may not necessarily be allowed to have a non-zero
mask. FW communicates such restrictions via field capabilities
MCDI. Newer FW may be aware of more fields. For such fields,
older FW simply does not report any capabilities.

A situation may occur when libefx is aware of a match field
which the FW is unaware of (eg., older FW), that is, FW does
not report capability status for this field. In this case,
libefx must consider such field as unsupported and demand
all-zeros mask for it when validating match specifications.

Currently, the helper in question simply exits and reports
that the specification is valid when it encounters a field
with no capability status available. This is clearly wrong.

Introduce the missing check to fix the problem.

Fixes: 34285fd ("common/sfc_efx/base: add match spec validate API")

Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
  • Loading branch information
ol-ivanmal authored and bluca committed Feb 4, 2021
1 parent 7e813f3 commit df8185a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions drivers/common/sfc_efx/base/efx_mae.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,8 +897,17 @@ efx_mae_match_spec_is_valid(
if (m_size == 0)
continue; /* Skip array gap */

if ((unsigned int)field_cap_id >= field_ncaps)
break;
if ((unsigned int)field_cap_id >= field_ncaps) {
/*
* The FW has not reported capability status for
* this field. Make sure that its mask is zeroed.
*/
is_valid = efx_mask_is_all_zeros(m_size, m_buf);
if (is_valid != B_FALSE)
continue;
else
break;
}

switch (field_caps[field_cap_id].emfc_support) {
case MAE_FIELD_SUPPORTED_MATCH_MASK:
Expand Down

0 comments on commit df8185a

Please sign in to comment.