lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1374516607-2705-16-git-send-email-bigeasy@linutronix.de>
Date:	Mon, 22 Jul 2013 20:10:06 +0200
From:	Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To:	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:	balbi@...com, george.cherian@...com,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	Vinod Koul <vinod.koul@...el.com>, Dan Williams <djbw@...com>
Subject: [PATCH 15/16] dmaengine: add transfered member to dma_async_tx_descriptor

In USB RX path it is possible that the we receive less bytes than
requested. Take the following example:
The driver for USB-to-UART submits an URB with 256 bytes in size and the
dmaengine driver in turn programs a transfer of 256 bytes. The transfer
is programmed and the dma engine waits for the data to arrive. Once data
is sent on the UART the dma engine begins to move data. If there was
only one data byte in the USB packet received then the DMA engine will
only move one byte due to USB restrictions / rules. The real size of the
transfer has to be notified to the user / caller so he set this to the
caller.
This patch adds the transfered member to the dma_async_tx_descriptor
where the caller can obtain the final size.

Cc: Vinod Koul <vinod.koul@...el.com>
Cc: Dan Williams <djbw@...com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
---
 include/linux/dmaengine.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index cb286b1..c3a4635 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -403,6 +403,8 @@ typedef void (*dma_async_tx_callback)(void *dma_async_param);
  * @tx_submit: set the prepared descriptor(s) to be executed by the engine
  * @callback: routine to call after this operation is complete
  * @callback_param: general parameter to pass to the callback routine
+ * @transfered: number of bytes that were really transfered in case the channel
+ *	transfered less than requested.
  * ---async_tx api specific fields---
  * @next: at completion submit this descriptor
  * @parent: pointer to the next level up in the dependency chain
@@ -416,6 +418,7 @@ struct dma_async_tx_descriptor {
 	dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
 	dma_async_tx_callback callback;
 	void *callback_param;
+	unsigned int transfered;
 #ifdef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH
 	struct dma_async_tx_descriptor *next;
 	struct dma_async_tx_descriptor *parent;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ