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-next>] [day] [month] [year] [list]
Date:	Fri, 8 Mar 2013 22:03:24 +0100
From:	Loic Domaigne <loic.domaigne@...glemail.com>
To:	netdev@...r.kernel.org
Cc:	linux-usb@...r.kernel.org
Subject: RFC: [PATCH 3/3] usb: cdc_ncm: MirrorLink booster for N60x,70x

This patch allows to boost the performance if used for MirrorLink(TM). It
is derived from a patch provided by Nokia-LC/Berlin. It optimizes the transfer
speed for the Nokia N60x,70x. which requires special settings (jumbo frame, 
no batching)

This patch applies to longterm kernel version 3.4.35.

Signed-Off-By: Loic Domaigne <loic.domaigne@...bit.com> 

--- linux-3.4.35/drivers/net/usb/cdc_ncm.c.patch2	2013-03-05 10:34:56.639566116 +0100
+++ linux-3.4.35/drivers/net/usb/cdc_ncm.c	2013-03-05 10:54:33.941773425 +0100
@@ -38,6 +38,22 @@
  * SUCH DAMAGE.
  */
 
+/* MirrorLink(TM) Booster patch
+ *
+ * Copyright (c) jambit GmbH
+ * Contact: Loic Domaigne <loic.domaigne@...bit.com>
+ *
+ * Contribution:
+ * Part of this work is derived from a patch provided by Nokia-LC/Berlin
+ * (thanks Juan!), which was licensed under the terms of the GNU General
+ * Public License (GPL) Version 2
+ *
+ * Licensing:
+ * This patch is available to you under the terms of the GNU General Public
+ * License (GPL) Version 2
+ *
+ * Disclaimer: same as above.
+ */
 #include <linux/version.h> /* LINUX_VERSION_CODE and KERNEL_VERSION macro */
 #include <linux/module.h>
 #include <linux/init.h>
@@ -52,7 +68,7 @@
 #include <linux/usb/usbnet.h>
 #include <linux/usb/cdc.h>
 
-#define	DRIVER_VERSION				"14-Mar-2012"
+#define	DRIVER_VERSION				"08-June-2012"
 
 /* CDC NCM subclass 3.2.1 */
 #define USB_CDC_NCM_NDP16_LENGTH_MIN		0x10
@@ -182,6 +198,38 @@ cdc_ncm_get_drvinfo(struct net_device *n
 	usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info));
 }
 
+void mirrorlink_booster(struct cdc_ncm_ctx *ctx, struct usbnet *dev)
+{
+#define NOKIA 0x0421
+#define N6x7x 0x1419
+
+	if (ctx->udev->descriptor.idVendor == NOKIA) {
+
+		switch (ctx->udev->descriptor.idProduct) {
+		case N6x7x:
+			/* The Nokia N60x,70x (productId 0x1419) needs:
+			 * - Jumbo Frame (MTU 8kB)
+			 * - Disable TX batching to improve latency
+			 */
+			if (dev != NULL)
+				/* called during NCM bind */
+				dev->hard_mtu = 8192+ETH_HLEN;
+			else {
+				/* called during NCM setup */
+				pr_info(KBUILD_MODNAME ":  jambit MirrorLink booster for "
+					"Nokia 60x,70x family");
+				ctx->tx_max_datagrams  = 1;
+				ctx->max_datagram_size = 8192+ETH_HLEN;
+			}
+			break;
+
+		default:
+			/* no other Nokia yet */
+			break;
+		}
+	}
+}
+
 static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx)
 {
 	u32 val;
@@ -414,9 +462,10 @@ size_err:
 	}
 
 max_dgram_err:
+	mirrorlink_booster(ctx, NULL);
 	if (ctx->netdev->mtu != (ctx->max_datagram_size - ETH_HLEN))
 		ctx->netdev->mtu = ctx->max_datagram_size - ETH_HLEN;
-
+	pr_debug("netdev->mtu = %u", ctx->netdev->mtu);
 	return 0;
 }
 
@@ -536,6 +585,8 @@ static int cdc_ncm_bind(struct usbnet *d
 				dev->hard_mtu =	CDC_NCM_MIN_DATAGRAM_SIZE;
 			else if (dev->hard_mtu > CDC_NCM_MAX_DATAGRAM_SIZE)
 				dev->hard_mtu =	CDC_NCM_MAX_DATAGRAM_SIZE;
+			mirrorlink_booster(ctx, dev);
+			pr_debug("dev->hard_mtu = %u", dev->hard_mtu);
 			break;
 
 		case USB_CDC_NCM_TYPE:
@@ -1269,5 +1320,7 @@ module_exit(cdc_ncm_exit);
 #endif
 
 MODULE_AUTHOR("Hans Petter Selasky");
+MODULE_AUTHOR("Loic Domaigne");
 MODULE_DESCRIPTION("USB CDC NCM host driver");
+MODULE_DESCRIPTION("MirrorLink Booster by jambit GmbH");
 MODULE_LICENSE("Dual BSD/GPL");
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ