From patchwork Fri Mar 8 21:03:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Domaigne X-Patchwork-Id: 226259 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3D6162C0332 for ; Sat, 9 Mar 2013 08:03:28 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932833Ab3CHVDZ (ORCPT ); Fri, 8 Mar 2013 16:03:25 -0500 Received: from mail-bk0-f54.google.com ([209.85.214.54]:45154 "EHLO mail-bk0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932528Ab3CHVDX (ORCPT ); Fri, 8 Mar 2013 16:03:23 -0500 Received: by mail-bk0-f54.google.com with SMTP id w5so933803bku.27 for ; Fri, 08 Mar 2013 13:03:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=9gzyFVTQ/PhlPhp8l/HqIk57Q+17GdiQ5V6Nm7nKZa4=; b=A5w3IeSGRRMWAHPPS96cogTj/w4soI8GAw6GAAok8Pkp/Ny9Ws6SsK3X3CISqbyQjK cSyn26y+3dUj1jCIb06FexG4qHa6MewsrvPaPD3Uuep1kgKfKOz2dPgxhlFkkN1vm7x3 zh7uCw0AAsaXmxj/Pm84uo3xWNqDK5a1XblEaRKmPPUZlIjGMH6eC+qf5m9i5Isvj+6F 7yIDnM540ylWMu6kcVSsOvbl6iBD7lk0/9grcigN3L7FcZdN1VBaR4SKOzUw3WUug3qe 5joKtMeUKwHDTVZ7Twm8JRHD1qrZFcwxXTKvSNBl41Dd7BUIX9k6ewMhrzcEdEshz57z VnIA== X-Received: by 10.205.2.134 with SMTP id nu6mr1531931bkb.26.1362776602236; Fri, 08 Mar 2013 13:03:22 -0800 (PST) Received: from feynman.loic.net (ppp-93-104-65-44.dynamic.mnet-online.de. [93.104.65.44]) by mx.google.com with ESMTPS id b21sm1960527bkw.12.2013.03.08.13.03.20 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 08 Mar 2013 13:03:21 -0800 (PST) Date: Fri, 8 Mar 2013 22:03:19 +0100 From: Loic Domaigne To: netdev@vger.kernel.org Cc: linux-usb@vger.kernel.org Subject: RFC: [PATCH 1/3] usb: cdc_ncm: patch for VMware Message-ID: <20130308210319.GA4794@feynman.loic.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch limits the Rx URB size to 16kB if the driver is compiled for a VMware environment. As of workstation 9, there are some major performance problems if the Rx URB size exceeds that limit. This patch applies to longterm kernel version 3.4.35. Signed-Off-By: Loic Domaigne --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- linux-3.4.35/drivers/net/usb/cdc_ncm.c.orig 2013-03-05 09:36:02.858740489 +0100 +++ linux-3.4.35/drivers/net/usb/cdc_ncm.c 2013-03-05 10:20:18.092588668 +0100 @@ -80,6 +80,23 @@ #define CDC_NCM_TIMER_PENDING_CNT 2 #define CDC_NCM_TIMER_INTERVAL (400UL * NSEC_PER_USEC) +/* maximum Rx URB size */ +/* + * in the original Linux driver, the rx urb size can be up to + * CDC_NCM_NTB_MAX_SIZE_RX. + * + * Under VMware (as of wks9), URB size greater than 16kB is a problem, + * so simply adjust this define when the driver is compiled for a VMware + * environment. + * + */ +#ifdef VMWARE_BUG +#warning "Compiling for VMware" +#define CDC_NCM_MAX_RX_URB_SIZE 16384 +#else +#define CDC_NCM_MAX_RX_URB_SIZE CDC_NCM_NTB_MAX_SIZE_RX +#endif + /* The following macro defines the minimum header space */ #define CDC_NCM_MIN_HDR_SIZE \ (sizeof(struct usb_cdc_ncm_nth16) + sizeof(struct usb_cdc_ncm_ndp16) + \ @@ -589,6 +606,9 @@ advance: ctx->out_ep->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); dev->status = ctx->status_ep; dev->rx_urb_size = ctx->rx_max; + if (dev->rx_urb_size > CDC_NCM_MAX_RX_URB_SIZE) + dev->rx_urb_size = CDC_NCM_MAX_RX_URB_SIZE; + pr_debug("dev->rx_urb_size = %zu", dev->rx_urb_size); /* * We should get an event when network connection is "connected" or