Commit graph

563936 commits

Author SHA1 Message Date
Mayank Rana
06b8c38125 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>
2016-03-22 11:06:23 -07:00
Jack Pham
78c2759dea 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>
2016-03-22 11:06:22 -07:00
Jack Pham
d675e70190 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>
2016-03-22 11:06:21 -07:00
Jack Pham
0b937c189f 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>
2016-03-22 11:06:21 -07:00
Jack Pham
88f0a43593 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>
2016-03-22 11:06:20 -07:00
Manu Gautam
b311a3dbc4 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>
2016-03-22 11:06:19 -07:00
Jack Pham
5de8e63f16 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>
2016-03-22 11:06:18 -07:00
Wesley Cheng
10bfd21360 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>
2016-03-22 11:06:17 -07:00
Jack Pham
36e0761d75 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>
2016-03-22 11:06:16 -07:00
Vijayavardhan Vennapusa
72dfd99183 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>
2016-03-22 11:06:15 -07:00
Jack Pham
2799624a41 usb: dwc3: Expose dwc3_trb_dma_offset
Expose this function for use in the glue layer.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
2016-03-22 11:06:14 -07:00
Manu Gautam
5ffe965cf4 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>
2016-03-22 11:06:13 -07:00
Mayank Rana
0e58b939fb 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>
2016-03-22 11:06:12 -07:00
Jack Pham
692988089f 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>
2016-03-22 11:06:12 -07:00
Jack Pham
56eae7e2c2 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>
2016-03-22 11:06:11 -07:00
Mayank Rana
cb69b6cb90 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>
2016-03-22 11:06:10 -07:00
Hemant Kumar
0cfa0c949f 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>
2016-03-22 11:06:09 -07:00
Maya Erez
5bf0c1d26a 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>
2016-03-22 11:06:08 -07:00
Jack Pham
d827d49e65 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>
2016-03-22 11:06:07 -07:00
Hemant Kumar
9dc0b922ab 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>
2016-03-22 11:06:06 -07:00
Jack Pham
a7e918b48f 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>
2016-03-22 11:06:06 -07:00
Jack Pham
810ed727f2 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>
2016-03-22 11:06:05 -07:00
Jack Pham
1c3de1655f usb: dwc3-msm: Remove pmic_id_irq
irq_read_line() is no longer supported.

Signed-off-by: Jack Pham <jackp@codeaurora.org>
2016-03-22 11:06:04 -07:00
Jack Pham
eb1ae4e274 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>
2016-03-22 11:06:03 -07:00
Jack Pham
3eab96eff7 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>
2016-03-22 11:06:02 -07:00
Jack Pham
37b653ba04 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>
2016-03-22 11:06:01 -07:00
Subash Abhinov Kasiviswanathan
545c0d1846 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>
2016-03-22 11:06:00 -07:00
Harout Hedeshian
07c71659e8 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>
2016-03-22 11:06:00 -07:00
Abhijeet Dharmapurikar
07f438368c 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>
2016-03-22 11:05:59 -07:00
Subash Abhinov Kasiviswanathan
5e5cb4ce4e net: rmnet_data: Remove the NETIF_F_IPV6_UDP_CSUM device feature
Commit 32dce968dd ("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>
2016-03-22 11:05:58 -07:00
Subash Abhinov Kasiviswanathan
0dc9f20694 net: Change the current NAPI context to use latest API
Commit 47405a253d ("percpu: Remove __this_cpu_ptr") and commit
6c51ec4d18 ("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>
2016-03-22 11:05:57 -07:00
Subash Abhinov Kasiviswanathan
09a36c1368 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>
2016-03-22 11:05:56 -07:00
Tianyi Gou
12fae71b18 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>
2016-03-22 11:05:55 -07:00
Harout Hedeshian
6ff0325a57 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>
2016-03-22 11:05:54 -07:00
Tianyi Gou
a4dc732269 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>
2016-03-22 11:05:53 -07:00
Tianyi Gou
84b4c1cc42 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>
2016-03-22 11:05:53 -07:00
Subash Abhinov Kasiviswanathan
85c61fa3ac 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>
2016-03-22 11:05:52 -07:00
Ravinder Konka
b81ad4f065 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>
2016-03-22 11:05:51 -07:00
Ravinder Konka
986546c1b5 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>
2016-03-22 11:05:50 -07:00
Harout Hedeshian
91c3e578f9 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>
2016-03-22 11:05:49 -07:00
Harout Hedeshian
59759698a9 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>
2016-03-22 11:05:48 -07:00
Subash Abhinov Kasiviswanathan
567dbc61c4 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>
2016-03-22 11:05:47 -07:00
Subash Abhinov Kasiviswanathan
715efdf30e 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>
2016-03-22 11:05:46 -07:00
Subash Abhinov Kasiviswanathan
32f496dc2d 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>
2016-03-22 11:05:46 -07:00
Subash Abhinov Kasiviswanathan
42f8729b51 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>
2016-03-22 11:05:45 -07:00
Subash Abhinov Kasiviswanathan
3ed49aeb34 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>
2016-03-22 11:05:44 -07:00
Subash Abhinov Kasiviswanathan
ece90739ec net: rmnet_data: Assign network_header instead of data in mac_header
Commit 1a37e412a0 ("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>
2016-03-22 11:05:43 -07:00
Subash Abhinov Kasiviswanathan
2b455e304e 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>
2016-03-22 11:05:42 -07:00
Subash Abhinov Kasiviswanathan
747f0aec1b 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>
2016-03-22 11:05:41 -07:00
Subash Abhinov Kasiviswanathan
a5bfaf0d40 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>
2016-03-22 11:05:40 -07:00