From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id A31BB23D; Thu, 26 Jul 2018 03:15:59 +0200 (CEST) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 6C15F30C016; Wed, 25 Jul 2018 18:15:54 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 6C15F30C016 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1532567754; bh=xyWHgWMtNJi2sgus3r8l7DpgdA/kpZVIaIVTemTt9f0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=joMxCKuSiy4oLLzijOZy2C2uaUgPLzBZlRtR/d5YgcEJHOYvYxpZg4Vj+DmEsHQpY tDI3g4BOd65H/6+EfCp025lzr6pTAPDWIsvLs6vg7PKsK2E9VHAJgSvb8AExGVKhfx 3picfNQWl6aBP0W4TJvr4a1iL/japK8AdvLGOWRo= Received: from C02VPB22HTD6.vpn.broadcom.net (unknown [10.10.118.171]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id 31448AC06AD; Wed, 25 Jul 2018 18:15:54 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: stable@dpdk.org Date: Wed, 25 Jul 2018 18:15:47 -0700 Message-Id: <20180726011548.97788-5-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.15.2 (Apple Git-101.1) In-Reply-To: <20180726011548.97788-1-ajit.khaparde@broadcom.com> References: <20180726011548.97788-1-ajit.khaparde@broadcom.com> Subject: [dpdk-dev] [PATCH 4/5] net/bnxt: check access denied error for HWRM commands X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jul 2018 01:16:00 -0000 Firmware can restrict access to certain resources in the hardware depending on various factors. In such cases when the PMD tries to configure these resources the firmware will return HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED error. Parse this and return the standard EACCES error to the applications. Fixes: 804e746c7b73 ("net/bnxt: add hardware resource manager init code") Cc: stable@dpdk.org Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_hwrm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 5e8970ac3..c682488ae 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -182,6 +182,10 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, if (rc) { \ PMD_DRV_LOG(ERR, "failed rc:%d\n", rc); \ rte_spinlock_unlock(&bp->hwrm_lock); \ + if (rc == HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED) \ + rc = -EACCES; \ + else if (rc > 0) \ + rc = -EINVAL; \ return rc; \ } \ if (resp->error_code) { \ @@ -200,6 +204,10 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, PMD_DRV_LOG(ERR, "error %d\n", rc); \ } \ rte_spinlock_unlock(&bp->hwrm_lock); \ + if (rc == HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED) \ + rc = -EACCES; \ + else if (rc > 0) \ + rc = -EINVAL; \ return rc; \ } \ } while (0) -- 2.15.2 (Apple Git-101.1)