19 #include <linux/kernel.h>
20 #include <linux/random.h>
21 #include <linux/slab.h>
32 static const int reason_codes[] = {
52 return reason_codes[rsv->
state];
60 static const int companion_reason_codes[] = {
68 return companion_reason_codes[rsv->
state];
76 static const int statuses[] = {
97 return statuses[rsv->
state];
105 static const int companion_statuses[] = {
113 return companion_statuses[rsv->
state];
124 static struct uwb_ie_drp *uwb_drp_ie_alloc(
void)
141 static void uwb_drp_ie_from_bm(
struct uwb_ie_drp *drp_ie,
144 int z,
i, num_fields = 0,
next = 0;
159 current_bmp = (
__le16) *tmp_mas_bm;
160 for (i = 0; i <
next; i++) {
161 if (current_bmp == zones[i].
mas_bm) {
178 for (i = 0; i < num_fields; i++) {
203 unsafe = rsv->
mas.unsafe ? 1 : 0;
206 rsv->
drp_ie = uwb_drp_ie_alloc();
212 uwb_ie_drp_set_unsafe(drp_ie, unsafe);
213 uwb_ie_drp_set_tiebreaker(drp_ie, rsv->
tiebreaker);
214 uwb_ie_drp_set_owner(drp_ie, uwb_rsv_is_owner(rsv));
217 uwb_ie_drp_set_stream_index(drp_ie, rsv->
stream);
218 uwb_ie_drp_set_type(drp_ie, rsv->
type);
220 if (uwb_rsv_is_owner(rsv)) {
221 switch (rsv->
target.type) {
232 uwb_drp_ie_from_bm(drp_ie, &rsv->
mas);
248 uwb_ie_drp_set_unsafe(drp_ie, 1);
276 if (mas_bm & mas_mask)
277 set_bit(zone * UWB_NUM_ZONES + mas, bm->bm);
298 int numallocs = (drp_ie->
hdr.length - 4) / 4;
307 for (cnt = 0; cnt < numallocs; cnt++) {
312 zone_mask = 1 << zone;
313 if (zone_bm & zone_mask)
314 uwb_drp_ie_single_zone_to_bm(bm, zone, mas_bm);