mt76: add common code shared between multiple chipsets
This will be used by drivers for MT76x2e, MT7603e and MT7628 Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:

committed by
Kalle Valo

parent
9402f8eb9b
commit
17f1de56df
44
drivers/net/wireless/mediatek/mt76/util.h
Normal file
44
drivers/net/wireless/mediatek/mt76/util.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
|
||||
* Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __MT76_UTIL_H
|
||||
#define __MT76_UTIL_H
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/bitfield.h>
|
||||
|
||||
#define MT76_INCR(_var, _size) \
|
||||
_var = (((_var) + 1) % _size)
|
||||
|
||||
int mt76_wcid_alloc(unsigned long *mask, int size);
|
||||
|
||||
static inline void
|
||||
mt76_wcid_free(unsigned long *mask, int idx)
|
||||
{
|
||||
mask[idx / BITS_PER_LONG] &= ~BIT(idx % BITS_PER_LONG);
|
||||
}
|
||||
|
||||
static inline void
|
||||
mt76_skb_set_moredata(struct sk_buff *skb, bool enable)
|
||||
{
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
|
||||
|
||||
if (enable)
|
||||
hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA);
|
||||
else
|
||||
hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_MOREDATA);
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user