OSDN Git Service

sagit-ice-cold/kernel_xiaomi_msm8998.git
8 years agousb: dwc: Fix function wakeup during suspend on SW path
Danny Segal [Tue, 17 Jun 2014 12:22:45 +0000 (15:22 +0300)]
usb: dwc: Fix function wakeup during suspend on SW path

When the SW wants to start USB traffic during USB bus suspend state, it
needs to issue remote-wakeup signaling to the USB host before sending the
function wakeup notification. This patch changes the function wakeup
sending notification function to check whenter the USB bus is suspended
and issue remote-wakeup if needed.

CRs-Fixed: 678203
Change-Id: I1b09e7763c821a0a0e62095b4dc1c8621a2316b3
Signed-off-by: Danny Segal <dsegal@codeaurora.org>
8 years agogadget: dwc: Support remote wakeup bit in GET_STATUS command in HS-USB mode
Danny Segal [Tue, 27 May 2014 09:22:38 +0000 (12:22 +0300)]
gadget: dwc: Support remote wakeup bit in GET_STATUS command in HS-USB mode

In High-Speed mode, the remote wakeup feature is enabled by a SET_FEATURE
command sent from the host. This patch adds the logic reflect this
configuration in the device GET_STATUS command response.

Change-Id: I0c934d0330d2580f15b1307005dde7b4b7874a7d
Signed-off-by: Danny Segal <dsegal@codeaurora.org>
8 years agousb: dwc: add support for super-speed function suspend
Danny Segal [Thu, 22 May 2014 13:11:58 +0000 (16:11 +0300)]
usb: dwc: add support for super-speed function suspend

The USB 3.0 specification defines a new 'Function Suspend' feature.
This feature enables the USB host to put inactive composite device
functions in a suspended state even when the device itself is not
suspended.
This patch extends the existing framework of USB dwc driver
to properly support the 'Function Resume' and 'Function Remote Wakeup'
related features.

Change-Id: If7bbfa7d6a4ff70d4b44ede5fc258370b890df47
Signed-off-by: Danny Segal <dsegal@codeaurora.org>
8 years agousb: gadget: Add udc_priv member to struct usb_request
Jack Pham [Wed, 10 Sep 2014 09:22:17 +0000 (02:22 -0700)]
usb: gadget: Add udc_priv member to struct usb_request

This member is used to store additional private flags
for BAM-enabled functions to pass information to the UDC.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3: gadget: allow running wakeup in delayed context
Bar Weiner [Tue, 13 May 2014 12:45:00 +0000 (15:45 +0300)]
usb: dwc3: gadget: allow running wakeup in delayed context

Adding the option of running the gadget wakeup function
from the context in which it is called, or delaying it - in case
it is called from an atomic context. This is required in order
to support a case where the gadget is in lpm and the wakeup
would result in a queue to the low-powered hardware.

Change-Id: I09fc60e75c79202c97251146aab1539de3307424
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
Signed-off-by: Danny Segal <dsegal@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agoUSB: dwc3: Add support for fixing superspeed enumeration issue
Vijayavardhan Vennapusa [Thu, 8 May 2014 08:17:50 +0000 (13:47 +0530)]
USB: dwc3: Add support for fixing superspeed enumeration issue

Setting SSPHY SUSP bit (bit 17) in GUSB3PIPECTL(0) register
might cause device enumerating at high speed mode instead of
superspeed mode on some platforms. Hence add workaround by
clearing the SSPHY SUSP bit during disconnect and setting it
after it is configured to fix this enumeration issue on those
platforms.

Also add support for disabling U1 and U2 low power modes  which
could also affect this enumeration issue.

CRs-Fixed: 637902
Change-Id: I8668ced09a88b77f37265ab15e89fa9e964bfbe9
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
[jackp@codeaurora.org: only add u1/u2 disable bits]
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3: add in_lpm flag to struct dwc3
Bar Weiner [Tue, 13 May 2014 12:13:19 +0000 (15:13 +0300)]
usb: dwc3: add in_lpm flag to struct dwc3

This change provides the gadget with awareness regarding
the vendor-specific's low-power-mode status. This is done
in order to enable proper decision making regarding cases
where the gadget would potentially attempt to interface the
hardware when it's in lpm.

Change-Id: I1508fbddd13228fbb7d6d53d91d98a0acaaf3fd7
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
8 years agousb: dwc3: add support for pwr_event_irq
Bar Weiner [Mon, 19 May 2014 08:18:01 +0000 (11:18 +0300)]
usb: dwc3: add support for pwr_event_irq

Adds support for the pwr_event_irq in general, and for
the L1_OUT pwr event specifically. The support consists of:
1. Enabling the pwr_event_irq based on the DT.
2. Adding a threaded irq handler as well as a centralized function
   (dwc3_pwr_event_handler()) for handling the various power events.
3. Enabling the L1_OUT pwr event. This is done on an
   arch-by-arch basis. The trigger for enabling this is
   dbm_l1_lpm_interrupt().
4. Calling usb_gadget_wakeup() in order to initiate a wakeup sequence
   without sending a remote-wakeup indication to the host.
5. Adding a call from dwc3_msm_resume() to dwc3_pwr_event_handler().
   This is done in order to overcome a situation where
   dwc3_msm_suspend() would have disabled the clocks, thereby
   disabling the ability to read the PWR_STAT register before calling
   the handler function.

Change-Id: Ia548ec2e9ee4a7c6634c87ba24fe4cdbf1221000
Signed-off-by: Dov Levenglick <dovl@codeaurora.org>
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
8 years agousb: dwc3: gadget: ignore suspend interrupt before connect
Dov Levenglick [Sun, 4 May 2014 08:34:45 +0000 (11:34 +0300)]
usb: dwc3: gadget: ignore suspend interrupt before connect

The controller sees a suspend event prior to the the cable connect
or reset events. As a result, it runs through an unnecessary
suspend sequence. Adding a check on the gadget's state avoids
the overhead.
The root cause of this appears to be a situation where the
controller senses/is told that there is a VBUS, but the port
reset is not forthcoming. In such a case, the line state is
interpreted as suspend, and the event is generated.
When VBUS detach is sensed/indicated, the state is returned to
USB_STATE_NOTATTACHED, in preparation for the next cable connect.

Change-Id: I639454ceb0ad3a8ff2c02d527c553a934b8639fc
Signed-off-by: Dov Levenglick <dovl@codeaurora.org>
8 years agousb: dwc3: Add missing defines
Jack Pham [Sat, 11 Apr 2015 01:05:53 +0000 (18:05 -0700)]
usb: dwc3: Add missing defines

Add bit definition for the GUSB2PHYCFG ENBLSLPM bit.
Add definition for DWC3_GUCTL_REFCLKPER which is used to set
the reference clock frequency. Also add definition for
DWC3_GDBGLTSSM_LINKSTATE_MASK used to query the HW for
the current LTSSM link state.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3: gadget: allow remote-wakeup for SS-USB
Bar Weiner [Thu, 3 Apr 2014 09:47:51 +0000 (12:47 +0300)]
usb: dwc3: gadget: allow remote-wakeup for SS-USB

Remove the restriction in the code that disables the possibility
of device remote wakeup in SS-USB.
Originally, this restriction was coded since suspend/resume in SS-USB
is expected to be performed at the function level, rather than the
device level. However, the suspend is currently done at the device
level, and therefore the corresponding remote wakeup should also
follow in suit.
The concept of function suspend/resume may be revisited in the future.

Change-Id: If071f38c03cf46290536cafad1a13a6818088eb7
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
8 years agousb: dwc3: Keep track of interrupt statistics
Mayank Rana [Fri, 28 Feb 2014 19:04:38 +0000 (11:04 -0800)]
usb: dwc3: Keep track of interrupt statistics

This change adds debug support to log all received different
events with endpoint0, other endpoints and gadget events. It
tracks these events per endpoint and displays the same.

For each of the endpoint event counters, add the rate (in Hz)
at which it occurs in order to better analyze performance and
aid in optimization.

How to use:
- Mount debugfs
- To see received all dwc3 events/interrupts
cat /sys/kernel/debug/<base_address>.dwc3/int_events
- To clear all received dwc3 events/interrupts
echo 0 > /sys/kernel/debug/<base_address>.dwc3/int_events

Change-Id: Ibf5f3ee57f69c87f94f55a58f50792075be24fbb
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agousb: dwc3: gadget: start resume sequence on remote-wakeup
Dov Levenglick [Thu, 27 Mar 2014 21:41:09 +0000 (23:41 +0200)]
usb: dwc3: gadget: start resume sequence on remote-wakeup

As per Synopsys databook, the USB controller does not
trigger a wakeup event when remote-wakeup is used.
Hence, after remote-wakeup sequence is complete, and
the device is back at U0 state, it is required that
the resume sequence is initiated manually by SW.

Change-Id: I2f147d4a0644088b948b1798627c7717c35c0104
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
Signed-off-by: Dov Levenglick <dovl@codeaurora.org>
8 years agousb: dwc3: gadget: Protect against ep disabling during completion
Jack Pham [Tue, 11 Mar 2014 06:40:58 +0000 (23:40 -0700)]
usb: dwc3: gadget: Protect against ep disabling during completion

In dwc3_cleanup_done_reqs(), a potential race condition
could arise when dwc3_gadget_giveback() temporarily
releases the main spinlock.  If during this window the
very endpoint being handled becomes disabled, it would
lead to a NULL pointer dereference in the code that
follows.  Guard against this by making sure the endpoint
is still enabled after returning from the giveback call.

CRs-fixed: 628972
Change-Id: Ifdb823fff12747f699217d871a5959c85b5340f7
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agodwc3: Disable USB Link state(U1/U2) change events
Mayank Rana [Mon, 10 Mar 2014 22:24:52 +0000 (15:24 -0700)]
dwc3: Disable USB Link state(U1/U2) change events

Currently all USB Link state change events are enable which are
triggering huge number of interrupts to the cpu. Disable U1/U2 Link
state entry/exit events by using dwc_usb3_devten register. Below is
one of test results showing the same.
Test case: Run tethered RMNET UDP UL/DL Modem looback with 50M bandwidth
Test duration: 120 seconds
Test Results :
- with USB Link state change events enable:
CPU Idle : 42%, Number of USB Link state change events: 3769013
- with USB Link state change events disable:
CPU Idle : 51%, Number of USB Link state change events: 0
These numbers (cpu usage, number of interrupts) are taken for
120 seconds duration of test execution.

This change also does enable U3L2L1SuspEn event (BIT:6)  to get U3
notification and handling suspend part. Wakeup event is already enabled
which takes care of USB resuming.

CRs-Fixed: 610718
Change-Id: Ied6da6699849a3136a35de0b9a27ee18086daeab
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
8 years agousb: dwc3: Stop processing more events after erratic error
Jack Pham [Fri, 29 Aug 2014 22:21:03 +0000 (15:21 -0700)]
usb: dwc3: Stop processing more events after erratic error

In rare cases if the controller is unable to communicate with the
PHY it will trigger an ERRATIC ERROR event, upon which it is
recommended that the controller be reset. Currently the reset
is scheduled to be performed in a workqueue, which relinquishes
the dwc3_interrupt thread to continue to process the event buffer.
Meanwhile if the reset runs concurrently, it would disable the core
clock, which would result in unclocked I/O access if the gadget
interrupt handling continues to run. Fix this by stopping the
interrupt thread and prevent further interrupts from reading DWC3
registers until the reset sequence has completed.

Change-Id: Ib9a2173867d2ce3c9dbc5f5cbff0dda554168b35
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3: gadget: Handle erratic error event only once
Jack Pham [Tue, 25 Feb 2014 04:04:11 +0000 (20:04 -0800)]
usb: dwc3: gadget: Handle erratic error event only once

DWC3 databook suggests that upon receiving erratic error event
software should reset the controller. The way in which the
driver currently handles interrupts by offloading event processing
to a threaded handler could result in a long sequence of received
erratic errors in the event queue. dwc3_gadget_interrupt() could
then end up processing a large number of the same event unnecessarily.

In the case of dwc3-msm, this results in KERN_INFO messages flooding
the console. Fix this by only handling erratic error once. Add
a state variable to keep track of when it is seen, and clear it
once a non-error event is processed.

Change-Id: I5deeb2a614f9002867472a0e4aa26a61f0413ceb
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3: gadget: Ensure core is not suspended when handling interrupt
Jack Pham [Fri, 14 Feb 2014 02:33:50 +0000 (18:33 -0800)]
usb: dwc3: gadget: Ensure core is not suspended when handling interrupt

Since dwc3_thread_interrupt is part of interrupt handling that
can be scheduled to run in thread context, it leaves open a
window in which the controller might be placed into low power
mode. In this state, clocks would be disabled, and by the time
dwc3_thread_interrupt runs, would result in an unclocked I/O
access when it tries to write to the GEVNTCOUNT register.

Prevent this by calling pm_runtime_get() in dwc3_interrupt() in
order to force the device to remain in active state, which
increments the parent device's child count so that it too is
prevented from entering suspend. Call pm_runtime_put() at the
end of dwc3_thread_interrupt() after finishing processing the
event buffers.

CRs-fixed: 609233
CRs-fixed: 622850
Change-Id: Ia21c9ac74d74833a889081f41c93acec2a7ae011
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3: Enable newer refclk-based SOF/ITP generation
Jack Pham [Wed, 20 Nov 2013 01:15:13 +0000 (17:15 -0800)]
usb: dwc3: Enable newer refclk-based SOF/ITP generation

Add support for refclk-based SOF and ITP generation, which is
present on DWC3 cores starting in revision 2.50a. This supersedes
the functionality provided by GCTL.SOFTITPSYNC which handled ITP
generation only. This introduces the new GFLADJ register and
writes its fields based on the reference clock period to the
core, which can now be specified as a device tree parameter.

Change-Id: I2c57586cd8b5275b77ebe64cf0835617f0340b62
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3: core: Allow platform glue driver to handle PM
Manu Gautam [Fri, 16 Aug 2013 10:56:16 +0000 (16:26 +0530)]
usb: dwc3: core: Allow platform glue driver to handle PM

DWC3 platform glue driver on some targets is responsible for
dealing with power management. They might even implement
runtime suspend for DWC3 and want to keep devices in suspend
during system PM state transitions. Also, DWC3 core driver
doesn't implement runtime PM and carries out hardware read
write operations assuming it is never put in LPM and clocks
would always be ON.
Hence, for platforms which implement aggressive power management
of DWC3 from its glue driver, make core's PM ops as NO-OP and
just notify them of the core PM states using callback.

Change-Id: If82913ebe753236682e31ab351c991c3f855b2f1
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
8 years agoUSB: dwc3: Implement revised initialization sequence
Jack Pham [Tue, 21 Apr 2015 06:25:16 +0000 (23:25 -0700)]
USB: dwc3: Implement revised initialization sequence

Revise initialization and power-on routines to
be more consistent with recommended sequences.
Since some of the same sequences are repeated during
USB cable reconnection and exiting from power collapse,
consolidate these into common routines to avoid duplicated code.

Also don't perform controller and PHYs soft reset as they may
result in unknown flip-flop state resulting in undefined issues.
Soft reset is not required as Controller and PHY are reset using
GCC anyway.

Change-Id: I99856ac2ff01daa75b7e6d5a584c1b314402aa03
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agoUSB: dwc3: gadget: Reset device core before setting Run/stop bit
Wesley Cheng [Wed, 5 Jun 2013 10:45:01 +0000 (16:15 +0530)]
USB: dwc3: gadget: Reset device core before setting Run/stop bit

When cable is disconnected, SW does device initiated disconnect
by clearing run/stop bit in DCTL register. When software wants to
reconnect to host, it has to do soft reset USB core and then
do device reinitialization.

By default max burst size for for control endpoints are initialized
to zero. This leads to setting burst size to non zero value for
control endpoints as part of reenabling endpoint 0 and 1 which results
in command queued for ep0 out getting timed out. Hence fix this by
initializing burst size to one in udc_start() API.

CRs-Fixed: 494807
Change-Id: I0a23ae8bc80932f9f66f792a1149ad5d8ac7d4a2
Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
8 years agousb: dwc3: Set elastic buffer mode
Jack Pham [Wed, 27 Jan 2016 23:10:17 +0000 (15:10 -0800)]
usb: dwc3: Set elastic buffer mode

Add a device tree property to allow setting the GUSB3PIPECTRL
Elastic Buffer Mode (bit 0). By default set the buffer to
half-full to work around SuperSpeed link errors. If the property
is set, set the buffer to be nominally empty.

This change is a combination of two previous commits:

USB: dwc3: core: Set elastic buffer mode to zero

Currently elastic buffer mode in GUSB3PIPE_CTRL(0) register is
set to one. This results in high link error rates and superspeed
mode transfer failures if VDDCX is at super turbo mode voltage
1.05V. Hence set elastic buffer mode to zero in GUSB3PIP_CTRL
register.

usb: dwc3: Do not set half-full elastic buffer

On some platforms setting of half-full elastic buffer will cause data
corruption and hence we need to avoid this setting.

Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agoUSB: dwc3: Add debug support for DWC3 driver
Vijayavardhan Vennapusa [Thu, 14 Feb 2013 11:03:30 +0000 (16:33 +0530)]
USB: dwc3: Add debug support for DWC3 driver

Add support for DWC3 driver to dump requests in SW queue
list, requests queued to USB HW and trb list as well. Also
add support for logging endpoint events through debugfs.
Enable logging of EP0 control events by default.

Example:
To capture 2 in endpoint events
echo -n 4 > /sys/module/dwc3/parameters/ep_addr_txdbg_mask
To capture 3 out endpoint events
echo -n 8 > /sys/module/dwc3/parameters/ep_addr_rxdbg_mask
To print debug log events on endpoints
cat /sys/kernel/debug/dwc3/events

To dump requests in SW queue list for 6 out endpoint
echo 6 0 > /sys/kernel/debug/dwc3/requests
cat /sys/kernel/debug/dwc3/requests
To dump requests queued to USB HW for 8 in endpoint
echo 8 1 > /sys/kernel/debug/dwc3/queued_reqs
cat /sys/kernel/debug/dwc3/queued_reqs
To dump TRBs for 9 in endpoint
echo 9 1 > /sys/kernel/debug/dwc3/trbs
cat /sys/kernel/debug/dwc3/trbs

Change-Id: I84e963b8299a1af76de9a35a6ea46ec34b9fe79e
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3: Expose dwc3_trb_dma_offset
Jack Pham [Fri, 10 Apr 2015 02:34:09 +0000 (19:34 -0700)]
usb: dwc3: Expose dwc3_trb_dma_offset

Expose this function for use in the glue layer.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3: gadget: Fail request submission if it was already queued
Manu Gautam [Mon, 11 Feb 2013 10:23:34 +0000 (15:53 +0530)]
usb: dwc3: gadget: Fail request submission if it was already queued

Function driver should not try to queue a busy request again to DCD
until DCD returns it by calling its completion handler or it is
explicitly dequeued. Some buggy function driver may try to submit a
request again which is with DCD resulting in corruption of request_list
leading to crash later in giveback. Catch such conditions and fail the
request submission to DCD.

CRs-Fixed: 447192
Change-Id: Id2a4a1720f61dffc50cc22598734f229caf07ff3
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
8 years agousb: dwc3: gadget: Introduce endless endpoints
Mayank Rana [Fri, 14 Feb 2014 04:04:03 +0000 (20:04 -0800)]
usb: dwc3: gadget: Introduce endless endpoints

There are 3 different transport used for BAM communication and
each BAM pipe can be BAM2BAM or SYS2BAM configuration. Currently
all different per endpoint related interrupts/events are enabled
with USB controller for this configuration. Hence although data
transfer is happening through BAM hardware accerlation path, APPS
is receiving interrupt for each completion from USB controller.
This change binds property with each endpoint if it is being used
in BAM2BAM mode, and enables required interrupts with USB
controller. This significantly reduces number of interrupts
received on APPS with keeping CPU idle in all tethered calls.

Change-Id: I0185606f93996bf7a8c3f9451950b7c4cf9e21c7
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
[jackp@codeaurora.org: renamed subject, omitted u_bam.c and u_bam_data.c]
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: phy: msm: Use regulator_set_load()
Jack Pham [Sat, 30 Jan 2016 02:19:47 +0000 (18:19 -0800)]
usb: phy: msm: Use regulator_set_load()

regulator_set_optimum_mode() was renamed regulator_set_load().
Update the USB PHY drivers.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: phy: add snapshot of phy-msm drivers
Jack Pham [Fri, 10 Apr 2015 01:43:23 +0000 (18:43 -0700)]
usb: phy: add snapshot of phy-msm drivers

This is a snapshot of phy-msm-{hsusb,ssusb,ssusb-qmp,qusb}.c
taken as of msm-3.18 commit 9da4ddc18727 (Merge "clk: msm:
clock-gcc: Associate gfx rail voting with gfx3d branch")

Also replaced ARCH_MSM dependency with ARCH_QCOM in the Kconfig.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agoUSB: phy: Add support to invoke DP and DM sourcing and pulsing
Mayank Rana [Wed, 24 Jun 2015 02:52:51 +0000 (19:52 -0700)]
USB: phy: Add support to invoke DP and DM sourcing and pulsing

This change adds support for sourcing and pulsig with DP/DM
using QUSB PHY. This change uses POWER_SUPPLY_PROP_DP_DM power
supply property with different values to achieve the same.

This change is a cherry-pick of msm-3.18 commit
55b93e2506d5399b1b0ee4a1b173168fb8026548 ("USB: Add support to
invoke DP and DM sourcing and pulsing") with only the change
from include/linux/usb/phy.h

Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: phy: Add new OTG state OTG_STATE_B_SUSPENDED
Hemant Kumar [Tue, 7 Apr 2015 21:42:39 +0000 (14:42 -0700)]
usb: phy: Add new OTG state OTG_STATE_B_SUSPENDED

This state is used to handle:-

- Bus suspend followed by cable disconnect: pm usage
count is incremented upon cable connect. Upon bus
suspend, suspend interrupt kicks in otg state machine
which moves device state to OTG_STATE_B_SUSPENDED from
OTG_STATE_B_PERIPHERAL and decrements pm usage count.
Upon cable unplug additional decrement of pm usage count
is prevented. This state also takes care the handling of
cable unplug followed by bus suspend interrupt.

- Host initiated resume after bus suspend: Being in
OTG_STATE_B_SUSPENDED after bus suspend, upon host
initiated resume, wakeup interrupt kicks in otg state machine
which moves device to OTG_STATE_B_PERIPHERAL state by
incrementing pm usage count.

- PC reboot with cable plugged in: After PC shutdown
device goes to OTG_STATE_B_SUSPENDED state. After
PC start power event irq thread kicks in otg state
machine to move device to OTG_STATE_B_PERIPHERAL
state and increments pm usage count.

- Composition switch after bus suspend:
dwc3_gadget_pullup() kicks in otg state machine to
move device state from OTG_STATE_B_SUSPENDED to
OTG_STATE_B_PERIPHERAL and increments pm usage count
to prevent runtime suspend during device enumeration.

Also, remove pm_runtime_set_active() which sets the PM
runtime stauts as active to avoid pm_runtime_get_sync() failures
which explicitly checks for runtime pm status. For example, if
status is active, pm_runtime_get_sync() will just increments the
counter without actually resuming the device.

Change-Id: Id33b81911ef3894a00802b3e553840b9447f6269
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
[jackp@codeaurora.org: cherry-pick only phy.h and common.c]
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: phy: Expose new PHY callback for performing PHY reset
Maya Erez [Mon, 9 Dec 2013 21:15:30 +0000 (23:15 +0200)]
usb: phy: Expose new PHY callback for performing PHY reset

Add a new PHY callback for performing PHY reset, which is required
by some targets during their initialization sequence.
As usb_phy_reset name was already in use by local msm PHY APIs,
change the previous usb_phy_reset to msm_usb_phy_reset.

Change-Id: Ieb5099d12e107c123d8889058aa564d0b091d6f9
Signed-off-by: Maya Erez <merez@codeaurora.org>
8 years agoARM: dts: msm: Use correct HS PHY IRQ for msm8996 secondary USB
Jack Pham [Fri, 11 Dec 2015 21:03:17 +0000 (13:03 -0800)]
ARM: dts: msm: Use correct HS PHY IRQ for msm8996 secondary USB

The driver change in commit 96f92e28e035 ("usb: dwc3-msm: Use hs
phy and ss phy irq as wake up source") favored using hs_phy_irq
over pwr_event_irq to wake up USB out of suspend. This change
revealed the wrong IRQ was used for the secondary USB2s instance
on msm8996. Use the correct HS PHY IRQ number which maps to QUSB.
Map this IRQ to the corresponding MPM wakeup pin as well.

Change-Id: Ibd56c10c3c96f88d964f7f5f8a0fe9b590c522c5
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agoARM: dts: msm: Add ss_phy_irq as SS USB wakeup source
Hemant Kumar [Fri, 13 Nov 2015 03:29:07 +0000 (19:29 -0800)]
ARM: dts: msm: Add ss_phy_irq as SS USB wakeup source

For mdmcalifornium in case of super speed suspend, power event irq is
not generated upon bus resume. Hence explicitly register for lfps_rxterm
irq as a wake up source to initiate resume sequence for controller in
super speed mode.
To have the same solution across all platforms, update 8996 dtsi.
Also for 8996 update the correct hs_phy_irq interrupt number as
that of QUSB PHY IRQ.

Change-Id: Ie0e67f202513b2c4bf069c10f2b2538a08c8c80c
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>
8 years agoARM: dts: msm: Remove unused ref_clk from USB
Jack Pham [Fri, 11 Dec 2015 20:17:46 +0000 (12:17 -0800)]
ARM: dts: msm: Remove unused ref_clk from USB

As of commit b44b9c5ae647 ("usb: dwc3-msm: Remove voting for
ref_clk") the USB device no longer references the ref_clk. Remove
the unused entries from msm8996, mdm9640 and mdmcalifornium.

Change-Id: I3979e56293c8729cf89b32677bb23216ce68f120
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agoARM: dts: msm: Add ref_clk_src to QUSB PHYs on msm8996
Jack Pham [Fri, 11 Dec 2015 20:11:17 +0000 (12:11 -0800)]
ARM: dts: msm: Add ref_clk_src to QUSB PHYs on msm8996

The QUSB PHY instances each require a ref clk sourced by PMIC
ln_bb_clk in order to function properly. Since this clock is
shared among other peripherals, make sure the PHYs also can
enable it independently when needed.

Change-Id: Id5837532a2c9249b7babb720483c94734d80b717
Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3-msm: Remove pmic_id_irq
Jack Pham [Wed, 27 Jan 2016 02:41:13 +0000 (18:41 -0800)]
usb: dwc3-msm: Remove pmic_id_irq

irq_read_line() is no longer supported.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3-msm: Adapt to new power_supply interface
Jack Pham [Wed, 27 Jan 2016 00:42:47 +0000 (16:42 -0800)]
usb: dwc3-msm: Adapt to new power_supply interface

[devm_]power_supply_register() was updated to receive
power_supply_desc and power_supply_config parameters and
returns a created power_supply object. Update dwc3-msm.c
to conform. Also replace calls to custom power_supply_set_*
functions with direct calls to power_supply_set_property().

Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3-msm: Compilation fixups for 4.4
Jack Pham [Tue, 2 Feb 2016 07:40:27 +0000 (23:40 -0800)]
usb: dwc3-msm: Compilation fixups for 4.4

This patch includes a couple of fixups to compile against
recent kernels:

- replace CONFIG_PM_RUNTIME with CONFIG_PM
- replace of_usb_get_dr_mode() with usb_get_dr_mode(). As a result
  it needs to be called after of_find_device_by_node()

Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agousb: dwc3: msm: Add snapshot of DWC3 MSM drivers
Jack Pham [Mon, 25 Jan 2016 21:24:55 +0000 (13:24 -0800)]
usb: dwc3: msm: Add snapshot of DWC3 MSM drivers

Add dwc3-msm.c and associated driver files. Note these are
based on the downstream implementation and will coexist
(for the time being) with dwc3-qcom glue driver until they
can eventually be merged.

This snapshot is taken as of msm-3.18 commit a3883c356869 (Merge "input:
touchscreen: correct condition checks in ITE tech touch driver")

Signed-off-by: Jack Pham <jackp@codeaurora.org>
8 years agodefconfig: arm64: msm: Enable RmNet Data feature
Subash Abhinov Kasiviswanathan [Fri, 5 Feb 2016 06:15:05 +0000 (23:15 -0700)]
defconfig: arm64: msm: Enable RmNet Data feature

Enabled RmNet data on msm based platforms in order to support MAP data
feature as required for data connectivity.

Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agoipv6: generate random IID only for temporary addresses on RAWIP devices
Harout Hedeshian [Wed, 24 Jun 2015 21:16:34 +0000 (15:16 -0600)]
ipv6: generate random IID only for temporary addresses on RAWIP devices

RAWIP devices require the device IID to be used for permanent
addresses only, and random IIDs to be generated for temporary
addresses. Legacy user-space applications rely on this behavior

CRs-Fixed: 860791
Change-Id: I007bdf8bcfdce687ad31612fed9d9c769321edb9
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agomsm_rmnet: merge support for RAWIP msm_rmnet device
Abhijeet Dharmapurikar [Wed, 15 Sep 2010 19:08:00 +0000 (13:08 -0600)]
msm_rmnet: merge support for RAWIP msm_rmnet device

Add to support for msm_rmnet device using ARPHRD_RAWIP.

Change-Id: Ie1e5433f440b26b644cccb18083ef325129f7942
Acked-by: Andrew Richardson <randrew@qualcomm.com>
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
8 years agonet: rmnet_data: Remove the NETIF_F_IPV6_UDP_CSUM device feature
Subash Abhinov Kasiviswanathan [Fri, 5 Feb 2016 20:43:15 +0000 (13:43 -0700)]
net: rmnet_data: Remove the NETIF_F_IPV6_UDP_CSUM device feature

Commit 32dce968dd987ad ("ipv6: Allow for partial checksums on non-ufo
packets) adds support for checksum offload in hardware for single
UDP packets. As a result, the custom NETIF_F_IPV6_UDP_CSUM feature
is no longer needed.

Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: Change the current NAPI context to use latest API
Subash Abhinov Kasiviswanathan [Fri, 5 Feb 2016 18:11:56 +0000 (11:11 -0700)]
net: Change the current NAPI context to use latest API

Commit 47405a253da4d8c ("percpu: Remove __this_cpu_ptr") and commit
6c51ec4d18d24b2 ("percpu: remove __get_cpu_var and __raw_get_cpu_var
macros") removed __this_cpu_ptr which is needed to access current
NAPI. Use this_cpu_ptr instead.

Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: Add the get current NAPI context API
Subash Abhinov Kasiviswanathan [Tue, 26 Jan 2016 01:09:54 +0000 (18:09 -0700)]
net: Add the get current NAPI context API

Commit 69235aa80090 ("net: Remove the get current NAPI context API")
removed the definition of get_current_napi_context() as rmnet_data
was no longer using it. However, the rmnet_data change to use its
NAPI in multiple contexts was prone to race in hotplug scenarios.

Add back get_current_napi_context() and current_napi to the
softnet_data struct

CRs-Fixed: 966095
Change-Id: I7cf1c5e39a5ccbd7a74a096b11efd179a4d0d034
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: sched: Schedule PRIO qdisc when flow control released
Tianyi Gou [Tue, 26 Jun 2012 16:11:05 +0000 (10:11 -0600)]
net: sched: Schedule PRIO qdisc when flow control released

The PRIO qdisc supports flow control, such that packet
dequeue can be disabled based on boolean flag 'enable_flow'.
When flow is re-enabled, the latency for new packets
arriving at network driver is high.  To reduce the delay in
scheduling packets, the qdisc will now invoke
__netif_schedule() to expedite dequeue.  This significantly
reduces the latency of packets arriving at network driver.

Change-Id: Ic5fe3faf86f177300d3018b9f60974ba3811641c
CRs-Fixed: 355156
Acked-by: Jimi Shah <jimis@qualcomm.com>
Signed-off-by: Tianyi Gou <tgou@codeaurora.org>
8 years agonet: tc_qdisc_flow_control returning qdisc size
Harout Hedeshian [Wed, 7 May 2014 06:01:06 +0000 (09:01 +0300)]
net: tc_qdisc_flow_control returning qdisc size

Changed the tc_qdisc_flow_control API to return the size of the
qdisc in order to be able to collect data on the size of the
qdisc before doing flow control operations. This is required to effectively
diagnose the state of the queues when debugging flow control.

CRs-Fixed: 657414
Change-Id: I4aff2157410e1170de2d0791757ed2e12830a2db
Acked-by: Sivan Reinstein <sivanr@qti.qualcomm.com>
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet_sched: Add flow control support to prio qdisc
Tianyi Gou [Tue, 31 May 2011 20:23:01 +0000 (13:23 -0700)]
net_sched: Add flow control support to prio qdisc

Add enable_flow flag to the prio qdisc.  Packet flow is
enabled by default, but can be disabled from userspace
(e.g. IPROUTE2 tc tool).  This allows for suspending packet
dequeue on a per-qdisc basis, which is needed to supprot
Quality of Service (QOS) when using WWAN modem.

Change-Id: I932f296be946f1acc3b00c7d8569bbb733d33622
Acked-by: Andrew Richardson <randrew@qualcomm.com>
CRs-Fixed: 283471
Signed-off-by: Tianyi Gou <tgou@codeaurora.org>
8 years agonet: sched: export an api to enable/disable flow on sch
Tianyi Gou [Tue, 7 Aug 2012 00:23:26 +0000 (17:23 -0700)]
net: sched: export an api to enable/disable flow on sch

Export a function from sch_api.c that will look up
desired qdisc and call it's registered change function
to enable/disable flow.

Change-Id: I5b6dc7a6fd2b09b796c92b3770ba83423d19c864
CRs-Fixed: 355156
Acked-by: Jimi Shah <jimis@qualcomm.com>
Signed-off-by: Tianyi Gou <tgou@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Remove the NAPI context for rmnet_data devices
Subash Abhinov Kasiviswanathan [Tue, 26 Jan 2016 01:09:38 +0000 (18:09 -0700)]
net: rmnet_data: Remove the NAPI context for rmnet_data devices

Commit 28207b510dca ("net: rmnet_data: Add NAPI context for rmnet_data
devices") added a NAPI struct per rmnet_data device. This was to
ensure that the NAPI struct is always available even if there was a
hotplug. However, this seems to be leading to some races where the
NAPI struct is accessed concurrently across cores.

The race here is between napi_gro_receive on one core with
napi_complete running on the other accessing the same NAPI struct.
If napi_gro_receive runs slightly earlier, napi_complete would see
that the napi->gro_list would be non NULL in __napi_complete even
though it had cleared earlier and would lead to a BUG.
If napi_complete runs slightly earlier, napi_gro_receive would
dereference a NULL pointer even though it had assigned an skb to
napi->gro_list.

Fix this by using the per cpu backlog struct as the NAPI struct for
queuing packets to GRO engine. Access across cores would not be a
problem in case of hotplug as they would use core specific structures.

CRs-Fixed: 966095
Change-Id: I831df5b93cc6ee77355f2e98af89efcffe825bd8
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agormnet_data : Changes to support Scatter Gather and GSO.
Ravinder Konka [Mon, 26 Oct 2015 07:45:33 +0000 (13:15 +0530)]
rmnet_data : Changes to support Scatter Gather and GSO.

This patch enables hardware device features such as
NETIF_F_SG NETIF_F_GSO NETIF_F_GSO_UDP_TUNNEL
NETIF_F_GSO_UDP_TUNNEL_CSUM. This patch also ensures
to skip padding(to align length to word boundaries)
for outgoing  non linear skbs.

This patch also adds a new ioctl interface
RMNET_IOCTL_GET_SG_SUPPORT  to query the physical
 network devices for Scatter Gather support.

Change-Id: I9788d75c249ab2dac5b598dad131c0692ed84e4d
Acked-by: Abhishek Chauhan <abchauha@qti.qualcomm.com>
Signed-off-by: Ravinder Konka <rkonka@codeaurora.org>
8 years agonet: msm_rmnet: Add an IOCTL definition to deregister a net device
Ravinder Konka [Sun, 18 Jan 2015 05:17:57 +0000 (10:47 +0530)]
net: msm_rmnet: Add an IOCTL definition to deregister a net device

Platform drivers may be registered on driver startup for multiple
channels which may cause probe and remove events to be called
corresponding to driver events. It is possible that not all
channels need to be enumerated for normal device operation. The
unused channels also add unnecessary delay during sub system
restart.

Add an extended IOCTL which provides user space an option to
unregister a platform driver.

Change-Id: Ifa6284563551ecdd297ae457ea2b35027f60844e
Acked-by: Nagarjuna Chaganti <nchagant@qti.qualcomm.com>
Signed-off-by: Ravinder Konka <rkonka@codeaurora.org>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: msm_rmnet: extend SET_INGRESS_DATA_FORMAT to include AGG data
Harout Hedeshian [Mon, 6 Apr 2015 22:33:23 +0000 (16:33 -0600)]
net: msm_rmnet: extend SET_INGRESS_DATA_FORMAT to include AGG data

Introduced new format flag for RMNET_IOCTL_SET_INGRESS_DATA_FORMAT:
RMNET_IOCTL_INGRESS_FORMAT_AGG_DATA
This flag is set by the entity callint the IOCTL if the
ingress_format union has been populated with a valid aggregation count
and buffer size.

Change-Id: Icb30c99e69062736c343591226fbdb499aa47a41
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: msm_rmnet: Add an extended ioctl definition to pass xlat device info
Harout Hedeshian [Wed, 26 Nov 2014 02:10:08 +0000 (19:10 -0700)]
net: msm_rmnet: Add an extended ioctl definition to pass xlat device info

Add an ioctl for passing rmnet_data device name to the physical device
driver for xlat capable calls. This information is used by the driver
to optimize traffic on the rmnet_data device.

CRs-Fixed: 762178
Change-Id: Ib19730d239882f0900ca2dbd91e5252fefd63053
Acked-by: Sudharsan Coimbatore Premkumar <supremku@qti.qualcomm.com>
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: msm_rmnet.h: Add sleep state extended IOCTL
Subash Abhinov Kasiviswanathan [Mon, 16 Jun 2014 16:26:56 +0000 (10:26 -0600)]
net: msm_rmnet.h: Add sleep state extended IOCTL

Add extended IOCTL to set and reset the sleep states
of the underlying physical transport.

CRs-Fixed: 679058
Change-Id: I962e016abf3bfa4b468591039b79cef58fbb8b3b
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: msm_rmnet.h: Fix data type of flow_id in QoS header
Subash Abhinov Kasiviswanathan [Wed, 21 May 2014 19:06:10 +0000 (13:06 -0600)]
net: msm_rmnet.h: Fix data type of flow_id in QoS header

Fix an issue where the flow_id was appearing to be 8 bytes in
64 bit platforms. This is because the flow_id is declared as unsigned
long which is 8 bytes in 64 bit and 4 bytes in 32 bit platforms.
Change the flow_id to uint32_t to make it 4 bytes on all platforms.

CRs-fixed: 663814
Change-Id: I2472fb99750d1818ecfae03b5bcd860f19ac51a7
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Add RXCSUM capability to netdevices
Subash Abhinov Kasiviswanathan [Sun, 11 Oct 2015 07:38:58 +0000 (01:38 -0600)]
net: rmnet_data: Add RXCSUM capability to netdevices

Checksum offload is supported in MAPv3/v4. Add the device feature
to indicate this support.

Change-Id: I89caf6d9029cd483759404542681621909de70a3
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Stop adding pad bytes for MAPv4 uplink packets
Subash Abhinov Kasiviswanathan [Fri, 9 Oct 2015 00:59:00 +0000 (18:59 -0600)]
net: rmnet_data: Stop adding pad bytes for MAPv4 uplink packets

Hardware does not handle pad bytes in egress packets when uplink
aggregation is not enabled. This is due to the translation support
added on hardware for MAPv4.

Change-Id: Ic246a4548561450035d5252221032d72eff44518
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Add support for MAPv4 data format
Subash Abhinov Kasiviswanathan [Wed, 2 Sep 2015 20:44:08 +0000 (14:44 -0600)]
net: rmnet_data: Add support for MAPv4 data format

Add the MAPv4 ingress and data format handlers. MAPv4 requires the
checksum for uplink TCP and UDP packets to be 1's complemented
before passing the packet onto the physical netdevice.

This workaround is needed due to failures seen in hardware while
processing translated packets.

Change-Id: Ib79382fa7e8b2bd0c1adbe68b8de75f1602df10b
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Assign network_header instead of data in mac_header
Subash Abhinov Kasiviswanathan [Wed, 2 Sep 2015 20:18:46 +0000 (14:18 -0600)]
net: rmnet_data: Assign network_header instead of data in mac_header

Commit 1a37e412a0225fc ("net: Use 16bits for *_headers fields of
struct skbuff") changes the data type of mac_header from pointer to
__u16. As a result, it is invalid to assign data to mac_header
in architectures where NET_SKBUFF_DATA_USES_OFFSET is 0.

Change-Id: I97ce04e3747983839d3908ca8111fd588c8e43a2
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Call the GRO handler for TCP packets only
Subash Abhinov Kasiviswanathan [Sat, 15 Aug 2015 00:08:30 +0000 (18:08 -0600)]
net: rmnet_data: Call the GRO handler for TCP packets only

While running a UDP test using gro handler, there was a slight
increase in MIPS observed. This is because all UDP packets passed
through napi_gro_receive need to be checked if it is an encapsulated
UDP packet which could actually be coalesced and processed further.

As of now, clients of rmnet_data do not support this and we can
save MIPS on this by passing only TCP packets through the GRO
handler. All non TCP packets will directly be passed directly to
the network stack. This also helps us to avoid an atomic operation
unnecessarily when GRO path is not exercised.

There is 1% savings in MIPS observed when using a single stream
UDP DL connection at 300Mbps.

Change-Id: Ie601000de21afeacfca93f23117aeb0f7cefda98
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Remove ip type check in deaggregate handler
Subash Abhinov Kasiviswanathan [Fri, 28 Aug 2015 21:55:31 +0000 (15:55 -0600)]
net: rmnet_data: Remove ip type check in deaggregate handler

This was originally added for debug and is no longer needed.

Change-Id: I9780e86ff0db31eaa13f2470c19f1424db3311b8
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Add NAPI context for rmnet_data devices
Subash Abhinov Kasiviswanathan [Sat, 1 Aug 2015 04:06:07 +0000 (22:06 -0600)]
net: rmnet_data: Add NAPI context for rmnet_data devices

This is needed so that we can pass the virtual netdevice NAPI struct
to napi_gro_receive rather than relying on the current CPU NAPI
context which can cause issues due to CPU hotplug.

Change-Id: I41977c3a3a51212aa2fe092427b0ca924045b477
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: process MAP commands only after frame deaggregation
Harout Hedeshian [Wed, 12 Aug 2015 20:38:34 +0000 (14:38 -0600)]
net: rmnet_data: process MAP commands only after frame deaggregation

It is not guaranteed that MAP commands will be in their own frame. Some
commands may be embedded in a large aggregated frame of datagrams. This
patch forces MAP command processing to occur after the deaggregation
routing. This has the side-effect of incurring a malloc/memcpy latency
penalty for each MAP command. This also introduces a side-effect where
every packet after de-aggregation will need to be inspected for the
cmd bit.

Change-Id: Icc5ad1e7d622a35883f858c2c132c9679f43c79e
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: Handle info pointer from netdevice notifier
Subash Abhinov Kasiviswanathan [Fri, 3 Jul 2015 01:13:00 +0000 (19:13 -0600)]
net: rmnet_data: Handle info pointer from netdevice notifier

Commit 351638e7deeed2e ("net: pass info struct via netdevice notifier")
adds support for passing a custom struct rather than a net device.

BUG: KASan: out of bounds on stack in rmnet_config_notify_cb+0x11c/0x728i
at addr ffffffc01232fb48
Read of size 8 by task WifiStateMachin/2268
page:ffffffbb056ce3e8 count:0 mapcount:0 mapping:        (null) index:0x2
flags: 0x0()
page dumped because: kasan: bad access detected
CPU: 2 PID: 2268 Comm: WifiStateMachin Tainted: G        W  O
3.18.0-g092b7e8-dirty #6
Hardware name: Qualcomm Technologies, Inc. MSM 8996 v2 + PMI8994 MTP (DT)
Call trace:
[<ffffffc000089c70>] dump_backtrace+0x0/0x1c4
[<ffffffc000089e44>] show_stack+0x10/0x1c
[<ffffffc0010cae0c>] dump_stack+0x74/0xc8
[<ffffffc00020e360>] kasan_report_error+0x2ac/0x3d0
[<ffffffc00020e560>] kasan_report+0x34/0x40
[<ffffffc00020d520>] __asan_load8+0x84/0x90
[<ffffffc0010ba434>] rmnet_config_notify_cb+0x118/0x728
[<ffffffc0000d1858>] notifier_call_chain+0x68/0xb4
[<ffffffc0000d1940>] raw_notifier_call_chain+0x10/0x1c
[<ffffffc000e2a39c>] call_netdevice_notifiers_info+0x60/0x74
[<ffffffc000e2a418>] call_netdevice_notifiers+0x68/0x84
[<ffffffc000e367c8>] netdev_run_todo+0x100/0x348
[<ffffffc000e4545c>] rtnl_unlock+0x8/0x14
[<ffffffc000e31a4c>] unregister_netdev+0x20/0x30
[<ffffffbffc02420c>] hdd_cleanup_adapter+0x88/0x9c [wlan]
[<ffffffbffc026630>] hdd_close_all_adapters+0xc4/0x128 [wlan]
[<ffffffbffc02a8d4>] hdd_wlan_exit+0x660/0x744 [wlan]
[<ffffffbffc02c388>] __hdd_wlan_exit+0x104/0x138 [wlan]
[<ffffffbffc284410>] hif_pci_remove+0x68/0x114 [wlan]
[<ffffffc0007f45c8>] cnss_wlan_unregister_driver+0xa0/0x21c
[<ffffffbffc286118>] hif_unregister_driver+0x14/0x20 [wlan]
[<ffffffbffc2a0288>] hdd_module_exit+0x1b4/0x218 [wlan]
[<ffffffc00014f804>] SyS_delete_module+0x1f4/0x290
Memory state around the buggy address:
ffffffc01232fa00: f1 f1 00 f4 f4 f4 f3 f3 f3 f3 00 00 00 00 00 00
ffffffc01232fa80: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 f4
>ffffffc01232fb00: f4 f4 f2 f2 f2 f2 00 f4 f4 f4 f2 f2 f2 f2 00 00
                                              ^
ffffffc01232fb80: 00 00 00 00 00 00 f3 f3 f3 f3 00 00 00 00 00 00
ffffffc01232fc00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Update the netdevice callback to handle this change.
Also remove a redundant check for associated devices.

CRs-Fixed: 865889
Change-Id: I96461807631447aef84eb3eac906057e3ce6827c
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Fix incorrect flags for rmnet_data devices
Subash Abhinov Kasiviswanathan [Wed, 24 Jun 2015 19:50:35 +0000 (13:50 -0600)]
net: rmnet_data: Fix incorrect flags for rmnet_data devices

Userspace applications report that SIOCETHTOOL IOCTL fails for
option ETHTOOL_STXCSUM even though rmnet_data devices with
prefix were created. This is because commit I183ba7
("net: rmnet_data: adding support to GRO") replaced the dev
features with NETIF_F_GRO only.

Fix this this by specifying the expected set of dev features.

CRs-fixed: 860895
Change-Id: Ic0935718a3a3f7bab5ea70d81c7dff99ebf0a7fc
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Fix memory corruption in gro tracepoint
Subash Abhinov Kasiviswanathan [Wed, 10 Jun 2015 17:26:17 +0000 (11:26 -0600)]
net: rmnet_data: Fix memory corruption in gro tracepoint

skb's passed to the network stack through napi_gro_receive can
be freed before it is used in the gro tracepoint to print the
ingress device.

Fix this by removing the skb as an argument. We could copy the
skb->dev to a string before passing it to napi_gro_receive and then
use it as an argument for the tracepoint but that would mean
unnecessary code in hotpath for debugging purposes.

Change-Id: I82055dbc9b84f405e8f63f7b2eeb7c80e5ae0c3a
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: use netif_tx_lock when sending MAP ACK message
Harout Hedeshian [Thu, 21 May 2015 13:35:04 +0000 (07:35 -0600)]
net: rmnet_data: use netif_tx_lock when sending MAP ACK message

The initial implementation of MAP command would grab the global
tx lock on the physical transport interface directly. It seems grabbing
the lock on its own is not enough to serialize access to the underlying
device's ndo_start_xmit() function. In addition to grabbing the lock
the transmit queue must be placed in frozen state. The fix is to use the
standard netif_tx_lock/unlock APIs as provided by the core framework
rather than manually grabbing the spinlocks.

Additionally, the null check has been optimized with an unlikely().
A new LOGD() message was added for further debugging of MAP ACK
sending.

CRs-Fixed: 841068
Change-Id: Ia76396f3075f25cdf6bf7278bba0ec78433b2934
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: Remove watchdog_timeo
Subash Abhinov Kasiviswanathan [Mon, 4 May 2015 23:33:12 +0000 (17:33 -0600)]
net: rmnet_data: Remove watchdog_timeo

Remove all references of watchdog_timeo since rmnet_data does not
support recovering from tx timeouts.

Change-Id: I7d92c430e502ac53f8dee2315b64b58cd2ab7745
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Fix deaggregation to work with DL checksum offload
Subash Abhinov Kasiviswanathan [Mon, 23 Mar 2015 20:21:14 +0000 (14:21 -0600)]
net: rmnet_data: Fix deaggregation to work with DL checksum offload

Specifications state that the MAP packet length in the MAP header do
not account for the number of bytes of packet trailer from DL checksum
offload. Current implementation does not take this into account when
MAP aggregation is enabled.

Fix this by accounting for the extra bytes of the DL checksum trailer
if DL checksum offload is enabled when computing packet length during
MAP deaggregation

Change-Id: I9c10bb9726413b1f14f94210dbe194c2c15349f5
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: adding support to GRO
Sivan Reinstein [Sun, 8 Mar 2015 13:12:08 +0000 (15:12 +0200)]
net: rmnet_data: adding support to GRO

Adding support to GRO (Generic Receive Offload) in rmnet_data
interfaces.
Rmnet_data interface invokes the GRO API napi_gro_receive() using
the napi_struct which belongs to the current NAPI context, as
given by the network stack.

CRs-fixed: 784626
Change-Id: I183ba73f176cb0ee0ccb94cc2d77209bb26f7506
Signed-off-by: Sivan Reinstein <sivanr@codeaurora.org>
8 years agonet: rmnet_data: Change memory allocation style
Subash Abhinov Kasiviswanathan [Mon, 23 Mar 2015 23:27:07 +0000 (17:27 -0600)]
net: rmnet_data: Change memory allocation style

Modify all alloc's to use the style as mentioned in the kernel
coding guidelines.

Change-Id: Id471e6640d69c4cad2b6f44049e291a06e0306b3
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: use memcpy() during deaggration of MAP frames
Harout Hedeshian [Thu, 12 Mar 2015 00:13:30 +0000 (18:13 -0600)]
net: rmnet_data: use memcpy() during deaggration of MAP frames

Using skb_clone() to deaggregate frames results in multiple side effects.

First side effect is that skb->truesize will reflect the total
aggregation buffer size for each 1500-byte frame charged to a socket.
Hence, the socket thinks it is using more memory than it actually is
resulting in unnecessary packet drops.

Second side effect is that GRO will not work correctly since the cloned
SKBs share the same shinfo struct. GRO uses the gso_segs field here
and will get confused when the packets have bad values here.

The new algorithm removes skb_clone altogether. Instead a new empty
skb is allocated with alloc_skb() and a manual memcpy is performed to
move the data. This guarantees that there are no shared segments
between SKBs.

Change-Id: I1f1b69a22ed4726c31b8d3295622a604af95d008
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: alloc_netdev() needs name_assign_type
Harout Hedeshian [Mon, 6 Apr 2015 21:37:55 +0000 (15:37 -0600)]
net: rmnet_data: alloc_netdev() needs name_assign_type

Update RmNet Data to pass this new parameter in during VND
creation. Going with NET_NAME_ENUM as these are reusable
names.

Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: fix UL checksum header format
Sivan Reinstein [Wed, 11 Mar 2015 08:31:31 +0000 (10:31 +0200)]
net: rmnet_data: fix UL checksum header format

MAPv3 UL checksum header requires that the CHECKSUM_INSERT_OFFSET
will be relative to CHECKSUM_START_OFFSET.

CRs-fixed: 806129
Change-Id: I1f8363e90588dfbd3ac4f9f35defd6259406d8b5
Signed-off-by: Sivan Reinstein <sivanr@codeaurora.org>
8 years agonet: rmnet_data: consolidate VND free work-queue task on force unassociate
Harout Hedeshian [Thu, 4 Dec 2014 16:08:02 +0000 (21:38 +0530)]
net: rmnet_data: consolidate VND free work-queue task on force unassociate

Previously, one new work-queue item was created and scheduled with
schedule_work() for each VND getting unregistered. Since we know the
exact set of VNDs which need to be cleared ahead of time, the VNDs
are added to a list and freed at the same time with a single work-queue
task. This saves us from having to malloc/schedule/free for each
VND and provides a speed up on some low tier hardware.

CRs-Fixed: 738039
Change-Id: I02d4de1308a2aed9d493f6fd58cf0984265facba
Acked-by: Nagarjuna Chaganti <nchagant@qti.qualcomm.com>
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Close the VND before freeing endpoint configuration
Harout Hedeshian [Mon, 15 Dec 2014 15:33:17 +0000 (08:33 -0700)]
net: rmnet_data: Close the VND before freeing endpoint configuration

Whenever handling a force-unassociate, make sure the device is closed
before freeing the logical endoint configuration. Whenever the endpoint
config is cleared, the egress device is set to null. This can cause null
pointer dereference if the endpoint config is cleared at the same time a
packet is being transmitted.

[  479.906025] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to un
register rmnet_ipa0
[  479.913428] Unable to handle kernel NULL pointer dereference at virtual
address 000002c0
[  480.068123] [<ffffffc000c73608>] rmnet_egress_handler+0x30/0x2bc
[  480.074109] [<ffffffc000c728e8>] rmnet_vnd_start_xmit+0x108/0x13c
[  480.080192] [<ffffffc000ae42ec>] dev_hard_start_xmit+0x260/0x484
[  480.086178] [<ffffffc000afd390>] sch_direct_xmit+0x68/0x198
[  480.091732] [<ffffffc000afd5b0>] __qdisc_run+0xf0/0x140
[  480.096938] [<ffffffc000ae4794>] dev_queue_xmit+0x284/0x400

Change-Id: Ib87b123dc565b087374dfde6d3c40ddccf2a257d
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: Add trace points for device force unassociation
Harout Hedeshian [Tue, 30 Dec 2014 19:15:19 +0000 (12:15 -0700)]
net: rmnet_data: Add trace points for device force unassociation

Added trace points to debug processing time of rmnet_config_notify_cb.
Additionally, tracepoints were added for succesfull associate/unassociate
events. Needed to debug unusually slow cleanup.

New trace points are:
rmnet_unregister_cb_unhandled
rmnet_unregister_cb_entry
rmnet_unregister_cb_exit
rmnet_unregister_cb_clear_vnds
rmnet_unregister_cb_clear_lepcs
rmnet_associate
rmnet_unassociate

Change-Id: I0269435d9c7234ef21092ba13510fff106a1966f
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: Handle VND level MAP flow control with flow ID 0xFFFFFFFF
Harout Hedeshian [Tue, 9 Dec 2014 16:06:09 +0000 (09:06 -0700)]
net: rmnet_data: Handle VND level MAP flow control with flow ID 0xFFFFFFFF

Flow control the entire RmNet Data virtual network device whenever
we receive a MAP flow control command with flow ID 0xFFFFFFFF. Since
it is guaranteed that we will never mix 0xFFFFFFFF with other flow IDs
(e.g.. disable 0xFFFFFFFF enable 0x00000001), TC based flow control
is not required. Instead netif stop/wake queue APIs are used in immediate
context.

CRs-Fixed: 767337
Change-Id: I8eff0988fa38726284789b70e045cc4b1dbb5d4e
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: Further optimize UL aggregation accumulation
Harout Hedeshian [Wed, 17 Dec 2014 17:22:36 +0000 (10:22 -0700)]
net: rmnet_data: Further optimize UL aggregation accumulation

Do not aggregate frames if they are sapced out more than 10ms. Since the
scedule_delayed_work() API only takes time in jiffies, ping packets
are getting substantially delayed. Instead, just send them. This parameter
is tunable from the module parameters location.

CRs-Fixed: 772705
Change-Id: I6ac337c8d61b1290f939b86081070c14c2c757b1
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: Optimize UL aggregation accumulation logic
Harout Hedeshian [Wed, 17 Dec 2014 16:34:36 +0000 (09:34 -0700)]
net: rmnet_data: Optimize UL aggregation accumulation logic

Accumulation logic now respects max packet count as well as buffer size.
Additionally, packets will get shipped if they have been sitting around
for more than 1ms. This parameter is tunable from the module parameters
location.

CRs-Fixed: 772705
Change-Id: I1b5cb597ef6adfe19df590582f9a6cae091c5977
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: add support to UL checksum offload for IPv6 over UDP
Sivan Reinstein [Tue, 30 Sep 2014 13:40:27 +0000 (16:40 +0300)]
net: rmnet_data: add support to UL checksum offload for IPv6 over UDP

Set rmnet_data virtual network devices with NETIF_F_IPV6_UDP_CSUM
to support uplink checksum offloading to HW for IPv6 over UDP
packets.

CRs-fixed: 731693
Change-Id: I6c06fb4d137d4e96a813894802e3096c26e88da4
Signed-off-by: Sivan Reinstein <sivanr@codeaurora.org>
8 years agonet: rmnet_data: add support for UL MAP based checksum offload
Sivan Reinstein [Wed, 3 Sep 2014 12:40:27 +0000 (15:40 +0300)]
net: rmnet_data: add support for UL MAP based checksum offload

Add UL checksum offload routines for MAPv3. Can bypass checksum software
for IPv4/IPv6 TCP/UDP protocols.
Set rmnet_data VNDs hw_flags to NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM to
define the checksum offload abilities.
Add UL checksum meta-info header for IPv4/IPv6 TCP/UDP packets for which
UL checksum is being offloaded.

CRs-fixed: 731693
Change-Id: Ief139d357b528aead66acfe39a5227328b8fbf93
Signed-off-by: Sivan Reinstein <sivanr@codeaurora.org>
8 years agonet: rmnet_data: Checksum offload handle IPv4 UDP frames with 0 checksum
Harout Hedeshian [Thu, 13 Nov 2014 15:35:50 +0000 (08:35 -0700)]
net: rmnet_data: Checksum offload handle IPv4 UDP frames with 0 checksum

Checksum offload routine should skip checksum fixup computation on
IPv4 UDP packets which have the checksum field set to 0 by the sender.
This is allowed by RFC768. Packets are marked as checksum unnecessary
and shipped up the stack as-is.

CRs-Fixed: 755544
Change-Id: I0432c3e1b25196134ecc8bbbe23c9cab46666d5c
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: Add counters for downlink checksum offload return codes
Harout Hedeshian [Tue, 26 Aug 2014 20:32:51 +0000 (14:32 -0600)]
net: rmnet_data: Add counters for downlink checksum offload return codes

Added counter array to /sys/module/rmnet_data/parameters/checksum_dl_stats
for non-realtime analysis of checksum offload.

Change-Id: I749c09147325fd0f871c34ff17e2546b68898faa
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: Add documentation for configuration structures
Harout Hedeshian [Fri, 15 Aug 2014 15:18:31 +0000 (09:18 -0600)]
net: rmnet_data: Add documentation for configuration structures

Better document the configuration structures and the element usage.
Anticipating more elements being added in the near term.

Change-Id: I5ca90b7a776072d6b1ac4838782cada38f4fea3b
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: Increase max mux IDs to 256
Harout Hedeshian [Mon, 11 Aug 2014 21:38:27 +0000 (15:38 -0600)]
net: rmnet_data: Increase max mux IDs to 256

Support the full range of mux IDs for special channels which have large
ID numbers. Expected runtime memory impact is an increase of ~1.5KB per
attached physical network device.

Change-Id: Ic9db497708064c31fe7ed588a855311b50d55e19
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: add support for DL MAP based checksum offload
Sivan Reinstein [Thu, 10 Jul 2014 13:22:41 +0000 (16:22 +0300)]
net: rmnet_data: add support for DL MAP based checksum offload

Add DL checksum offload routines for MAPv3. Can bypass checksum software
for IPv4/IPv6 TCP/UDP protocols.

CRs-fixed: 692334
Change-Id: Ic13a5d9a1ebfdc57b6eb53ee93da92c3aee547b1
Signed-off-by: Sivan Reinstein <sivanr@codeaurora.org>
8 years agonet: rmnet_data: Fix potential memory corruption
Subash Abhinov Kasiviswanathan [Wed, 16 Jul 2014 02:43:54 +0000 (20:43 -0600)]
net: rmnet_data: Fix potential memory corruption

Fix an out of bounds array access during virtual
net device creation

CRs-fixed: 695032
Change-Id: Ie8ae1f25122f685c22d139d1abf06acf55d46782
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Move MAP header definition to UAPI
Harout Hedeshian [Tue, 17 Jun 2014 14:10:43 +0000 (08:10 -0600)]
net: rmnet_data: Move MAP header definition to UAPI

Expose the MAP header to the rest of the kernel and user space. Useful for
making various parts of the kernel MAP aware. Keeping consistency with
other networking procols by exposing protocol headers to user space with
a header file in UAPI.

CRs-Fixed: 681280
Change-Id: Ic7f414f926f68531418725f971ab2b44459f5ea1
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: modify the packet logging
Subash Abhinov Kasiviswanathan [Fri, 6 Jun 2014 18:47:44 +0000 (12:47 -0600)]
net: rmnet_data: modify the packet logging

skb->tail and skb->end are defined as character pointers in 32 bit
environments and as integers in other environments. Fix compilation
issues seen in the packet logging functions as a result of the data
type mismtach in 64 bit environments.

CRs-fixed: 665364
Change-Id: Ie70e01ce0678947d9c8cd924fe99b89ce319d4e5
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Catch empty MAP frames during de-aggregation
Harout Hedeshian [Wed, 30 Apr 2014 15:50:43 +0000 (09:50 -0600)]
net: rmnet_data: Catch empty MAP frames during de-aggregation

RmNet Data does not explicitly catch 0-length MAP frames when
de-aggregating frames. This causes the empty MAP frames to get dropped
at a later point in MAP processing, causing the drop counters to get
skewed with benign drops. This patch explicitly handles 0-length
MAP frames and adds a dedicated drop counter. This change is required
on hardware which generates 0-length MAP frames.

CRs-Fixed: 673296
Change-Id: I8e7210403d35018bffa8f45ea1b4b5752f3e30be
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: adding new trace points
Harout Hedeshian [Wed, 7 May 2014 06:10:49 +0000 (09:10 +0300)]
net: rmnet_data: adding new trace points

Added new trace points for flow control events and
aggregation/deaggregation.

CRs-Fixed: 661459
Change-Id: I22e5b441f5bb8ff055b0577954cc9f6285b68a74
Acked-by: Sivan Reinstein <sivanr@qti.qualcomm.com>
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: add cleanup in rmnet_config_exit
Subash Abhinov Kasiviswanathan [Thu, 10 Apr 2014 05:25:30 +0000 (23:25 -0600)]
net: rmnet_data: add cleanup in rmnet_config_exit

Add a call to unregister_netdevice_notifier in rmnet_config_exit,
and fix some compilation warnings.

CRs-Fixed: 633585
Change-Id: I0e61c5460b927c3348f4e9815bbd9f842488f14d
Acked-by: Sivan Reinstein <sivanr@qti.qualcomm.com>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Support for NETLINK getters
Harout Hedeshian [Tue, 1 Apr 2014 12:24:25 +0000 (06:24 -0600)]
net: rmnet_data: Support for NETLINK getters

Added support for RMNET_NETLINK_GET_LOGICAL_EP_CONFIG
and RMNET_NETLINK_GET_NETWORK_DEVICE_ASSOCIATED in the
rmnet_data configuration module.

CRs-fixed: 599231
Change-Id: Ib5eeb4a37f80a4df19cb3c1ef02ec477f5445740
Acked-by: David Arinzon <darinzon@qti.qualcomm.com>
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: Clear VNDs upon physical device unregistration
Harout Hedeshian [Tue, 25 Mar 2014 19:50:57 +0000 (13:50 -0600)]
net: rmnet_data: Clear VNDs upon physical device unregistration

Clear out VNDs which have their egress device pointing to an interface
which is trying to unregister from the network stack. Required to prevent
systems hangs on unexpected shutdown/reboot of the device.

CRs-Fixed: 638324
Change-Id: I406270fee9feb1f9673b3391ce51c11e8e6c9d81
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
8 years agonet: rmnet_data: remove NOARP flags for the virtual net device
Subash Abhinov Kasiviswanathan [Fri, 14 Mar 2014 00:57:26 +0000 (18:57 -0600)]
net: rmnet_data: remove NOARP flags for the virtual net device

When IFF_NOARP flag is set for a device, the kernel automatically
sets the accept_dad flag to -1 even though autoconf is enabled.
As a result, nodes on that link were not receiving neighbour
solicitations. Removed the setting of IFF_NOARP during net device
setup.

CRs-Fixed: 629099
Change-Id: Ia8b5d1163196cc0518a20beba643930b4f439771
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: modify 8-byte QoS Header
Subash Abhinov Kasiviswanathan [Fri, 7 Mar 2014 03:18:27 +0000 (20:18 -0700)]
net: rmnet_data: modify 8-byte QoS Header

Clients consuming the 8-byte QoS header expect the flowID
in a different position in the header thus causing random address
dereference and a potential crash. Update the 8-byte QoS header
format structure as specified in the mandated QOS specification

CRs-Fixed: 625709
Change-Id: I58c662ff2f3adfe9584d19891339ea31ce0c8bd3
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
8 years agonet: rmnet_data: Add support for ftrace events
Harout Hedeshian [Fri, 31 Jan 2014 16:12:50 +0000 (09:12 -0700)]
net: rmnet_data: Add support for ftrace events

Adding initial support for ftrace events in order to help with
profiling and debugging. This initial set of events covers the
ingress and egress handlers.

Change-Id: I296d6fb9d009d8fdc2061e17d25e1275ee0a8a12
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>