aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlexey Orishko <alexey.orishko@gmail.com>2011-05-05 23:01:30 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-12 18:30:28 -0400
commit6c60408e33aba6d1d7241bc9be3b8d1b39509291 (patch)
tree9b00ca27f05c094adff441891e6fdc9494713ecb /drivers
parentc92f5ca2e5120796c56455e0a4b7cc0dfd6ceb49 (diff)
CDC NCM: Add mising short packet in cdc_ncm driver
Changes: - while making NTB, driver shall check if device dwNtbOutMaxSize is higher than host value and shall add a short packet if this is the case - previous temporary patch for this issue is replaced by this one Signed-off-by: Alexey Orishko <alexey.orishko@stericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/usb/cdc_ncm.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 1033ef6476a4..4ab557d0287d 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -54,13 +54,13 @@
54#include <linux/usb/usbnet.h> 54#include <linux/usb/usbnet.h>
55#include <linux/usb/cdc.h> 55#include <linux/usb/cdc.h>
56 56
57#define DRIVER_VERSION "23-Apr-2011" 57#define DRIVER_VERSION "06-May-2011"
58 58
59/* CDC NCM subclass 3.2.1 */ 59/* CDC NCM subclass 3.2.1 */
60#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10 60#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10
61 61
62/* Maximum NTB length */ 62/* Maximum NTB length */
63#define CDC_NCM_NTB_MAX_SIZE_TX (16384 + 4) /* bytes, must be short terminated */ 63#define CDC_NCM_NTB_MAX_SIZE_TX 16384 /* bytes */
64#define CDC_NCM_NTB_MAX_SIZE_RX 16384 /* bytes */ 64#define CDC_NCM_NTB_MAX_SIZE_RX 16384 /* bytes */
65 65
66/* Minimum value for MaxDatagramSize, ch. 6.2.9 */ 66/* Minimum value for MaxDatagramSize, ch. 6.2.9 */
@@ -722,7 +722,7 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb)
722 722
723 } else { 723 } else {
724 /* reset variables */ 724 /* reset variables */
725 skb_out = alloc_skb(ctx->tx_max, GFP_ATOMIC); 725 skb_out = alloc_skb((ctx->tx_max + 1), GFP_ATOMIC);
726 if (skb_out == NULL) { 726 if (skb_out == NULL) {
727 if (skb != NULL) { 727 if (skb != NULL) {
728 dev_kfree_skb_any(skb); 728 dev_kfree_skb_any(skb);
@@ -861,8 +861,11 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb)
861 /* store last offset */ 861 /* store last offset */
862 last_offset = offset; 862 last_offset = offset;
863 863
864 if ((last_offset < ctx->tx_max) && ((last_offset % 864 if (((last_offset < ctx->tx_max) && ((last_offset %
865 le16_to_cpu(ctx->out_ep->desc.wMaxPacketSize)) == 0)) { 865 le16_to_cpu(ctx->out_ep->desc.wMaxPacketSize)) == 0)) ||
866 (((last_offset == ctx->tx_max) && ((ctx->tx_max %
867 le16_to_cpu(ctx->out_ep->desc.wMaxPacketSize)) == 0)) &&
868 (ctx->tx_max < le32_to_cpu(ctx->ncm_parm.dwNtbOutMaxSize)))) {
866 /* force short packet */ 869 /* force short packet */
867 *(((u8 *)skb_out->data) + last_offset) = 0; 870 *(((u8 *)skb_out->data) + last_offset) = 0;
868 last_offset++; 871 last_offset++;