soc:qcom:spcom: free not consumed packet on rx timeout
Every SPU to hlos spcom data packet should be consumed by userspace
read() context. When spcomlib read() system call exits on timeout,
a packet arrived later will be stuck till next read() context arrives.
This change fixes this by removing not used packet from channel table
in following cases:
- user character device is closed (no packet expected)
- packet receive from SPU, by assumption, that the next read()
belongs to different session
There is sequence number maintained for each spcom session per channel.
It is stored in a channel context and changed as follows:
- initialized on channel creation and channel destroy
- incremented by client side, before send new request to spcom server
- no changes on spcom_device_open/spcom_device_release
- incremented when timeout on spcom_rx() in order to drop later
txn_id of incoming server response is used to validate that incoming
packet has same sequence number as expected by client channel context.
Also added logic to support detection of communication
role (client/server):
- for server: first packet is incoming from SPU
- for client: first packet is send to SPU
Change-Id: Ied52fd6fa41255db817f1aabc2f4acf2616ee75c
Signed-off-by:
Konstantin Dorfman <kdorfman@codeaurora.org>
Loading
Please register or sign in to comment