From: Jie Liu <[email protected]>
Compare sxe2_ioctl_chnl.c against the reference implementation and
fix the following discrepancies:
- sxe2_drv_dev_close: only log the closed fd when it is valid, move
PMD_LOG_INFO inside the fd >= 0 check
- sxe2_drv_dev_mmap: fix swapped format arguments in the debug log
(cmd_fd and bar_idx were passed in the wrong order)
- sxe2_drv_dev_dma_unmap: use PMD_LOG_ERR instead of PMD_LOG_INFO
for the ioctl failure message
Fixes: 83866f8d7638 ("common/sxe2: add base driver skeleton")
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Jie Liu <[email protected]>
---
drivers/common/sxe2/sxe2_ioctl_chnl.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/common/sxe2/sxe2_ioctl_chnl.c
b/drivers/common/sxe2/sxe2_ioctl_chnl.c
index 3e2fbf572f..e62ca42a8f 100644
--- a/drivers/common/sxe2/sxe2_ioctl_chnl.c
+++ b/drivers/common/sxe2/sxe2_ioctl_chnl.c
@@ -107,9 +107,11 @@ sxe2_drv_dev_close(struct sxe2_common_device *cdev)
{
int32_t fd = SXE2_CDEV_TO_CMD_FD(cdev);
- if (fd >= 0)
+ if (fd >= 0) {
close(fd);
- PMD_LOG_INFO(COM, "closed device fd=%d", fd);
+ PMD_LOG_INFO(COM, "closed device fd=%d", fd);
+ }
+
SXE2_CDEV_TO_CMD_FD(cdev) = SXE2_CMD_FD_INVALID;
}
@@ -350,7 +352,7 @@ void
}
PMD_LOG_DEBUG(COM, "fd=%d, bar idx=%d, len=%"PRIu64", src=0x%"PRIx64",
offset=0x%"PRIx64"",
- bar_idx, cmd_fd, len, offset, SXE2_COM_PCI_OFFSET_GEN(bar_idx,
offset));
+ cmd_fd, bar_idx, len, offset, SXE2_COM_PCI_OFFSET_GEN(bar_idx,
offset));
virt = mmap(NULL, len, PROT_READ | PROT_WRITE,
MAP_SHARED, cmd_fd, SXE2_COM_PCI_OFFSET_GEN(bar_idx, offset));
@@ -477,7 +479,7 @@ sxe2_drv_dev_dma_unmap(struct sxe2_common_device *cdev,
uint64_t iova)
pthread_mutex_lock(&cdev->config.lock);
ret = ioctl(cmd_fd, SXE2_COM_CMD_DMA_UNMAP, &cmd_params);
if (ret < 0) {
- PMD_LOG_INFO(COM, "Failed to dma unmap, fd=%d, ret=%d, err:%s",
+ PMD_LOG_ERR(COM, "Failed to dma unmap, fd=%d, ret=%d, err:%s",
cmd_fd, ret, strerror(errno));
ret = -EIO;
pthread_mutex_unlock(&cdev->config.lock);
--
2.52.0