Commit Graph

114 Commits

Author SHA1 Message Date
Balaganapathy Palanisamy
3020842b6d qcacmn: Serialize PDEV CSA channel switch
CSA channel switch call directly interacts with VDEV
state machine, move CSA restart to go through serialization
service.

CRs-Fixed: 2598123

Change-Id: Ic0bea64b56f54eed354e11d0873ae4423e365cca
2020-01-17 21:29:38 -08:00
Abhinav Kumar
4c3c73a375 qcacmn: Remove unused serialization API
Remove unused serialization API
wlan_serialization_get_active_list_count.

Change-Id: I80c1cd5693fb3dda91ffd7de01c1df244e648135
CRs-Fixed: 2580681
2019-12-10 00:51:51 -08:00
Gururaj Pandurangi
85d32ab984 qcacmn: Rate limit logs in serialization API
Rate limit logs in wlan_serialization_peek_head_active_cmd_using_psoc
to prevent excessive logging

Change-Id: I25bc93754cf4fe5d56fdb67c15b79b72fcda9efd
CRs-Fixed: 2574786
2019-12-03 01:15:38 -08:00
Rachit Kankane
98ec4d132b qcacmn: use spinlock before iterating
Before iterating in pending list, use spinlock to avoid possible
race condition.
Remove function wlan_serialization_get_active_list_next_node_using_psoc
as it not being used and is part of legacy flow which is suppose to be
removed eventually.

Change-Id: I9e7cbd9db8b5a1c45915bf5291cd5011c276d0e2
CRs-Fixed: 2573425
2019-12-02 12:39:42 -08:00
Vivek
f011832a65 qcacmn: Update blocking command flags atomically
When moving a blocking command from pending to active queue,
we release the lock and call the activation cb.
After the activation cb returns, we update the blocking cmd
waiting flag based on the active cmd node's "is_blocking" param.

If the activation cb is also resulting in removing the command,
then after the cb returns, the active cmd node is returned to the
free pool and our check fails, and we miss to update the blocking
cmd waiting flag, resulting in no further commands moving to the
active queue.

The update to the blocking command should be done atomically,
immediately after it moves to active queue and before releasing
the lock for the activation callback.

Change-Id: Idedccb16ce68bb2166fb3970cd231fe738ec6af2
CRs-Fixed: 2554767
2019-11-19 13:05:08 -08:00
Arun Kumar Khandavalli
5377f457a1 qcacmn: Introduce new api to disable the vdev serialization queue
MCL presently sends the vdev delete to firmware via serialization,
with a new requirement vdev delete cannot be sent via serialization.
So, disable the serialization for the vdev before sending the vdev
delete to firmware.

Change-Id: Ieffccaf815eff7627d39b0191a7be121e85965fd
CRs-Fixed: 2566113
2019-11-15 16:01:32 -08:00
Wu Gao
5988e8b7d2 qcacmn: Remove unnecessary logs in loop
There is unnecessary logs in loop which affect useful log capturing.

Change-Id: I37b2c8123a280e4ec080ac1fb75e43135936fd79
CRs-Fixed: 2552104
2019-10-27 19:27:56 -07:00
Abhishek Singh
21116dd976 qcacmn: Fix removal of the serialization command if timer start fail
In case vdev is logically deleted the serialization active timer fails
to start because it fails to get vdev ref count. Now in this case the
cmd is not removed from the active queue and is just marked
CMD_ACTIVE_MARKED_FOR_REMOVAL because CMD_MARKED_FOR_ACTIVATION is set.

Even during pdev stop as CMD_MARKED_FOR_ACTIVATION is set the command is
not removed.

Fix is to reset CMD_MARKED_FOR_ACTIVATION flag and handle it in same way
as the activate failure case.
Also reset the timer cmd after timer start failure to avoid vdev ref count
release by WLAN_SERIALIZATION_ID even when it failed to take the ref count
in first place.

Change-Id: Ic078efa8ce4ad563087381b8c95eba91894d8a48
CRs-Fixed: 2535245
2019-09-27 02:46:53 -07:00
Himanshu Batra
591b333f00 qcacmn: Decrease log level of some expected prints
Log level of some expected prints were set to error level because
of which the prints were coming frequently.
Moving log level of these expected prints from error to debug level.

Change-Id: Ifd2672cd73db02488ce3055ca5e35d423d4f4761
CRs-Fixed: 2522164
2019-09-26 22:05:30 -07:00
Vivek
91dcde9050 qcacmn: Check for pdev/psoc before requesting serialization psoc object
The serialization vdev destroy handlers extracts the psoc
from the vdev, and get its psoc component object.

If the pdev or psoc is NULL for some reason, we get a
crash in object manager while trying to retrieve the serialization
psoc object.

So check for valid pdev/psoc before we get the serialization psoc object.

Change-Id: I9ca45654250403a8b5fe674431251defd1aac6e8
CRs-Fixed: 2524231
2019-09-17 03:56:23 -07:00
Abhishek Ambure
9377b064a6 qcacmn: Rename WLAN_SER_CMD_DEL_STA_SESSION macro
As a part of vdev manager conversion, vdev delete code is
refactored. Legacy code and naming is removed. In vdev manager
operations, STA_SESSION is addressed as VDEV.

Hence WLAN_SER_CMD_DEL_STA_SESSION macro is renamed to
WLAN_SER_CMD_VDEV_DELETE.

Change-Id: I08bf6b2e69f5635d5ebc2548c18991bbb12b3985
CRs-Fixed: 2508147
2019-08-14 15:43:23 -07:00
Pragaspathi Thilagaraj
bdcce7fcb1 qcacmn: Change the maximum serialization pending commands
The host driver serialization module currently supports upto 4
commands in non scan pending queue. This is calculated at the
wlan_serialization_vdev_create_handler() as:
    max_pending_cmds = (WLAN_SER_MAX_PENDING_CMDS /
                        WLAN_SER_MAX_VDEVS)

But in SAP case, if multiple STA sends deauth at the same time,
4 pending commands in non scan pending queue is not sufficient
and will result in only disassoc from the first 4 STA getting
honored.

The current host wlan driver supports 3 SAP mode and
2 STA vdevs amounting to a total of 5 vdevs supported.
So calculate the total non scan pending commands for
serialization based on the total peers supported for each
mode to fix this issue.

In SAP case, maximum 32 peer are supported and for STA case,
maximum 4 pending commands for serialization. So change the
max pending commands calculation as:
 max_pending_cmds = (No. of sap modes supported * 32) +
                    (No .of STA modes supported *4 )

For MCL case the definition of WLAN_SER_MAX_PENDING_CMDS
will be moved to Kbuild.
For WIN case, the existing maximum count will be retained.

Change-Id: Iff1d9430b45e26812b600560b08e85e6040eafef
CRs-Fixed: 2483520
2019-07-17 17:42:33 -07:00
Santosh Anbu
0616b55fed qcacmn: API to support serialization of restart cmds
Add APIs to support serialization of pdev restart and vdev
restart commands.

Change-Id: I367a8f369692e660c37278f7494db7aa0aeb7cd6
CRs-Fixed: 2480314
2019-07-16 15:53:56 -07:00
Santosh Anbu
f8ed4b9824 qcacmn: Add API for cancellation of non-blocking cmd
Add API to support cancellation of a non-scan command to match with the
vdev and is a non-blocking serialization command.

Change-Id: I31556ea8f35b9caf314f10eba0f0f655e3fce806
CRs-Fixed: 2481935
2019-07-16 15:53:52 -07:00
Santosh Anbu
e44904327a qcacmn: Update doc for serialization commands
Add change to update the doc section for the list of commands supported
by the serialization module.

Change-Id: I3534d3798291fa259c8ee4de38df8c0e8649e5ab
CRs-Fixed: 2477833
2019-07-01 02:24:54 -07:00
Vivek
140070028c qcacmn: Avoid adding cmd to serialization queue if disabled
Add API to fetch the vdev queue status and avoid enqueueing command
to serialization queue if the vdev queue is found to be disabled

Change-Id: If615b07dceaeb3113592f24355f254c8e70ca8a2
CRs-Fixed: 2470208
2019-06-14 07:41:05 -07:00
Santosh Anbu
f7b253f5e2 qcacmn: Fix to release vdev reference on cmd dequeue
Add change to release vdev reference only on successful removal
of active cmd from serialization active queue.

Change-Id: I2e14f7f53dc38388cdd05f029edc9329f9dd86a7
CRs-Fixed: 2463724
2019-06-12 20:04:15 -07:00
Abhishek Singh
77f9ba1cc0 qcacmn: Move legacy serialization flush cmds to common api
Move legacy serialization flush cmds to common api

Change-Id: I7a1a46a615c90e112c91efc4aec1461023b6ad5c
CRs-Fixed: 2452518
2019-05-16 14:46:34 -07:00
Jianmin Zhu
787c7cdb43 qcacmn: Free serial cmd before its timer when rmmod
Rmmod process:
wlan_hdd_pld_remove --> hdd_stop_adapter --> hdd_vdev_destroy
--> WLAN_SER_CMD_DEL_STA_SESSION (25) cmd queued --> PLD_FW_DOWN
(will complete wait event as part of qdf_complete_wait_events)
--> hdd_wlan_stop_modules --> cds_disable -->
dispatcher_psoc_disable --> wlan_serialization_psoc_disable -->
wlan_serialization_timer_destroy --> umac_stop --> csr_stop -->
wlan_ser_cancel_non_scan_cmd -> check if timer is present but th
 timer are already destroyed, so assert.

Move wlan_serialization_purge_cmd_list into converged API file to
be shared by MCC and WIN.

Change-Id: Iad557e4a05d682c257be0c39049c52950e5eb530
CRs-Fixed: 2451058
2019-05-16 05:57:33 -07:00
Vivek
ed4f95a545 qcacmn: Avoid vdev destroy until serialization cmd removal
The serialization active command removal can happen in two ways
1. Its through wlan_serialization_remove_cmd API
2. Command times out and command timeout handler is called.

In case, cmd times out and handler is called in scheduler
context and as part of the active cmd removal,
the active cmd is removed, and release cmd cb is called
which could delete the vdev(post last reference release).
Then as part of moving cmd from pending to active,
the vdev queues are null, and we see a panic.

We take a vdev reference, when timer for active cmd is started.

For active cmd removal through wlan_serialization_remove_cmd,
we release the reference when the timer is stopped.

To avoid vdev destroy, in case command times out,
and until the command timeout handling is completed,
we hold vdev reference from when timer is started,
until timer handler completes.

Change-Id: I16b6864f75e8bf354da6f8b16c3aaa6cf39d7ac7
CRs-Fixed: 2422422
2019-04-19 04:09:04 -07:00
Vivek
445a3a5889 qcacmn: Print all elements of serialization history circular buffer
In the current implementation, we print the ser history
from index 0 to the current index of the ciruclar buffer,
so when buffer overflows we print only few recent items.

Instead, we should print all the elements in the circular buffer
starting from current index to entire length of the circular buffer.
This will print all the elements in the circular buffer
when it overflows and also takes care of printing
required items when buffer is not overflown.

Change-Id: I6c54cb34de7a1ba24ee0204004cc9a203173c66b
CRs-Fixed: 2430483
2019-04-12 02:56:42 -07:00
Santosh Anbu
a3d6f77c62 qcacmn: Add API to validate umac_cmd in serialization command
Since umac cmd is specific to the module adding cmd to serialization
queue, an API is needed to validate the umac_cmd associated with that
serialization context holding the serialization queue lock.

Change-Id: Iadb4deb17ffabd780432a29e7cbd37024fd431fe
CRs-Fixed: 2430764
2019-04-11 01:14:10 -07:00
Vivek
740f39f568 qcacmn: Remove assert on serialization timer handler's cmd check
There is an assert inside the serialization timer cb.
This timer cb can also be called in the scheduler context.

So if we get a scan cancel request, it is posted to scheduler
and after that command timesout, the timer  cb is posted
to the scheduler.

So first the cancel is executed and the command is removed.
After that, the timer handler is executed which will find timer->cmd
to NULL.

So, by the time, the timer handler is involved in scheduler context
the command might be cancelled so we return an error when cmd is null
in timer handler cb.

Change-Id: I03651a63de88fe5c6467c5783254ffd006c663d2
CRs-Fixed: 2427323
2019-04-04 10:31:53 -07:00
Jeff Johnson
a95ea4f9ee qcacmn: serialization: Replace explicit comparison to NULL
Per the Linux Kernel coding style, as enforced by the kernel
checkpatch script, pointers should not be explicitly compared to
NULL. Therefore within umac serialization replace any such comparisons
with logical operations performed on the pointer itself.

Change-Id: I6b8ff46dacfd2f9a883262f6336f35f5aff499bc
CRs-Fixed: 2420150
2019-03-28 09:04:45 -07:00
Santosh Anbu
9f4daf55f7 qcacmn: Add change for timeout to be executed in scheduler
When a serialization cmd is activated and activation is process in
scheduler context, it is observed that the timeout for that cmd
occurs and the cmd is released even though the activation in
scheduler context is still in progress.

This will lead to accessing the serialization cmd after free,
leading to memory corruption error.

Add change to avoid this by posting timeout message to scheduler
thread which will help synchronize the cmd execution in scheduler.

Change-Id: Ib2234331844f48d0d219f430f5b585f792282d42
CRs-Fixed: 2419854
2019-03-26 01:24:55 -07:00
Santosh Anbu
3f0962833f qcacmn: Add API to fetch activation status for active cmd
Add change to fetch the activation status for the command in the
active queue of a given vdev.

Change-Id: I2ef87b5423f3749eb68e50147c9a30115492197c
CRs-Fixed: 2415236
2019-03-13 23:21:57 -07:00
Nachiket Kukade
ab9c7479e4 qcacmn: Add modules to support new NDP command and event
Add modules and API's to issue command WMI_NDP_CMDID. This
command, for now, can request Firmware to terminate all NDP's
associated with the given vdev. Add module that extracts
event information from event WMI_NDP_EVENTID. This event acts
as a response to command WMI_NDP_CMDID, and carries NDP
related status information for the host. Extract mac_id from
the updated TLV of NDP confirm and schedule update events.

Add modules and API's to support new NDP command and event.

Change-Id: Ibf6312cb3669b5e62ada3f4ad852be87f14ae09f
CRs-Fixed: 2384535
2019-03-12 13:58:31 -07:00
Santosh Anbu
73f3f09abf qcacmn: Fix type for wlan_serialization_cmd_callback
Fix the type for nan_serialized_cb and remove unnecessary
type casts from other callbacks.

Change-Id: Ie4e45f5a7e9fc17eb1c45fa18160e3bbd47151fe
CRs-Fixed: 2402989
2019-03-12 06:10:08 -07:00
Madhvapathi Sriram
b73fc282d8 qcacmn: Remove error log for qdf_mem_malloc in umac files
qdf layer already has the error trace

Change-Id: I2ea22fe0e3e59b9d41ac21142615ffb96227abaf
CRs-Fixed: 2376418
2019-03-04 07:30:21 -08:00
Vivek
963b9daa31 qcacmn: Explicit initialization of vdev id
The vdevid used in the wlan_ser_print_history function
is not initialized by default
and we pass them to subsequent function without initializing
though that would not be used.

Initialize the vdev id by default irrespective of its use.

Change-Id: I0c45528bdfcb8c6e37a40ea9a68f5c56c1cda753
CRs-Fixed: 2407068
2019-03-02 17:45:52 -08:00
Abhishek Singh
7c1fe52d51 qcacmn: Get vdev_id before releasing ref while flushing active cmd
In wlan_ser_cancel_non_scan_cmd, cmd.vdev pointer is used to get vdev id
after WLAN_SER_CB_RELEASE_MEM_CMD is called. In WLAN_SER_CB_RELEASE_MEM_CMD
the command release the vdev ref count and it may lead to physical
deletion of vdev. Thus getting vdev id from vdev may result in invalid
vdev_id and thus proper bits are not reset in vdev_active_cmd_bitmap
for the vdev.

Thus no new blocking command will be allowed in serialization active queue.

Fix is to get proper vdev_id before WLAN_SER_CB_RELEASE_MEM_CMD is called
and use that to reset the pdev_q->vdev_active_cmd_bitmap bit for vdev_id

Change-Id: I2756f1632a72f086e9d214a437ad794ae08afc45
CRs-Fixed: 2395851
2019-02-23 05:19:07 -08:00
gaurank kathpalia
1ff1e28d6a qcacmn: Replace scheduler post msg with scheduler post messsage
Currently many modules use the scheduler_post_msg API which
doesn't allow the driver to know about the src, and destination
modules.

Fix is to call scheduler_post_message which has src, dest, and
the que id.

Change-Id: I6cba6b2f8febb0cb0165af48704de91a893a8b49
CRs-Fixed: 2385912
2019-02-07 07:53:37 -08:00
Vivek
332df1206f qcacmn: Change log level of a debug message
Add change to decrease the log level from error to debug

Change-Id: Ic07a0dd083e6bd112a7d45af5397330ce4f29890
CRs-Fixed: 2391733
2019-02-04 15:36:45 -08:00
Santosh Anbu
0a46a191fa qcacmn: Add change to export symbol
Export the symbol as it is used across multiple modules

Change-Id: I7dd70bd0cf48b2f24cc10de7fd2e4bdd6bd938c6
CRs-Fixed: 2391939
2019-02-02 08:18:45 -08:00
Vivek
601cb9452f qcacmn: Fix number of active command timers in psoc
In psoc open, driver try to get the number of PDEV and
allocate memory for number of timers. But during psoc open number of
pdev are 0, thus timers are not allocated for non scan active queues.

Now if all scan active queues are full and a non scan command is
activated, it tries to find empty timer, which is not found, as
all timers are used by scan commands. Thus timer is not started for
this command and when this command is aborted the timer destroy API
return failure and thus the command is not removed from the active
queue.

Allocate the timer during psoc enable where pdevs are already created
and driver can get the number of pdev and print error if start timer
fails for a command.

Change-Id: Ia5b22e2849c58992a7d3d4097becc257ac673157
CRs-Fixed: 2389157
2019-01-29 21:47:31 -08:00
Jianmin Zhu
91308cc532 qcacmn: Remove code of CONFIG_SERIALIZATION_V1 part
Remove legacy code of CONFIG_SERIALIZATION_V1 part

Change-Id: I281d6ae911858c9212317c7e3a895db66511699b
CRs-Fixed: 2386843
2019-01-29 16:54:50 -08:00
Vivek
c4eabce922 qcacmn: Use QDF_TRACE with no fl for serialization history
The current serialization history output is printed with
file and line information since the common ser_err is using
the FL variants of trace function.

Add ser_err_no_fl to use non FL variant of the trace function
for printing the serialization history.

Change-Id: Icc0b5d00d50aaa8fd8fb6b072784a26177004219
CRs-Fixed: 2387039
2019-01-29 09:58:09 -08:00
Vivek
d34b7d0d62 qcacmn: Change default log level for serialization
Change default log level of serialization to QDF_TRACE_LEVEL_ERROR
Change error print to debug, when pending queue is empty,
which is a possible expected case.

Change-Id: I21cd6b5f158d5dffbc6e7309c9202e7e2e0162e8
CRs-Fixed: 2387017
2019-01-29 09:58:05 -08:00
Srinivas Pitla
1ff074ce30 qcacmn: Add support for scan and MLME synchronization
Reject scan request, if any VDEV is in START/DFS_CAC/SUSPEND states.

Change-Id: I1047ba510df5ae5debd1e3d5c8a064a57af65fbf
CRs-Fixed: 2384163
2019-01-24 09:59:14 -08:00
Vivek
0043ad80db qcacmn: Reset cmd_in_use flag when returning cmd_list to free pool
There is an instance where the cmd_in_use flag is not
reset when cmd_list is not returned to the free pool

Need to reset the cmd_in_use every time the cmd_list is
returned to the free pool

Change-Id: I1fae24dc691779c6c372936d2963f11f98898750
CRs-Fixed: 2379448
2019-01-23 06:37:33 -08:00
Santosh Anbu
6e2fed8f5f qcacmn: Add scheduler mq handler for mlme
Add mlme message queue handler as the call back for non scan commands
getting activated in the scheduler context.
Add cmd already exists enum to be returned if the command already exists
in the serialization queue.

Change-Id: I24fe453ffddbd4341459874458f11688adebc740
CRs-Fixed: 2377219
2019-01-22 05:06:24 -08:00
Abhishek Singh
6c962c7ac0 qcacmn: Remove unused commands from serialization
Remove unused commands from serialization.

Change-Id: I7fedbc028b2bdc8b7176d074855b62dc3e411767
CRs-Fixed: 2384370
2019-01-22 00:18:44 -08:00
Abhishek Singh
b46a753f63 qcacmn: Fix race while accessing the serialization timer cmd pointer
If two threads T1 and T2 are trying to stop the serialization timer,
both can get the timer while holding lock. Timer cmd pointer is set
to NULL after releasing lock.

Now if a third thread T3 is trying to start the timer at same time,
it may get the timer as soon as T1 make cmd NULL and adds its cmd
pointer to the timer in the list.

But T2, which was also trying to stop the timer can stop the timer
and set cmd back to NULL again.  Thus T3 will not have the timer in
the timer list.

Now when driver try to abort/flush the command it will not find the
timer and In case timer is not found the command is not freed, leading
to vdev ref leak.

To fix this stop and update the timer while holding lock.

Change-Id: I363a4d36181328be310c7c980c981302501a9453
CRs-Fixed: 2376733
2019-01-13 18:46:04 -08:00
Abhishek Singh
0a71d5a1f5 qcacmn: Remove serialization vdev destroy handler
Each cmd in serialization list holds a vdev ref by
I8d573ff5a25e6dff928b2708e51ad7b97e292277. When vdev is
destroyed physically, it means vdev ref count is 0, all
serialization cmds of this vdev are released, don't need purge
in vdev destroy handler.

Change-Id: Iea75707c88154e1e3e87369285b82d1288523e22
CRs-Fixed: 2367242
2019-01-01 03:58:27 -08:00
Santosh Anbu
a334af9437 qcacmn: Reset command list status flag after use
When the command is released from the queue, it is added back to the global
pool. Reset the status flag of the command before releasing it back to the
global pool.

Change-Id: I3e51fc6aa0ffc0dafe87b838a5a256fc65d12d09
CRs-Fixed: 2372562
2018-12-28 04:38:23 -08:00
Santosh Anbu
f9ba21e503 qcacmn: Clean active serialization timers on vdev destroy
In the current implementation, if there are any active commands
in the vdev queues then on vdev destroy we remove the commands from
the respective queue and return the command to the global pool.
We should also stop the timers for the corresponding active commands,
otherwise the timeout cb may be called after the destroy is executed.

Change-Id: I51a1049e952073d83b5caee3835e4f9adca2bb9e
CRs-Fixed: 2365411
2018-12-28 04:38:20 -08:00
Vivek
50f2998dfa qcacmn: Address review comments for activation cb reason change
There were minor review comments for the change
for adding activation reason also to activation sb
which was not addressed in the changeset
since it had all the necessaary approvals and it
was in path for merge.

Addressed all the comments as part of this change.

Change-Id: I8035adf2dce152e60eef1494aa7f100c2d567f41
CRs-Fixed: 2361327
2018-12-14 16:06:27 -08:00
Vivek
40d1bc8914 qcacmn: Add activation reason to serialization cmd structure
Add field for activation reason to serialization cmd structure
Also modified the other boolean fields to a bit field for optimization

The new field added to serialization command structure will be used
to update the activation reason about how the command was activated,
either directly from active queue or as part of movement of
pending to active queue.

Change-Id: I8a1da79b7ef60e8d8a739ae2f265418418e2c859
CRs-Fixed: 2361327
2018-12-14 16:06:24 -08:00
Vivek
6a84a1c328 qcacmn: Add serialization API to update timers
Add a new API to update serialization timer value for a
give command in the active queue.

Change-Id: I725a35822e881facd9e2f4a51e41ea5ee8d6bbd8
CRs-Fixed: 2352317
2018-12-14 16:06:21 -08:00
Vivek
c4f335719b qcacmn: Add API to peek vdev active queue
Add API to peek into the vdev active queue
and return the command type present in the
active queue of a given vdev

Change-Id: I4a4dc419f4a51645cc7e611ffb7053a8c8240381
CRs-Fixed: 2354133
2018-12-14 16:06:18 -08:00