diff options
author | Amarnath Hullur Subramanyam <amarnath@codeaurora.org> | 2015-08-26 21:02:15 +0530 |
---|---|---|
committer | Vineeta Srivastava <vsrivastava@google.com> | 2015-09-03 15:19:04 -0700 |
commit | eb3d1bfb7ba3935f3d5d31fc25a826760584e474 (patch) | |
tree | c9cd489ff497d2689a04deef8237f10aee339c75 /qcwcn/wifi_hal/rb_wrapper.cpp | |
parent | 273ec8f00d5fabae8e41d672042798a84c147309 (diff) | |
download | wlan-eb3d1bfb7ba3935f3d5d31fc25a826760584e474.tar.gz |
WiFi-HAL: Write and read data to/from ring buffers record wise
Currently, ring buffer writes and reads happens with byte
boundary. Add support to write only records and do not split any
records.
BUG=23783279
Change-Id: I2342f86cc4c3a678f21f1595b81e0cdf6d24b2c0
Diffstat (limited to 'qcwcn/wifi_hal/rb_wrapper.cpp')
-rw-r--r-- | qcwcn/wifi_hal/rb_wrapper.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/qcwcn/wifi_hal/rb_wrapper.cpp b/qcwcn/wifi_hal/rb_wrapper.cpp index 02338c0..3a9b109 100644 --- a/qcwcn/wifi_hal/rb_wrapper.cpp +++ b/qcwcn/wifi_hal/rb_wrapper.cpp @@ -88,13 +88,22 @@ int is_rb_name_match(struct rb_info *rb_info, char *name) wifi_error ring_buffer_write(struct rb_info *rb_info, u8 *buf, size_t length, int no_of_records) { - if (rb_write(rb_info->rb_ctx, buf, length, 0) != RB_SUCCESS) { - push_out_rb_data(rb_info); - /* Try writing the data after reading it out */ - if (rb_write(rb_info->rb_ctx, buf, length, 0) != RB_SUCCESS) { - ALOGE("Failed to write %zu bytes to rb %s", length, rb_info->name); - return WIFI_ERROR_OUT_OF_MEMORY; + enum rb_status status; + + status = rb_write(rb_info->rb_ctx, buf, length, 0); + if ((status == RB_FULL) || (status == RB_RETRY)) { + push_out_rb_data(rb_info); + /* Try writing the data after reading it out */ + status = rb_write(rb_info->rb_ctx, buf, length, 0); + if (status != RB_SUCCESS) { + ALOGE("Failed to rewrite %zu bytes to rb %s with error %d", length, + rb_info->name, status); + return WIFI_ERROR_UNKNOWN; } + } else if (status == RB_FAILURE) { + ALOGE("Failed to write %zu bytes to rb %s with error %d", length, + rb_info->name, status); + return WIFI_ERROR_UNKNOWN; } rb_info->written_records += no_of_records; |