From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 83427A0C4E for ; Wed, 13 Oct 2021 03:21:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6AFB6410E8; Wed, 13 Oct 2021 03:21:30 +0200 (CEST) Received: from alln-iport-8.cisco.com (alln-iport-8.cisco.com [173.37.142.95]) by mails.dpdk.org (Postfix) with ESMTP id D6A2440142; Wed, 13 Oct 2021 03:21:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1878; q=dns/txt; s=iport; t=1634088088; x=1635297688; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=xyArRY5+8vkSFYPtfST96YK3oGBl9K3cUbNyPHEdKQ8=; b=PPX4gj1sJKSvxR1phoN2W28JuiQ+d7kn9JZpQYLpeT2VQqdbNdYRK48o FDItst/UmubdeFEmi20ELz6b0INwagpd+aIq3EFlQo3k2QqRybqNSch5r uUnj1keW0lp4wjsXj5y3TYs/WzMObMvXHzGbmcSuBWcsB5ZYN7z3eFS25 g=; X-IronPort-AV: E=Sophos;i="5.85,369,1624320000"; d="scan'208";a="781726006" Received: from rcdn-core-6.cisco.com ([173.37.93.157]) by alln-iport-8.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 13 Oct 2021 01:21:26 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-6.cisco.com (8.15.2/8.15.2) with ESMTP id 19D1LO4q014663; Wed, 13 Oct 2021 01:21:25 GMT Received: by cisco.com (Postfix, from userid 508933) id 6B9C420F2005; Tue, 12 Oct 2021 18:21:25 -0700 (PDT) From: Hyong Youb Kim To: Ferruh Yigit Cc: dev@dpdk.org, Hyong Youb Kim , stable@dpdk.org, John Daley Date: Tue, 12 Oct 2021 18:21:23 -0700 Message-Id: <20211013012123.7874-1-hyonkim@cisco.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: rcdn-core-6.cisco.com Subject: [dpdk-stable] [PATCH] net/enic: fix filter mode detection 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" vnic_dev_capable_filter_mode() currently fails when CMD_CAPABILITY(CMD_ADD_FILTER) returns ERR_EPERM. In turn, this failure causes the driver initialization to fail. But, firmware may legitimately return ERR_EPERM. For example, VF vNIC returns ERR_EPERM when it does not support filtering at all. So, treat ERR_EPERM as "no filtering available" instead of an unexpected error. Fixes: 322b355f2183 ("net/enic/base: bring NIC interface functions up to date") Cc: stable@dpdk.org Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- drivers/net/enic/base/vnic_dev.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/enic/base/vnic_dev.c b/drivers/net/enic/base/vnic_dev.c index ab6e05739b..9c42595ced 100644 --- a/drivers/net/enic/base/vnic_dev.c +++ b/drivers/net/enic/base/vnic_dev.c @@ -644,8 +644,8 @@ static int vnic_dev_flowman_enable(struct vnic_dev *vdev, uint32_t *mode, return 1; } -/* Determine the "best" filtering mode VIC is capaible of. Returns one of 4 - * value or 0 on error: +/* Determine the "best" filtering mode VIC is capable of. Returns one of 4 + * value or 0 if filtering is unavailble: * FILTER_FLOWMAN- flowman api capable * FILTER_DPDK_1- advanced filters availabile * FILTER_USNIC_IP_FLAG - advanced filters but with the restriction that @@ -680,6 +680,14 @@ int vnic_dev_capable_filter_mode(struct vnic_dev *vdev, uint32_t *mode, args[0] = CMD_ADD_FILTER; args[1] = 0; err = vnic_dev_cmd_args(vdev, CMD_CAPABILITY, args, 2, 1000); + /* + * ERR_EPERM may be returned if, for example, vNIC is + * on a VF. It simply means no filtering is available + */ + if (err == -ERR_EPERM) { + *mode = 0; + return 0; + } if (err) return err; max_level = args[1]; -- 2.26.2