dma/idxd: fix return value for pci device commands

Message ID 20220408141655.1320288-1-kevin.laatz@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series dma/idxd: fix return value for pci device commands |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Kevin Laatz April 8, 2022, 2:16 p.m. UTC
  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(-)
  

Comments

Conor Walsh June 7, 2022, 10:56 a.m. UTC | #1
> Subject: [PATCH] dma/idxd: fix return value for pci device commands
> 
> 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>
> ---

Acked-by: Conor Walsh <conor.walsh@intel.com>
  
Thomas Monjalon June 8, 2022, 8:54 a.m. UTC | #2
07/06/2022 12:56, Walsh, Conor:
> 
> > Subject: [PATCH] dma/idxd: fix return value for pci device commands
> > 
> > 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>
> 
> Acked-by: Conor Walsh <conor.walsh@intel.com>

Fixes: 9449330a8458 ("dma/idxd: create dmadev instances on PCI probe")
Fixes: 452c1916b0db ("dma/idxd: fix truncated error code in status check")
Cc: stable@dpdk.org

Please don't forget above lines in future.

Applied, thanks.
  
Kevin Laatz June 8, 2022, 8:57 a.m. UTC | #3
On 08/06/2022 09:54, Thomas Monjalon wrote:
> 07/06/2022 12:56, Walsh, Conor:
>>> Subject: [PATCH] dma/idxd: fix return value for pci device commands
>>>
>>> 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>
>> Acked-by: Conor Walsh <conor.walsh@intel.com>
> Fixes: 9449330a8458 ("dma/idxd: create dmadev instances on PCI probe")
> Fixes: 452c1916b0db ("dma/idxd: fix truncated error code in status check")
> Cc: stable@dpdk.org
>
> Please don't forget above lines in future.
>
> Applied, thanks.
>
That was an oversight, thanks for adding!
  

Patch

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 *