1 /* 2 * Copyright (c) 2015-2016 Quantenna Communications, Inc. 3 * 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. 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 16 #include <linux/nl80211.h> 17 18 #include "qlink_util.h" 19 20 u16 qlink_iface_type_mask_to_nl(u16 qlink_mask) 21 { 22 u16 result = 0; 23 24 if (qlink_mask & QLINK_IFTYPE_AP) 25 result |= BIT(NL80211_IFTYPE_AP); 26 27 if (qlink_mask & QLINK_IFTYPE_STATION) 28 result |= BIT(NL80211_IFTYPE_STATION); 29 30 if (qlink_mask & QLINK_IFTYPE_ADHOC) 31 result |= BIT(NL80211_IFTYPE_ADHOC); 32 33 if (qlink_mask & QLINK_IFTYPE_MONITOR) 34 result |= BIT(NL80211_IFTYPE_MONITOR); 35 36 if (qlink_mask & QLINK_IFTYPE_WDS) 37 result |= BIT(NL80211_IFTYPE_WDS); 38 39 return result; 40 } 41 42 u8 qlink_chan_width_mask_to_nl(u16 qlink_mask) 43 { 44 u8 result = 0; 45 46 if (qlink_mask & QLINK_CHAN_WIDTH_5) 47 result |= BIT(NL80211_CHAN_WIDTH_5); 48 49 if (qlink_mask & QLINK_CHAN_WIDTH_10) 50 result |= BIT(NL80211_CHAN_WIDTH_10); 51 52 if (qlink_mask & QLINK_CHAN_WIDTH_20_NOHT) 53 result |= BIT(NL80211_CHAN_WIDTH_20_NOHT); 54 55 if (qlink_mask & QLINK_CHAN_WIDTH_20) 56 result |= BIT(NL80211_CHAN_WIDTH_20); 57 58 if (qlink_mask & QLINK_CHAN_WIDTH_40) 59 result |= BIT(NL80211_CHAN_WIDTH_40); 60 61 if (qlink_mask & QLINK_CHAN_WIDTH_80) 62 result |= BIT(NL80211_CHAN_WIDTH_80); 63 64 if (qlink_mask & QLINK_CHAN_WIDTH_80P80) 65 result |= BIT(NL80211_CHAN_WIDTH_80P80); 66 67 if (qlink_mask & QLINK_CHAN_WIDTH_160) 68 result |= BIT(NL80211_CHAN_WIDTH_160); 69 70 return result; 71 } 72