27 #include <linux/slab.h>
28 #include <linux/export.h>
51 ie_len =
sizeof(
struct uwb_ie_hdr) + hdr->length;
86 r +=
scnprintf(buf + r, size - r,
"%02x %02x",
90 while (d != ptr && r < size)
91 r +=
scnprintf(buf + r, size - r,
" %02x", (
unsigned)*d++);
124 result =
uwb_rc_vcmd(uwb_rc,
"GET_IE", cmd,
sizeof(*cmd),
132 if (result <
sizeof(*get_ie)) {
133 dev_err(dev,
"not enough data returned for decoding GET IE "
134 "(%zu bytes received vs %zu needed)\n",
135 result,
sizeof(*get_ie));
138 dev_err(dev,
"not enough data returned for decoding GET IE "
139 "payload (%zu bytes received vs %zu needed)\n", result,
165 &reply.
rceb,
sizeof(reply));
168 else if (result !=
sizeof(reply)) {
169 dev_err(dev,
"SET-IE: not enough data to decode reply "
170 "(%d bytes received vs %zu needed)\n",
171 result,
sizeof(reply));
174 dev_err(dev,
"SET-IE: command execution failed: %s (%d)\n",
205 capacity = uwb_rc_get_ie(uwb_rc, &ie_info);
231 static int uwb_rc_ie_add_one(
struct uwb_rc *
rc,
const struct uwb_ie_hdr *new_ie)
236 size_t length, new_ie_len, new_capacity,
size, prev_size;
239 new_ie_len =
sizeof(
struct uwb_ie_hdr) + new_ie->length;
249 ptr = rc->
ies->IEData;
259 memmove(prev_ie + new_ie_len, prev_ie, prev_size);
260 memcpy(prev_ie, new_ie, new_ie_len);
300 result = uwb_rc_ie_add_one(uwb_rc, ie);
332 void uwb_rc_ie_cache_rm(
struct uwb_rc *uwb_rc,
enum uwb_ie to_remove)
339 ptr = uwb_rc->
ies->IEData;
346 len -=
sizeof(
struct uwb_ie_hdr) + ie->length;
371 uwb_rc_ie_cache_rm(uwb_rc, element_id);