From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D73F4A09FF for ; Wed, 6 Jan 2021 11:06:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AEBDC16091F; Wed, 6 Jan 2021 11:06:12 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 5D00016091F; Wed, 6 Jan 2021 11:06:11 +0100 (CET) Received: from localhost.localdomain (unknown [188.242.7.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id C958D7F523; Wed, 6 Jan 2021 13:06:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru C958D7F523 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1609927570; bh=/Vpb4H1X0QkQ3JrJPTS45PXp+ILeICphEWIlByVceQQ=; h=From:To:Cc:Subject:Date; b=aeYErSMANNix9nbGkO0OEuHjQMmIlxXBnl+aU/OsnizUdPVrtChUalhFv0SxJaDxl VS0+jI/wT8BczhdJ/Od/L+v+VHIcwoVe7anwjzebgODapVtsQyqeCzmr2wDgT98eHH YE6bBnWmI45jrEsFlHEic2nzIqpF10AR2rA9nZ68= From: Ivan Malov To: dev@dpdk.org Cc: stable@dpdk.org, Andy Moreton , Andrew Rybchenko Date: Wed, 6 Jan 2021 13:05:59 +0300 Message-Id: <20210106100601.29299-1-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH 1/3] common/sfc_efx/base: fix MAE match spec validation helper X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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: 34285fd0891d ("common/sfc_efx/base: add match spec validate API") Cc: stable@dpdk.org Reviewed-by: Andy Moreton Reviewed-by: Andrew Rybchenko Signed-off-by: Ivan Malov --- drivers/common/sfc_efx/base/efx_mae.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c index a54d5f6e6..ef15deb10 100644 --- a/drivers/common/sfc_efx/base/efx_mae.c +++ b/drivers/common/sfc_efx/base/efx_mae.c @@ -885,8 +885,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: -- 2.20.1