Commit Graph

34 Commits

Author SHA1 Message Date
Jeff Johnson
4cee5cf7cc qcacmn: Fix typo "seperate"
Replace typo "seperate" with correct spelling "separate".

Change-Id: I742473a16b79c5b91722c3642c983a7fa6dfd252
CRs-Fixed: 2238309
2018-05-17 00:46:54 -07:00
Jeff Johnson
b311d8e273 qcacmn: Remove WLAN_SER_CMD_SCAN_IDLE_SCAN
enum WLAN_SER_CMD_SCAN_IDLE_SCAN is unused, so remove it.

Change-Id: I32acf848448ab3a739099e7446cd82c401aa11c9
CRs-Fixed: 2212931
2018-03-28 20:01:49 -07:00
Om Prakash Tripathi
339dc26b21 qcacmn: Enable scan command time out if not disabled explicitly
1. Enable scan command time out for all commands if not disabled
   explicitly.
2. Remove QDF_BUG() for no serialization command buffers

Change-Id: I5357211ef6bc44f8ebd4b8acaa56a12f691fa46d
CRs-Fixed: 2175843
2018-02-13 03:55:25 -08:00
Zhu Jianmin
181ebf835c qcacmn: Avoid memory corruption when calling cb to release cmd memory
When serialization puts the command in active queue & activates
the command, it gives the callback to command owner as part of
the activation procedure. If this activation callback fails then
serialization suppose to give a callback to the owner to release
the memory.
There are some instances observed in legacy platforms where owner
releases the memory itself as part of activation callback failure
first and gets serialization callback as well to release the same
memory. These scenario creates "double free" or "memory
corruption" phenomena.
In order to avoid this scenario, add a sanity check to make sure
command still present in active queue and memory is not released
by command owner before calling callback to release the memory.

Change-Id: Ide341e3288aadd7d6e4441a5768118cd1439d38d
CRs-Fixed: 2161678
2018-02-02 07:46:06 -08:00
Varun Reddy Yeturu
4aec1d63a8 qcacmn: Fetch the scan cmd in active list using scan ID
Loop through the active scan commands in the serialization
queue and find a match based on the scan ID provided. The API
wlan_serialization_get_scan_cmd_using_scan_id already exists
to achieve this. Move this API to wlan_serialization_api.c so
that it can be utilized by everyone as a public API.

Change-Id: If7250e1c994c728cd89f5d76db0023967027f12a
CRs-Fixed: 2169467
2018-01-15 13:25:21 -08:00
Arif Hussain
1493b989c7 qcacmn: serialization: Replace instances of unadorned %p
Replace instances of unadorned %p in serialization.

Change-Id: I9ae7cb5dc231e689d029d77b1dc7b081a93af0c3
CRs-Fixed: 2133328
2017-11-10 04:08:08 -08:00
Zhu Jianmin
5b55c8e857 qcacmn: wlan_serialization_activate_cmd activates first cmd only
wlan_serialization_activate_cmd() always activates first command from
active queue which creates issue for scan command related operations.
This issue has been brought in through:
I8c63dd15d7ab8612a87950a3c189e73d1436c26a
When there are multiple scan commands put in to active queue,
wlan_serialization_activate_cmd() will keep pulling first command and
activates it.
Fix: Enhance wlan_serialization_activate_cmd() API to activate the
command which has been put in a active queue.

Change-Id: Id72449cbee81b65977070a8bbec8e417eb2bb655
CRs-Fixed: 2136142
2017-11-05 18:38:36 -08:00
Zhu Jianmin
2255930af5 qcacmn: Fix logic and no return issue in wlan_serialization_stop_timer
wlan_serialization_timer can't be stopped before destroy it
always log: wlan_serialization_stop_timer: nothing to stop
No return in end of function

Change-Id: Ie40d8513ab5d7e84f21aebe720365d32b8205ea9
CRs-Fixed: 2133196
2017-11-02 05:48:37 -07:00
Zhu Jianmin
959cb86f82 qcacmn: Fix stability caused by unwanted recursive calls in serialization
Issue description: When wlan_serialization_dequeue_cmd() gets called, it
will remove the command from active queue and try to move next pending
command from pending queue to active queue. But before it moves this
pending command to active queue completly, it calls the caller and
notify that command is activated through callback.
If that callback returns failure then serialization abandon the process
of moving it from pending to active. Now it again picks the same command
from pending and repeat the process. This creates unwanted recursion and
reference count mistakenly decremented multiple times.

Here is the recursion stack:
  (a) wlan_serialization_move_pending_to_active()
    (b) wlan_serialization_enqueue_cmd
      (c) wlan_serialization_add_cmd_to_given_queue
        (d) cmd_list->cmd.cmd_cb() fails
          (e) wlan_serialization_put_back_to_global_list
            (f) go back to (a) and repeat
Fix: Divide wlan_serialization_enqueue_cmd() API's logic in 2 parts.
1) Enqueue the command first through wlan_serialization_enqueue_cmd()
   This ensures that command has been put in to given queue.
2) Once command has been put in to given queue and if this queue happen
   to be active queue then activate the command through
   wlan_serialization_activate_cmd()
Here is the stack after the fix:
  (a) wlan_serialization_move_pending_to_active()
    (b) wlan_serialization_enqueue_cmd
      (c) wlan_serialization_add_cmd_to_given_queue
        (d) returns WLAN_SER_CMD_ACTIVE or !WLAN_SER_CMD_ACTIVE
  (a1) if (WLAN_SER_CMD_ACTIVE)
    (b1) wlan_serialization_put_back_to_global_list() for pending cmd
      (c1) wlan_serialization_activate_cmd()
        (d1) if fail
          (e1) wlan_serialization_put_back_to_global_list for active cmd
             (f1) then repeat from (a)
        (d2) if pass then return
  (a2) if (!WLAN_SER_CMD_ACTIVE) then nothing to be done.

Change-Id: I8c63dd15d7ab8612a87950a3c189e73d1436c26a
CRs-Fixed: 2132975
2017-11-01 14:39:17 -07:00
Krunal Soni
80898349e8 qcacmn: Add NULL pointer check before dereferencing it
Few of the serialization APIs are de-referencing the pointer without
checking it against NULL.

Add a NULL check before de-referencing it.

CRs-Fixed: 2130161
Change-Id: I109518332e593e1f32936404021db1db7a332df7
2017-10-21 02:29:29 -07:00
Varun Reddy Yeturu
2576425ab6 qcacmn: Fix serialization log to use proper module ID
Fix serialization log to use proper module ID.
Replace QDF_MODULE_ID_HDD with QDF_MODULE_ID_SERIALIZATION.

Fix logging levels as per logging guidelines.
INFO_HIGH is not supposed to be used anymore.

Change-Id: I349254abc36565e5ba520d46588e5c3e27178ad9
CRs-Fixed: 2090993
2017-10-14 05:59:23 -07:00
Krunal Soni
fe33ab5fde qcacmn: Enhance serialization cancel command API
Current wlan_serialization_cancel_request API cancels commands which
are in pending queue but it doesn't cancel command which are in active
queue.

Enhance the API to allow requester to cancel the commands from active
queue as well.

Change-Id: Id303c59cbb2a36f6c358f34b4885a0af66f5dac1
CRs-Fixed: 2123090
2017-10-12 14:22:19 -07:00
Jeff Johnson
878533e29b qcacmn: umac: Replace instances of unadorned %p
Replace instances of unadorned %p in umac.

Change-Id: I7ae33c51405b31df24670dee3c98b6b4f1da9ab4
CRs-Fixed: 2111274
2017-10-03 16:02:30 -07:00
Krunal Soni
be546459fa qcacmn: Remove all commands related to vdev when it is destroyed
If serialization module has queued some commands for particular vdev
and if that vdev gets destroyed without informing serialization
module then upon those command timeout, serialization try to point
vdev pointer which is invalid. This situation create a crash.

If serialization module has some commands pending or active for vdev
which is being destroyed then remove those commands as part of vdev
destroyed notification.

CRs-Fixed: 2099063
Change-Id: I8df9900d83bea758ca5c50cbe0edf31e06f83a4c
2017-09-06 22:52:23 -07:00
Varun Reddy Yeturu
eea59a38ac qcacmn: Add vdev as argument to wlan_serialization_comp_info_cb
Add an additional argument to wlan_serialization_comp_info_cb to pass
the vdev information while filling the information required to apply the
rules.

Change-Id: I44dadc01108e746fd2ce6353a90cdf9401dd6d06
CRs-Fixed: 2090987
2017-08-13 16:16:06 -07:00
Vivek
5ec0bd3636 qcacmn: Remove psoc/pdev locks for trivial APIs
Remove psoc/pdev locks from trivial API's. This follows the changes from
which the lock requirement from few simple APIs are removed.

Change-Id: Ib5769c2234c8d57f485c0eef5a4e3c61fa170508
CRs-Fixed: 2060880
2017-06-26 23:32:19 -07:00
Anish Nataraj
9f07b47498 qcacmn: Check max scan allowed through API from scan component
Scan component provides API to check maximum scan
allowed. Replace all MAX_SCAN macros with API

Change-Id: I094b61978af015e5800784b90340e39aae94e7ba
CRs-Fixed: 2033852
2017-05-16 22:08:05 -07:00
Kabilan Kannan
b197624f96 qcacmn: Populate tdls scan interface member
Add tdls scan interface changes to notify
tdls status to scan

Change-Id: Ie9dc9ffda41414238ba6ad47704d42b5a0aaa53d
CRs-Fixed: 2034220
2017-04-20 00:04:52 -07:00
Naveen Rawat
d1f1484105 qcacmn: In serialization timeout timer avoid double free
In serialization timeout timer, do not free memory before removing the
cmd from serialization queue. Free only if command is not found in the
queue.

Change-Id: I775b4230f2cb558142a13cfe0a339f3a20a04a33
CRs-Fixed: 2029599
2017-04-11 11:04:26 -07:00
Krishna Kumaar Natarajan
8e039b16e1 qcacmn: Fix passing NULL vdev object to object manager
Fix passing NULL vdev object to object manager. Currently during unload
process, we are purging all the cmds in the cmd list. In this case
pointer vdev_id is passed as NULL since we wanted to clean up cmds
associated with all the vdevs. In wlan_serialization_purge_cmd_list()
vdev remains NULL in this scenario which results in an ASSERT in
wlan_objmgr_vdev_release_ref().

This change set will call wlan_objmgr_vdev_release_ref only if vdev is
not NULL.

Change-Id: I29a6114f4b5d9fcabe24b82f26defd8ab58cceec
CRs-Fixed: 2029580
2017-04-11 11:04:17 -07:00
Anish Nataraj
da0e2f41b7 qcacmn: Add SCAN WAR for hawkeye emulation
Emulation being clocked at lowest rate,
SCAN and serialization timers are modified to handle
these scenarios

Change-Id: Ia937930483dbcd0268fd2fe2d0393e49f09b215f
CRs-Fixed: 2009490
2017-03-29 09:09:43 -07:00
Anish Nataraj
089fd7c9da qcacmn: Implement Dynamic serialization rules framework
Add dynamic rules registration callbacks which needs to be registered
by each component during its initialization phase.
These callbacks are used for serialization component to determine
whether serialization request can or can't be honored.

Change-Id: I02000426527bc7611cb9bb1d0ee26f3c03d9f2d1
2017-03-27 00:22:33 -07:00
Naveen Rawat
b35a0ddc58 qcacmn: Include WIFI POS component ID in common files
This change defines WLAN_UMAC_COMP_WIFI_POS and WLAN_WIFI_POS_ID
to be used later by WIFI_POS component.

Change-Id: I70e35d45a9c7cbe72af91bb019e055699d61dd08
CRs-Fixed: 2003488
2017-03-09 16:18:57 -08:00
Varun Reddy Yeturu
5f3eea41fb qcacmn: Rename serialization files
Rename wlan_serialization_legacy_mcl_api to
wlan_serialization_legacy_api for both header and c files

Change-Id: I94ed98c790a1f8f829fbc2de676dd3a0e9382b9d
CRs-Fixed: 2012863
2017-03-01 16:47:23 -08:00
Krunal Soni
19f4104bcb qcacmn: Provide new serialization APIs & message types for legacy module
In order to move old legacy to new mechanism, provide new serialization
APIs and message types.

CRs-Fixed: 2000032
Change-Id: Ifc0a54837ab85f1cc1156a5592f409c9e95ebd8e
2017-02-24 00:39:45 -08:00
Krunal Soni
a43598c26d qcacmn: Fix previously provided review comments for serialization module
The fix addresses following issues.
1) Add legacy SME ID in object manager reference debug id.
2) Add legacy SME message enum to serialization module.
3) Make cmd_id from uint16_t to uint32_t for compatiblity.
4) Adjust the cmd_type check as there are more cmd_types available.
5) Add some logging to make debugging easier.
6) Don't take the spin lock while iterating through pdevs
7) Add supporting APIs to check if command is present in queues

CRs-Fixed: 2000032
Change-Id: I43ed80c2a4d63940d8d6db29f1132373545cd4ab
2017-02-24 00:39:44 -08:00
Krunal Soni
c336de23c9 qcacmn: Fix type of parameter passed to serialization timeout callback
By mistake, current serialization is passing component's command pointer
instead passing serialization's command pointer which leads to confusion
and incorrect behavior. Fix by passing correct parameters.

When serialization module's callback to activate the command fails, it
doesn't give callback to release the memory which will lead to memory
leak. Fix by calling release memory callback.

CRs-Fixed: 2000032
Change-Id: Ic08e00fd1a815674f54c16593baeb0dd6d14d033
2017-02-22 15:10:33 -08:00
Anish Nataraj
a60ad827cf qcacmn: Implement serialization command rules and processing logic
Initialize rules callback handlers for different components,
Add serialization command processing logic, which calls
component info callback handler to get information about component
state. Component info then is passed to apply rules logic callback
to either deny or enqueue the serialization command

Change-Id: I59be9c5ee71e57fb5737558654222346bea4f1f8
CRs-Fixed: 2000032
2017-02-20 05:21:28 -08:00
Krunal Soni
0bb803fb7e qcacmn: Fix compilation error caused by object manager API change
Object manager's API definition has been changed which causes
compilation error in serialization module. Fix the compilation.

Change-Id: I89cd20c12579f927984ca4c94cf6155ea567b9d7
CRs-Fixed: 2000032
2017-02-18 18:55:14 -08:00
Krunal Soni
16641b145a qcacmn: Provide implementation of command queue operations
Provide the implementation to enqueue, dequeue, cancel,
remove, flush operation of command.

Change-Id: Id62cf320fa0936ed3ddb1264464d35ab5c60e95a
CRs-Fixed: 2000032
2017-02-18 18:55:12 -08:00
Krunal Soni
8a583437e7 qcacmn: Fix bugs in serialization module reported by reviewer
Few issues are observed and reported in serialization module, fix
them.

Change-Id: I11929f086a5f7ef227b8b8fa62d0cf8c1b5f0b9c
CRs-Fixed: 2000032
2017-02-18 18:55:11 -08:00
Srinivas Pitla
10aa60c11f qcacmn: Add reference count support to PSOC/PDEV/VDEV/PEER objects
This change implements ref count mechanism, before accessing/storing object,
its ref count has to be incremented to avoid "use after free" scenarios.

1) Increments ref count of each object on its creation
2) Increments parent object on creation of child object (ex: on peer creation
	vdev object ref count gets incremented)
3) On get_obj() API, caller will be returned object after incrementing ref cnt

Change-Id: Ic01cb3217881d269cc451f0e63358e1e4decaaa7
CRS-Fixed: 1096009
2017-02-15 01:48:43 -08:00
Krunal Soni
c4e3592bbf qcacmn: Serialization Init and DeInit
Define folder and file structure for
Serialization UMAC convergence component.
Define the changes for initializing and de-initializing
the serialization component

Change-Id: I1074091a74bba8aa7426345f6fb1a5df127f1a59
CRs-Fixed: 2000032
2017-02-03 18:06:19 -08:00
Krunal Soni
748e6b76a1 qcacmn: Create serialization component's public API
Define the public APIs for serialization component for other
components to use.

Change-Id: I66c8fd2c85aaf7b78f98ea6a273784fa253969b6
CRs-Fixed: 2000032
2017-02-03 18:06:17 -08:00