]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - drivers/net/wireless/mediatek/mt76/util.h
timekeeping: Repair ktime_get_coarse*() granularity
[mirror_ubuntu-jammy-kernel.git] / drivers / net / wireless / mediatek / mt76 / util.h
1 /*
2 * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
3 * Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15 #ifndef __MT76_UTIL_H
16 #define __MT76_UTIL_H
17
18 #include <linux/skbuff.h>
19 #include <linux/bitops.h>
20 #include <linux/bitfield.h>
21
22 #define MT76_INCR(_var, _size) \
23 _var = (((_var) + 1) % _size)
24
25 int mt76_wcid_alloc(unsigned long *mask, int size);
26
27 static inline void
28 mt76_wcid_free(unsigned long *mask, int idx)
29 {
30 mask[idx / BITS_PER_LONG] &= ~BIT(idx % BITS_PER_LONG);
31 }
32
33 static inline void
34 mt76_skb_set_moredata(struct sk_buff *skb, bool enable)
35 {
36 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
37
38 if (enable)
39 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA);
40 else
41 hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_MOREDATA);
42 }
43
44 #endif