2 * Copyright (c) 2015-2016 Quantenna Communications, Inc.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
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.
16 #include <linux/nl80211.h>
18 #include "qlink_util.h"
20 u16 qlink_iface_type_to_nl_mask(u16 qlink_type)
26 result |= BIT(NL80211_IFTYPE_AP);
28 case QLINK_IFTYPE_STATION:
29 result |= BIT(NL80211_IFTYPE_STATION);
31 case QLINK_IFTYPE_ADHOC:
32 result |= BIT(NL80211_IFTYPE_ADHOC);
34 case QLINK_IFTYPE_MONITOR:
35 result |= BIT(NL80211_IFTYPE_MONITOR);
37 case QLINK_IFTYPE_WDS:
38 result |= BIT(NL80211_IFTYPE_WDS);
40 case QLINK_IFTYPE_AP_VLAN:
41 result |= BIT(NL80211_IFTYPE_AP_VLAN);
48 u8 qlink_chan_width_mask_to_nl(u16 qlink_mask)
52 if (qlink_mask & QLINK_CHAN_WIDTH_5)
53 result |= BIT(NL80211_CHAN_WIDTH_5);
55 if (qlink_mask & QLINK_CHAN_WIDTH_10)
56 result |= BIT(NL80211_CHAN_WIDTH_10);
58 if (qlink_mask & QLINK_CHAN_WIDTH_20_NOHT)
59 result |= BIT(NL80211_CHAN_WIDTH_20_NOHT);
61 if (qlink_mask & QLINK_CHAN_WIDTH_20)
62 result |= BIT(NL80211_CHAN_WIDTH_20);
64 if (qlink_mask & QLINK_CHAN_WIDTH_40)
65 result |= BIT(NL80211_CHAN_WIDTH_40);
67 if (qlink_mask & QLINK_CHAN_WIDTH_80)
68 result |= BIT(NL80211_CHAN_WIDTH_80);
70 if (qlink_mask & QLINK_CHAN_WIDTH_80P80)
71 result |= BIT(NL80211_CHAN_WIDTH_80P80);
73 if (qlink_mask & QLINK_CHAN_WIDTH_160)
74 result |= BIT(NL80211_CHAN_WIDTH_160);