From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 61D43A050B;
	Fri,  8 Apr 2022 16:16:47 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 50BAC4067E;
	Fri,  8 Apr 2022 16:16:47 +0200 (CEST)
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by mails.dpdk.org (Postfix) with ESMTP id 252714003F
 for <dev@dpdk.org>; Fri,  8 Apr 2022 16:16:45 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1649427406; x=1680963406;
 h=from:to:cc:subject:date:message-id:mime-version:
 content-transfer-encoding;
 bh=iaAcNCcHx9YPG50WpTrEdx0+q0IUOMfja9YyouyNH4U=;
 b=DVpOaMJY5RsEX2AKWPMqMJry9znDaqUXuFNZhaGeiQ3ka71yjhyvrt2J
 KrWNqlL11Ngta1QOWBOqkHNoHssHrmCSJ68cL/7nR7N8yo6FPJPL3Y5GX
 KhRT4CqkOcYbXlqzm55W0CpG5vsXBewjEqcOTHF6rdG93hHyqwbLLpPGB
 O5mx2n3HF1IpNbfBnmzi47wb4CSaQAU5mYMr2AflB0vEXM4wwhx8//AFQ
 hfh2Z9KpxgsQ98hO0/ovPeSjh4NoTy8QqWPGiJzNJT4VI0P0fgUny1mPB
 +i/PDyNSzUU4AILNr5ny3TqypzkOcc045nj4JEaLadGSU3Pw9De6U+KtW Q==;
X-IronPort-AV: E=McAfee;i="6400,9594,10310"; a="260439143"
X-IronPort-AV: E=Sophos;i="5.90,245,1643702400"; d="scan'208";a="260439143"
Received: from fmsmga005.fm.intel.com ([10.253.24.32])
 by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 08 Apr 2022 07:16:45 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.90,245,1643702400"; d="scan'208";a="852084304"
Received: from silpixa00401122.ir.intel.com ([10.55.128.10])
 by fmsmga005.fm.intel.com with ESMTP; 08 Apr 2022 07:16:44 -0700
From: Kevin Laatz <kevin.laatz@intel.com>
To: dev@dpdk.org
Cc: Kevin Laatz <kevin.laatz@intel.com>,
 Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH] dma/idxd: fix return value for pci device commands
Date: Fri,  8 Apr 2022 15:16:55 +0100
Message-Id: <20220408141655.1320288-1-kevin.laatz@intel.com>
X-Mailer: git-send-email 2.31.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

When sending a command to an idxd device via pci bar, the response from
HW is checked to ensure it was successful. The response was incorrectly
being negated before being returned by the function, meaning error codes
cannot be checked against the HW specification.

This patch fixes the return values of the function by removing the
negation.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
---
 drivers/dma/idxd/idxd_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/idxd/idxd_pci.c b/drivers/dma/idxd/idxd_pci.c
index fa0a1ad562..844077b079 100644
--- a/drivers/dma/idxd/idxd_pci.c
+++ b/drivers/dma/idxd/idxd_pci.c
@@ -39,13 +39,13 @@ idxd_pci_dev_command(struct idxd_dmadev *idxd, enum rte_idxd_cmds command)
 			IDXD_PMD_ERR("Timeout waiting for command response from HW");
 			rte_spinlock_unlock(&idxd->u.pci->lk);
 			err_code &= CMDSTATUS_ERR_MASK;
-			return -err_code;
+			return err_code;
 		}
 	} while (err_code & CMDSTATUS_ACTIVE_MASK);
 	rte_spinlock_unlock(&idxd->u.pci->lk);
 
 	err_code &= CMDSTATUS_ERR_MASK;
-	return -err_code;
+	return err_code;
 }
 
 static uint32_t *
-- 
2.31.1