usb: u_ether: Add workqueue as bottom half handler for rx data path

u_ether driver passes rx data to network layer and resubmits the
request back to usb hardware in interrupt context. Network layer
processes rx data by scheduling tasklet. For high throughput
scenarios on rx data path driver is spending lot of time in interrupt
context due to rx data processing by tasklet and continuous completion
and re-submission of the usb requests which results in watchdog bark.
Hence move the rx data processing and usb request submission to a
workqueue bottom half handler.

Change-Id: I316de8e267997137ac189a8b7b2846fa325f4a5a
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
usb: gadget: prevent change of Host MAC address of 'usb0' interface

On windows 7 platform, previously allocated ip address is maintained.
However, Host MAC address of 'usb0' interface is changed when the
tethering driver re-enumerated. Thus, the tethering network driver
can't be allocated ip address from dhcp. It causes connection delay
between host and phone for usb tethering.

This patch prevents from changing Host MAC address of 'usb0' interface.
In other words, this patch maintains the Host MAC address allocated when
first tethering driver although the driver is re-enumerated. However,
after reboot, the Host MAC address can be changed.

Change-Id: I43add9925e9d6d90c56cffbd3ed999104448f818
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
USB: gadget: u_ether: Fix data stall issue in RNDIS tethering mode

For dual speed gadget, with current no. of request(10), there is
possibility of corner case occurence where all 10 reuqests are queued
to HW without setting IOC bit, which could lead to data stall in
RNDIS tethering and RNDIS local networking.

With this patch, counter will be incremented before queueing request to
HW and sets IOC bit for every nth request due to which the corner case
of all requests queued to HW without IOC bit set will be avoided.

Change-Id: I26515bfd9bbc8f7af38be7835692143f7093118a
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
RNDIS: Add Data aggregation (multi packet) support

Add data aggregation support using RNDIS Multi Packet feature
to achieve better UDP Downlink throughput. Max 3 RNDIS Packets
aggregated into one RNDIS Packet with this implementation.

With this change, seeing UDP Downlink throughput increase
from 90 Mbps to above 100 Mbps when using Iperf and sending
data more than 100 Mbps.

Change-Id: I21c39482718944bb1b1068bdd02f626531e58f08
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
ndis: Add debug support to disable RNDIS Multipacket Feature

This change adds module param which allows to disable RNDIS
Multi-packet Feature (Aggregation support in Downlink path)
as this feature is enabled by default.

To disable use this param before moving to RNDIS Composition:
echo 1 > /sys/module/g_android/parameters/rndis_multipacket_dl_disable

Also counts errors as Rx errors if received RNDIS packets are
not following RNDIS message format as those packets are being
discarded.

Change-Id: I764430da78f2204af92e14bb279c11b24c7e4c67
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
USB: gadget: rndis: Add module parameter for DL max packets per xfer

Currently DL aggregation is supported in RNDIS driver and is set to
3 by default. And there is no support to change downlink maximum
packets per transfer at runtime through module parameter. Hence add
module parameter for DL maximum packets per transfer to change it at
runtime.

echo 6 > /sys/module/g_android/parameters/rndis_dl_max_pkt_per_xfer

To disable DL aggregation during runtime,

echo 1 > /sys/module/g_android/parameters/rndis_dl_max_pkt_per_xfer

Change-Id: I3a1d0bc97358e2b6f233df7ae8725fb507de50db
Signed-off-by: Xerox Lin <xerox_lin@htc.com>
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
USB: f_rndis: fix compile error

Change-Id: Ied5dd8ef905bdf84d176a5e560b09e292b68fbc5
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>