GRO engine needs to identify the right flow to add incoming skb.
It does this by marking all flows, and unmarks flows as it identifies
differences. First a quick elimination is done by comparing rx hash.
All flows with unequal rx hashes are unmarked. It further eliminates
flows after comparing IP and TCP header contents.
The skb is added to the marked flow's gro_list. If all the flows
are unmarked, implying the skb is a unique flow, the skb
is initialized as the head to a new gro_list.
rmnet_data creates a skb and copies contents from QMAP packet.
since rx hash is uninitialized, GRO engine has to compare IP and TCP
headers with all the GROing flows. So set rx_hash before calling
napi_gro_receive, for easier flow elimination.
Change-Id: Iaa444d6c17a25da494a650ed6076b50fd9b99cc4
Signed-off-by: Tejaswi Tanikella <tejaswit@codeaurora.org>
In case an invalid mux id is passed, an invalid device lookup is
done leading to passing on the packet to stack incorrectly rather
than consuming them.
CRs-Fixed: 2181180
Change-Id: Iad905e932b49eda00a7d91e906f0ac0ca44cdb59
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
The worker thread can run even if the aggregation state machine
has moved on to an idle after processing packets. This results
in log spam with an invalid message.
CRs-Fixed: 2165883
Change-Id: I218ac9b20a41749adce45a0d787782d15f07c65b
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
The delay argument in schedule_delayed_work(struct delayed_work
*dwork, unsigned long delay) API is jiffies. The system tick for
seems to be 100Hz, so the minimum time resolution for the work to
be scheduled is 10ms.
Switch to hrtimer to achieve 3 ms granularity with a current timer
of 1ms for the flush thread. A workqueue is immediately scheduled
in the same context after this timer expiry to do the tx work.
CRs-Fixed: 2157214
Change-Id: I29cbbee417e84b101ed34c0d29c2731bd52c3ec5
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
A crash was seen when running the hrtimer solution, so revert the
change till it is resoloved. The crash occurs due to interrupts
being enabled by a later function in the call stack within
interrupt context.
[ffffff8cc22b157c] __local_bh_enable_ip+0xa8/0x114
[ffffff8cc33495d0] _raw_spin_unlock_bh+0x30/0x3c
[ffffff8cc2e57ed8] ipa3_send+0x2a0/0xaa0
[ffffff8cc2e5c544] ipa3_tx_dp+0x59c/0x990
[ffffff8cc2ea7ef0] ipa3_wwan_xmit+0x204/0x338
[ffffff8cc30f0160] dev_hard_start_xmit+0xc4/0x29c
[ffffff8cc311d0f4] sch_direct_xmit+0x100/0x1cc
[ffffff8cc30f0890] __dev_queue_xmit+0x1f4/0x704
[ffffff8cc30f0dc8] dev_queue_xmit+0x28/0x34
[ffffff8cc333285c] rmnet_map_flush_packet_queue+0xc0/0x218
[ffffff8cc2344f9c] __hrtimer_run_queues+0x158/0x36c
[ffffff8cc2345f38] hrtimer_interrupt+0xb0/0x1f4
CRs-fixed: 2147503
Change-Id: I7b3617577cbf5e166380d4361b73e2f57a4bd042
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
The delay argument in schedule_delayed_work(struct delayed_work
*dwork, unsigned long delay) API is jiffies. The system tick for
seems to be 100Hz, so the minimum time resolution for the work to
be scheduled is 10ms.
Switch to hrtimer to achieve 1 ms granularity with a current timer
of 3ms for the flush thread.
CRs-fixed: 2147503
Change-Id: If33fea37146f91b2980e6637db71567fb5ca12a5
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Skipping UL aggregation if the packet was linear was causing out
of order packets. If linearization fails, pass up the packet as is.
Also skip padding if using version 3 or v4 when using UL aggregation.
CRs-Fixed: 2141234
Change-Id: I711668ecf2a3e6807f2270b4b107f4a2a3d21654
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Optimize for the IPv6 normal ping case instead of the
fragmentation scenario. Also, check for IPv6 explicitly
rather than directly disecting the packet.
CRs-Fixed: 2131879
Change-Id: Idee5c7d52972d06aee6ac6d71ebd5d1c3c875f9f
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
ICMP packets could be potentially stuck behind aggregated traffic
if UL aggregation is enabled on rmnet_data. This results in
increased latencies during ping tests as the workqueues for these
packets are scheduled at non deterministic times.
CRs-Fixed: 2131879
Change-Id: I19208301b5674749aa2f1dee65a9226eda364c85
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Global variables are no longer assigned values. Instead
flush meta data is handled and tracked at per end
point basis.
Reduce the number of register reads for timer. Leverage
value which has already been read earlier in function.
Change-Id: If0f3362aff1f92c94d05367c4b6428b897ff6ede
Signed-off-by: Conner Huff <chuff@codeaurora.org>
Using UL aggregation for non linear data is not efficient since
we are copying data from a non linear segment to a linear buffer.
As a result, we lose the advantages of GSO and increase our RTT.
CRs-Fixed: 2117151
Change-Id: I7963c4a19531c53deaf5e50dc408ba3faea41c35
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
We clean up the logical end points only for the un-registering device
in bridge mode. However, the other physical end point's local end
point still points to the the un-registered device.
This may lead up to a crash if one of the physical devices in bridge
mode is un-registered. Fix this by unsetting the local endpoint.
It is still possible that packets in a different context across cores
might try to access this data. This usually manifests as packets
requesting a very large headroom. Handle this by dropping these stale
skb's.
CRs-Fixed: 1098513
Change-Id: I1ba4d877a6ed3eca66946fe056938f0927bcd9a5
Signed-off-by: Ashwanth Goli <ashwanth@codeaurora.org>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
rmnet_data assigns device name by the order they are created.
This causes problems which multiple processes are trying to
create devices and leads to random device names.
Assign device name as specified by user.
CRs-Fixed: 2018785
Change-Id: Iab8e053c6ccacbeedaa7763e760d0c12e756b5d0
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Port single flow dynamic GRO changes into rmnet driver. This
feature uses configurable parameters that determine when GRO
should be flushed based on both timing and receive byte count.
Although the parameters are initially set, they dynamically
fluctuate based on incoming traffic.
CRs-Fixed: 1113125
Change-Id: I7469118d3108e0c9f71c4f50efd8ceebfb324a63
Signed-off-by: Conner Huff <chuff@codeaurora.org>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
rmnet_data does not free skb's when phy netdev
fails to xmit a qmap control packet cauing memory leak.
To avoid this we queue the packet back into device queue
if start_xmit fails.
CRs-Fixed: 1089477
Change-Id: Id7efdd10ac76c989c086cb5f934a4b666b7c5939
Signed-off-by: Ashwanth Goli <ashwanth@codeaurora.org>
After commit 605ad7f184 ("tcp: refine TSO autosizing"), kernel
throttles uplink TCP data in case there is not sufficient amount
of socket buffer available due to delayed release of buffers
through TX completions in the physical net device.
Work around this by orphaning the socket buffer. This makes the
kernel assume that more packets can be sent in this scenario.
Out of band signaling and flow controlling at qdisc / HTB layer
should guarantee no issue for flow control.
Throughput difference for IPv4 TCP UL -
Before change : 143Mbps
After change : 146Mbps
CRs-Fixed: 1088104
Change-Id: I251ed7938c29e08954d4c81d3041cb235a39d266
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Some creators of skb's may fail to set sufficient headroom or
tailroom to stamp the MAP header or tailroom respectively when
transmitting packets to rmnet_data.
In these cases, rmnet_data was failing to free these packets which
lead to out of memory scenarios in low memory targets. Free these
skb's in these scenarios.
CRs-Fixed: 1086873
Change-Id: I8bd2eb93393766bf9c301766e525354770577e0a
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Generic receive offload is enabled by default on a net_device
whenever it is registered. In case of rmnet_data, a physical
device could theoretically pass cloned frames and rmnet_data
would pass on these cloned frames to GRO framework. This
would cause memory corruption or crashes since GRO modifies
the skb shared info which is shared across clones.
While cloned frames are usually not sent to rmnet_data, this
configuration actually requires userspace intervention. If
userspace does not makes appropriate calls to kernel, we will
run into crashes. Handle this scenario by disabling GRO by
default. Userspace will need to explicitly enable GRO if
required to do so.
CRs-Fixed: 1097389
Change-Id: I40d5ce940f4722b128c0138c07232c33d0b74e14
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
rmnet_data netlink handler currently does not check for the
incoming process pid and instead just loops back the pid.
A malicious root user could potentially send a message with
source pid 0 and this could cause rmnet_data to loop the message
back till an out of memory situation occurs.
rmnet_data also does not check for the message length of the
incoming netlink messages and instead casts the netlink message
without checking for the boundary.
Fix these two scenarios by adding the pid and message length checks
respectively
Bug: 31252965
CRs-Fixed: 1098801
Change-Id: I172c1a7112e67e82959b397af7ddfd963d819bdc
Signed-off-by: Conner Huff <chuff@codeaurora.org>
This is a snapshot of the rmnet_data driver taken as of msm-4.4.
commit 5da00923b1544ba ("rmnet_data: Changing format specifier to
%pK").
Additionally, fix some style issues reported by checkpatch.
CRs-Fixed: 1078373
Change-Id: Idb2df22e61803e04a01db64ea5e9d1e93ae92e09
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>