refactor GRil incoming bytes dispatching mechanism

Bug #1408239 reported by You-Sheng Yang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ofono (Ubuntu)
Won't Fix
Low
You-Sheng Yang

Bug Description

GRil reads incoming bytes into ril_msg structure in function `read_fixed_record` in gril/gril.c. It's mostly working except it makes some assumptions that are not always true.

1. The `read_fixed_record` function calls `memmove` to copy data from ring_buffer, which follows that the whole parcel must not be wrapped. This is usually true because whenever a parcel is read, the ring_buffer rewind its in/out position markers to the beginning. However, if somehow rild transmits massive amount of parcels, or due to various reasons that the gio thread is not waked up in time and a lot of incoming data queued in kernel, then a parcel that spans across the boundary becomes very likely. This is actually the question raised in the comment:

  /* TODO: need to better understand how wrap works! */

With https://bugs.launchpad.net/ubuntu/+source/ofono/+bug/1408228, the GrilIO part is immune from this problem but the `read_fixed_record` is still affected.

2. One should really avoid using ring_buffer APIs that involve its internal states. Ring buffer wrapping should not be a concern to other components whenever possible.

Revision history for this message
You-Sheng Yang (vicamo) wrote :
Changed in ofono (Ubuntu):
assignee: nobody → Vicamo Yang (vicamo)
Tony Espy (awe)
Changed in ofono (Ubuntu):
status: New → In Progress
importance: Undecided → Low
You-Sheng Yang (vicamo)
Changed in ofono (Ubuntu):
status: In Progress → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.