Commit Graph

14 Commits

Author SHA1 Message Date
Sean Tranchetti
320db4b3c0 rmnet_core: Avoid altering ep before synchronize_rcu()
rmnet_dellink() will handle freeing the endpoint information, but as this
structure is accessed via RCU on the packet path, care must be taken. It
is dangerous to alter any fields inside of it until it is guaranteed that
no one is currently accessing it.

pc : rmnet_frag_process_next_hdr_packet
lr : rmnet_frag_process_next_hdr_packet
Call trace:
  rmnet_frag_process_next_hdr_packet
  rmnet_frag_ingress_handler
  rmnet_rx_handler

Change-Id: I2410d941e370d1173eefd6e63049121285a1cb26
Signed-off-by: Sean Tranchetti <quic_stranche@quicinc.com>
2022-04-11 10:41:44 -07:00
Weiyi Chen
a2ea279ba9 rmnet_core: fix race condition in rmnet_get_packets
In rmnet powersave work, rmnet_get_packets() could access NULL dev pointer
if rmnet_dellink() is nullifying the dev pointer at the same time.

18377 [   72.651710][ T1527] Unable to handle kernel NULL pointer dereference
at virtual address 00000000000009d0

18424 [   72.653999][ T1527] Call trace:
18425 [   72.654085][ T1527]  rmnet_get_packets+0xc4/0x11c [rmnet_core]
18426 [   72.654170][ T1527]  qmi_rmnet_check_stats_2+0x80/0x410 [rmnet_core]
18427 [   72.654180][ T1527]  process_one_work+0x260/0x804

This change Uses the rcu variant of the hlist traversal function in
rmnet_get_packet for safe concurrency with the hlist del primitives.
It also checks dev pointer before accessing the dev private structure.
The existing synchronize rcu call in rmnet_dellink ensures that the ep
and dev structure are not freed while being referenced in rcu read
session of rmnet_get_packets.

Change-Id: Ib5f5aff6e76f9fffd9110a2aa924ad6ab090991f
Signed-off-by: Weiyi Chen <quic_weiyic@quicinc.com>
2022-01-25 13:27:49 -08:00
Subash Abhinov Kasiviswanathan
ef13a42ae2 dfc: fix spinlock leak
In the DFC powersave work, the separate spin lock and unlock
of multiple qos structures could be out of sync during SSR
and results in spinlock leak after exiting the work.

This change consolidated the spinlock operations to avoid
multiple locking and unlocking, and fixed below issue:

BUG: workqueue leaked lock or atomic: kworker/0:9/0x00000201/1361
     last function: qmi_rmnet_check_stats_2.cfi_jt [rmnet_core]
1 lock held by kworker/0:9/1361:
(&qos->qos_lock){....}-{2:2}, at: rmnet_lock_unlock_all_flows+0xa4/0xdc

Change-Id: I10c1687a4f9993363dc631dee0b347faaa1067ab
Acked-by: Weiyi Chen <weiyic@qti.qualcomm.com>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2021-08-18 09:59:34 -07:00
Sean Tranchetti
80816d12be rmnet_core: Set proper maxtype element for NL attributes
maxtype should be set to the value of the highest attribute type that
is valid, not the number of valid attributes accepted. This ensures that
attributes with types higher than this number are ignored properly.

Change-Id: Ife53a4a9a7327a8d89e709320eb1c6cb50992922
Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
2021-06-16 10:34:39 -07:00
Subash Abhinov Kasiviswanathan
b5f52b0fe3 dfc: QMAP based powersave
Support DFC powersave using extended QMAP powersave command.

Change-Id: I3055212d8ecfe461bf9a6b35488269a59d4dec52
Acked-by: Weiyi Chen <weiyic@qti.qualcomm.com>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2021-06-01 16:52:50 -07:00
Sean Tranchetti
5860a49e62 rmnet_core: Allow different UL aggregation params per state
Allows the use of different uplink aggregation parameters for the
default and low-latency uplink aggregation states. To faciliate this,
both contexts now have their own page recycling elements instead of a
single port-wide list, as well as their own instance of the
rmnet_egress_agg_params struct.

To configure these paramters, a new netlink attribute has been created
for specifying which aggregation state the given IFLA_RMNET_UL_AGG_PARAMS
attribute should apply to. For compatibility with user space, the default
state will be chosen if this element is not provided.

Change-Id: Ia340bbb479d9427658a153a2019f4891da0b741c
Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
2021-05-14 10:30:48 -07:00
Subash Abhinov Kasiviswanathan
b8552944d5 rmnet_core: support low latency channel switch
Add support to switch bearers between default and lower latency
channels via QMAP commands.

Change-Id: I6662f59c713e8e3ab7409f50871bec11d9908c67
Acked-by: Weiyi Chen <weiyic@qti.qualcomm.com>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2021-05-12 17:03:12 -07:00
Sean Tranchetti
b38dff7d79 rmnet_core: Add Low Latency framework
Packets are now sent over a dedicated MHI channel when indicated by the
DFC driver.

New dedicated channel is controlled by rmnet driver. Buffers are allocated
and supplied to it as needed from a recyclable pool for RX on the channel,
and packets will be sent to it and freed manually once the channel
indicates that they have been sent.

Low latency packets can be aggregated like standard QMAP packets, but have
their own aggregation state to prevent mixing default and low latency
flows, and to allow each type of flow to use their own send functions
(i.e. dev_queue_xmit() versus rmnet_ll_send_skb()).

Low latency packets also have their own load-balancing scheme, and do not
need to use the SHS module for balancing. To facilitate this, we mark the
low latency packets with a non-zero priority value upon receipt from the
MHI chainnel and avoid sending any such marked packets to the SHS ingress
hook.

DFC has been updated with a new netlink message type to handle swapping a
list of bearers from one channel to another. The actual swap is performed
asynchronously, and separate netlink ACKs will be sent to the userspace
socket when the switch has been completed.

Change-Id: I93861d4b004f399ba203d76a71b2f01fa5c0d5d2
Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
2021-05-12 17:02:51 -07:00
Conner Huff
4fe7a4add4 datarmnet: Fastforward core from data-kernel.lnx.1.1 to data-kernel.lnx.1.2
Catches up to commit b4d76675a6feeb57f7188d5354e1cf82b7adb012.

Change-Id: Ib1f00be9799712bd4ab0381cde648287f98a61a1
Signed-off-by: Conner Huff <chuff@codeaurora.org>
2021-02-01 18:46:12 -08:00
Subash Abhinov Kasiviswanathan
9a791f3de4 net: qualcomm: rmnet: Allow UL aggregation time limit of 1ms
Reduce the minimum allowed UL aggregation timeout to 1ms
as a lower limit might be preferable to reduce latency for
sporadic traffic scenarios.

CRs-fixed: 2692360
Change-Id: Iba1c02232fa83d7cac112bd4b3f625128e2da88b
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2020-05-21 12:51:13 -06:00
Subash Abhinov Kasiviswanathan
c4bd722431 core: Hold on to module reference
Do not remove module if the dependent modules are removed.

CRs-Fixed: 2683697
Change-Id: I35539aff061fe57a85f0bb8eb3dcf40499eca760
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2020-05-11 19:43:16 -06:00
Subash Abhinov Kasiviswanathan
0dfa55e06d core: rmnet: Remove unnecessary warning
Remove warning from module load. Fixes the following-

WARNING: CPU: 2 PID: 735 at core/rmnet_config.c:753
 init_module+0x18/0x64 [rmnet_core]
pstate: 60400005 (nZCv daif +PAN -UAO)
pc : init_module+0x18/0x64 [rmnet_core]
lr : do_one_initcall+0x190/0x380
Call trace:
 init_module+0x18/0x64 [rmnet_core]
 do_one_initcall+0x190/0x380
 do_init_module+0x5c/0x210
 load_module+0x45d8/0x480c
 __arm64_sys_finit_module+0xec/0x120
 el0_svc_common+0xbc/0x1c0
 el0_svc_handler+0x6c/0x88
 el0_svc+0x8/0xc

CRs-Fixed: 2644088
Change-Id: Icab7f3b3021a94e4376374b9cb3b905178f9894a
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2020-03-17 21:22:05 -06:00
Sean Tranchetti
eeb4944964 core: rmnet: Fastforward to 4.19 tip
This brings the RmNet and DFC modules up to date with the 4.19 tip as of
commit 9b38611ea527 ("rmnet: Reduce synchronize_rcu calls").

As part of this, the rmnet_ctl driver was also incorporated, using commit
4ceee3aafb7d ("rmnet_ctl: Add IPC logging and optimizations")

Change-Id: Ic45d46074c7401dfed408c769cfb6462dac0d4ee
Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
2020-01-23 13:31:14 -07:00
Subash Abhinov Kasiviswanathan
08d4972b2a core: Rmnet initial commit
Inital commit of rmnet_core net device driver in dlkm form
in datarmnet. This requires rmnet to be disabled in the
kernel and for it to be loaded before dependent modules.

CRs-Fixed: 2558810
Change-Id: I742e85033fa0999bf9069d43ce73ab9a622a8388
Acked-by: Raul Martinez <mraul@qti.qualcomm.com>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2019-12-10 15:22:43 -07:00