1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
4 * Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
10 #include <linux/skbuff.h>
11 #include <linux/bitops.h>
12 #include <linux/bitfield.h>
14 #define MT76_INCR(_var, _size) \
15 (_var = (((_var) + 1) % (_size)))
17 int mt76_wcid_alloc(unsigned long *mask
, int size
);
20 mt76_wcid_mask_test(unsigned long *mask
, int idx
)
22 return mask
[idx
/ BITS_PER_LONG
] & BIT(idx
% BITS_PER_LONG
);
26 mt76_wcid_mask_set(unsigned long *mask
, int idx
)
28 mask
[idx
/ BITS_PER_LONG
] |= BIT(idx
% BITS_PER_LONG
);
32 mt76_wcid_mask_clear(unsigned long *mask
, int idx
)
34 mask
[idx
/ BITS_PER_LONG
] &= ~BIT(idx
% BITS_PER_LONG
);
38 mt76_skb_set_moredata(struct sk_buff
*skb
, bool enable
)
40 struct ieee80211_hdr
*hdr
= (struct ieee80211_hdr
*)skb
->data
;
43 hdr
->frame_control
|= cpu_to_le16(IEEE80211_FCTL_MOREDATA
);
45 hdr
->frame_control
&= ~cpu_to_le16(IEEE80211_FCTL_MOREDATA
);