From a6567ff49aadc8b03ea6b64b0b62e8eca05addb3 Mon Sep 17 00:00:00 2001 From: hadaq Date: Wed, 23 Nov 2011 17:10:00 +0000 Subject: [PATCH] update of error handling --- pexor/kernel-module/pexor_trb.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/pexor/kernel-module/pexor_trb.c b/pexor/kernel-module/pexor_trb.c index 5115452..a4f8888 100644 --- a/pexor/kernel-module/pexor_trb.c +++ b/pexor/kernel-module/pexor_trb.c @@ -1330,7 +1330,7 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg) default: pexor_msg(KERN_ERR "ERROR> invalid request %x\n", command); - status = -EFAULT; + status = -EINVAL; goto OUT_IOCTL; }; @@ -1386,8 +1386,9 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg) (unsigned int)dmastat); /* reset DMA */ iowrite32(PEXOR_TRB_DMA_RESET, priv->pexor.dma_control_stat); + ndelay(1000); /* do we need to flush the fifo-buffer, no libtrbnet takes care */ - status = -130; + status = -201; goto OUT_IOCTL; } } @@ -1408,8 +1409,9 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg) (unsigned int)dmastat); /* reset DMA */ iowrite32(PEXOR_TRB_DMA_RESET, priv->pexor.dma_control_stat); + ndelay(1000); /* do we need to flush the fifo-buffer, no libtrbnet takes care */ - status = -131; + status = -202; goto OUT_IOCTL; } @@ -1419,13 +1421,15 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg) /* No, end DMA */ break; } - if ((sg_ctr + 1) >= priv->dma.nr_sglist) { + // if ((sg_ctr + 1) >= priv->dma.nr_sglist) { + if ((sg_ctr + 1) >= 2) { pexor_msg(KERN_ERR "ERROR> no more DMA buffers available, aborting DMA\n"); /* reset DMA */ iowrite32(PEXOR_TRB_DMA_RESET, priv->pexor.dma_control_stat); + ndelay(1000); /* do we need to flush the fifo-buffer, no libtrbnet takes care */ - status = -132; + status = -203; goto OUT_IOCTL; } } @@ -1434,7 +1438,7 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg) if ((dmaSize % 5) != 0) { pexor_msg(KERN_ERR "ERROR> Invalid DMA Size %d\n", dmaSize); - status = -133; + status = -204; goto OUT_IOCTL; } @@ -1447,7 +1451,7 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg) pexor_msg(KERN_ERR "ERROR> Lost DMA Credentials: 0x%08x != 0x%08x Command: %d\n", cred1, cred2, command); - status = -EFAULT; + status = -205; goto OUT_IOCTL; } @@ -1470,11 +1474,11 @@ int pexor_ioctl_trbnet_request(struct pexor_privdata *priv, unsigned long arg) status = pexor_copy_fifo_to_dma(priv, channel); pexor_dbg(KERN_ERR "FIFO copy to DMA buffer returned Size: %d\n", status); if (status == -1) { - status = -EFAULT; + status = -206; goto OUT_IOCTL; } } - + OUT_IOCTL: spin_unlock((&(priv->dma_lock))); return status; -- 2.43.0