diff options
| author | Dan Williams <dan.j.williams@intel.com> | 2009-09-08 20:55:21 -0400 |
|---|---|---|
| committer | Dan Williams <dan.j.williams@intel.com> | 2009-09-08 20:55:21 -0400 |
| commit | bbb20089a3275a19e475dbc21320c3742e3ca423 (patch) | |
| tree | 216fdc1cbef450ca688135c5b8969169482d9a48 /include/net | |
| parent | 3e48e656903e9fd8bc805c6a2c4264d7808d315b (diff) | |
| parent | 657a77fa7284d8ae28dfa48f1dc5d919bf5b2843 (diff) | |
Merge branch 'dmaengine' into async-tx-next
Conflicts:
crypto/async_tx/async_xor.c
drivers/dma/ioat/dma_v2.h
drivers/dma/ioat/pci.c
drivers/md/raid5.c
Diffstat (limited to 'include/net')
46 files changed, 1926 insertions, 939 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 3ad5390a4dd5..968166a45f86 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
| @@ -81,12 +81,6 @@ enum { | |||
| 81 | BT_CLOSED | 81 | BT_CLOSED |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | /* Endianness conversions */ | ||
| 85 | #define htobs(a) __cpu_to_le16(a) | ||
| 86 | #define htobl(a) __cpu_to_le32(a) | ||
| 87 | #define btohs(a) __le16_to_cpu(a) | ||
| 88 | #define btohl(a) __le32_to_cpu(a) | ||
| 89 | |||
| 90 | /* BD Address */ | 84 | /* BD Address */ |
| 91 | typedef struct { | 85 | typedef struct { |
| 92 | __u8 b[6]; | 86 | __u8 b[6]; |
| @@ -171,15 +165,6 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long l | |||
| 171 | return skb; | 165 | return skb; |
| 172 | } | 166 | } |
| 173 | 167 | ||
| 174 | static inline int skb_frags_no(struct sk_buff *skb) | ||
| 175 | { | ||
| 176 | register struct sk_buff *frag = skb_shinfo(skb)->frag_list; | ||
| 177 | register int n = 1; | ||
| 178 | |||
| 179 | for (; frag; frag=frag->next, n++); | ||
| 180 | return n; | ||
| 181 | } | ||
| 182 | |||
| 183 | int bt_err(__u16 code); | 168 | int bt_err(__u16 code); |
| 184 | 169 | ||
| 185 | extern int hci_sock_init(void); | 170 | extern int hci_sock_init(void); |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 73aead222b32..c4ca4228b083 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -137,6 +137,8 @@ struct hci_dev { | |||
| 137 | struct device *parent; | 137 | struct device *parent; |
| 138 | struct device dev; | 138 | struct device dev; |
| 139 | 139 | ||
| 140 | struct rfkill *rfkill; | ||
| 141 | |||
| 140 | struct module *owner; | 142 | struct module *owner; |
| 141 | 143 | ||
| 142 | int (*open)(struct hci_dev *hdev); | 144 | int (*open)(struct hci_dev *hdev); |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index f566aa1f0a4c..e919fca1072a 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
| @@ -26,8 +26,13 @@ | |||
| 26 | #define __L2CAP_H | 26 | #define __L2CAP_H |
| 27 | 27 | ||
| 28 | /* L2CAP defaults */ | 28 | /* L2CAP defaults */ |
| 29 | #define L2CAP_DEFAULT_MTU 672 | 29 | #define L2CAP_DEFAULT_MTU 672 |
| 30 | #define L2CAP_DEFAULT_FLUSH_TO 0xFFFF | 30 | #define L2CAP_DEFAULT_FLUSH_TO 0xffff |
| 31 | #define L2CAP_DEFAULT_RX_WINDOW 1 | ||
| 32 | #define L2CAP_DEFAULT_MAX_RECEIVE 1 | ||
| 33 | #define L2CAP_DEFAULT_RETRANS_TO 300 /* 300 milliseconds */ | ||
| 34 | #define L2CAP_DEFAULT_MONITOR_TO 1000 /* 1 second */ | ||
| 35 | #define L2CAP_DEFAULT_MAX_RX_APDU 0xfff7 | ||
| 31 | 36 | ||
| 32 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ | 37 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ |
| 33 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ | 38 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ |
| @@ -64,17 +69,29 @@ struct l2cap_conninfo { | |||
| 64 | #define L2CAP_LM_SECURE 0x0020 | 69 | #define L2CAP_LM_SECURE 0x0020 |
| 65 | 70 | ||
| 66 | /* L2CAP command codes */ | 71 | /* L2CAP command codes */ |
| 67 | #define L2CAP_COMMAND_REJ 0x01 | 72 | #define L2CAP_COMMAND_REJ 0x01 |
| 68 | #define L2CAP_CONN_REQ 0x02 | 73 | #define L2CAP_CONN_REQ 0x02 |
| 69 | #define L2CAP_CONN_RSP 0x03 | 74 | #define L2CAP_CONN_RSP 0x03 |
| 70 | #define L2CAP_CONF_REQ 0x04 | 75 | #define L2CAP_CONF_REQ 0x04 |
| 71 | #define L2CAP_CONF_RSP 0x05 | 76 | #define L2CAP_CONF_RSP 0x05 |
| 72 | #define L2CAP_DISCONN_REQ 0x06 | 77 | #define L2CAP_DISCONN_REQ 0x06 |
| 73 | #define L2CAP_DISCONN_RSP 0x07 | 78 | #define L2CAP_DISCONN_RSP 0x07 |
| 74 | #define L2CAP_ECHO_REQ 0x08 | 79 | #define L2CAP_ECHO_REQ 0x08 |
| 75 | #define L2CAP_ECHO_RSP 0x09 | 80 | #define L2CAP_ECHO_RSP 0x09 |
| 76 | #define L2CAP_INFO_REQ 0x0a | 81 | #define L2CAP_INFO_REQ 0x0a |
| 77 | #define L2CAP_INFO_RSP 0x0b | 82 | #define L2CAP_INFO_RSP 0x0b |
| 83 | |||
| 84 | /* L2CAP feature mask */ | ||
| 85 | #define L2CAP_FEAT_FLOWCTL 0x00000001 | ||
| 86 | #define L2CAP_FEAT_RETRANS 0x00000002 | ||
| 87 | #define L2CAP_FEAT_ERTM 0x00000008 | ||
| 88 | #define L2CAP_FEAT_STREAMING 0x00000010 | ||
| 89 | #define L2CAP_FEAT_FCS 0x00000020 | ||
| 90 | #define L2CAP_FEAT_FIXED_CHAN 0x00000080 | ||
| 91 | |||
| 92 | /* L2CAP checksum option */ | ||
| 93 | #define L2CAP_FCS_NONE 0x00 | ||
| 94 | #define L2CAP_FCS_CRC16 0x01 | ||
| 78 | 95 | ||
| 79 | /* L2CAP structures */ | 96 | /* L2CAP structures */ |
| 80 | struct l2cap_hdr { | 97 | struct l2cap_hdr { |
| @@ -106,17 +123,23 @@ struct l2cap_conn_rsp { | |||
| 106 | __le16 status; | 123 | __le16 status; |
| 107 | } __attribute__ ((packed)); | 124 | } __attribute__ ((packed)); |
| 108 | 125 | ||
| 126 | /* channel indentifier */ | ||
| 127 | #define L2CAP_CID_SIGNALING 0x0001 | ||
| 128 | #define L2CAP_CID_CONN_LESS 0x0002 | ||
| 129 | #define L2CAP_CID_DYN_START 0x0040 | ||
| 130 | #define L2CAP_CID_DYN_END 0xffff | ||
| 131 | |||
| 109 | /* connect result */ | 132 | /* connect result */ |
| 110 | #define L2CAP_CR_SUCCESS 0x0000 | 133 | #define L2CAP_CR_SUCCESS 0x0000 |
| 111 | #define L2CAP_CR_PEND 0x0001 | 134 | #define L2CAP_CR_PEND 0x0001 |
| 112 | #define L2CAP_CR_BAD_PSM 0x0002 | 135 | #define L2CAP_CR_BAD_PSM 0x0002 |
| 113 | #define L2CAP_CR_SEC_BLOCK 0x0003 | 136 | #define L2CAP_CR_SEC_BLOCK 0x0003 |
| 114 | #define L2CAP_CR_NO_MEM 0x0004 | 137 | #define L2CAP_CR_NO_MEM 0x0004 |
| 115 | 138 | ||
| 116 | /* connect status */ | 139 | /* connect status */ |
| 117 | #define L2CAP_CS_NO_INFO 0x0000 | 140 | #define L2CAP_CS_NO_INFO 0x0000 |
| 118 | #define L2CAP_CS_AUTHEN_PEND 0x0001 | 141 | #define L2CAP_CS_AUTHEN_PEND 0x0001 |
| 119 | #define L2CAP_CS_AUTHOR_PEND 0x0002 | 142 | #define L2CAP_CS_AUTHOR_PEND 0x0002 |
| 120 | 143 | ||
| 121 | struct l2cap_conf_req { | 144 | struct l2cap_conf_req { |
| 122 | __le16 dcid; | 145 | __le16 dcid; |
| @@ -143,10 +166,14 @@ struct l2cap_conf_opt { | |||
| 143 | } __attribute__ ((packed)); | 166 | } __attribute__ ((packed)); |
| 144 | #define L2CAP_CONF_OPT_SIZE 2 | 167 | #define L2CAP_CONF_OPT_SIZE 2 |
| 145 | 168 | ||
| 169 | #define L2CAP_CONF_HINT 0x80 | ||
| 170 | #define L2CAP_CONF_MASK 0x7f | ||
| 171 | |||
| 146 | #define L2CAP_CONF_MTU 0x01 | 172 | #define L2CAP_CONF_MTU 0x01 |
| 147 | #define L2CAP_CONF_FLUSH_TO 0x02 | 173 | #define L2CAP_CONF_FLUSH_TO 0x02 |
| 148 | #define L2CAP_CONF_QOS 0x03 | 174 | #define L2CAP_CONF_QOS 0x03 |
| 149 | #define L2CAP_CONF_RFC 0x04 | 175 | #define L2CAP_CONF_RFC 0x04 |
| 176 | #define L2CAP_CONF_FCS 0x05 | ||
| 150 | 177 | ||
| 151 | #define L2CAP_CONF_MAX_SIZE 22 | 178 | #define L2CAP_CONF_MAX_SIZE 22 |
| 152 | 179 | ||
| @@ -162,6 +189,8 @@ struct l2cap_conf_rfc { | |||
| 162 | #define L2CAP_MODE_BASIC 0x00 | 189 | #define L2CAP_MODE_BASIC 0x00 |
| 163 | #define L2CAP_MODE_RETRANS 0x01 | 190 | #define L2CAP_MODE_RETRANS 0x01 |
| 164 | #define L2CAP_MODE_FLOWCTL 0x02 | 191 | #define L2CAP_MODE_FLOWCTL 0x02 |
| 192 | #define L2CAP_MODE_ERTM 0x03 | ||
| 193 | #define L2CAP_MODE_STREAM 0x04 | ||
| 165 | 194 | ||
| 166 | struct l2cap_disconn_req { | 195 | struct l2cap_disconn_req { |
| 167 | __le16 dcid; | 196 | __le16 dcid; |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 5389afdc1297..1a21895b732b 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
| @@ -1,71 +1,220 @@ | |||
| 1 | #ifndef __NET_CFG80211_H | 1 | #ifndef __NET_CFG80211_H |
| 2 | #define __NET_CFG80211_H | 2 | #define __NET_CFG80211_H |
| 3 | /* | ||
| 4 | * 802.11 device and configuration interface | ||
| 5 | * | ||
| 6 | * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | */ | ||
| 3 | 12 | ||
| 13 | #include <linux/netdevice.h> | ||
| 14 | #include <linux/debugfs.h> | ||
| 15 | #include <linux/list.h> | ||
| 4 | #include <linux/netlink.h> | 16 | #include <linux/netlink.h> |
| 5 | #include <linux/skbuff.h> | 17 | #include <linux/skbuff.h> |
| 6 | #include <linux/nl80211.h> | 18 | #include <linux/nl80211.h> |
| 7 | #include <linux/if_ether.h> | 19 | #include <linux/if_ether.h> |
| 8 | #include <linux/ieee80211.h> | 20 | #include <linux/ieee80211.h> |
| 9 | #include <linux/wireless.h> | 21 | #include <net/regulatory.h> |
| 10 | #include <net/iw_handler.h> | 22 | |
| 11 | #include <net/genetlink.h> | ||
| 12 | /* remove once we remove the wext stuff */ | 23 | /* remove once we remove the wext stuff */ |
| 13 | #include <net/iw_handler.h> | 24 | #include <net/iw_handler.h> |
| 25 | #include <linux/wireless.h> | ||
| 26 | |||
| 14 | 27 | ||
| 15 | /* | 28 | /* |
| 16 | * 802.11 configuration in-kernel interface | 29 | * wireless hardware capability structures |
| 30 | */ | ||
| 31 | |||
| 32 | /** | ||
| 33 | * enum ieee80211_band - supported frequency bands | ||
| 34 | * | ||
| 35 | * The bands are assigned this way because the supported | ||
| 36 | * bitrates differ in these bands. | ||
| 17 | * | 37 | * |
| 18 | * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> | 38 | * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band |
| 39 | * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) | ||
| 19 | */ | 40 | */ |
| 41 | enum ieee80211_band { | ||
| 42 | IEEE80211_BAND_2GHZ, | ||
| 43 | IEEE80211_BAND_5GHZ, | ||
| 44 | |||
| 45 | /* keep last */ | ||
| 46 | IEEE80211_NUM_BANDS | ||
| 47 | }; | ||
| 20 | 48 | ||
| 21 | /** | 49 | /** |
| 22 | * struct vif_params - describes virtual interface parameters | 50 | * enum ieee80211_channel_flags - channel flags |
| 23 | * @mesh_id: mesh ID to use | 51 | * |
| 24 | * @mesh_id_len: length of the mesh ID | 52 | * Channel flags set by the regulatory control code. |
| 53 | * | ||
| 54 | * @IEEE80211_CHAN_DISABLED: This channel is disabled. | ||
| 55 | * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted | ||
| 56 | * on this channel. | ||
| 57 | * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. | ||
| 58 | * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. | ||
| 59 | * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel | ||
| 60 | * is not permitted. | ||
| 61 | * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel | ||
| 62 | * is not permitted. | ||
| 25 | */ | 63 | */ |
| 26 | struct vif_params { | 64 | enum ieee80211_channel_flags { |
| 27 | u8 *mesh_id; | 65 | IEEE80211_CHAN_DISABLED = 1<<0, |
| 28 | int mesh_id_len; | 66 | IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, |
| 67 | IEEE80211_CHAN_NO_IBSS = 1<<2, | ||
| 68 | IEEE80211_CHAN_RADAR = 1<<3, | ||
| 69 | IEEE80211_CHAN_NO_HT40PLUS = 1<<4, | ||
| 70 | IEEE80211_CHAN_NO_HT40MINUS = 1<<5, | ||
| 29 | }; | 71 | }; |
| 30 | 72 | ||
| 31 | /* Radiotap header iteration | 73 | #define IEEE80211_CHAN_NO_HT40 \ |
| 32 | * implemented in net/wireless/radiotap.c | 74 | (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) |
| 33 | * docs in Documentation/networking/radiotap-headers.txt | 75 | |
| 76 | /** | ||
| 77 | * struct ieee80211_channel - channel definition | ||
| 78 | * | ||
| 79 | * This structure describes a single channel for use | ||
| 80 | * with cfg80211. | ||
| 81 | * | ||
| 82 | * @center_freq: center frequency in MHz | ||
| 83 | * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz | ||
| 84 | * @hw_value: hardware-specific value for the channel | ||
| 85 | * @flags: channel flags from &enum ieee80211_channel_flags. | ||
| 86 | * @orig_flags: channel flags at registration time, used by regulatory | ||
| 87 | * code to support devices with additional restrictions | ||
| 88 | * @band: band this channel belongs to. | ||
| 89 | * @max_antenna_gain: maximum antenna gain in dBi | ||
| 90 | * @max_power: maximum transmission power (in dBm) | ||
| 91 | * @beacon_found: helper to regulatory code to indicate when a beacon | ||
| 92 | * has been found on this channel. Use regulatory_hint_found_beacon() | ||
| 93 | * to enable this, this is is useful only on 5 GHz band. | ||
| 94 | * @orig_mag: internal use | ||
| 95 | * @orig_mpwr: internal use | ||
| 34 | */ | 96 | */ |
| 97 | struct ieee80211_channel { | ||
| 98 | enum ieee80211_band band; | ||
| 99 | u16 center_freq; | ||
| 100 | u8 max_bandwidth; | ||
| 101 | u16 hw_value; | ||
| 102 | u32 flags; | ||
| 103 | int max_antenna_gain; | ||
| 104 | int max_power; | ||
| 105 | bool beacon_found; | ||
| 106 | u32 orig_flags; | ||
| 107 | int orig_mag, orig_mpwr; | ||
| 108 | }; | ||
| 109 | |||
| 35 | /** | 110 | /** |
| 36 | * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args | 111 | * enum ieee80211_rate_flags - rate flags |
| 37 | * @rtheader: pointer to the radiotap header we are walking through | 112 | * |
| 38 | * @max_length: length of radiotap header in cpu byte ordering | 113 | * Hardware/specification flags for rates. These are structured |
| 39 | * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg | 114 | * in a way that allows using the same bitrate structure for |
| 40 | * @this_arg: pointer to current radiotap arg | 115 | * different bands/PHY modes. |
| 41 | * @arg_index: internal next argument index | 116 | * |
| 42 | * @arg: internal next argument pointer | 117 | * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short |
| 43 | * @next_bitmap: internal pointer to next present u32 | 118 | * preamble on this bitrate; only relevant in 2.4GHz band and |
| 44 | * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present | 119 | * with CCK rates. |
| 120 | * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate | ||
| 121 | * when used with 802.11a (on the 5 GHz band); filled by the | ||
| 122 | * core code when registering the wiphy. | ||
| 123 | * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate | ||
| 124 | * when used with 802.11b (on the 2.4 GHz band); filled by the | ||
| 125 | * core code when registering the wiphy. | ||
| 126 | * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate | ||
| 127 | * when used with 802.11g (on the 2.4 GHz band); filled by the | ||
| 128 | * core code when registering the wiphy. | ||
| 129 | * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. | ||
| 45 | */ | 130 | */ |
| 131 | enum ieee80211_rate_flags { | ||
| 132 | IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, | ||
| 133 | IEEE80211_RATE_MANDATORY_A = 1<<1, | ||
| 134 | IEEE80211_RATE_MANDATORY_B = 1<<2, | ||
| 135 | IEEE80211_RATE_MANDATORY_G = 1<<3, | ||
| 136 | IEEE80211_RATE_ERP_G = 1<<4, | ||
| 137 | }; | ||
| 46 | 138 | ||
| 47 | struct ieee80211_radiotap_iterator { | 139 | /** |
| 48 | struct ieee80211_radiotap_header *rtheader; | 140 | * struct ieee80211_rate - bitrate definition |
| 49 | int max_length; | 141 | * |
| 50 | int this_arg_index; | 142 | * This structure describes a bitrate that an 802.11 PHY can |
| 51 | u8 *this_arg; | 143 | * operate with. The two values @hw_value and @hw_value_short |
| 144 | * are only for driver use when pointers to this structure are | ||
| 145 | * passed around. | ||
| 146 | * | ||
| 147 | * @flags: rate-specific flags | ||
| 148 | * @bitrate: bitrate in units of 100 Kbps | ||
| 149 | * @hw_value: driver/hardware value for this rate | ||
| 150 | * @hw_value_short: driver/hardware value for this rate when | ||
| 151 | * short preamble is used | ||
| 152 | */ | ||
| 153 | struct ieee80211_rate { | ||
| 154 | u32 flags; | ||
| 155 | u16 bitrate; | ||
| 156 | u16 hw_value, hw_value_short; | ||
| 157 | }; | ||
| 52 | 158 | ||
| 53 | int arg_index; | 159 | /** |
| 54 | u8 *arg; | 160 | * struct ieee80211_sta_ht_cap - STA's HT capabilities |
| 55 | __le32 *next_bitmap; | 161 | * |
| 56 | u32 bitmap_shifter; | 162 | * This structure describes most essential parameters needed |
| 163 | * to describe 802.11n HT capabilities for an STA. | ||
| 164 | * | ||
| 165 | * @ht_supported: is HT supported by the STA | ||
| 166 | * @cap: HT capabilities map as described in 802.11n spec | ||
| 167 | * @ampdu_factor: Maximum A-MPDU length factor | ||
| 168 | * @ampdu_density: Minimum A-MPDU spacing | ||
| 169 | * @mcs: Supported MCS rates | ||
| 170 | */ | ||
| 171 | struct ieee80211_sta_ht_cap { | ||
| 172 | u16 cap; /* use IEEE80211_HT_CAP_ */ | ||
| 173 | bool ht_supported; | ||
| 174 | u8 ampdu_factor; | ||
| 175 | u8 ampdu_density; | ||
| 176 | struct ieee80211_mcs_info mcs; | ||
| 57 | }; | 177 | }; |
| 58 | 178 | ||
| 59 | extern int ieee80211_radiotap_iterator_init( | 179 | /** |
| 60 | struct ieee80211_radiotap_iterator *iterator, | 180 | * struct ieee80211_supported_band - frequency band definition |
| 61 | struct ieee80211_radiotap_header *radiotap_header, | 181 | * |
| 62 | int max_length); | 182 | * This structure describes a frequency band a wiphy |
| 183 | * is able to operate in. | ||
| 184 | * | ||
| 185 | * @channels: Array of channels the hardware can operate in | ||
| 186 | * in this band. | ||
| 187 | * @band: the band this structure represents | ||
| 188 | * @n_channels: Number of channels in @channels | ||
| 189 | * @bitrates: Array of bitrates the hardware can operate with | ||
| 190 | * in this band. Must be sorted to give a valid "supported | ||
| 191 | * rates" IE, i.e. CCK rates first, then OFDM. | ||
| 192 | * @n_bitrates: Number of bitrates in @bitrates | ||
| 193 | */ | ||
| 194 | struct ieee80211_supported_band { | ||
| 195 | struct ieee80211_channel *channels; | ||
| 196 | struct ieee80211_rate *bitrates; | ||
| 197 | enum ieee80211_band band; | ||
| 198 | int n_channels; | ||
| 199 | int n_bitrates; | ||
| 200 | struct ieee80211_sta_ht_cap ht_cap; | ||
| 201 | }; | ||
| 63 | 202 | ||
| 64 | extern int ieee80211_radiotap_iterator_next( | 203 | /* |
| 65 | struct ieee80211_radiotap_iterator *iterator); | 204 | * Wireless hardware/device configuration structures and methods |
| 205 | */ | ||
| 66 | 206 | ||
| 207 | /** | ||
| 208 | * struct vif_params - describes virtual interface parameters | ||
| 209 | * @mesh_id: mesh ID to use | ||
| 210 | * @mesh_id_len: length of the mesh ID | ||
| 211 | */ | ||
| 212 | struct vif_params { | ||
| 213 | u8 *mesh_id; | ||
| 214 | int mesh_id_len; | ||
| 215 | }; | ||
| 67 | 216 | ||
| 68 | /** | 217 | /** |
| 69 | * struct key_params - key information | 218 | * struct key_params - key information |
| 70 | * | 219 | * |
| 71 | * Information about a key | 220 | * Information about a key |
| @@ -106,27 +255,6 @@ struct beacon_parameters { | |||
| 106 | }; | 255 | }; |
| 107 | 256 | ||
| 108 | /** | 257 | /** |
| 109 | * enum station_flags - station flags | ||
| 110 | * | ||
| 111 | * Station capability flags. Note that these must be the bits | ||
| 112 | * according to the nl80211 flags. | ||
| 113 | * | ||
| 114 | * @STATION_FLAG_CHANGED: station flags were changed | ||
| 115 | * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X) | ||
| 116 | * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames | ||
| 117 | * with short preambles | ||
| 118 | * @STATION_FLAG_WME: station is WME/QoS capable | ||
| 119 | * @STATION_FLAG_MFP: station uses management frame protection | ||
| 120 | */ | ||
| 121 | enum station_flags { | ||
| 122 | STATION_FLAG_CHANGED = 1<<0, | ||
| 123 | STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED, | ||
| 124 | STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE, | ||
| 125 | STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME, | ||
| 126 | STATION_FLAG_MFP = 1<<NL80211_STA_FLAG_MFP, | ||
| 127 | }; | ||
| 128 | |||
| 129 | /** | ||
| 130 | * enum plink_action - actions to perform in mesh peers | 258 | * enum plink_action - actions to perform in mesh peers |
| 131 | * | 259 | * |
| 132 | * @PLINK_ACTION_INVALID: action 0 is reserved | 260 | * @PLINK_ACTION_INVALID: action 0 is reserved |
| @@ -148,14 +276,17 @@ enum plink_actions { | |||
| 148 | * @supported_rates: supported rates in IEEE 802.11 format | 276 | * @supported_rates: supported rates in IEEE 802.11 format |
| 149 | * (or NULL for no change) | 277 | * (or NULL for no change) |
| 150 | * @supported_rates_len: number of supported rates | 278 | * @supported_rates_len: number of supported rates |
| 151 | * @station_flags: station flags (see &enum station_flags) | 279 | * @sta_flags_mask: station flags that changed |
| 280 | * (bitmask of BIT(NL80211_STA_FLAG_...)) | ||
| 281 | * @sta_flags_set: station flags values | ||
| 282 | * (bitmask of BIT(NL80211_STA_FLAG_...)) | ||
| 152 | * @listen_interval: listen interval or -1 for no change | 283 | * @listen_interval: listen interval or -1 for no change |
| 153 | * @aid: AID or zero for no change | 284 | * @aid: AID or zero for no change |
| 154 | */ | 285 | */ |
| 155 | struct station_parameters { | 286 | struct station_parameters { |
| 156 | u8 *supported_rates; | 287 | u8 *supported_rates; |
| 157 | struct net_device *vlan; | 288 | struct net_device *vlan; |
| 158 | u32 station_flags; | 289 | u32 sta_flags_mask, sta_flags_set; |
| 159 | int listen_interval; | 290 | int listen_interval; |
| 160 | u16 aid; | 291 | u16 aid; |
| 161 | u8 supported_rates_len; | 292 | u8 supported_rates_len; |
| @@ -348,92 +479,6 @@ struct bss_parameters { | |||
| 348 | u8 basic_rates_len; | 479 | u8 basic_rates_len; |
| 349 | }; | 480 | }; |
| 350 | 481 | ||
| 351 | /** | ||
| 352 | * enum environment_cap - Environment parsed from country IE | ||
| 353 | * @ENVIRON_ANY: indicates country IE applies to both indoor and | ||
| 354 | * outdoor operation. | ||
| 355 | * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation | ||
| 356 | * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation | ||
| 357 | */ | ||
| 358 | enum environment_cap { | ||
| 359 | ENVIRON_ANY, | ||
| 360 | ENVIRON_INDOOR, | ||
| 361 | ENVIRON_OUTDOOR, | ||
| 362 | }; | ||
| 363 | |||
| 364 | /** | ||
| 365 | * struct regulatory_request - used to keep track of regulatory requests | ||
| 366 | * | ||
| 367 | * @wiphy_idx: this is set if this request's initiator is | ||
| 368 | * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This | ||
| 369 | * can be used by the wireless core to deal with conflicts | ||
| 370 | * and potentially inform users of which devices specifically | ||
| 371 | * cased the conflicts. | ||
| 372 | * @initiator: indicates who sent this request, could be any of | ||
| 373 | * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*) | ||
| 374 | * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested | ||
| 375 | * regulatory domain. We have a few special codes: | ||
| 376 | * 00 - World regulatory domain | ||
| 377 | * 99 - built by driver but a specific alpha2 cannot be determined | ||
| 378 | * 98 - result of an intersection between two regulatory domains | ||
| 379 | * @intersect: indicates whether the wireless core should intersect | ||
| 380 | * the requested regulatory domain with the presently set regulatory | ||
| 381 | * domain. | ||
| 382 | * @country_ie_checksum: checksum of the last processed and accepted | ||
| 383 | * country IE | ||
| 384 | * @country_ie_env: lets us know if the AP is telling us we are outdoor, | ||
| 385 | * indoor, or if it doesn't matter | ||
| 386 | * @list: used to insert into the reg_requests_list linked list | ||
| 387 | */ | ||
| 388 | struct regulatory_request { | ||
| 389 | int wiphy_idx; | ||
| 390 | enum nl80211_reg_initiator initiator; | ||
| 391 | char alpha2[2]; | ||
| 392 | bool intersect; | ||
| 393 | u32 country_ie_checksum; | ||
| 394 | enum environment_cap country_ie_env; | ||
| 395 | struct list_head list; | ||
| 396 | }; | ||
| 397 | |||
| 398 | struct ieee80211_freq_range { | ||
| 399 | u32 start_freq_khz; | ||
| 400 | u32 end_freq_khz; | ||
| 401 | u32 max_bandwidth_khz; | ||
| 402 | }; | ||
| 403 | |||
| 404 | struct ieee80211_power_rule { | ||
| 405 | u32 max_antenna_gain; | ||
| 406 | u32 max_eirp; | ||
| 407 | }; | ||
| 408 | |||
| 409 | struct ieee80211_reg_rule { | ||
| 410 | struct ieee80211_freq_range freq_range; | ||
| 411 | struct ieee80211_power_rule power_rule; | ||
| 412 | u32 flags; | ||
| 413 | }; | ||
| 414 | |||
| 415 | struct ieee80211_regdomain { | ||
| 416 | u32 n_reg_rules; | ||
| 417 | char alpha2[2]; | ||
| 418 | struct ieee80211_reg_rule reg_rules[]; | ||
| 419 | }; | ||
| 420 | |||
| 421 | #define MHZ_TO_KHZ(freq) ((freq) * 1000) | ||
| 422 | #define KHZ_TO_MHZ(freq) ((freq) / 1000) | ||
| 423 | #define DBI_TO_MBI(gain) ((gain) * 100) | ||
| 424 | #define MBI_TO_DBI(gain) ((gain) / 100) | ||
| 425 | #define DBM_TO_MBM(gain) ((gain) * 100) | ||
| 426 | #define MBM_TO_DBM(gain) ((gain) / 100) | ||
| 427 | |||
| 428 | #define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \ | ||
| 429 | .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \ | ||
| 430 | .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \ | ||
| 431 | .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \ | ||
| 432 | .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \ | ||
| 433 | .power_rule.max_eirp = DBM_TO_MBM(eirp), \ | ||
| 434 | .flags = reg_flags, \ | ||
| 435 | } | ||
| 436 | |||
| 437 | struct mesh_config { | 482 | struct mesh_config { |
| 438 | /* Timeouts in ms */ | 483 | /* Timeouts in ms */ |
| 439 | /* Mesh plink management parameters */ | 484 | /* Mesh plink management parameters */ |
| @@ -504,7 +549,7 @@ struct cfg80211_scan_request { | |||
| 504 | int n_ssids; | 549 | int n_ssids; |
| 505 | struct ieee80211_channel **channels; | 550 | struct ieee80211_channel **channels; |
| 506 | u32 n_channels; | 551 | u32 n_channels; |
| 507 | u8 *ie; | 552 | const u8 *ie; |
| 508 | size_t ie_len; | 553 | size_t ie_len; |
| 509 | 554 | ||
| 510 | /* internal */ | 555 | /* internal */ |
| @@ -612,6 +657,11 @@ struct cfg80211_auth_request { | |||
| 612 | * @ssid_len: Length of ssid in octets | 657 | * @ssid_len: Length of ssid in octets |
| 613 | * @ie: Extra IEs to add to (Re)Association Request frame or %NULL | 658 | * @ie: Extra IEs to add to (Re)Association Request frame or %NULL |
| 614 | * @ie_len: Length of ie buffer in octets | 659 | * @ie_len: Length of ie buffer in octets |
| 660 | * @use_mfp: Use management frame protection (IEEE 802.11w) in this association | ||
| 661 | * @control_port: Whether user space controls IEEE 802.1X port, i.e., | ||
| 662 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is | ||
| 663 | * required to assume that the port is unauthorized until authorized by | ||
| 664 | * user space. Otherwise, port is marked authorized by default. | ||
| 615 | */ | 665 | */ |
| 616 | struct cfg80211_assoc_request { | 666 | struct cfg80211_assoc_request { |
| 617 | struct ieee80211_channel *chan; | 667 | struct ieee80211_channel *chan; |
| @@ -620,6 +670,8 @@ struct cfg80211_assoc_request { | |||
| 620 | size_t ssid_len; | 670 | size_t ssid_len; |
| 621 | const u8 *ie; | 671 | const u8 *ie; |
| 622 | size_t ie_len; | 672 | size_t ie_len; |
| 673 | bool use_mfp; | ||
| 674 | bool control_port; | ||
| 623 | }; | 675 | }; |
| 624 | 676 | ||
| 625 | /** | 677 | /** |
| @@ -659,6 +711,60 @@ struct cfg80211_disassoc_request { | |||
| 659 | }; | 711 | }; |
| 660 | 712 | ||
| 661 | /** | 713 | /** |
| 714 | * struct cfg80211_ibss_params - IBSS parameters | ||
| 715 | * | ||
| 716 | * This structure defines the IBSS parameters for the join_ibss() | ||
| 717 | * method. | ||
| 718 | * | ||
| 719 | * @ssid: The SSID, will always be non-null. | ||
| 720 | * @ssid_len: The length of the SSID, will always be non-zero. | ||
| 721 | * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not | ||
| 722 | * search for IBSSs with a different BSSID. | ||
| 723 | * @channel: The channel to use if no IBSS can be found to join. | ||
| 724 | * @channel_fixed: The channel should be fixed -- do not search for | ||
| 725 | * IBSSs to join on other channels. | ||
| 726 | * @ie: information element(s) to include in the beacon | ||
| 727 | * @ie_len: length of that | ||
| 728 | * @beacon_interval: beacon interval to use | ||
| 729 | */ | ||
| 730 | struct cfg80211_ibss_params { | ||
| 731 | u8 *ssid; | ||
| 732 | u8 *bssid; | ||
| 733 | struct ieee80211_channel *channel; | ||
| 734 | u8 *ie; | ||
| 735 | u8 ssid_len, ie_len; | ||
| 736 | u16 beacon_interval; | ||
| 737 | bool channel_fixed; | ||
| 738 | }; | ||
| 739 | |||
| 740 | /** | ||
| 741 | * enum wiphy_params_flags - set_wiphy_params bitfield values | ||
| 742 | * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed | ||
| 743 | * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed | ||
| 744 | * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed | ||
| 745 | * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed | ||
| 746 | */ | ||
| 747 | enum wiphy_params_flags { | ||
| 748 | WIPHY_PARAM_RETRY_SHORT = 1 << 0, | ||
| 749 | WIPHY_PARAM_RETRY_LONG = 1 << 1, | ||
| 750 | WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, | ||
| 751 | WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, | ||
| 752 | }; | ||
| 753 | |||
| 754 | /** | ||
| 755 | * enum tx_power_setting - TX power adjustment | ||
| 756 | * | ||
| 757 | * @TX_POWER_AUTOMATIC: the dbm parameter is ignored | ||
| 758 | * @TX_POWER_LIMITED: limit TX power by the dbm parameter | ||
| 759 | * @TX_POWER_FIXED: fix TX power to the dbm parameter | ||
| 760 | */ | ||
| 761 | enum tx_power_setting { | ||
| 762 | TX_POWER_AUTOMATIC, | ||
| 763 | TX_POWER_LIMITED, | ||
| 764 | TX_POWER_FIXED, | ||
| 765 | }; | ||
| 766 | |||
| 767 | /** | ||
| 662 | * struct cfg80211_ops - backend description for wireless configuration | 768 | * struct cfg80211_ops - backend description for wireless configuration |
| 663 | * | 769 | * |
| 664 | * This struct is registered by fullmac card drivers and/or wireless stacks | 770 | * This struct is registered by fullmac card drivers and/or wireless stacks |
| @@ -688,10 +794,11 @@ struct cfg80211_disassoc_request { | |||
| 688 | * @get_key: get information about the key with the given parameters. | 794 | * @get_key: get information about the key with the given parameters. |
| 689 | * @mac_addr will be %NULL when requesting information for a group | 795 | * @mac_addr will be %NULL when requesting information for a group |
| 690 | * key. All pointers given to the @callback function need not be valid | 796 | * key. All pointers given to the @callback function need not be valid |
| 691 | * after it returns. | 797 | * after it returns. This function should return an error if it is |
| 798 | * not possible to retrieve the key, -ENOENT if it doesn't exist. | ||
| 692 | * | 799 | * |
| 693 | * @del_key: remove a key given the @mac_addr (%NULL for a group key) | 800 | * @del_key: remove a key given the @mac_addr (%NULL for a group key) |
| 694 | * and @key_index | 801 | * and @key_index, return -ENOENT if the key doesn't exist. |
| 695 | * | 802 | * |
| 696 | * @set_default_key: set the default key on an interface | 803 | * @set_default_key: set the default key on an interface |
| 697 | * | 804 | * |
| @@ -733,6 +840,23 @@ struct cfg80211_disassoc_request { | |||
| 733 | * @assoc: Request to (re)associate with the specified peer | 840 | * @assoc: Request to (re)associate with the specified peer |
| 734 | * @deauth: Request to deauthenticate from the specified peer | 841 | * @deauth: Request to deauthenticate from the specified peer |
| 735 | * @disassoc: Request to disassociate from the specified peer | 842 | * @disassoc: Request to disassociate from the specified peer |
| 843 | * | ||
| 844 | * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call | ||
| 845 | * cfg80211_ibss_joined(), also call that function when changing BSSID due | ||
| 846 | * to a merge. | ||
| 847 | * @leave_ibss: Leave the IBSS. | ||
| 848 | * | ||
| 849 | * @set_wiphy_params: Notify that wiphy parameters have changed; | ||
| 850 | * @changed bitfield (see &enum wiphy_params_flags) describes which values | ||
| 851 | * have changed. The actual parameter values are available in | ||
| 852 | * struct wiphy. If returning an error, no value should be changed. | ||
| 853 | * | ||
| 854 | * @set_tx_power: set the transmit power according to the parameters | ||
| 855 | * @get_tx_power: store the current TX power into the dbm variable; | ||
| 856 | * return 0 if successful | ||
| 857 | * | ||
| 858 | * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting | ||
| 859 | * functions to adjust rfkill hw state | ||
| 736 | */ | 860 | */ |
| 737 | struct cfg80211_ops { | 861 | struct cfg80211_ops { |
| 738 | int (*suspend)(struct wiphy *wiphy); | 862 | int (*suspend)(struct wiphy *wiphy); |
| @@ -747,13 +871,13 @@ struct cfg80211_ops { | |||
| 747 | struct vif_params *params); | 871 | struct vif_params *params); |
| 748 | 872 | ||
| 749 | int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, | 873 | int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, |
| 750 | u8 key_index, u8 *mac_addr, | 874 | u8 key_index, const u8 *mac_addr, |
| 751 | struct key_params *params); | 875 | struct key_params *params); |
| 752 | int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, | 876 | int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, |
| 753 | u8 key_index, u8 *mac_addr, void *cookie, | 877 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 754 | void (*callback)(void *cookie, struct key_params*)); | 878 | void (*callback)(void *cookie, struct key_params*)); |
| 755 | int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, | 879 | int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, |
| 756 | u8 key_index, u8 *mac_addr); | 880 | u8 key_index, const u8 *mac_addr); |
| 757 | int (*set_default_key)(struct wiphy *wiphy, | 881 | int (*set_default_key)(struct wiphy *wiphy, |
| 758 | struct net_device *netdev, | 882 | struct net_device *netdev, |
| 759 | u8 key_index); | 883 | u8 key_index); |
| @@ -818,9 +942,473 @@ struct cfg80211_ops { | |||
| 818 | struct cfg80211_deauth_request *req); | 942 | struct cfg80211_deauth_request *req); |
| 819 | int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, | 943 | int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, |
| 820 | struct cfg80211_disassoc_request *req); | 944 | struct cfg80211_disassoc_request *req); |
| 945 | |||
| 946 | int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, | ||
| 947 | struct cfg80211_ibss_params *params); | ||
| 948 | int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); | ||
| 949 | |||
| 950 | int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); | ||
| 951 | |||
| 952 | int (*set_tx_power)(struct wiphy *wiphy, | ||
| 953 | enum tx_power_setting type, int dbm); | ||
| 954 | int (*get_tx_power)(struct wiphy *wiphy, int *dbm); | ||
| 955 | |||
| 956 | void (*rfkill_poll)(struct wiphy *wiphy); | ||
| 821 | }; | 957 | }; |
| 822 | 958 | ||
| 823 | /* temporary wext handlers */ | 959 | /* |
| 960 | * wireless hardware and networking interfaces structures | ||
| 961 | * and registration/helper functions | ||
| 962 | */ | ||
| 963 | |||
| 964 | /** | ||
| 965 | * struct wiphy - wireless hardware description | ||
| 966 | * @idx: the wiphy index assigned to this item | ||
| 967 | * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> | ||
| 968 | * @custom_regulatory: tells us the driver for this device | ||
| 969 | * has its own custom regulatory domain and cannot identify the | ||
| 970 | * ISO / IEC 3166 alpha2 it belongs to. When this is enabled | ||
| 971 | * we will disregard the first regulatory hint (when the | ||
| 972 | * initiator is %REGDOM_SET_BY_CORE). | ||
| 973 | * @strict_regulatory: tells us the driver for this device will ignore | ||
| 974 | * regulatory domain settings until it gets its own regulatory domain | ||
| 975 | * via its regulatory_hint(). After its gets its own regulatory domain | ||
| 976 | * it will only allow further regulatory domain settings to further | ||
| 977 | * enhance compliance. For example if channel 13 and 14 are disabled | ||
| 978 | * by this regulatory domain no user regulatory domain can enable these | ||
| 979 | * channels at a later time. This can be used for devices which do not | ||
| 980 | * have calibration information gauranteed for frequencies or settings | ||
| 981 | * outside of its regulatory domain. | ||
| 982 | * @reg_notifier: the driver's regulatory notification callback | ||
| 983 | * @regd: the driver's regulatory domain, if one was requested via | ||
| 984 | * the regulatory_hint() API. This can be used by the driver | ||
| 985 | * on the reg_notifier() if it chooses to ignore future | ||
| 986 | * regulatory domain changes caused by other drivers. | ||
| 987 | * @signal_type: signal type reported in &struct cfg80211_bss. | ||
| 988 | * @cipher_suites: supported cipher suites | ||
| 989 | * @n_cipher_suites: number of supported cipher suites | ||
| 990 | * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) | ||
| 991 | * @retry_long: Retry limit for long frames (dot11LongRetryLimit) | ||
| 992 | * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); | ||
| 993 | * -1 = fragmentation disabled, only odd values >= 256 used | ||
| 994 | * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled | ||
| 995 | */ | ||
| 996 | struct wiphy { | ||
| 997 | /* assign these fields before you register the wiphy */ | ||
| 998 | |||
| 999 | /* permanent MAC address */ | ||
| 1000 | u8 perm_addr[ETH_ALEN]; | ||
| 1001 | |||
| 1002 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ | ||
| 1003 | u16 interface_modes; | ||
| 1004 | |||
| 1005 | bool custom_regulatory; | ||
| 1006 | bool strict_regulatory; | ||
| 1007 | |||
| 1008 | enum cfg80211_signal_type signal_type; | ||
| 1009 | |||
| 1010 | int bss_priv_size; | ||
| 1011 | u8 max_scan_ssids; | ||
| 1012 | u16 max_scan_ie_len; | ||
| 1013 | |||
| 1014 | int n_cipher_suites; | ||
| 1015 | const u32 *cipher_suites; | ||
| 1016 | |||
| 1017 | u8 retry_short; | ||
| 1018 | u8 retry_long; | ||
| 1019 | u32 frag_threshold; | ||
| 1020 | u32 rts_threshold; | ||
| 1021 | |||
| 1022 | /* If multiple wiphys are registered and you're handed e.g. | ||
| 1023 | * a regular netdev with assigned ieee80211_ptr, you won't | ||
| 1024 | * know whether it points to a wiphy your driver has registered | ||
| 1025 | * or not. Assign this to something global to your driver to | ||
| 1026 | * help determine whether you own this wiphy or not. */ | ||
| 1027 | const void *privid; | ||
| 1028 | |||
| 1029 | struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; | ||
| 1030 | |||
| 1031 | /* Lets us get back the wiphy on the callback */ | ||
| 1032 | int (*reg_notifier)(struct wiphy *wiphy, | ||
| 1033 | struct regulatory_request *request); | ||
| 1034 | |||
| 1035 | /* fields below are read-only, assigned by cfg80211 */ | ||
| 1036 | |||
| 1037 | const struct ieee80211_regdomain *regd; | ||
| 1038 | |||
| 1039 | /* the item in /sys/class/ieee80211/ points to this, | ||
| 1040 | * you need use set_wiphy_dev() (see below) */ | ||
| 1041 | struct device dev; | ||
| 1042 | |||
| 1043 | /* dir in debugfs: ieee80211/<wiphyname> */ | ||
| 1044 | struct dentry *debugfsdir; | ||
| 1045 | |||
| 1046 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | ||
| 1047 | }; | ||
| 1048 | |||
| 1049 | /** | ||
| 1050 | * wiphy_priv - return priv from wiphy | ||
| 1051 | * | ||
| 1052 | * @wiphy: the wiphy whose priv pointer to return | ||
| 1053 | */ | ||
| 1054 | static inline void *wiphy_priv(struct wiphy *wiphy) | ||
| 1055 | { | ||
| 1056 | BUG_ON(!wiphy); | ||
| 1057 | return &wiphy->priv; | ||
| 1058 | } | ||
| 1059 | |||
| 1060 | /** | ||
| 1061 | * set_wiphy_dev - set device pointer for wiphy | ||
| 1062 | * | ||
| 1063 | * @wiphy: The wiphy whose device to bind | ||
| 1064 | * @dev: The device to parent it to | ||
| 1065 | */ | ||
| 1066 | static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) | ||
| 1067 | { | ||
| 1068 | wiphy->dev.parent = dev; | ||
| 1069 | } | ||
| 1070 | |||
| 1071 | /** | ||
| 1072 | * wiphy_dev - get wiphy dev pointer | ||
| 1073 | * | ||
| 1074 | * @wiphy: The wiphy whose device struct to look up | ||
| 1075 | */ | ||
| 1076 | static inline struct device *wiphy_dev(struct wiphy *wiphy) | ||
| 1077 | { | ||
| 1078 | return wiphy->dev.parent; | ||
| 1079 | } | ||
| 1080 | |||
| 1081 | /** | ||
| 1082 | * wiphy_name - get wiphy name | ||
| 1083 | * | ||
| 1084 | * @wiphy: The wiphy whose name to return | ||
| 1085 | */ | ||
| 1086 | static inline const char *wiphy_name(struct wiphy *wiphy) | ||
| 1087 | { | ||
| 1088 | return dev_name(&wiphy->dev); | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | /** | ||
| 1092 | * wiphy_new - create a new wiphy for use with cfg80211 | ||
| 1093 | * | ||
| 1094 | * @ops: The configuration operations for this device | ||
| 1095 | * @sizeof_priv: The size of the private area to allocate | ||
| 1096 | * | ||
| 1097 | * Create a new wiphy and associate the given operations with it. | ||
| 1098 | * @sizeof_priv bytes are allocated for private use. | ||
| 1099 | * | ||
| 1100 | * The returned pointer must be assigned to each netdev's | ||
| 1101 | * ieee80211_ptr for proper operation. | ||
| 1102 | */ | ||
| 1103 | struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); | ||
| 1104 | |||
| 1105 | /** | ||
| 1106 | * wiphy_register - register a wiphy with cfg80211 | ||
| 1107 | * | ||
| 1108 | * @wiphy: The wiphy to register. | ||
| 1109 | * | ||
| 1110 | * Returns a non-negative wiphy index or a negative error code. | ||
| 1111 | */ | ||
| 1112 | extern int wiphy_register(struct wiphy *wiphy); | ||
| 1113 | |||
| 1114 | /** | ||
| 1115 | * wiphy_unregister - deregister a wiphy from cfg80211 | ||
| 1116 | * | ||
| 1117 | * @wiphy: The wiphy to unregister. | ||
| 1118 | * | ||
| 1119 | * After this call, no more requests can be made with this priv | ||
| 1120 | * pointer, but the call may sleep to wait for an outstanding | ||
| 1121 | * request that is being handled. | ||
| 1122 | */ | ||
| 1123 | extern void wiphy_unregister(struct wiphy *wiphy); | ||
| 1124 | |||
| 1125 | /** | ||
| 1126 | * wiphy_free - free wiphy | ||
| 1127 | * | ||
| 1128 | * @wiphy: The wiphy to free | ||
| 1129 | */ | ||
| 1130 | extern void wiphy_free(struct wiphy *wiphy); | ||
| 1131 | |||
| 1132 | /** | ||
| 1133 | * struct wireless_dev - wireless per-netdev state | ||
| 1134 | * | ||
| 1135 | * This structure must be allocated by the driver/stack | ||
| 1136 | * that uses the ieee80211_ptr field in struct net_device | ||
| 1137 | * (this is intentional so it can be allocated along with | ||
| 1138 | * the netdev.) | ||
| 1139 | * | ||
| 1140 | * @wiphy: pointer to hardware description | ||
| 1141 | * @iftype: interface type | ||
| 1142 | * @list: (private) Used to collect the interfaces | ||
| 1143 | * @netdev: (private) Used to reference back to the netdev | ||
| 1144 | * @current_bss: (private) Used by the internal configuration code | ||
| 1145 | * @bssid: (private) Used by the internal configuration code | ||
| 1146 | * @ssid: (private) Used by the internal configuration code | ||
| 1147 | * @ssid_len: (private) Used by the internal configuration code | ||
| 1148 | * @wext: (private) Used by the internal wireless extensions compat code | ||
| 1149 | * @wext_bssid: (private) Used by the internal wireless extensions compat code | ||
| 1150 | */ | ||
| 1151 | struct wireless_dev { | ||
| 1152 | struct wiphy *wiphy; | ||
| 1153 | enum nl80211_iftype iftype; | ||
| 1154 | |||
| 1155 | /* private to the generic wireless code */ | ||
| 1156 | struct list_head list; | ||
| 1157 | struct net_device *netdev; | ||
| 1158 | |||
| 1159 | /* currently used for IBSS - might be rearranged in the future */ | ||
| 1160 | struct cfg80211_bss *current_bss; | ||
| 1161 | u8 bssid[ETH_ALEN]; | ||
| 1162 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | ||
| 1163 | u8 ssid_len; | ||
| 1164 | |||
| 1165 | #ifdef CONFIG_WIRELESS_EXT | ||
| 1166 | /* wext data */ | ||
| 1167 | struct { | ||
| 1168 | struct cfg80211_ibss_params ibss; | ||
| 1169 | u8 bssid[ETH_ALEN]; | ||
| 1170 | s8 default_key, default_mgmt_key; | ||
| 1171 | } wext; | ||
| 1172 | #endif | ||
| 1173 | }; | ||
| 1174 | |||
| 1175 | /** | ||
| 1176 | * wdev_priv - return wiphy priv from wireless_dev | ||
| 1177 | * | ||
| 1178 | * @wdev: The wireless device whose wiphy's priv pointer to return | ||
| 1179 | */ | ||
| 1180 | static inline void *wdev_priv(struct wireless_dev *wdev) | ||
| 1181 | { | ||
| 1182 | BUG_ON(!wdev); | ||
| 1183 | return wiphy_priv(wdev->wiphy); | ||
| 1184 | } | ||
| 1185 | |||
| 1186 | /* | ||
| 1187 | * Utility functions | ||
| 1188 | */ | ||
| 1189 | |||
| 1190 | /** | ||
| 1191 | * ieee80211_channel_to_frequency - convert channel number to frequency | ||
| 1192 | */ | ||
| 1193 | extern int ieee80211_channel_to_frequency(int chan); | ||
| 1194 | |||
| 1195 | /** | ||
| 1196 | * ieee80211_frequency_to_channel - convert frequency to channel number | ||
| 1197 | */ | ||
| 1198 | extern int ieee80211_frequency_to_channel(int freq); | ||
| 1199 | |||
| 1200 | /* | ||
| 1201 | * Name indirection necessary because the ieee80211 code also has | ||
| 1202 | * a function named "ieee80211_get_channel", so if you include | ||
| 1203 | * cfg80211's header file you get cfg80211's version, if you try | ||
| 1204 | * to include both header files you'll (rightfully!) get a symbol | ||
| 1205 | * clash. | ||
| 1206 | */ | ||
| 1207 | extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, | ||
| 1208 | int freq); | ||
| 1209 | /** | ||
| 1210 | * ieee80211_get_channel - get channel struct from wiphy for specified frequency | ||
| 1211 | */ | ||
| 1212 | static inline struct ieee80211_channel * | ||
| 1213 | ieee80211_get_channel(struct wiphy *wiphy, int freq) | ||
| 1214 | { | ||
| 1215 | return __ieee80211_get_channel(wiphy, freq); | ||
| 1216 | } | ||
| 1217 | |||
| 1218 | /** | ||
| 1219 | * ieee80211_get_response_rate - get basic rate for a given rate | ||
| 1220 | * | ||
| 1221 | * @sband: the band to look for rates in | ||
| 1222 | * @basic_rates: bitmap of basic rates | ||
| 1223 | * @bitrate: the bitrate for which to find the basic rate | ||
| 1224 | * | ||
| 1225 | * This function returns the basic rate corresponding to a given | ||
| 1226 | * bitrate, that is the next lower bitrate contained in the basic | ||
| 1227 | * rate map, which is, for this function, given as a bitmap of | ||
| 1228 | * indices of rates in the band's bitrate table. | ||
| 1229 | */ | ||
| 1230 | struct ieee80211_rate * | ||
| 1231 | ieee80211_get_response_rate(struct ieee80211_supported_band *sband, | ||
| 1232 | u32 basic_rates, int bitrate); | ||
| 1233 | |||
| 1234 | /* | ||
| 1235 | * Radiotap parsing functions -- for controlled injection support | ||
| 1236 | * | ||
| 1237 | * Implemented in net/wireless/radiotap.c | ||
| 1238 | * Documentation in Documentation/networking/radiotap-headers.txt | ||
| 1239 | */ | ||
| 1240 | |||
| 1241 | /** | ||
| 1242 | * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args | ||
| 1243 | * @rtheader: pointer to the radiotap header we are walking through | ||
| 1244 | * @max_length: length of radiotap header in cpu byte ordering | ||
| 1245 | * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg | ||
| 1246 | * @this_arg: pointer to current radiotap arg | ||
| 1247 | * @arg_index: internal next argument index | ||
| 1248 | * @arg: internal next argument pointer | ||
| 1249 | * @next_bitmap: internal pointer to next present u32 | ||
| 1250 | * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present | ||
| 1251 | */ | ||
| 1252 | |||
| 1253 | struct ieee80211_radiotap_iterator { | ||
| 1254 | struct ieee80211_radiotap_header *rtheader; | ||
| 1255 | int max_length; | ||
| 1256 | int this_arg_index; | ||
| 1257 | u8 *this_arg; | ||
| 1258 | |||
| 1259 | int arg_index; | ||
| 1260 | u8 *arg; | ||
| 1261 | __le32 *next_bitmap; | ||
| 1262 | u32 bitmap_shifter; | ||
| 1263 | }; | ||
| 1264 | |||
| 1265 | extern int ieee80211_radiotap_iterator_init( | ||
| 1266 | struct ieee80211_radiotap_iterator *iterator, | ||
| 1267 | struct ieee80211_radiotap_header *radiotap_header, | ||
| 1268 | int max_length); | ||
| 1269 | |||
| 1270 | extern int ieee80211_radiotap_iterator_next( | ||
| 1271 | struct ieee80211_radiotap_iterator *iterator); | ||
| 1272 | |||
| 1273 | extern const unsigned char rfc1042_header[6]; | ||
| 1274 | extern const unsigned char bridge_tunnel_header[6]; | ||
| 1275 | |||
| 1276 | /** | ||
| 1277 | * ieee80211_get_hdrlen_from_skb - get header length from data | ||
| 1278 | * | ||
| 1279 | * Given an skb with a raw 802.11 header at the data pointer this function | ||
| 1280 | * returns the 802.11 header length in bytes (not including encryption | ||
| 1281 | * headers). If the data in the sk_buff is too short to contain a valid 802.11 | ||
| 1282 | * header the function returns 0. | ||
| 1283 | * | ||
| 1284 | * @skb: the frame | ||
| 1285 | */ | ||
| 1286 | unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); | ||
| 1287 | |||
| 1288 | /** | ||
| 1289 | * ieee80211_hdrlen - get header length in bytes from frame control | ||
| 1290 | * @fc: frame control field in little-endian format | ||
| 1291 | */ | ||
| 1292 | unsigned int ieee80211_hdrlen(__le16 fc); | ||
| 1293 | |||
| 1294 | /** | ||
| 1295 | * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 | ||
| 1296 | * @skb: the 802.11 data frame | ||
| 1297 | * @addr: the device MAC address | ||
| 1298 | * @iftype: the virtual interface type | ||
| 1299 | */ | ||
| 1300 | int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr, | ||
| 1301 | enum nl80211_iftype iftype); | ||
| 1302 | |||
| 1303 | /** | ||
| 1304 | * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 | ||
| 1305 | * @skb: the 802.3 frame | ||
| 1306 | * @addr: the device MAC address | ||
| 1307 | * @iftype: the virtual interface type | ||
| 1308 | * @bssid: the network bssid (used only for iftype STATION and ADHOC) | ||
| 1309 | * @qos: build 802.11 QoS data frame | ||
| 1310 | */ | ||
| 1311 | int ieee80211_data_from_8023(struct sk_buff *skb, u8 *addr, | ||
| 1312 | enum nl80211_iftype iftype, u8 *bssid, bool qos); | ||
| 1313 | |||
| 1314 | /** | ||
| 1315 | * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame | ||
| 1316 | * @skb: the data frame | ||
| 1317 | */ | ||
| 1318 | unsigned int cfg80211_classify8021d(struct sk_buff *skb); | ||
| 1319 | |||
| 1320 | /* | ||
| 1321 | * Regulatory helper functions for wiphys | ||
| 1322 | */ | ||
| 1323 | |||
| 1324 | /** | ||
| 1325 | * regulatory_hint - driver hint to the wireless core a regulatory domain | ||
| 1326 | * @wiphy: the wireless device giving the hint (used only for reporting | ||
| 1327 | * conflicts) | ||
| 1328 | * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain | ||
| 1329 | * should be in. If @rd is set this should be NULL. Note that if you | ||
| 1330 | * set this to NULL you should still set rd->alpha2 to some accepted | ||
| 1331 | * alpha2. | ||
| 1332 | * | ||
| 1333 | * Wireless drivers can use this function to hint to the wireless core | ||
| 1334 | * what it believes should be the current regulatory domain by | ||
| 1335 | * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory | ||
| 1336 | * domain should be in or by providing a completely build regulatory domain. | ||
| 1337 | * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried | ||
| 1338 | * for a regulatory domain structure for the respective country. | ||
| 1339 | * | ||
| 1340 | * The wiphy must have been registered to cfg80211 prior to this call. | ||
| 1341 | * For cfg80211 drivers this means you must first use wiphy_register(), | ||
| 1342 | * for mac80211 drivers you must first use ieee80211_register_hw(). | ||
| 1343 | * | ||
| 1344 | * Drivers should check the return value, its possible you can get | ||
| 1345 | * an -ENOMEM. | ||
| 1346 | */ | ||
| 1347 | extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); | ||
| 1348 | |||
| 1349 | /** | ||
| 1350 | * regulatory_hint_11d - hints a country IE as a regulatory domain | ||
| 1351 | * @wiphy: the wireless device giving the hint (used only for reporting | ||
| 1352 | * conflicts) | ||
| 1353 | * @country_ie: pointer to the country IE | ||
| 1354 | * @country_ie_len: length of the country IE | ||
| 1355 | * | ||
| 1356 | * We will intersect the rd with the what CRDA tells us should apply | ||
| 1357 | * for the alpha2 this country IE belongs to, this prevents APs from | ||
| 1358 | * sending us incorrect or outdated information against a country. | ||
| 1359 | */ | ||
| 1360 | extern void regulatory_hint_11d(struct wiphy *wiphy, | ||
| 1361 | u8 *country_ie, | ||
| 1362 | u8 country_ie_len); | ||
| 1363 | /** | ||
| 1364 | * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain | ||
| 1365 | * @wiphy: the wireless device we want to process the regulatory domain on | ||
| 1366 | * @regd: the custom regulatory domain to use for this wiphy | ||
| 1367 | * | ||
| 1368 | * Drivers can sometimes have custom regulatory domains which do not apply | ||
| 1369 | * to a specific country. Drivers can use this to apply such custom regulatory | ||
| 1370 | * domains. This routine must be called prior to wiphy registration. The | ||
| 1371 | * custom regulatory domain will be trusted completely and as such previous | ||
| 1372 | * default channel settings will be disregarded. If no rule is found for a | ||
| 1373 | * channel on the regulatory domain the channel will be disabled. | ||
| 1374 | */ | ||
| 1375 | extern void wiphy_apply_custom_regulatory( | ||
| 1376 | struct wiphy *wiphy, | ||
| 1377 | const struct ieee80211_regdomain *regd); | ||
| 1378 | |||
| 1379 | /** | ||
| 1380 | * freq_reg_info - get regulatory information for the given frequency | ||
| 1381 | * @wiphy: the wiphy for which we want to process this rule for | ||
| 1382 | * @center_freq: Frequency in KHz for which we want regulatory information for | ||
| 1383 | * @desired_bw_khz: the desired max bandwidth you want to use per | ||
| 1384 | * channel. Note that this is still 20 MHz if you want to use HT40 | ||
| 1385 | * as HT40 makes use of two channels for its 40 MHz width bandwidth. | ||
| 1386 | * If set to 0 we'll assume you want the standard 20 MHz. | ||
| 1387 | * @reg_rule: the regulatory rule which we have for this frequency | ||
| 1388 | * | ||
| 1389 | * Use this function to get the regulatory rule for a specific frequency on | ||
| 1390 | * a given wireless device. If the device has a specific regulatory domain | ||
| 1391 | * it wants to follow we respect that unless a country IE has been received | ||
| 1392 | * and processed already. | ||
| 1393 | * | ||
| 1394 | * Returns 0 if it was able to find a valid regulatory rule which does | ||
| 1395 | * apply to the given center_freq otherwise it returns non-zero. It will | ||
| 1396 | * also return -ERANGE if we determine the given center_freq does not even have | ||
| 1397 | * a regulatory rule for a frequency range in the center_freq's band. See | ||
| 1398 | * freq_in_rule_band() for our current definition of a band -- this is purely | ||
| 1399 | * subjective and right now its 802.11 specific. | ||
| 1400 | */ | ||
| 1401 | extern int freq_reg_info(struct wiphy *wiphy, | ||
| 1402 | u32 center_freq, | ||
| 1403 | u32 desired_bw_khz, | ||
| 1404 | const struct ieee80211_reg_rule **reg_rule); | ||
| 1405 | |||
| 1406 | /* | ||
| 1407 | * Temporary wext handlers & helper functions | ||
| 1408 | * | ||
| 1409 | * In the future cfg80211 will simply assign the entire wext handler | ||
| 1410 | * structure to netdevs it manages, but we're not there yet. | ||
| 1411 | */ | ||
| 824 | int cfg80211_wext_giwname(struct net_device *dev, | 1412 | int cfg80211_wext_giwname(struct net_device *dev, |
| 825 | struct iw_request_info *info, | 1413 | struct iw_request_info *info, |
| 826 | char *name, char *extra); | 1414 | char *name, char *extra); |
| @@ -834,9 +1422,72 @@ int cfg80211_wext_siwscan(struct net_device *dev, | |||
| 834 | int cfg80211_wext_giwscan(struct net_device *dev, | 1422 | int cfg80211_wext_giwscan(struct net_device *dev, |
| 835 | struct iw_request_info *info, | 1423 | struct iw_request_info *info, |
| 836 | struct iw_point *data, char *extra); | 1424 | struct iw_point *data, char *extra); |
| 1425 | int cfg80211_wext_siwmlme(struct net_device *dev, | ||
| 1426 | struct iw_request_info *info, | ||
| 1427 | struct iw_point *data, char *extra); | ||
| 837 | int cfg80211_wext_giwrange(struct net_device *dev, | 1428 | int cfg80211_wext_giwrange(struct net_device *dev, |
| 838 | struct iw_request_info *info, | 1429 | struct iw_request_info *info, |
| 839 | struct iw_point *data, char *extra); | 1430 | struct iw_point *data, char *extra); |
| 1431 | int cfg80211_ibss_wext_siwfreq(struct net_device *dev, | ||
| 1432 | struct iw_request_info *info, | ||
| 1433 | struct iw_freq *freq, char *extra); | ||
| 1434 | int cfg80211_ibss_wext_giwfreq(struct net_device *dev, | ||
| 1435 | struct iw_request_info *info, | ||
| 1436 | struct iw_freq *freq, char *extra); | ||
| 1437 | int cfg80211_ibss_wext_siwessid(struct net_device *dev, | ||
| 1438 | struct iw_request_info *info, | ||
| 1439 | struct iw_point *data, char *ssid); | ||
| 1440 | int cfg80211_ibss_wext_giwessid(struct net_device *dev, | ||
| 1441 | struct iw_request_info *info, | ||
| 1442 | struct iw_point *data, char *ssid); | ||
| 1443 | int cfg80211_ibss_wext_siwap(struct net_device *dev, | ||
| 1444 | struct iw_request_info *info, | ||
| 1445 | struct sockaddr *ap_addr, char *extra); | ||
| 1446 | int cfg80211_ibss_wext_giwap(struct net_device *dev, | ||
| 1447 | struct iw_request_info *info, | ||
| 1448 | struct sockaddr *ap_addr, char *extra); | ||
| 1449 | |||
| 1450 | struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy, | ||
| 1451 | struct iw_freq *freq); | ||
| 1452 | |||
| 1453 | int cfg80211_wext_siwrts(struct net_device *dev, | ||
| 1454 | struct iw_request_info *info, | ||
| 1455 | struct iw_param *rts, char *extra); | ||
| 1456 | int cfg80211_wext_giwrts(struct net_device *dev, | ||
| 1457 | struct iw_request_info *info, | ||
| 1458 | struct iw_param *rts, char *extra); | ||
| 1459 | int cfg80211_wext_siwfrag(struct net_device *dev, | ||
| 1460 | struct iw_request_info *info, | ||
| 1461 | struct iw_param *frag, char *extra); | ||
| 1462 | int cfg80211_wext_giwfrag(struct net_device *dev, | ||
| 1463 | struct iw_request_info *info, | ||
| 1464 | struct iw_param *frag, char *extra); | ||
| 1465 | int cfg80211_wext_siwretry(struct net_device *dev, | ||
| 1466 | struct iw_request_info *info, | ||
| 1467 | struct iw_param *retry, char *extra); | ||
| 1468 | int cfg80211_wext_giwretry(struct net_device *dev, | ||
| 1469 | struct iw_request_info *info, | ||
| 1470 | struct iw_param *retry, char *extra); | ||
| 1471 | int cfg80211_wext_siwencodeext(struct net_device *dev, | ||
| 1472 | struct iw_request_info *info, | ||
| 1473 | struct iw_point *erq, char *extra); | ||
| 1474 | int cfg80211_wext_siwencode(struct net_device *dev, | ||
| 1475 | struct iw_request_info *info, | ||
| 1476 | struct iw_point *erq, char *keybuf); | ||
| 1477 | int cfg80211_wext_giwencode(struct net_device *dev, | ||
| 1478 | struct iw_request_info *info, | ||
| 1479 | struct iw_point *erq, char *keybuf); | ||
| 1480 | int cfg80211_wext_siwtxpower(struct net_device *dev, | ||
| 1481 | struct iw_request_info *info, | ||
| 1482 | union iwreq_data *data, char *keybuf); | ||
| 1483 | int cfg80211_wext_giwtxpower(struct net_device *dev, | ||
| 1484 | struct iw_request_info *info, | ||
| 1485 | union iwreq_data *data, char *keybuf); | ||
| 1486 | |||
| 1487 | /* | ||
| 1488 | * callbacks for asynchronous cfg80211 methods, notification | ||
| 1489 | * functions and BSS handling helpers | ||
| 1490 | */ | ||
| 840 | 1491 | ||
| 841 | /** | 1492 | /** |
| 842 | * cfg80211_scan_done - notify that scan finished | 1493 | * cfg80211_scan_done - notify that scan finished |
| @@ -864,6 +1515,14 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
| 864 | struct ieee80211_mgmt *mgmt, size_t len, | 1515 | struct ieee80211_mgmt *mgmt, size_t len, |
| 865 | s32 signal, gfp_t gfp); | 1516 | s32 signal, gfp_t gfp); |
| 866 | 1517 | ||
| 1518 | struct cfg80211_bss* | ||
| 1519 | cfg80211_inform_bss(struct wiphy *wiphy, | ||
| 1520 | struct ieee80211_channel *channel, | ||
| 1521 | const u8 *bssid, | ||
| 1522 | u64 timestamp, u16 capability, u16 beacon_interval, | ||
| 1523 | const u8 *ie, size_t ielen, | ||
| 1524 | s32 signal, gfp_t gfp); | ||
| 1525 | |||
| 867 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, | 1526 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, |
| 868 | struct ieee80211_channel *channel, | 1527 | struct ieee80211_channel *channel, |
| 869 | const u8 *bssid, | 1528 | const u8 *bssid, |
| @@ -883,6 +1542,7 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, | |||
| 883 | const u8 *meshid, size_t meshidlen, | 1542 | const u8 *meshid, size_t meshidlen, |
| 884 | const u8 *meshcfg); | 1543 | const u8 *meshcfg); |
| 885 | void cfg80211_put_bss(struct cfg80211_bss *bss); | 1544 | void cfg80211_put_bss(struct cfg80211_bss *bss); |
| 1545 | |||
| 886 | /** | 1546 | /** |
| 887 | * cfg80211_unlink_bss - unlink BSS from internal data structures | 1547 | * cfg80211_unlink_bss - unlink BSS from internal data structures |
| 888 | * @wiphy: the wiphy | 1548 | * @wiphy: the wiphy |
| @@ -902,44 +1562,62 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); | |||
| 902 | * @len: length of the frame data | 1562 | * @len: length of the frame data |
| 903 | * | 1563 | * |
| 904 | * This function is called whenever an authentication has been processed in | 1564 | * This function is called whenever an authentication has been processed in |
| 905 | * station mode. | 1565 | * station mode. The driver is required to call either this function or |
| 1566 | * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() | ||
| 1567 | * call. | ||
| 906 | */ | 1568 | */ |
| 907 | void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); | 1569 | void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); |
| 908 | 1570 | ||
| 909 | /** | 1571 | /** |
| 1572 | * cfg80211_send_auth_timeout - notification of timed out authentication | ||
| 1573 | * @dev: network device | ||
| 1574 | * @addr: The MAC address of the device with which the authentication timed out | ||
| 1575 | */ | ||
| 1576 | void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); | ||
| 1577 | |||
| 1578 | /** | ||
| 910 | * cfg80211_send_rx_assoc - notification of processed association | 1579 | * cfg80211_send_rx_assoc - notification of processed association |
| 911 | * @dev: network device | 1580 | * @dev: network device |
| 912 | * @buf: (re)association response frame (header + body) | 1581 | * @buf: (re)association response frame (header + body) |
| 913 | * @len: length of the frame data | 1582 | * @len: length of the frame data |
| 914 | * | 1583 | * |
| 915 | * This function is called whenever a (re)association response has been | 1584 | * This function is called whenever a (re)association response has been |
| 916 | * processed in station mode. | 1585 | * processed in station mode. The driver is required to call either this |
| 1586 | * function or cfg80211_send_assoc_timeout() to indicate the result of | ||
| 1587 | * cfg80211_ops::assoc() call. | ||
| 917 | */ | 1588 | */ |
| 918 | void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); | 1589 | void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); |
| 919 | 1590 | ||
| 920 | /** | 1591 | /** |
| 921 | * cfg80211_send_rx_deauth - notification of processed deauthentication | 1592 | * cfg80211_send_assoc_timeout - notification of timed out association |
| 1593 | * @dev: network device | ||
| 1594 | * @addr: The MAC address of the device with which the association timed out | ||
| 1595 | */ | ||
| 1596 | void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); | ||
| 1597 | |||
| 1598 | /** | ||
| 1599 | * cfg80211_send_deauth - notification of processed deauthentication | ||
| 922 | * @dev: network device | 1600 | * @dev: network device |
| 923 | * @buf: deauthentication frame (header + body) | 1601 | * @buf: deauthentication frame (header + body) |
| 924 | * @len: length of the frame data | 1602 | * @len: length of the frame data |
| 925 | * | 1603 | * |
| 926 | * This function is called whenever deauthentication has been processed in | 1604 | * This function is called whenever deauthentication has been processed in |
| 927 | * station mode. | 1605 | * station mode. This includes both received deauthentication frames and |
| 1606 | * locally generated ones. | ||
| 928 | */ | 1607 | */ |
| 929 | void cfg80211_send_rx_deauth(struct net_device *dev, const u8 *buf, | 1608 | void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); |
| 930 | size_t len); | ||
| 931 | 1609 | ||
| 932 | /** | 1610 | /** |
| 933 | * cfg80211_send_rx_disassoc - notification of processed disassociation | 1611 | * cfg80211_send_disassoc - notification of processed disassociation |
| 934 | * @dev: network device | 1612 | * @dev: network device |
| 935 | * @buf: disassociation response frame (header + body) | 1613 | * @buf: disassociation response frame (header + body) |
| 936 | * @len: length of the frame data | 1614 | * @len: length of the frame data |
| 937 | * | 1615 | * |
| 938 | * This function is called whenever disassociation has been processed in | 1616 | * This function is called whenever disassociation has been processed in |
| 939 | * station mode. | 1617 | * station mode. This includes both received disassociation frames and locally |
| 1618 | * generated ones. | ||
| 940 | */ | 1619 | */ |
| 941 | void cfg80211_send_rx_disassoc(struct net_device *dev, const u8 *buf, | 1620 | void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len); |
| 942 | size_t len); | ||
| 943 | 1621 | ||
| 944 | /** | 1622 | /** |
| 945 | * cfg80211_hold_bss - exclude bss from expiration | 1623 | * cfg80211_hold_bss - exclude bss from expiration |
| @@ -958,4 +1636,55 @@ void cfg80211_hold_bss(struct cfg80211_bss *bss); | |||
| 958 | */ | 1636 | */ |
| 959 | void cfg80211_unhold_bss(struct cfg80211_bss *bss); | 1637 | void cfg80211_unhold_bss(struct cfg80211_bss *bss); |
| 960 | 1638 | ||
| 1639 | /** | ||
| 1640 | * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) | ||
| 1641 | * @dev: network device | ||
| 1642 | * @addr: The source MAC address of the frame | ||
| 1643 | * @key_type: The key type that the received frame used | ||
| 1644 | * @key_id: Key identifier (0..3) | ||
| 1645 | * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) | ||
| 1646 | * | ||
| 1647 | * This function is called whenever the local MAC detects a MIC failure in a | ||
| 1648 | * received frame. This matches with MLME-MICHAELMICFAILURE.indication() | ||
| 1649 | * primitive. | ||
| 1650 | */ | ||
| 1651 | void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, | ||
| 1652 | enum nl80211_key_type key_type, int key_id, | ||
| 1653 | const u8 *tsc); | ||
| 1654 | |||
| 1655 | /** | ||
| 1656 | * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS | ||
| 1657 | * | ||
| 1658 | * @dev: network device | ||
| 1659 | * @bssid: the BSSID of the IBSS joined | ||
| 1660 | * @gfp: allocation flags | ||
| 1661 | * | ||
| 1662 | * This function notifies cfg80211 that the device joined an IBSS or | ||
| 1663 | * switched to a different BSSID. Before this function can be called, | ||
| 1664 | * either a beacon has to have been received from the IBSS, or one of | ||
| 1665 | * the cfg80211_inform_bss{,_frame} functions must have been called | ||
| 1666 | * with the locally generated beacon -- this guarantees that there is | ||
| 1667 | * always a scan result for this IBSS. cfg80211 will handle the rest. | ||
| 1668 | */ | ||
| 1669 | void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); | ||
| 1670 | |||
| 1671 | /** | ||
| 1672 | * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state | ||
| 1673 | * @wiphy: the wiphy | ||
| 1674 | * @blocked: block status | ||
| 1675 | */ | ||
| 1676 | void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); | ||
| 1677 | |||
| 1678 | /** | ||
| 1679 | * wiphy_rfkill_start_polling - start polling rfkill | ||
| 1680 | * @wiphy: the wiphy | ||
| 1681 | */ | ||
| 1682 | void wiphy_rfkill_start_polling(struct wiphy *wiphy); | ||
| 1683 | |||
| 1684 | /** | ||
| 1685 | * wiphy_rfkill_stop_polling - stop polling rfkill | ||
| 1686 | * @wiphy: the wiphy | ||
| 1687 | */ | ||
| 1688 | void wiphy_rfkill_stop_polling(struct wiphy *wiphy); | ||
| 1689 | |||
| 961 | #endif /* __NET_CFG80211_H */ | 1690 | #endif /* __NET_CFG80211_H */ |
diff --git a/include/net/dst.h b/include/net/dst.h index 6be3b082a070..7fc409c19b37 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -195,6 +195,12 @@ struct dst_entry * dst_clone(struct dst_entry * dst) | |||
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | extern void dst_release(struct dst_entry *dst); | 197 | extern void dst_release(struct dst_entry *dst); |
| 198 | static inline void skb_dst_drop(struct sk_buff *skb) | ||
| 199 | { | ||
| 200 | if (skb->_skb_dst) | ||
| 201 | dst_release(skb_dst(skb)); | ||
| 202 | skb->_skb_dst = 0UL; | ||
| 203 | } | ||
| 198 | 204 | ||
| 199 | /* Children define the path of the packet through the | 205 | /* Children define the path of the packet through the |
| 200 | * Linux networking. Thus, destinations are stackable. | 206 | * Linux networking. Thus, destinations are stackable. |
| @@ -246,7 +252,7 @@ static inline void dst_negative_advice(struct dst_entry **dst_p) | |||
| 246 | 252 | ||
| 247 | static inline void dst_link_failure(struct sk_buff *skb) | 253 | static inline void dst_link_failure(struct sk_buff *skb) |
| 248 | { | 254 | { |
| 249 | struct dst_entry * dst = skb->dst; | 255 | struct dst_entry *dst = skb_dst(skb); |
| 250 | if (dst && dst->ops && dst->ops->link_failure) | 256 | if (dst && dst->ops && dst->ops->link_failure) |
| 251 | dst->ops->link_failure(skb); | 257 | dst->ops->link_failure(skb); |
| 252 | } | 258 | } |
| @@ -265,13 +271,13 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout) | |||
| 265 | /* Output packet to network from transport. */ | 271 | /* Output packet to network from transport. */ |
| 266 | static inline int dst_output(struct sk_buff *skb) | 272 | static inline int dst_output(struct sk_buff *skb) |
| 267 | { | 273 | { |
| 268 | return skb->dst->output(skb); | 274 | return skb_dst(skb)->output(skb); |
| 269 | } | 275 | } |
| 270 | 276 | ||
| 271 | /* Input packet from network to transport. */ | 277 | /* Input packet from network to transport. */ |
| 272 | static inline int dst_input(struct sk_buff *skb) | 278 | static inline int dst_input(struct sk_buff *skb) |
| 273 | { | 279 | { |
| 274 | return skb->dst->input(skb); | 280 | return skb_dst(skb)->input(skb); |
| 275 | } | 281 | } |
| 276 | 282 | ||
| 277 | static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie) | 283 | static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie) |
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index c2bb5cae6515..ca4b2e840078 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
| @@ -48,14 +48,12 @@ struct fib_rules_ops | |||
| 48 | struct flowi *, int); | 48 | struct flowi *, int); |
| 49 | int (*configure)(struct fib_rule *, | 49 | int (*configure)(struct fib_rule *, |
| 50 | struct sk_buff *, | 50 | struct sk_buff *, |
| 51 | struct nlmsghdr *, | ||
| 52 | struct fib_rule_hdr *, | 51 | struct fib_rule_hdr *, |
| 53 | struct nlattr **); | 52 | struct nlattr **); |
| 54 | int (*compare)(struct fib_rule *, | 53 | int (*compare)(struct fib_rule *, |
| 55 | struct fib_rule_hdr *, | 54 | struct fib_rule_hdr *, |
| 56 | struct nlattr **); | 55 | struct nlattr **); |
| 57 | int (*fill)(struct fib_rule *, struct sk_buff *, | 56 | int (*fill)(struct fib_rule *, struct sk_buff *, |
| 58 | struct nlmsghdr *, | ||
| 59 | struct fib_rule_hdr *); | 57 | struct fib_rule_hdr *); |
| 60 | u32 (*default_pref)(struct fib_rules_ops *ops); | 58 | u32 (*default_pref)(struct fib_rules_ops *ops); |
| 61 | size_t (*nlmsg_payload)(struct fib_rule *); | 59 | size_t (*nlmsg_payload)(struct fib_rule *); |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 747c255d1df0..1b0e3ee4ddd8 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
| @@ -88,6 +88,8 @@ struct genl_ops | |||
| 88 | }; | 88 | }; |
| 89 | 89 | ||
| 90 | extern int genl_register_family(struct genl_family *family); | 90 | extern int genl_register_family(struct genl_family *family); |
| 91 | extern int genl_register_family_with_ops(struct genl_family *family, | ||
| 92 | struct genl_ops *ops, size_t n_ops); | ||
| 91 | extern int genl_unregister_family(struct genl_family *family); | 93 | extern int genl_unregister_family(struct genl_family *family); |
| 92 | extern int genl_register_ops(struct genl_family *, struct genl_ops *ops); | 94 | extern int genl_register_ops(struct genl_family *, struct genl_ops *ops); |
| 93 | extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops); | 95 | extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops); |
diff --git a/include/net/ieee802154/af_ieee802154.h b/include/net/ieee802154/af_ieee802154.h new file mode 100644 index 000000000000..0d78605fb1a6 --- /dev/null +++ b/include/net/ieee802154/af_ieee802154.h | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | /* | ||
| 2 | * IEEE 802.15.4 inteface for userspace | ||
| 3 | * | ||
| 4 | * Copyright 2007, 2008 Siemens AG | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 | ||
| 8 | * as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License along | ||
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 18 | * | ||
| 19 | * Written by: | ||
| 20 | * Sergey Lapin <slapin@ossfans.org> | ||
| 21 | * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifndef _AF_IEEE802154_H | ||
| 25 | #define _AF_IEEE802154_H | ||
| 26 | |||
| 27 | #include <linux/socket.h> /* for sa_family_t */ | ||
| 28 | |||
| 29 | enum { | ||
| 30 | IEEE802154_ADDR_NONE = 0x0, | ||
| 31 | /* RESERVED = 0x01, */ | ||
| 32 | IEEE802154_ADDR_SHORT = 0x2, /* 16-bit address + PANid */ | ||
| 33 | IEEE802154_ADDR_LONG = 0x3, /* 64-bit address + PANid */ | ||
| 34 | }; | ||
| 35 | |||
| 36 | /* address length, octets */ | ||
| 37 | #define IEEE802154_ADDR_LEN 8 | ||
| 38 | |||
| 39 | struct ieee802154_addr { | ||
| 40 | int addr_type; | ||
| 41 | u16 pan_id; | ||
| 42 | union { | ||
| 43 | u8 hwaddr[IEEE802154_ADDR_LEN]; | ||
| 44 | u16 short_addr; | ||
| 45 | }; | ||
| 46 | }; | ||
| 47 | |||
| 48 | #define IEEE802154_PANID_BROADCAST 0xffff | ||
| 49 | #define IEEE802154_ADDR_BROADCAST 0xffff | ||
| 50 | #define IEEE802154_ADDR_UNDEF 0xfffe | ||
| 51 | |||
| 52 | struct sockaddr_ieee802154 { | ||
| 53 | sa_family_t family; /* AF_IEEE802154 */ | ||
| 54 | struct ieee802154_addr addr; | ||
| 55 | }; | ||
| 56 | |||
| 57 | /* master device */ | ||
| 58 | #define IEEE802154_SIOC_ADD_SLAVE (SIOCDEVPRIVATE + 0) | ||
| 59 | |||
| 60 | #endif | ||
diff --git a/include/net/ieee802154/mac_def.h b/include/net/ieee802154/mac_def.h new file mode 100644 index 000000000000..8cb684635650 --- /dev/null +++ b/include/net/ieee802154/mac_def.h | |||
| @@ -0,0 +1,160 @@ | |||
| 1 | /* | ||
| 2 | * IEEE802.15.4-2003 specification | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007, 2008 Siemens AG | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 | ||
| 8 | * as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License along | ||
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 18 | * | ||
| 19 | * Written by: | ||
| 20 | * Pavel Smolenskiy <pavel.smolenskiy@gmail.com> | ||
| 21 | * Maxim Gorbachyov <maxim.gorbachev@siemens.com> | ||
| 22 | * Maxim Osipov <maxim.osipov@siemens.com> | ||
| 23 | * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | ||
| 24 | */ | ||
| 25 | |||
| 26 | #ifndef IEEE802154_MAC_DEF_H | ||
| 27 | #define IEEE802154_MAC_DEF_H | ||
| 28 | |||
| 29 | #define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */ | ||
| 30 | #define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */ | ||
| 31 | #define IEEE802154_FC_TYPE_ACK 0x2 /* Frame is acknowledgment */ | ||
| 32 | #define IEEE802154_FC_TYPE_MAC_CMD 0x3 /* Frame is MAC command */ | ||
| 33 | |||
| 34 | #define IEEE802154_FC_TYPE_SHIFT 0 | ||
| 35 | #define IEEE802154_FC_TYPE_MASK ((1 << 3) - 1) | ||
| 36 | #define IEEE802154_FC_TYPE(x) ((x & IEEE802154_FC_TYPE_MASK) >> IEEE802154_FC_TYPE_SHIFT) | ||
| 37 | #define IEEE802154_FC_SET_TYPE(v, x) do { \ | ||
| 38 | v = (((v) & ~IEEE802154_FC_TYPE_MASK) | \ | ||
| 39 | (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \ | ||
| 40 | } while (0) | ||
| 41 | |||
| 42 | #define IEEE802154_FC_SECEN (1 << 3) | ||
| 43 | #define IEEE802154_FC_FRPEND (1 << 4) | ||
| 44 | #define IEEE802154_FC_ACK_REQ (1 << 5) | ||
| 45 | #define IEEE802154_FC_INTRA_PAN (1 << 6) | ||
| 46 | |||
| 47 | #define IEEE802154_FC_SAMODE_SHIFT 14 | ||
| 48 | #define IEEE802154_FC_SAMODE_MASK (3 << IEEE802154_FC_SAMODE_SHIFT) | ||
| 49 | #define IEEE802154_FC_DAMODE_SHIFT 10 | ||
| 50 | #define IEEE802154_FC_DAMODE_MASK (3 << IEEE802154_FC_DAMODE_SHIFT) | ||
| 51 | |||
| 52 | #define IEEE802154_FC_SAMODE(x) \ | ||
| 53 | (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT) | ||
| 54 | |||
| 55 | #define IEEE802154_FC_DAMODE(x) \ | ||
| 56 | (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT) | ||
| 57 | |||
| 58 | |||
| 59 | /* MAC's Command Frames Identifiers */ | ||
| 60 | #define IEEE802154_CMD_ASSOCIATION_REQ 0x01 | ||
| 61 | #define IEEE802154_CMD_ASSOCIATION_RESP 0x02 | ||
| 62 | #define IEEE802154_CMD_DISASSOCIATION_NOTIFY 0x03 | ||
| 63 | #define IEEE802154_CMD_DATA_REQ 0x04 | ||
| 64 | #define IEEE802154_CMD_PANID_CONFLICT_NOTIFY 0x05 | ||
| 65 | #define IEEE802154_CMD_ORPHAN_NOTIFY 0x06 | ||
| 66 | #define IEEE802154_CMD_BEACON_REQ 0x07 | ||
| 67 | #define IEEE802154_CMD_COORD_REALIGN_NOTIFY 0x08 | ||
| 68 | #define IEEE802154_CMD_GTS_REQ 0x09 | ||
| 69 | |||
| 70 | /* | ||
| 71 | * The return values of MAC operations | ||
| 72 | */ | ||
| 73 | enum { | ||
| 74 | /* | ||
| 75 | * The requested operation was completed successfully. | ||
| 76 | * For a transmission request, this value indicates | ||
| 77 | * a successful transmission. | ||
| 78 | */ | ||
| 79 | IEEE802154_SUCCESS = 0x0, | ||
| 80 | |||
| 81 | /* The beacon was lost following a synchronization request. */ | ||
| 82 | IEEE802154_BEACON_LOSS = 0xe0, | ||
| 83 | /* | ||
| 84 | * A transmission could not take place due to activity on the | ||
| 85 | * channel, i.e., the CSMA-CA mechanism has failed. | ||
| 86 | */ | ||
| 87 | IEEE802154_CHNL_ACCESS_FAIL = 0xe1, | ||
| 88 | /* The GTS request has been denied by the PAN coordinator. */ | ||
| 89 | IEEE802154_DENINED = 0xe2, | ||
| 90 | /* The attempt to disable the transceiver has failed. */ | ||
| 91 | IEEE802154_DISABLE_TRX_FAIL = 0xe3, | ||
| 92 | /* | ||
| 93 | * The received frame induces a failed security check according to | ||
| 94 | * the security suite. | ||
| 95 | */ | ||
| 96 | IEEE802154_FAILED_SECURITY_CHECK = 0xe4, | ||
| 97 | /* | ||
| 98 | * The frame resulting from secure processing has a length that is | ||
| 99 | * greater than aMACMaxFrameSize. | ||
| 100 | */ | ||
| 101 | IEEE802154_FRAME_TOO_LONG = 0xe5, | ||
| 102 | /* | ||
| 103 | * The requested GTS transmission failed because the specified GTS | ||
| 104 | * either did not have a transmit GTS direction or was not defined. | ||
| 105 | */ | ||
| 106 | IEEE802154_INVALID_GTS = 0xe6, | ||
| 107 | /* | ||
| 108 | * A request to purge an MSDU from the transaction queue was made using | ||
| 109 | * an MSDU handle that was not found in the transaction table. | ||
| 110 | */ | ||
| 111 | IEEE802154_INVALID_HANDLE = 0xe7, | ||
| 112 | /* A parameter in the primitive is out of the valid range.*/ | ||
| 113 | IEEE802154_INVALID_PARAMETER = 0xe8, | ||
| 114 | /* No acknowledgment was received after aMaxFrameRetries. */ | ||
| 115 | IEEE802154_NO_ACK = 0xe9, | ||
| 116 | /* A scan operation failed to find any network beacons.*/ | ||
| 117 | IEEE802154_NO_BEACON = 0xea, | ||
| 118 | /* No response data were available following a request. */ | ||
| 119 | IEEE802154_NO_DATA = 0xeb, | ||
| 120 | /* The operation failed because a short address was not allocated. */ | ||
| 121 | IEEE802154_NO_SHORT_ADDRESS = 0xec, | ||
| 122 | /* | ||
| 123 | * A receiver enable request was unsuccessful because it could not be | ||
| 124 | * completed within the CAP. | ||
| 125 | */ | ||
| 126 | IEEE802154_OUT_OF_CAP = 0xed, | ||
| 127 | /* | ||
| 128 | * A PAN identifier conflict has been detected and communicated to the | ||
| 129 | * PAN coordinator. | ||
| 130 | */ | ||
| 131 | IEEE802154_PANID_CONFLICT = 0xee, | ||
| 132 | /* A coordinator realignment command has been received. */ | ||
| 133 | IEEE802154_REALIGMENT = 0xef, | ||
| 134 | /* The transaction has expired and its information discarded. */ | ||
| 135 | IEEE802154_TRANSACTION_EXPIRED = 0xf0, | ||
| 136 | /* There is no capacity to store the transaction. */ | ||
| 137 | IEEE802154_TRANSACTION_OVERFLOW = 0xf1, | ||
| 138 | /* | ||
| 139 | * The transceiver was in the transmitter enabled state when the | ||
| 140 | * receiver was requested to be enabled. | ||
| 141 | */ | ||
| 142 | IEEE802154_TX_ACTIVE = 0xf2, | ||
| 143 | /* The appropriate key is not available in the ACL. */ | ||
| 144 | IEEE802154_UNAVAILABLE_KEY = 0xf3, | ||
| 145 | /* | ||
| 146 | * A SET/GET request was issued with the identifier of a PIB attribute | ||
| 147 | * that is not supported. | ||
| 148 | */ | ||
| 149 | IEEE802154_UNSUPPORTED_ATTR = 0xf4, | ||
| 150 | /* | ||
| 151 | * A request to perform a scan operation failed because the MLME was | ||
| 152 | * in the process of performing a previously initiated scan operation. | ||
| 153 | */ | ||
| 154 | IEEE802154_SCAN_IN_PROGRESS = 0xfc, | ||
| 155 | }; | ||
| 156 | |||
| 157 | |||
| 158 | #endif | ||
| 159 | |||
| 160 | |||
diff --git a/include/net/ieee802154/netdevice.h b/include/net/ieee802154/netdevice.h new file mode 100644 index 000000000000..e2506af3e7c8 --- /dev/null +++ b/include/net/ieee802154/netdevice.h | |||
| @@ -0,0 +1,115 @@ | |||
| 1 | /* | ||
| 2 | * An interface between IEEE802.15.4 device and rest of the kernel. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007, 2008, 2009 Siemens AG | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 | ||
| 8 | * as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License along | ||
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 18 | * | ||
| 19 | * Written by: | ||
| 20 | * Pavel Smolenskiy <pavel.smolenskiy@gmail.com> | ||
| 21 | * Maxim Gorbachyov <maxim.gorbachev@siemens.com> | ||
| 22 | * Maxim Osipov <maxim.osipov@siemens.com> | ||
| 23 | * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | ||
| 24 | */ | ||
| 25 | |||
| 26 | #ifndef IEEE802154_NETDEVICE_H | ||
| 27 | #define IEEE802154_NETDEVICE_H | ||
| 28 | |||
| 29 | /* | ||
| 30 | * A control block of skb passed between the ARPHRD_IEEE802154 device | ||
| 31 | * and other stack parts. | ||
| 32 | */ | ||
| 33 | struct ieee802154_mac_cb { | ||
| 34 | u8 lqi; | ||
| 35 | struct ieee802154_addr sa; | ||
| 36 | struct ieee802154_addr da; | ||
| 37 | u8 flags; | ||
| 38 | u8 seq; | ||
| 39 | }; | ||
| 40 | |||
| 41 | static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb) | ||
| 42 | { | ||
| 43 | return (struct ieee802154_mac_cb *)skb->cb; | ||
| 44 | } | ||
| 45 | |||
| 46 | #define MAC_CB_FLAG_TYPEMASK ((1 << 3) - 1) | ||
| 47 | |||
| 48 | #define MAC_CB_FLAG_ACKREQ (1 << 3) | ||
| 49 | #define MAC_CB_FLAG_SECEN (1 << 4) | ||
| 50 | #define MAC_CB_FLAG_INTRAPAN (1 << 5) | ||
| 51 | |||
| 52 | static inline int mac_cb_is_ackreq(struct sk_buff *skb) | ||
| 53 | { | ||
| 54 | return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ; | ||
| 55 | } | ||
| 56 | |||
| 57 | static inline int mac_cb_is_secen(struct sk_buff *skb) | ||
| 58 | { | ||
| 59 | return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN; | ||
| 60 | } | ||
| 61 | |||
| 62 | static inline int mac_cb_is_intrapan(struct sk_buff *skb) | ||
| 63 | { | ||
| 64 | return mac_cb(skb)->flags & MAC_CB_FLAG_INTRAPAN; | ||
| 65 | } | ||
| 66 | |||
| 67 | static inline int mac_cb_type(struct sk_buff *skb) | ||
| 68 | { | ||
| 69 | return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK; | ||
| 70 | } | ||
| 71 | |||
| 72 | #define IEEE802154_MAC_SCAN_ED 0 | ||
| 73 | #define IEEE802154_MAC_SCAN_ACTIVE 1 | ||
| 74 | #define IEEE802154_MAC_SCAN_PASSIVE 2 | ||
| 75 | #define IEEE802154_MAC_SCAN_ORPHAN 3 | ||
| 76 | |||
| 77 | /* | ||
| 78 | * This should be located at net_device->ml_priv | ||
| 79 | */ | ||
| 80 | struct ieee802154_mlme_ops { | ||
| 81 | int (*assoc_req)(struct net_device *dev, | ||
| 82 | struct ieee802154_addr *addr, | ||
| 83 | u8 channel, u8 cap); | ||
| 84 | int (*assoc_resp)(struct net_device *dev, | ||
| 85 | struct ieee802154_addr *addr, | ||
| 86 | u16 short_addr, u8 status); | ||
| 87 | int (*disassoc_req)(struct net_device *dev, | ||
| 88 | struct ieee802154_addr *addr, | ||
| 89 | u8 reason); | ||
| 90 | int (*start_req)(struct net_device *dev, | ||
| 91 | struct ieee802154_addr *addr, | ||
| 92 | u8 channel, u8 bcn_ord, u8 sf_ord, | ||
| 93 | u8 pan_coord, u8 blx, u8 coord_realign); | ||
| 94 | int (*scan_req)(struct net_device *dev, | ||
| 95 | u8 type, u32 channels, u8 duration); | ||
| 96 | |||
| 97 | /* | ||
| 98 | * FIXME: these should become the part of PIB/MIB interface. | ||
| 99 | * However we still don't have IB interface of any kind | ||
| 100 | */ | ||
| 101 | u16 (*get_pan_id)(struct net_device *dev); | ||
| 102 | u16 (*get_short_addr)(struct net_device *dev); | ||
| 103 | u8 (*get_dsn)(struct net_device *dev); | ||
| 104 | u8 (*get_bsn)(struct net_device *dev); | ||
| 105 | }; | ||
| 106 | |||
| 107 | static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops( | ||
| 108 | struct net_device *dev) | ||
| 109 | { | ||
| 110 | return dev->ml_priv; | ||
| 111 | } | ||
| 112 | |||
| 113 | #endif | ||
| 114 | |||
| 115 | |||
diff --git a/include/net/ieee802154/nl802154.h b/include/net/ieee802154/nl802154.h new file mode 100644 index 000000000000..78efcdf52b59 --- /dev/null +++ b/include/net/ieee802154/nl802154.h | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* | ||
| 2 | * nl802154.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007, 2008, 2009 Siemens AG | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 | ||
| 8 | * as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License along | ||
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef IEEE802154_NL_H | ||
| 22 | #define IEEE802154_NL_H | ||
| 23 | |||
| 24 | struct net_device; | ||
| 25 | struct ieee802154_addr; | ||
| 26 | |||
| 27 | int ieee802154_nl_assoc_indic(struct net_device *dev, | ||
| 28 | struct ieee802154_addr *addr, u8 cap); | ||
| 29 | int ieee802154_nl_assoc_confirm(struct net_device *dev, | ||
| 30 | u16 short_addr, u8 status); | ||
| 31 | int ieee802154_nl_disassoc_indic(struct net_device *dev, | ||
| 32 | struct ieee802154_addr *addr, u8 reason); | ||
| 33 | int ieee802154_nl_disassoc_confirm(struct net_device *dev, | ||
| 34 | u8 status); | ||
| 35 | int ieee802154_nl_scan_confirm(struct net_device *dev, | ||
| 36 | u8 status, u8 scan_type, u32 unscanned, | ||
| 37 | u8 *edl/*, struct list_head *pan_desc_list */); | ||
| 38 | int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid, | ||
| 39 | u16 coord_addr); | ||
| 40 | |||
| 41 | #endif | ||
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index f74665d7bea8..22c73a77cd99 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
| @@ -100,7 +100,7 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, | |||
| 100 | 100 | ||
| 101 | if (unlikely(sk = skb_steal_sock(skb))) | 101 | if (unlikely(sk = skb_steal_sock(skb))) |
| 102 | return sk; | 102 | return sk; |
| 103 | else return __inet6_lookup(dev_net(skb->dst->dev), hashinfo, | 103 | else return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo, |
| 104 | &ipv6_hdr(skb)->saddr, sport, | 104 | &ipv6_hdr(skb)->saddr, sport, |
| 105 | &ipv6_hdr(skb)->daddr, ntohs(dport), | 105 | &ipv6_hdr(skb)->daddr, ntohs(dport), |
| 106 | inet6_iif(skb)); | 106 | inet6_iif(skb)); |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index a44e2248b2ef..d522dcf3031a 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
| @@ -385,7 +385,7 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo, | |||
| 385 | if (unlikely(sk = skb_steal_sock(skb))) | 385 | if (unlikely(sk = skb_steal_sock(skb))) |
| 386 | return sk; | 386 | return sk; |
| 387 | else | 387 | else |
| 388 | return __inet_lookup(dev_net(skb->dst->dev), hashinfo, | 388 | return __inet_lookup(dev_net(skb_dst(skb)->dev), hashinfo, |
| 389 | iph->saddr, sport, | 389 | iph->saddr, sport, |
| 390 | iph->daddr, dport, inet_iif(skb)); | 390 | iph->daddr, dport, inet_iif(skb)); |
| 391 | } | 391 | } |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index de0ecc71cf03..47004f35cc7e 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #define _INET_SOCK_H | 17 | #define _INET_SOCK_H |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | #include <linux/kmemcheck.h> | ||
| 20 | #include <linux/string.h> | 21 | #include <linux/string.h> |
| 21 | #include <linux/types.h> | 22 | #include <linux/types.h> |
| 22 | #include <linux/jhash.h> | 23 | #include <linux/jhash.h> |
| @@ -66,14 +67,16 @@ struct inet_request_sock { | |||
| 66 | __be32 loc_addr; | 67 | __be32 loc_addr; |
| 67 | __be32 rmt_addr; | 68 | __be32 rmt_addr; |
| 68 | __be16 rmt_port; | 69 | __be16 rmt_port; |
| 69 | u16 snd_wscale : 4, | 70 | kmemcheck_bitfield_begin(flags); |
| 70 | rcv_wscale : 4, | 71 | u16 snd_wscale : 4, |
| 72 | rcv_wscale : 4, | ||
| 71 | tstamp_ok : 1, | 73 | tstamp_ok : 1, |
| 72 | sack_ok : 1, | 74 | sack_ok : 1, |
| 73 | wscale_ok : 1, | 75 | wscale_ok : 1, |
| 74 | ecn_ok : 1, | 76 | ecn_ok : 1, |
| 75 | acked : 1, | 77 | acked : 1, |
| 76 | no_srccheck: 1; | 78 | no_srccheck: 1; |
| 79 | kmemcheck_bitfield_end(flags); | ||
| 77 | struct ip_options *opt; | 80 | struct ip_options *opt; |
| 78 | }; | 81 | }; |
| 79 | 82 | ||
| @@ -130,7 +133,8 @@ struct inet_sock { | |||
| 130 | freebind:1, | 133 | freebind:1, |
| 131 | hdrincl:1, | 134 | hdrincl:1, |
| 132 | mc_loop:1, | 135 | mc_loop:1, |
| 133 | transparent:1; | 136 | transparent:1, |
| 137 | mc_all:1; | ||
| 134 | int mc_index; | 138 | int mc_index; |
| 135 | __be32 mc_addr; | 139 | __be32 mc_addr; |
| 136 | struct ip_mc_socklist *mc_list; | 140 | struct ip_mc_socklist *mc_list; |
| @@ -198,9 +202,12 @@ static inline int inet_sk_ehashfn(const struct sock *sk) | |||
| 198 | static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) | 202 | static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) |
| 199 | { | 203 | { |
| 200 | struct request_sock *req = reqsk_alloc(ops); | 204 | struct request_sock *req = reqsk_alloc(ops); |
| 205 | struct inet_request_sock *ireq = inet_rsk(req); | ||
| 201 | 206 | ||
| 202 | if (req != NULL) | 207 | if (req != NULL) { |
| 203 | inet_rsk(req)->opt = NULL; | 208 | kmemcheck_annotate_bitfield(ireq, flags); |
| 209 | ireq->opt = NULL; | ||
| 210 | } | ||
| 204 | 211 | ||
| 205 | return req; | 212 | return req; |
| 206 | } | 213 | } |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 4b8ece22b8e9..b63b80fac567 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #define _INET_TIMEWAIT_SOCK_ | 16 | #define _INET_TIMEWAIT_SOCK_ |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | #include <linux/kmemcheck.h> | ||
| 19 | #include <linux/list.h> | 20 | #include <linux/list.h> |
| 20 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 21 | #include <linux/timer.h> | 22 | #include <linux/timer.h> |
| @@ -127,10 +128,12 @@ struct inet_timewait_sock { | |||
| 127 | __be32 tw_rcv_saddr; | 128 | __be32 tw_rcv_saddr; |
| 128 | __be16 tw_dport; | 129 | __be16 tw_dport; |
| 129 | __u16 tw_num; | 130 | __u16 tw_num; |
| 131 | kmemcheck_bitfield_begin(flags); | ||
| 130 | /* And these are ours. */ | 132 | /* And these are ours. */ |
| 131 | __u8 tw_ipv6only:1, | 133 | __u8 tw_ipv6only:1, |
| 132 | tw_transparent:1; | 134 | tw_transparent:1; |
| 133 | /* 15 bits hole, try to pack */ | 135 | /* 14 bits hole, try to pack */ |
| 136 | kmemcheck_bitfield_end(flags); | ||
| 134 | __u16 tw_ipv6_offset; | 137 | __u16 tw_ipv6_offset; |
| 135 | unsigned long tw_ttd; | 138 | unsigned long tw_ttd; |
| 136 | struct inet_bind_bucket *tw_tb; | 139 | struct inet_bind_bucket *tw_tb; |
diff --git a/include/net/ip.h b/include/net/ip.h index 4ac7577f98d0..72c36926c26d 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
| @@ -168,7 +168,10 @@ struct ipv4_config | |||
| 168 | extern struct ipv4_config ipv4_config; | 168 | extern struct ipv4_config ipv4_config; |
| 169 | #define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field) | 169 | #define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field) |
| 170 | #define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field) | 170 | #define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field) |
| 171 | #define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.ip_statistics, field, val) | ||
| 171 | #define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val) | 172 | #define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val) |
| 173 | #define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS((net)->mib.ip_statistics, field, val) | ||
| 174 | #define IP_UPD_PO_STATS_BH(net, field, val) SNMP_UPD_PO_STATS_BH((net)->mib.ip_statistics, field, val) | ||
| 172 | #define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) | 175 | #define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) |
| 173 | #define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) | 176 | #define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) |
| 174 | #define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) | 177 | #define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 5f53db7e4e57..0e1b8aebaff8 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
| @@ -142,7 +142,7 @@ static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, | |||
| 142 | 142 | ||
| 143 | static inline int ipv6_unicast_destination(struct sk_buff *skb) | 143 | static inline int ipv6_unicast_destination(struct sk_buff *skb) |
| 144 | { | 144 | { |
| 145 | struct rt6_info *rt = (struct rt6_info *) skb->dst; | 145 | struct rt6_info *rt = (struct rt6_info *) skb_dst(skb); |
| 146 | 146 | ||
| 147 | return rt->rt6i_flags & RTF_LOCAL; | 147 | return rt->rt6i_flags & RTF_LOCAL; |
| 148 | } | 148 | } |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 8b12667f7a2b..ef91fe924ba4 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
| @@ -124,14 +124,12 @@ struct fib_result_nl { | |||
| 124 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 124 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
| 125 | 125 | ||
| 126 | #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) | 126 | #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) |
| 127 | #define FIB_RES_RESET(res) ((res).nh_sel = 0) | ||
| 128 | 127 | ||
| 129 | #define FIB_TABLE_HASHSZ 2 | 128 | #define FIB_TABLE_HASHSZ 2 |
| 130 | 129 | ||
| 131 | #else /* CONFIG_IP_ROUTE_MULTIPATH */ | 130 | #else /* CONFIG_IP_ROUTE_MULTIPATH */ |
| 132 | 131 | ||
| 133 | #define FIB_RES_NH(res) ((res).fi->fib_nh[0]) | 132 | #define FIB_RES_NH(res) ((res).fi->fib_nh[0]) |
| 134 | #define FIB_RES_RESET(res) | ||
| 135 | 133 | ||
| 136 | #define FIB_TABLE_HASHSZ 256 | 134 | #define FIB_TABLE_HASHSZ 256 |
| 137 | 135 | ||
| @@ -145,7 +143,6 @@ struct fib_result_nl { | |||
| 145 | struct fib_table { | 143 | struct fib_table { |
| 146 | struct hlist_node tb_hlist; | 144 | struct hlist_node tb_hlist; |
| 147 | u32 tb_id; | 145 | u32 tb_id; |
| 148 | unsigned tb_stamp; | ||
| 149 | int tb_default; | 146 | int tb_default; |
| 150 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); | 147 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); |
| 151 | int (*tb_insert)(struct fib_table *, struct fib_config *); | 148 | int (*tb_insert)(struct fib_table *, struct fib_config *); |
diff --git a/include/net/ipip.h b/include/net/ipip.h index fdf9bd743705..5d3036fa1511 100644 --- a/include/net/ipip.h +++ b/include/net/ipip.h | |||
| @@ -28,11 +28,18 @@ struct ip_tunnel | |||
| 28 | unsigned int prl_count; /* # of entries in PRL */ | 28 | unsigned int prl_count; /* # of entries in PRL */ |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | /* ISATAP: default interval between RS in secondy */ | ||
| 32 | #define IPTUNNEL_RS_DEFAULT_DELAY (900) | ||
| 33 | |||
| 31 | struct ip_tunnel_prl_entry | 34 | struct ip_tunnel_prl_entry |
| 32 | { | 35 | { |
| 33 | struct ip_tunnel_prl_entry *next; | 36 | struct ip_tunnel_prl_entry *next; |
| 34 | __be32 addr; | 37 | __be32 addr; |
| 35 | u16 flags; | 38 | u16 flags; |
| 39 | unsigned long rs_delay; | ||
| 40 | struct timer_list rs_timer; | ||
| 41 | struct ip_tunnel *tunnel; | ||
| 42 | spinlock_t lock; | ||
| 36 | }; | 43 | }; |
| 37 | 44 | ||
| 38 | #define IPTUNNEL_XMIT() do { \ | 45 | #define IPTUNNEL_XMIT() do { \ |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index c1f16fc49ade..f27fd83d67d8 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -126,15 +126,28 @@ extern struct ctl_path net_ipv6_ctl_path[]; | |||
| 126 | SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\ | 126 | SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\ |
| 127 | }) | 127 | }) |
| 128 | 128 | ||
| 129 | #define _DEVUPD(net, statname, modifier, idev, field, val) \ | ||
| 130 | ({ \ | ||
| 131 | struct inet6_dev *_idev = (idev); \ | ||
| 132 | if (likely(_idev != NULL)) \ | ||
| 133 | SNMP_UPD_PO_STATS##modifier((_idev)->stats.statname, field, (val)); \ | ||
| 134 | SNMP_UPD_PO_STATS##modifier((net)->mib.statname##_statistics, field, (val));\ | ||
| 135 | }) | ||
| 136 | |||
| 129 | /* MIBs */ | 137 | /* MIBs */ |
| 130 | 138 | ||
| 131 | #define IP6_INC_STATS(net, idev,field) \ | 139 | #define IP6_INC_STATS(net, idev,field) \ |
| 132 | _DEVINC(net, ipv6, , idev, field) | 140 | _DEVINC(net, ipv6, , idev, field) |
| 133 | #define IP6_INC_STATS_BH(net, idev,field) \ | 141 | #define IP6_INC_STATS_BH(net, idev,field) \ |
| 134 | _DEVINC(net, ipv6, _BH, idev, field) | 142 | _DEVINC(net, ipv6, _BH, idev, field) |
| 143 | #define IP6_ADD_STATS(net, idev,field,val) \ | ||
| 144 | _DEVADD(net, ipv6, , idev, field, val) | ||
| 135 | #define IP6_ADD_STATS_BH(net, idev,field,val) \ | 145 | #define IP6_ADD_STATS_BH(net, idev,field,val) \ |
| 136 | _DEVADD(net, ipv6, _BH, idev, field, val) | 146 | _DEVADD(net, ipv6, _BH, idev, field, val) |
| 137 | 147 | #define IP6_UPD_PO_STATS(net, idev,field,val) \ | |
| 148 | _DEVUPD(net, ipv6, , idev, field, val) | ||
| 149 | #define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ | ||
| 150 | _DEVUPD(net, ipv6, _BH, idev, field, val) | ||
| 138 | #define ICMP6_INC_STATS(net, idev, field) \ | 151 | #define ICMP6_INC_STATS(net, idev, field) \ |
| 139 | _DEVINC(net, icmpv6, , idev, field) | 152 | _DEVINC(net, icmpv6, , idev, field) |
| 140 | #define ICMP6_INC_STATS_BH(net, idev, field) \ | 153 | #define ICMP6_INC_STATS_BH(net, idev, field) \ |
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h index 85f80eadfa35..f82a1e877372 100644 --- a/include/net/iucv/af_iucv.h +++ b/include/net/iucv/af_iucv.h | |||
| @@ -73,8 +73,17 @@ struct iucv_sock { | |||
| 73 | struct sk_buff_head backlog_skb_q; | 73 | struct sk_buff_head backlog_skb_q; |
| 74 | struct sock_msg_q message_q; | 74 | struct sock_msg_q message_q; |
| 75 | unsigned int send_tag; | 75 | unsigned int send_tag; |
| 76 | u8 flags; | ||
| 77 | u16 msglimit; | ||
| 76 | }; | 78 | }; |
| 77 | 79 | ||
| 80 | /* iucv socket options (SOL_IUCV) */ | ||
| 81 | #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ | ||
| 82 | #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ | ||
| 83 | |||
| 84 | /* iucv related control messages (scm) */ | ||
| 85 | #define SCM_IUCV_TRGCLS 0x0001 /* target class control message */ | ||
| 86 | |||
| 78 | struct iucv_sock_list { | 87 | struct iucv_sock_list { |
| 79 | struct hlist_head head; | 88 | struct hlist_head head; |
| 80 | rwlock_t lock; | 89 | rwlock_t lock; |
| @@ -85,8 +94,6 @@ unsigned int iucv_sock_poll(struct file *file, struct socket *sock, | |||
| 85 | poll_table *wait); | 94 | poll_table *wait); |
| 86 | void iucv_sock_link(struct iucv_sock_list *l, struct sock *s); | 95 | void iucv_sock_link(struct iucv_sock_list *l, struct sock *s); |
| 87 | void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s); | 96 | void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s); |
| 88 | int iucv_sock_wait_state(struct sock *sk, int state, int state2, | ||
| 89 | unsigned long timeo); | ||
| 90 | int iucv_sock_wait_cnt(struct sock *sk, unsigned long timeo); | 97 | int iucv_sock_wait_cnt(struct sock *sk, unsigned long timeo); |
| 91 | void iucv_accept_enqueue(struct sock *parent, struct sock *sk); | 98 | void iucv_accept_enqueue(struct sock *parent, struct sock *sk); |
| 92 | void iucv_accept_unlink(struct sock *sk); | 99 | void iucv_accept_unlink(struct sock *sk); |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 3b83a80e3fe0..c06104476973 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include <linux/wireless.h> | 19 | #include <linux/wireless.h> |
| 20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
| 21 | #include <linux/ieee80211.h> | 21 | #include <linux/ieee80211.h> |
| 22 | #include <net/wireless.h> | ||
| 23 | #include <net/cfg80211.h> | 22 | #include <net/cfg80211.h> |
| 24 | 23 | ||
| 25 | /** | 24 | /** |
| @@ -74,22 +73,6 @@ | |||
| 74 | */ | 73 | */ |
| 75 | 74 | ||
| 76 | /** | 75 | /** |
| 77 | * struct ieee80211_ht_bss_info - describing BSS's HT characteristics | ||
| 78 | * | ||
| 79 | * This structure describes most essential parameters needed | ||
| 80 | * to describe 802.11n HT characteristics in a BSS. | ||
| 81 | * | ||
| 82 | * @primary_channel: channel number of primery channel | ||
| 83 | * @bss_cap: 802.11n's general BSS capabilities (e.g. channel width) | ||
| 84 | * @bss_op_mode: 802.11n's BSS operation modes (e.g. HT protection) | ||
| 85 | */ | ||
| 86 | struct ieee80211_ht_bss_info { | ||
| 87 | u8 primary_channel; | ||
| 88 | u8 bss_cap; /* use IEEE80211_HT_IE_CHA_ */ | ||
| 89 | u8 bss_op_mode; /* use IEEE80211_HT_IE_ */ | ||
| 90 | }; | ||
| 91 | |||
| 92 | /** | ||
| 93 | * enum ieee80211_max_queues - maximum number of queues | 76 | * enum ieee80211_max_queues - maximum number of queues |
| 94 | * | 77 | * |
| 95 | * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. | 78 | * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. |
| @@ -150,6 +133,13 @@ struct ieee80211_low_level_stats { | |||
| 150 | * @BSS_CHANGED_ERP_SLOT: slot timing changed | 133 | * @BSS_CHANGED_ERP_SLOT: slot timing changed |
| 151 | * @BSS_CHANGED_HT: 802.11n parameters changed | 134 | * @BSS_CHANGED_HT: 802.11n parameters changed |
| 152 | * @BSS_CHANGED_BASIC_RATES: Basic rateset changed | 135 | * @BSS_CHANGED_BASIC_RATES: Basic rateset changed |
| 136 | * @BSS_CHANGED_BEACON_INT: Beacon interval changed | ||
| 137 | * @BSS_CHANGED_BSSID: BSSID changed, for whatever | ||
| 138 | * reason (IBSS and managed mode) | ||
| 139 | * @BSS_CHANGED_BEACON: Beacon data changed, retrieve | ||
| 140 | * new beacon (beaconing modes) | ||
| 141 | * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be | ||
| 142 | * enabled/disabled (beaconing modes) | ||
| 153 | */ | 143 | */ |
| 154 | enum ieee80211_bss_change { | 144 | enum ieee80211_bss_change { |
| 155 | BSS_CHANGED_ASSOC = 1<<0, | 145 | BSS_CHANGED_ASSOC = 1<<0, |
| @@ -158,14 +148,10 @@ enum ieee80211_bss_change { | |||
| 158 | BSS_CHANGED_ERP_SLOT = 1<<3, | 148 | BSS_CHANGED_ERP_SLOT = 1<<3, |
| 159 | BSS_CHANGED_HT = 1<<4, | 149 | BSS_CHANGED_HT = 1<<4, |
| 160 | BSS_CHANGED_BASIC_RATES = 1<<5, | 150 | BSS_CHANGED_BASIC_RATES = 1<<5, |
| 161 | }; | 151 | BSS_CHANGED_BEACON_INT = 1<<6, |
| 162 | 152 | BSS_CHANGED_BSSID = 1<<7, | |
| 163 | /** | 153 | BSS_CHANGED_BEACON = 1<<8, |
| 164 | * struct ieee80211_bss_ht_conf - BSS's changing HT configuration | 154 | BSS_CHANGED_BEACON_ENABLED = 1<<9, |
| 165 | * @operation_mode: HT operation mode (like in &struct ieee80211_ht_info) | ||
| 166 | */ | ||
| 167 | struct ieee80211_bss_ht_conf { | ||
| 168 | u16 operation_mode; | ||
| 169 | }; | 155 | }; |
| 170 | 156 | ||
| 171 | /** | 157 | /** |
| @@ -187,12 +173,16 @@ struct ieee80211_bss_ht_conf { | |||
| 187 | * @timestamp: beacon timestamp | 173 | * @timestamp: beacon timestamp |
| 188 | * @beacon_int: beacon interval | 174 | * @beacon_int: beacon interval |
| 189 | * @assoc_capability: capabilities taken from assoc resp | 175 | * @assoc_capability: capabilities taken from assoc resp |
| 190 | * @ht: BSS's HT configuration | ||
| 191 | * @basic_rates: bitmap of basic rates, each bit stands for an | 176 | * @basic_rates: bitmap of basic rates, each bit stands for an |
| 192 | * index into the rate table configured by the driver in | 177 | * index into the rate table configured by the driver in |
| 193 | * the current band. | 178 | * the current band. |
| 179 | * @bssid: The BSSID for this BSS | ||
| 180 | * @enable_beacon: whether beaconing should be enabled or not | ||
| 181 | * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info). | ||
| 182 | * This field is only valid when the channel type is one of the HT types. | ||
| 194 | */ | 183 | */ |
| 195 | struct ieee80211_bss_conf { | 184 | struct ieee80211_bss_conf { |
| 185 | const u8 *bssid; | ||
| 196 | /* association related data */ | 186 | /* association related data */ |
| 197 | bool assoc; | 187 | bool assoc; |
| 198 | u16 aid; | 188 | u16 aid; |
| @@ -200,12 +190,13 @@ struct ieee80211_bss_conf { | |||
| 200 | bool use_cts_prot; | 190 | bool use_cts_prot; |
| 201 | bool use_short_preamble; | 191 | bool use_short_preamble; |
| 202 | bool use_short_slot; | 192 | bool use_short_slot; |
| 193 | bool enable_beacon; | ||
| 203 | u8 dtim_period; | 194 | u8 dtim_period; |
| 204 | u16 beacon_int; | 195 | u16 beacon_int; |
| 205 | u16 assoc_capability; | 196 | u16 assoc_capability; |
| 206 | u64 timestamp; | 197 | u64 timestamp; |
| 207 | u32 basic_rates; | 198 | u32 basic_rates; |
| 208 | struct ieee80211_bss_ht_conf ht; | 199 | u16 ht_operation_mode; |
| 209 | }; | 200 | }; |
| 210 | 201 | ||
| 211 | /** | 202 | /** |
| @@ -248,6 +239,8 @@ struct ieee80211_bss_conf { | |||
| 248 | * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, | 239 | * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, |
| 249 | * used to indicate that a pending frame requires TX processing before | 240 | * used to indicate that a pending frame requires TX processing before |
| 250 | * it can be sent out. | 241 | * it can be sent out. |
| 242 | * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211, | ||
| 243 | * used to indicate that a frame was already retried due to PS | ||
| 251 | */ | 244 | */ |
| 252 | enum mac80211_tx_control_flags { | 245 | enum mac80211_tx_control_flags { |
| 253 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), | 246 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), |
| @@ -265,6 +258,7 @@ enum mac80211_tx_control_flags { | |||
| 265 | IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), | 258 | IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), |
| 266 | IEEE80211_TX_INTFL_RCALGO = BIT(13), | 259 | IEEE80211_TX_INTFL_RCALGO = BIT(13), |
| 267 | IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), | 260 | IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), |
| 261 | IEEE80211_TX_INTFL_RETRIED = BIT(15), | ||
| 268 | }; | 262 | }; |
| 269 | 263 | ||
| 270 | /** | 264 | /** |
| @@ -518,52 +512,76 @@ struct ieee80211_rx_status { | |||
| 518 | * Flags to define PHY configuration options | 512 | * Flags to define PHY configuration options |
| 519 | * | 513 | * |
| 520 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) | 514 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) |
| 521 | * @IEEE80211_CONF_PS: Enable 802.11 power save mode | 515 | * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only) |
| 516 | * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set | ||
| 517 | * the driver should be prepared to handle configuration requests but | ||
| 518 | * may turn the device off as much as possible. Typically, this flag will | ||
| 519 | * be set when an interface is set UP but not associated or scanning, but | ||
| 520 | * it can also be unset in that case when monitor interfaces are active. | ||
| 522 | */ | 521 | */ |
| 523 | enum ieee80211_conf_flags { | 522 | enum ieee80211_conf_flags { |
| 524 | IEEE80211_CONF_RADIOTAP = (1<<0), | 523 | IEEE80211_CONF_RADIOTAP = (1<<0), |
| 525 | IEEE80211_CONF_PS = (1<<1), | 524 | IEEE80211_CONF_PS = (1<<1), |
| 525 | IEEE80211_CONF_IDLE = (1<<2), | ||
| 526 | }; | 526 | }; |
| 527 | 527 | ||
| 528 | 528 | ||
| 529 | /** | 529 | /** |
| 530 | * enum ieee80211_conf_changed - denotes which configuration changed | 530 | * enum ieee80211_conf_changed - denotes which configuration changed |
| 531 | * | 531 | * |
| 532 | * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed | 532 | * @_IEEE80211_CONF_CHANGE_RADIO_ENABLED: DEPRECATED |
| 533 | * @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed | ||
| 534 | * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed | 533 | * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed |
| 535 | * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed | 534 | * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed |
| 536 | * @IEEE80211_CONF_CHANGE_PS: the PS flag changed | 535 | * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed |
| 537 | * @IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT: the dynamic PS timeout changed | ||
| 538 | * @IEEE80211_CONF_CHANGE_POWER: the TX power changed | 536 | * @IEEE80211_CONF_CHANGE_POWER: the TX power changed |
| 539 | * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed | 537 | * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed |
| 540 | * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed | 538 | * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed |
| 539 | * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed | ||
| 541 | */ | 540 | */ |
| 542 | enum ieee80211_conf_changed { | 541 | enum ieee80211_conf_changed { |
| 543 | IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), | 542 | _IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), |
| 544 | IEEE80211_CONF_CHANGE_BEACON_INTERVAL = BIT(1), | ||
| 545 | IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), | 543 | IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), |
| 546 | IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), | 544 | IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), |
| 547 | IEEE80211_CONF_CHANGE_PS = BIT(4), | 545 | IEEE80211_CONF_CHANGE_PS = BIT(4), |
| 548 | IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT = BIT(5), | 546 | IEEE80211_CONF_CHANGE_POWER = BIT(5), |
| 549 | IEEE80211_CONF_CHANGE_POWER = BIT(6), | 547 | IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), |
| 550 | IEEE80211_CONF_CHANGE_CHANNEL = BIT(7), | 548 | IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), |
| 551 | IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(8), | 549 | IEEE80211_CONF_CHANGE_IDLE = BIT(8), |
| 552 | }; | 550 | }; |
| 553 | 551 | ||
| 552 | static inline __deprecated enum ieee80211_conf_changed | ||
| 553 | __IEEE80211_CONF_CHANGE_RADIO_ENABLED(void) | ||
| 554 | { | ||
| 555 | return _IEEE80211_CONF_CHANGE_RADIO_ENABLED; | ||
| 556 | } | ||
| 557 | #define IEEE80211_CONF_CHANGE_RADIO_ENABLED \ | ||
| 558 | __IEEE80211_CONF_CHANGE_RADIO_ENABLED() | ||
| 559 | |||
| 554 | /** | 560 | /** |
| 555 | * struct ieee80211_conf - configuration of the device | 561 | * struct ieee80211_conf - configuration of the device |
| 556 | * | 562 | * |
| 557 | * This struct indicates how the driver shall configure the hardware. | 563 | * This struct indicates how the driver shall configure the hardware. |
| 558 | * | 564 | * |
| 565 | * @flags: configuration flags defined above | ||
| 566 | * | ||
| 559 | * @radio_enabled: when zero, driver is required to switch off the radio. | 567 | * @radio_enabled: when zero, driver is required to switch off the radio. |
| 560 | * @beacon_int: beacon interval (TODO make interface config) | 568 | * @beacon_int: DEPRECATED, DO NOT USE |
| 569 | * | ||
| 561 | * @listen_interval: listen interval in units of beacon interval | 570 | * @listen_interval: listen interval in units of beacon interval |
| 562 | * @flags: configuration flags defined above | 571 | * @max_sleep_period: the maximum number of beacon intervals to sleep for |
| 572 | * before checking the beacon for a TIM bit (managed mode only); this | ||
| 573 | * value will be only achievable between DTIM frames, the hardware | ||
| 574 | * needs to check for the multicast traffic bit in DTIM beacons. | ||
| 575 | * This variable is valid only when the CONF_PS flag is set. | ||
| 576 | * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the | ||
| 577 | * powersave documentation below. This variable is valid only when | ||
| 578 | * the CONF_PS flag is set. | ||
| 579 | * | ||
| 563 | * @power_level: requested transmit power (in dBm) | 580 | * @power_level: requested transmit power (in dBm) |
| 564 | * @dynamic_ps_timeout: dynamic powersave timeout (in ms) | 581 | * |
| 565 | * @channel: the channel to tune to | 582 | * @channel: the channel to tune to |
| 566 | * @channel_type: the channel (HT) type | 583 | * @channel_type: the channel (HT) type |
| 584 | * | ||
| 567 | * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame | 585 | * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame |
| 568 | * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, | 586 | * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, |
| 569 | * but actually means the number of transmissions not the number of retries | 587 | * but actually means the number of transmissions not the number of retries |
| @@ -572,12 +590,13 @@ enum ieee80211_conf_changed { | |||
| 572 | * number of transmissions not the number of retries | 590 | * number of transmissions not the number of retries |
| 573 | */ | 591 | */ |
| 574 | struct ieee80211_conf { | 592 | struct ieee80211_conf { |
| 575 | int beacon_int; | 593 | int __deprecated beacon_int; |
| 576 | u32 flags; | 594 | u32 flags; |
| 577 | int power_level, dynamic_ps_timeout; | 595 | int power_level, dynamic_ps_timeout; |
| 596 | int max_sleep_period; | ||
| 578 | 597 | ||
| 579 | u16 listen_interval; | 598 | u16 listen_interval; |
| 580 | bool radio_enabled; | 599 | bool __deprecated radio_enabled; |
| 581 | 600 | ||
| 582 | u8 long_frame_max_tx_count, short_frame_max_tx_count; | 601 | u8 long_frame_max_tx_count, short_frame_max_tx_count; |
| 583 | 602 | ||
| @@ -640,37 +659,6 @@ struct ieee80211_if_init_conf { | |||
| 640 | }; | 659 | }; |
| 641 | 660 | ||
| 642 | /** | 661 | /** |
| 643 | * enum ieee80211_if_conf_change - interface config change flags | ||
| 644 | * | ||
| 645 | * @IEEE80211_IFCC_BSSID: The BSSID changed. | ||
| 646 | * @IEEE80211_IFCC_BEACON: The beacon for this interface changed | ||
| 647 | * (currently AP and MESH only), use ieee80211_beacon_get(). | ||
| 648 | * @IEEE80211_IFCC_BEACON_ENABLED: The enable_beacon value changed. | ||
| 649 | */ | ||
| 650 | enum ieee80211_if_conf_change { | ||
| 651 | IEEE80211_IFCC_BSSID = BIT(0), | ||
| 652 | IEEE80211_IFCC_BEACON = BIT(1), | ||
| 653 | IEEE80211_IFCC_BEACON_ENABLED = BIT(2), | ||
| 654 | }; | ||
| 655 | |||
| 656 | /** | ||
| 657 | * struct ieee80211_if_conf - configuration of an interface | ||
| 658 | * | ||
| 659 | * @changed: parameters that have changed, see &enum ieee80211_if_conf_change. | ||
| 660 | * @bssid: BSSID of the network we are associated to/creating. | ||
| 661 | * @enable_beacon: Indicates whether beacons can be sent. | ||
| 662 | * This is valid only for AP/IBSS/MESH modes. | ||
| 663 | * | ||
| 664 | * This structure is passed to the config_interface() callback of | ||
| 665 | * &struct ieee80211_hw. | ||
| 666 | */ | ||
| 667 | struct ieee80211_if_conf { | ||
| 668 | u32 changed; | ||
| 669 | const u8 *bssid; | ||
| 670 | bool enable_beacon; | ||
| 671 | }; | ||
| 672 | |||
| 673 | /** | ||
| 674 | * enum ieee80211_key_alg - key algorithm | 662 | * enum ieee80211_key_alg - key algorithm |
| 675 | * @ALG_WEP: WEP40 or WEP104 | 663 | * @ALG_WEP: WEP40 or WEP104 |
| 676 | * @ALG_TKIP: TKIP | 664 | * @ALG_TKIP: TKIP |
| @@ -685,16 +673,6 @@ enum ieee80211_key_alg { | |||
| 685 | }; | 673 | }; |
| 686 | 674 | ||
| 687 | /** | 675 | /** |
| 688 | * enum ieee80211_key_len - key length | ||
| 689 | * @LEN_WEP40: WEP 5-byte long key | ||
| 690 | * @LEN_WEP104: WEP 13-byte long key | ||
| 691 | */ | ||
| 692 | enum ieee80211_key_len { | ||
| 693 | LEN_WEP40 = 5, | ||
| 694 | LEN_WEP104 = 13, | ||
| 695 | }; | ||
| 696 | |||
| 697 | /** | ||
| 698 | * enum ieee80211_key_flags - key flags | 676 | * enum ieee80211_key_flags - key flags |
| 699 | * | 677 | * |
| 700 | * These flags are used for communication about keys between the driver | 678 | * These flags are used for communication about keys between the driver |
| @@ -1109,11 +1087,9 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
| 1109 | * need software support for parsing the TIM bitmap. This is also supported | 1087 | * need software support for parsing the TIM bitmap. This is also supported |
| 1110 | * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and | 1088 | * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and |
| 1111 | * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still | 1089 | * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still |
| 1112 | * required to pass up beacons. Additionally, in this case, mac80211 will | 1090 | * required to pass up beacons. The hardware is still required to handle |
| 1113 | * wake up the hardware when multicast traffic is announced in the beacon. | 1091 | * waking up for multicast traffic; if it cannot the driver must handle that |
| 1114 | * | 1092 | * as best as it can, mac80211 is too slow. |
| 1115 | * FIXME: I don't think we can be fast enough in software when we want to | ||
| 1116 | * receive multicast traffic? | ||
| 1117 | * | 1093 | * |
| 1118 | * Dynamic powersave mode is an extension to normal powersave mode in which | 1094 | * Dynamic powersave mode is an extension to normal powersave mode in which |
| 1119 | * the hardware stays awake for a user-specified period of time after sending | 1095 | * the hardware stays awake for a user-specified period of time after sending |
| @@ -1134,11 +1110,53 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
| 1134 | * way the host will only receive beacons where some relevant information | 1110 | * way the host will only receive beacons where some relevant information |
| 1135 | * (for example ERP protection or WMM settings) have changed. | 1111 | * (for example ERP protection or WMM settings) have changed. |
| 1136 | * | 1112 | * |
| 1137 | * Beacon filter support is informed with %IEEE80211_HW_BEACON_FILTER flag. | 1113 | * Beacon filter support is advertised with the %IEEE80211_HW_BEACON_FILTER |
| 1138 | * The driver needs to enable beacon filter support whenever power save is | 1114 | * hardware capability. The driver needs to enable beacon filter support |
| 1139 | * enabled, that is %IEEE80211_CONF_PS is set. When power save is enabled, | 1115 | * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When |
| 1140 | * the stack will not check for beacon miss at all and the driver needs to | 1116 | * power save is enabled, the stack will not check for beacon loss and the |
| 1141 | * notify about complete loss of beacons with ieee80211_beacon_loss(). | 1117 | * driver needs to notify about loss of beacons with ieee80211_beacon_loss(). |
| 1118 | * | ||
| 1119 | * The time (or number of beacons missed) until the firmware notifies the | ||
| 1120 | * driver of a beacon loss event (which in turn causes the driver to call | ||
| 1121 | * ieee80211_beacon_loss()) should be configurable and will be controlled | ||
| 1122 | * by mac80211 and the roaming algorithm in the future. | ||
| 1123 | * | ||
| 1124 | * Since there may be constantly changing information elements that nothing | ||
| 1125 | * in the software stack cares about, we will, in the future, have mac80211 | ||
| 1126 | * tell the driver which information elements are interesting in the sense | ||
| 1127 | * that we want to see changes in them. This will include | ||
| 1128 | * - a list of information element IDs | ||
| 1129 | * - a list of OUIs for the vendor information element | ||
| 1130 | * | ||
| 1131 | * Ideally, the hardware would filter out any beacons without changes in the | ||
| 1132 | * requested elements, but if it cannot support that it may, at the expense | ||
| 1133 | * of some efficiency, filter out only a subset. For example, if the device | ||
| 1134 | * doesn't support checking for OUIs it should pass up all changes in all | ||
| 1135 | * vendor information elements. | ||
| 1136 | * | ||
| 1137 | * Note that change, for the sake of simplification, also includes information | ||
| 1138 | * elements appearing or disappearing from the beacon. | ||
| 1139 | * | ||
| 1140 | * Some hardware supports an "ignore list" instead, just make sure nothing | ||
| 1141 | * that was requested is on the ignore list, and include commonly changing | ||
| 1142 | * information element IDs in the ignore list, for example 11 (BSS load) and | ||
| 1143 | * the various vendor-assigned IEs with unknown contents (128, 129, 133-136, | ||
| 1144 | * 149, 150, 155, 156, 173, 176, 178, 179, 219); for forward compatibility | ||
| 1145 | * it could also include some currently unused IDs. | ||
| 1146 | * | ||
| 1147 | * | ||
| 1148 | * In addition to these capabilities, hardware should support notifying the | ||
| 1149 | * host of changes in the beacon RSSI. This is relevant to implement roaming | ||
| 1150 | * when no traffic is flowing (when traffic is flowing we see the RSSI of | ||
| 1151 | * the received data packets). This can consist in notifying the host when | ||
| 1152 | * the RSSI changes significantly or when it drops below or rises above | ||
| 1153 | * configurable thresholds. In the future these thresholds will also be | ||
| 1154 | * configured by mac80211 (which gets them from userspace) to implement | ||
| 1155 | * them as the roaming algorithm requires. | ||
| 1156 | * | ||
| 1157 | * If the hardware cannot implement this, the driver should ask it to | ||
| 1158 | * periodically pass beacon frames to the host so that software can do the | ||
| 1159 | * signal strength threshold checking. | ||
| 1142 | */ | 1160 | */ |
| 1143 | 1161 | ||
| 1144 | /** | 1162 | /** |
| @@ -1298,10 +1316,6 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1298 | * This function should never fail but returns a negative error code | 1316 | * This function should never fail but returns a negative error code |
| 1299 | * if it does. | 1317 | * if it does. |
| 1300 | * | 1318 | * |
| 1301 | * @config_interface: Handler for configuration requests related to interfaces | ||
| 1302 | * (e.g. BSSID changes.) | ||
| 1303 | * Returns a negative error code which will be seen in userspace. | ||
| 1304 | * | ||
| 1305 | * @bss_info_changed: Handler for configuration requests related to BSS | 1319 | * @bss_info_changed: Handler for configuration requests related to BSS |
| 1306 | * parameters that may vary during BSS's lifespan, and may affect low | 1320 | * parameters that may vary during BSS's lifespan, and may affect low |
| 1307 | * level driver (e.g. assoc/disassoc status, erp parameters). | 1321 | * level driver (e.g. assoc/disassoc status, erp parameters). |
| @@ -1330,11 +1344,14 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1330 | * the scan state machine in stack. The scan must honour the channel | 1344 | * the scan state machine in stack. The scan must honour the channel |
| 1331 | * configuration done by the regulatory agent in the wiphy's | 1345 | * configuration done by the regulatory agent in the wiphy's |
| 1332 | * registered bands. The hardware (or the driver) needs to make sure | 1346 | * registered bands. The hardware (or the driver) needs to make sure |
| 1333 | * that power save is disabled. When the scan finishes, | 1347 | * that power save is disabled. |
| 1334 | * ieee80211_scan_completed() must be called; note that it also must | 1348 | * The @req ie/ie_len members are rewritten by mac80211 to contain the |
| 1335 | * be called when the scan cannot finish because the hardware is | 1349 | * entire IEs after the SSID, so that drivers need not look at these |
| 1336 | * turned off! Anything else is a bug! Returns a negative error code | 1350 | * at all but just send them after the SSID -- mac80211 includes the |
| 1337 | * which will be seen in userspace. | 1351 | * (extended) supported rates and HT information (where applicable). |
| 1352 | * When the scan finishes, ieee80211_scan_completed() must be called; | ||
| 1353 | * note that it also must be called when the scan cannot finish due to | ||
| 1354 | * any error unless this callback returned a negative error code. | ||
| 1338 | * | 1355 | * |
| 1339 | * @sw_scan_start: Notifier function that is called just before a software scan | 1356 | * @sw_scan_start: Notifier function that is called just before a software scan |
| 1340 | * is started. Can be NULL, if the driver doesn't need this notification. | 1357 | * is started. Can be NULL, if the driver doesn't need this notification. |
| @@ -1390,6 +1407,10 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1390 | * is the first frame we expect to perform the action on. Notice | 1407 | * is the first frame we expect to perform the action on. Notice |
| 1391 | * that TX/RX_STOP can pass NULL for this parameter. | 1408 | * that TX/RX_STOP can pass NULL for this parameter. |
| 1392 | * Returns a negative error code on failure. | 1409 | * Returns a negative error code on failure. |
| 1410 | * | ||
| 1411 | * @rfkill_poll: Poll rfkill hardware state. If you need this, you also | ||
| 1412 | * need to set wiphy->rfkill_poll to %true before registration, | ||
| 1413 | * and need to call wiphy_rfkill_set_hw_state() in the callback. | ||
| 1393 | */ | 1414 | */ |
| 1394 | struct ieee80211_ops { | 1415 | struct ieee80211_ops { |
| 1395 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); | 1416 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); |
| @@ -1400,9 +1421,6 @@ struct ieee80211_ops { | |||
| 1400 | void (*remove_interface)(struct ieee80211_hw *hw, | 1421 | void (*remove_interface)(struct ieee80211_hw *hw, |
| 1401 | struct ieee80211_if_init_conf *conf); | 1422 | struct ieee80211_if_init_conf *conf); |
| 1402 | int (*config)(struct ieee80211_hw *hw, u32 changed); | 1423 | int (*config)(struct ieee80211_hw *hw, u32 changed); |
| 1403 | int (*config_interface)(struct ieee80211_hw *hw, | ||
| 1404 | struct ieee80211_vif *vif, | ||
| 1405 | struct ieee80211_if_conf *conf); | ||
| 1406 | void (*bss_info_changed)(struct ieee80211_hw *hw, | 1424 | void (*bss_info_changed)(struct ieee80211_hw *hw, |
| 1407 | struct ieee80211_vif *vif, | 1425 | struct ieee80211_vif *vif, |
| 1408 | struct ieee80211_bss_conf *info, | 1426 | struct ieee80211_bss_conf *info, |
| @@ -1441,6 +1459,8 @@ struct ieee80211_ops { | |||
| 1441 | int (*ampdu_action)(struct ieee80211_hw *hw, | 1459 | int (*ampdu_action)(struct ieee80211_hw *hw, |
| 1442 | enum ieee80211_ampdu_mlme_action action, | 1460 | enum ieee80211_ampdu_mlme_action action, |
| 1443 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); | 1461 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
| 1462 | |||
| 1463 | void (*rfkill_poll)(struct ieee80211_hw *hw); | ||
| 1444 | }; | 1464 | }; |
| 1445 | 1465 | ||
| 1446 | /** | 1466 | /** |
| @@ -1572,6 +1592,20 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw); | |||
| 1572 | */ | 1592 | */ |
| 1573 | void ieee80211_free_hw(struct ieee80211_hw *hw); | 1593 | void ieee80211_free_hw(struct ieee80211_hw *hw); |
| 1574 | 1594 | ||
| 1595 | /** | ||
| 1596 | * ieee80211_restart_hw - restart hardware completely | ||
| 1597 | * | ||
| 1598 | * Call this function when the hardware was restarted for some reason | ||
| 1599 | * (hardware error, ...) and the driver is unable to restore its state | ||
| 1600 | * by itself. mac80211 assumes that at this point the driver/hardware | ||
| 1601 | * is completely uninitialised and stopped, it starts the process by | ||
| 1602 | * calling the ->start() operation. The driver will need to reset all | ||
| 1603 | * internal state that it has prior to calling this function. | ||
| 1604 | * | ||
| 1605 | * @hw: the hardware to restart | ||
| 1606 | */ | ||
| 1607 | void ieee80211_restart_hw(struct ieee80211_hw *hw); | ||
| 1608 | |||
| 1575 | /* trick to avoid symbol clashes with the ieee80211 subsystem */ | 1609 | /* trick to avoid symbol clashes with the ieee80211 subsystem */ |
| 1576 | void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, | 1610 | void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, |
| 1577 | struct ieee80211_rx_status *status); | 1611 | struct ieee80211_rx_status *status); |
| @@ -1775,24 +1809,6 @@ struct sk_buff * | |||
| 1775 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); | 1809 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); |
| 1776 | 1810 | ||
| 1777 | /** | 1811 | /** |
| 1778 | * ieee80211_get_hdrlen_from_skb - get header length from data | ||
| 1779 | * | ||
| 1780 | * Given an skb with a raw 802.11 header at the data pointer this function | ||
| 1781 | * returns the 802.11 header length in bytes (not including encryption | ||
| 1782 | * headers). If the data in the sk_buff is too short to contain a valid 802.11 | ||
| 1783 | * header the function returns 0. | ||
| 1784 | * | ||
| 1785 | * @skb: the frame | ||
| 1786 | */ | ||
| 1787 | unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); | ||
| 1788 | |||
| 1789 | /** | ||
| 1790 | * ieee80211_hdrlen - get header length in bytes from frame control | ||
| 1791 | * @fc: frame control field in little-endian format | ||
| 1792 | */ | ||
| 1793 | unsigned int ieee80211_hdrlen(__le16 fc); | ||
| 1794 | |||
| 1795 | /** | ||
| 1796 | * ieee80211_get_tkip_key - get a TKIP rc4 for skb | 1812 | * ieee80211_get_tkip_key - get a TKIP rc4 for skb |
| 1797 | * | 1813 | * |
| 1798 | * This function computes a TKIP rc4 key for an skb. It computes | 1814 | * This function computes a TKIP rc4 key for an skb. It computes |
diff --git a/include/net/netfilter/ipv4/nf_conntrack_icmp.h b/include/net/netfilter/ipv4/nf_conntrack_icmp.h deleted file mode 100644 index 3dd22cff23ec..000000000000 --- a/include/net/netfilter/ipv4/nf_conntrack_icmp.h +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | #ifndef _NF_CONNTRACK_ICMP_H | ||
| 2 | #define _NF_CONNTRACK_ICMP_H | ||
| 3 | /* ICMP tracking. */ | ||
| 4 | #include <asm/atomic.h> | ||
| 5 | |||
| 6 | struct ip_ct_icmp | ||
| 7 | { | ||
| 8 | /* Optimization: when number in == number out, forget immediately. */ | ||
| 9 | atomic_t count; | ||
| 10 | }; | ||
| 11 | #endif /* _NF_CONNTRACK_ICMP_H */ | ||
diff --git a/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h b/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h index 86591afda29c..67edd50a398a 100644 --- a/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h +++ b/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | 9 | ||
| 10 | #ifndef _NF_CONNTRACK_ICMPV6_H | 10 | #ifndef _NF_CONNTRACK_ICMPV6_H |
| 11 | #define _NF_CONNTRACK_ICMPV6_H | 11 | #define _NF_CONNTRACK_ICMPV6_H |
| 12 | #include <asm/atomic.h> | ||
| 13 | 12 | ||
| 14 | #ifndef ICMPV6_NI_QUERY | 13 | #ifndef ICMPV6_NI_QUERY |
| 15 | #define ICMPV6_NI_QUERY 139 | 14 | #define ICMPV6_NI_QUERY 139 |
| @@ -18,10 +17,4 @@ | |||
| 18 | #define ICMPV6_NI_REPLY 140 | 17 | #define ICMPV6_NI_REPLY 140 |
| 19 | #endif | 18 | #endif |
| 20 | 19 | ||
| 21 | struct nf_ct_icmpv6 | ||
| 22 | { | ||
| 23 | /* Optimization: when number in == number out, forget immediately. */ | ||
| 24 | atomic_t count; | ||
| 25 | }; | ||
| 26 | |||
| 27 | #endif /* _NF_CONNTRACK_ICMPV6_H */ | 20 | #endif /* _NF_CONNTRACK_ICMPV6_H */ |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 6c3f964de9e1..a632689b61b4 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include <linux/netfilter/nf_conntrack_dccp.h> | 23 | #include <linux/netfilter/nf_conntrack_dccp.h> |
| 24 | #include <linux/netfilter/nf_conntrack_sctp.h> | 24 | #include <linux/netfilter/nf_conntrack_sctp.h> |
| 25 | #include <linux/netfilter/nf_conntrack_proto_gre.h> | 25 | #include <linux/netfilter/nf_conntrack_proto_gre.h> |
| 26 | #include <net/netfilter/ipv4/nf_conntrack_icmp.h> | ||
| 27 | #include <net/netfilter/ipv6/nf_conntrack_icmpv6.h> | 26 | #include <net/netfilter/ipv6/nf_conntrack_icmpv6.h> |
| 28 | 27 | ||
| 29 | #include <net/netfilter/nf_conntrack_tuple.h> | 28 | #include <net/netfilter/nf_conntrack_tuple.h> |
| @@ -34,8 +33,6 @@ union nf_conntrack_proto { | |||
| 34 | struct nf_ct_dccp dccp; | 33 | struct nf_ct_dccp dccp; |
| 35 | struct ip_ct_sctp sctp; | 34 | struct ip_ct_sctp sctp; |
| 36 | struct ip_ct_tcp tcp; | 35 | struct ip_ct_tcp tcp; |
| 37 | struct ip_ct_icmp icmp; | ||
| 38 | struct nf_ct_icmpv6 icmpv6; | ||
| 39 | struct nf_ct_gre gre; | 36 | struct nf_ct_gre gre; |
| 40 | }; | 37 | }; |
| 41 | 38 | ||
| @@ -96,6 +93,8 @@ struct nf_conn { | |||
| 96 | plus 1 for any connection(s) we are `master' for */ | 93 | plus 1 for any connection(s) we are `master' for */ |
| 97 | struct nf_conntrack ct_general; | 94 | struct nf_conntrack ct_general; |
| 98 | 95 | ||
| 96 | spinlock_t lock; | ||
| 97 | |||
| 99 | /* XXX should I move this to the tail ? - Y.K */ | 98 | /* XXX should I move this to the tail ? - Y.K */ |
| 100 | /* These are my tuples; original and reply */ | 99 | /* These are my tuples; original and reply */ |
| 101 | struct nf_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; | 100 | struct nf_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; |
| @@ -144,6 +143,8 @@ static inline u_int8_t nf_ct_protonum(const struct nf_conn *ct) | |||
| 144 | return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum; | 143 | return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum; |
| 145 | } | 144 | } |
| 146 | 145 | ||
| 146 | #define nf_ct_tuple(ct, dir) (&(ct)->tuplehash[dir].tuple) | ||
| 147 | |||
| 147 | /* get master conntrack via master expectation */ | 148 | /* get master conntrack via master expectation */ |
| 148 | #define master_ct(conntr) (conntr->master) | 149 | #define master_ct(conntr) (conntr->master) |
| 149 | 150 | ||
| @@ -200,8 +201,10 @@ extern struct nf_conntrack_tuple_hash * | |||
| 200 | __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); | 201 | __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); |
| 201 | 202 | ||
| 202 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); | 203 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); |
| 204 | extern void nf_ct_delete_from_lists(struct nf_conn *ct); | ||
| 205 | extern void nf_ct_insert_dying_list(struct nf_conn *ct); | ||
| 203 | 206 | ||
| 204 | extern void nf_conntrack_flush(struct net *net, u32 pid, int report); | 207 | extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report); |
| 205 | 208 | ||
| 206 | extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, | 209 | extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, |
| 207 | unsigned int nhoff, u_int16_t l3num, | 210 | unsigned int nhoff, u_int16_t l3num, |
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h index 0ff0dc69ca4a..4f20d58e2ab7 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h | |||
| @@ -6,17 +6,54 @@ | |||
| 6 | #define _NF_CONNTRACK_ECACHE_H | 6 | #define _NF_CONNTRACK_ECACHE_H |
| 7 | #include <net/netfilter/nf_conntrack.h> | 7 | #include <net/netfilter/nf_conntrack.h> |
| 8 | 8 | ||
| 9 | #include <linux/notifier.h> | ||
| 10 | #include <linux/interrupt.h> | ||
| 11 | #include <net/net_namespace.h> | 9 | #include <net/net_namespace.h> |
| 12 | #include <net/netfilter/nf_conntrack_expect.h> | 10 | #include <net/netfilter/nf_conntrack_expect.h> |
| 11 | #include <linux/netfilter/nf_conntrack_common.h> | ||
| 12 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | ||
| 13 | #include <net/netfilter/nf_conntrack_extend.h> | ||
| 14 | |||
| 15 | /* Connection tracking event types */ | ||
| 16 | enum ip_conntrack_events | ||
| 17 | { | ||
| 18 | IPCT_NEW = 0, /* new conntrack */ | ||
| 19 | IPCT_RELATED = 1, /* related conntrack */ | ||
| 20 | IPCT_DESTROY = 2, /* destroyed conntrack */ | ||
| 21 | IPCT_STATUS = 3, /* status has changed */ | ||
| 22 | IPCT_PROTOINFO = 4, /* protocol information has changed */ | ||
| 23 | IPCT_HELPER = 5, /* new helper has been set */ | ||
| 24 | IPCT_MARK = 6, /* new mark has been set */ | ||
| 25 | IPCT_NATSEQADJ = 7, /* NAT is doing sequence adjustment */ | ||
| 26 | IPCT_SECMARK = 8, /* new security mark has been set */ | ||
| 27 | }; | ||
| 28 | |||
| 29 | enum ip_conntrack_expect_events { | ||
| 30 | IPEXP_NEW = 0, /* new expectation */ | ||
| 31 | }; | ||
| 13 | 32 | ||
| 14 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
| 15 | struct nf_conntrack_ecache { | 33 | struct nf_conntrack_ecache { |
| 16 | struct nf_conn *ct; | 34 | unsigned long cache; /* bitops want long */ |
| 17 | unsigned int events; | 35 | unsigned long missed; /* missed events */ |
| 36 | u32 pid; /* netlink pid of destroyer */ | ||
| 37 | }; | ||
| 38 | |||
| 39 | static inline struct nf_conntrack_ecache * | ||
| 40 | nf_ct_ecache_find(const struct nf_conn *ct) | ||
| 41 | { | ||
| 42 | return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE); | ||
| 43 | } | ||
| 44 | |||
| 45 | static inline struct nf_conntrack_ecache * | ||
| 46 | nf_ct_ecache_ext_add(struct nf_conn *ct, gfp_t gfp) | ||
| 47 | { | ||
| 48 | struct net *net = nf_ct_net(ct); | ||
| 49 | |||
| 50 | if (!net->ct.sysctl_events) | ||
| 51 | return NULL; | ||
| 52 | |||
| 53 | return nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp); | ||
| 18 | }; | 54 | }; |
| 19 | 55 | ||
| 56 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
| 20 | /* This structure is passed to event handler */ | 57 | /* This structure is passed to event handler */ |
| 21 | struct nf_ct_event { | 58 | struct nf_ct_event { |
| 22 | struct nf_conn *ct; | 59 | struct nf_conn *ct; |
| @@ -24,47 +61,96 @@ struct nf_ct_event { | |||
| 24 | int report; | 61 | int report; |
| 25 | }; | 62 | }; |
| 26 | 63 | ||
| 27 | extern struct atomic_notifier_head nf_conntrack_chain; | 64 | struct nf_ct_event_notifier { |
| 28 | extern int nf_conntrack_register_notifier(struct notifier_block *nb); | 65 | int (*fcn)(unsigned int events, struct nf_ct_event *item); |
| 29 | extern int nf_conntrack_unregister_notifier(struct notifier_block *nb); | 66 | }; |
| 67 | |||
| 68 | extern struct nf_ct_event_notifier *nf_conntrack_event_cb; | ||
| 69 | extern int nf_conntrack_register_notifier(struct nf_ct_event_notifier *nb); | ||
| 70 | extern void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *nb); | ||
| 30 | 71 | ||
| 31 | extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); | 72 | extern void nf_ct_deliver_cached_events(struct nf_conn *ct); |
| 32 | extern void __nf_ct_event_cache_init(struct nf_conn *ct); | ||
| 33 | extern void nf_ct_event_cache_flush(struct net *net); | ||
| 34 | 73 | ||
| 35 | static inline void | 74 | static inline void |
| 36 | nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) | 75 | nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) |
| 37 | { | 76 | { |
| 77 | struct nf_conntrack_ecache *e; | ||
| 78 | |||
| 79 | if (nf_conntrack_event_cb == NULL) | ||
| 80 | return; | ||
| 81 | |||
| 82 | e = nf_ct_ecache_find(ct); | ||
| 83 | if (e == NULL) | ||
| 84 | return; | ||
| 85 | |||
| 86 | set_bit(event, &e->cache); | ||
| 87 | } | ||
| 88 | |||
| 89 | static inline int | ||
| 90 | nf_conntrack_eventmask_report(unsigned int eventmask, | ||
| 91 | struct nf_conn *ct, | ||
| 92 | u32 pid, | ||
| 93 | int report) | ||
| 94 | { | ||
| 95 | int ret = 0; | ||
| 38 | struct net *net = nf_ct_net(ct); | 96 | struct net *net = nf_ct_net(ct); |
| 39 | struct nf_conntrack_ecache *ecache; | 97 | struct nf_ct_event_notifier *notify; |
| 40 | 98 | struct nf_conntrack_ecache *e; | |
| 41 | local_bh_disable(); | 99 | |
| 42 | ecache = per_cpu_ptr(net->ct.ecache, raw_smp_processor_id()); | 100 | rcu_read_lock(); |
| 43 | if (ct != ecache->ct) | 101 | notify = rcu_dereference(nf_conntrack_event_cb); |
| 44 | __nf_ct_event_cache_init(ct); | 102 | if (notify == NULL) |
| 45 | ecache->events |= event; | 103 | goto out_unlock; |
| 46 | local_bh_enable(); | 104 | |
| 105 | if (!net->ct.sysctl_events) | ||
| 106 | goto out_unlock; | ||
| 107 | |||
| 108 | e = nf_ct_ecache_find(ct); | ||
| 109 | if (e == NULL) | ||
| 110 | goto out_unlock; | ||
| 111 | |||
| 112 | if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) { | ||
| 113 | struct nf_ct_event item = { | ||
| 114 | .ct = ct, | ||
| 115 | .pid = e->pid ? e->pid : pid, | ||
| 116 | .report = report | ||
| 117 | }; | ||
| 118 | /* This is a resent of a destroy event? If so, skip missed */ | ||
| 119 | unsigned long missed = e->pid ? 0 : e->missed; | ||
| 120 | |||
| 121 | ret = notify->fcn(eventmask | missed, &item); | ||
| 122 | if (unlikely(ret < 0 || missed)) { | ||
| 123 | spin_lock_bh(&ct->lock); | ||
| 124 | if (ret < 0) { | ||
| 125 | /* This is a destroy event that has been | ||
| 126 | * triggered by a process, we store the PID | ||
| 127 | * to include it in the retransmission. */ | ||
| 128 | if (eventmask & (1 << IPCT_DESTROY) && | ||
| 129 | e->pid == 0 && pid != 0) | ||
| 130 | e->pid = pid; | ||
| 131 | else | ||
| 132 | e->missed |= eventmask; | ||
| 133 | } else | ||
| 134 | e->missed &= ~missed; | ||
| 135 | spin_unlock_bh(&ct->lock); | ||
| 136 | } | ||
| 137 | } | ||
| 138 | out_unlock: | ||
| 139 | rcu_read_unlock(); | ||
| 140 | return ret; | ||
| 47 | } | 141 | } |
| 48 | 142 | ||
| 49 | static inline void | 143 | static inline int |
| 50 | nf_conntrack_event_report(enum ip_conntrack_events event, | 144 | nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct, |
| 51 | struct nf_conn *ct, | 145 | u32 pid, int report) |
| 52 | u32 pid, | ||
| 53 | int report) | ||
| 54 | { | 146 | { |
| 55 | struct nf_ct_event item = { | 147 | return nf_conntrack_eventmask_report(1 << event, ct, pid, report); |
| 56 | .ct = ct, | ||
| 57 | .pid = pid, | ||
| 58 | .report = report | ||
| 59 | }; | ||
| 60 | if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) | ||
| 61 | atomic_notifier_call_chain(&nf_conntrack_chain, event, &item); | ||
| 62 | } | 148 | } |
| 63 | 149 | ||
| 64 | static inline void | 150 | static inline int |
| 65 | nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct) | 151 | nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct) |
| 66 | { | 152 | { |
| 67 | nf_conntrack_event_report(event, ct, 0, 0); | 153 | return nf_conntrack_eventmask_report(1 << event, ct, 0, 0); |
| 68 | } | 154 | } |
| 69 | 155 | ||
| 70 | struct nf_exp_event { | 156 | struct nf_exp_event { |
| @@ -73,9 +159,13 @@ struct nf_exp_event { | |||
| 73 | int report; | 159 | int report; |
| 74 | }; | 160 | }; |
| 75 | 161 | ||
| 76 | extern struct atomic_notifier_head nf_ct_expect_chain; | 162 | struct nf_exp_event_notifier { |
| 77 | extern int nf_ct_expect_register_notifier(struct notifier_block *nb); | 163 | int (*fcn)(unsigned int events, struct nf_exp_event *item); |
| 78 | extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb); | 164 | }; |
| 165 | |||
| 166 | extern struct nf_exp_event_notifier *nf_expect_event_cb; | ||
| 167 | extern int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *nb); | ||
| 168 | extern void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *nb); | ||
| 79 | 169 | ||
| 80 | static inline void | 170 | static inline void |
| 81 | nf_ct_expect_event_report(enum ip_conntrack_expect_events event, | 171 | nf_ct_expect_event_report(enum ip_conntrack_expect_events event, |
| @@ -83,12 +173,27 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event, | |||
| 83 | u32 pid, | 173 | u32 pid, |
| 84 | int report) | 174 | int report) |
| 85 | { | 175 | { |
| 86 | struct nf_exp_event item = { | 176 | struct net *net = nf_ct_exp_net(exp); |
| 87 | .exp = exp, | 177 | struct nf_exp_event_notifier *notify; |
| 88 | .pid = pid, | 178 | |
| 89 | .report = report | 179 | rcu_read_lock(); |
| 90 | }; | 180 | notify = rcu_dereference(nf_expect_event_cb); |
| 91 | atomic_notifier_call_chain(&nf_ct_expect_chain, event, &item); | 181 | if (notify == NULL) |
| 182 | goto out_unlock; | ||
| 183 | |||
| 184 | if (!net->ct.sysctl_events) | ||
| 185 | goto out_unlock; | ||
| 186 | |||
| 187 | { | ||
| 188 | struct nf_exp_event item = { | ||
| 189 | .exp = exp, | ||
| 190 | .pid = pid, | ||
| 191 | .report = report | ||
| 192 | }; | ||
| 193 | notify->fcn(1 << event, &item); | ||
| 194 | } | ||
| 195 | out_unlock: | ||
| 196 | rcu_read_unlock(); | ||
| 92 | } | 197 | } |
| 93 | 198 | ||
| 94 | static inline void | 199 | static inline void |
| @@ -105,12 +210,16 @@ extern void nf_conntrack_ecache_fini(struct net *net); | |||
| 105 | 210 | ||
| 106 | static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, | 211 | static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, |
| 107 | struct nf_conn *ct) {} | 212 | struct nf_conn *ct) {} |
| 108 | static inline void nf_conntrack_event(enum ip_conntrack_events event, | 213 | static inline int nf_conntrack_eventmask_report(unsigned int eventmask, |
| 109 | struct nf_conn *ct) {} | 214 | struct nf_conn *ct, |
| 110 | static inline void nf_conntrack_event_report(enum ip_conntrack_events event, | 215 | u32 pid, |
| 111 | struct nf_conn *ct, | 216 | int report) { return 0; } |
| 112 | u32 pid, | 217 | static inline int nf_conntrack_event(enum ip_conntrack_events event, |
| 113 | int report) {} | 218 | struct nf_conn *ct) { return 0; } |
| 219 | static inline int nf_conntrack_event_report(enum ip_conntrack_events event, | ||
| 220 | struct nf_conn *ct, | ||
| 221 | u32 pid, | ||
| 222 | int report) { return 0; } | ||
| 114 | static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} | 223 | static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} |
| 115 | static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, | 224 | static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, |
| 116 | struct nf_conntrack_expect *exp) {} | 225 | struct nf_conntrack_expect *exp) {} |
| @@ -118,7 +227,6 @@ static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e, | |||
| 118 | struct nf_conntrack_expect *exp, | 227 | struct nf_conntrack_expect *exp, |
| 119 | u32 pid, | 228 | u32 pid, |
| 120 | int report) {} | 229 | int report) {} |
| 121 | static inline void nf_ct_event_cache_flush(struct net *net) {} | ||
| 122 | 230 | ||
| 123 | static inline int nf_conntrack_ecache_init(struct net *net) | 231 | static inline int nf_conntrack_ecache_init(struct net *net) |
| 124 | { | 232 | { |
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h index da8ee52613a5..7f8fc5d123c5 100644 --- a/include/net/netfilter/nf_conntrack_extend.h +++ b/include/net/netfilter/nf_conntrack_extend.h | |||
| @@ -8,12 +8,14 @@ enum nf_ct_ext_id | |||
| 8 | NF_CT_EXT_HELPER, | 8 | NF_CT_EXT_HELPER, |
| 9 | NF_CT_EXT_NAT, | 9 | NF_CT_EXT_NAT, |
| 10 | NF_CT_EXT_ACCT, | 10 | NF_CT_EXT_ACCT, |
| 11 | NF_CT_EXT_ECACHE, | ||
| 11 | NF_CT_EXT_NUM, | 12 | NF_CT_EXT_NUM, |
| 12 | }; | 13 | }; |
| 13 | 14 | ||
| 14 | #define NF_CT_EXT_HELPER_TYPE struct nf_conn_help | 15 | #define NF_CT_EXT_HELPER_TYPE struct nf_conn_help |
| 15 | #define NF_CT_EXT_NAT_TYPE struct nf_conn_nat | 16 | #define NF_CT_EXT_NAT_TYPE struct nf_conn_nat |
| 16 | #define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter | 17 | #define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter |
| 18 | #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache | ||
| 17 | 19 | ||
| 18 | /* Extensions: optional stuff which isn't permanently in struct. */ | 20 | /* Extensions: optional stuff which isn't permanently in struct. */ |
| 19 | struct nf_ct_ext { | 21 | struct nf_ct_ext { |
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h index ee2a4b369a04..1b7068000927 100644 --- a/include/net/netfilter/nf_conntrack_helper.h +++ b/include/net/netfilter/nf_conntrack_helper.h | |||
| @@ -50,6 +50,8 @@ extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); | |||
| 50 | 50 | ||
| 51 | extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags); | 51 | extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags); |
| 52 | 52 | ||
| 53 | extern void nf_ct_helper_destroy(struct nf_conn *ct); | ||
| 54 | |||
| 53 | static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) | 55 | static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) |
| 54 | { | 56 | { |
| 55 | return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); | 57 | return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); |
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index ba32ed7bdabe..3767fb41e541 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h | |||
| @@ -59,11 +59,11 @@ struct nf_conntrack_l4proto | |||
| 59 | const struct nf_conntrack_tuple *); | 59 | const struct nf_conntrack_tuple *); |
| 60 | 60 | ||
| 61 | /* Print out the private part of the conntrack. */ | 61 | /* Print out the private part of the conntrack. */ |
| 62 | int (*print_conntrack)(struct seq_file *s, const struct nf_conn *); | 62 | int (*print_conntrack)(struct seq_file *s, struct nf_conn *); |
| 63 | 63 | ||
| 64 | /* convert protoinfo to nfnetink attributes */ | 64 | /* convert protoinfo to nfnetink attributes */ |
| 65 | int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, | 65 | int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, |
| 66 | const struct nf_conn *ct); | 66 | struct nf_conn *ct); |
| 67 | /* Calculate protoinfo nlattr size */ | 67 | /* Calculate protoinfo nlattr size */ |
| 68 | int (*nlattr_size)(void); | 68 | int (*nlattr_size)(void); |
| 69 | 69 | ||
diff --git a/include/net/netlink.h b/include/net/netlink.h index eddb50289d6d..007bdb07dabb 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
| @@ -940,6 +940,15 @@ static inline u64 nla_get_u64(const struct nlattr *nla) | |||
| 940 | } | 940 | } |
| 941 | 941 | ||
| 942 | /** | 942 | /** |
| 943 | * nla_get_be64 - return payload of __be64 attribute | ||
| 944 | * @nla: __be64 netlink attribute | ||
| 945 | */ | ||
| 946 | static inline __be64 nla_get_be64(const struct nlattr *nla) | ||
| 947 | { | ||
| 948 | return *(__be64 *) nla_data(nla); | ||
| 949 | } | ||
| 950 | |||
| 951 | /** | ||
| 943 | * nla_get_flag - return payload of flag attribute | 952 | * nla_get_flag - return payload of flag attribute |
| 944 | * @nla: flag netlink attribute | 953 | * @nla: flag netlink attribute |
| 945 | */ | 954 | */ |
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index 9dc58402bc09..ba1ba0c5efd1 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h | |||
| @@ -14,16 +14,17 @@ struct netns_ct { | |||
| 14 | struct hlist_nulls_head *hash; | 14 | struct hlist_nulls_head *hash; |
| 15 | struct hlist_head *expect_hash; | 15 | struct hlist_head *expect_hash; |
| 16 | struct hlist_nulls_head unconfirmed; | 16 | struct hlist_nulls_head unconfirmed; |
| 17 | struct hlist_nulls_head dying; | ||
| 17 | struct ip_conntrack_stat *stat; | 18 | struct ip_conntrack_stat *stat; |
| 18 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 19 | int sysctl_events; |
| 19 | struct nf_conntrack_ecache *ecache; | 20 | unsigned int sysctl_events_retry_timeout; |
| 20 | #endif | ||
| 21 | int sysctl_acct; | 21 | int sysctl_acct; |
| 22 | int sysctl_checksum; | 22 | int sysctl_checksum; |
| 23 | unsigned int sysctl_log_invalid; /* Log invalid packets */ | 23 | unsigned int sysctl_log_invalid; /* Log invalid packets */ |
| 24 | #ifdef CONFIG_SYSCTL | 24 | #ifdef CONFIG_SYSCTL |
| 25 | struct ctl_table_header *sysctl_header; | 25 | struct ctl_table_header *sysctl_header; |
| 26 | struct ctl_table_header *acct_sysctl_header; | 26 | struct ctl_table_header *acct_sysctl_header; |
| 27 | struct ctl_table_header *event_sysctl_header; | ||
| 27 | #endif | 28 | #endif |
| 28 | int hash_vmalloc; | 29 | int hash_vmalloc; |
| 29 | int expect_vmalloc; | 30 | int expect_vmalloc; |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index e37fe3129c17..82a3191375f5 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
| @@ -41,16 +41,17 @@ static inline void *qdisc_priv(struct Qdisc *q) | |||
| 41 | typedef u64 psched_time_t; | 41 | typedef u64 psched_time_t; |
| 42 | typedef long psched_tdiff_t; | 42 | typedef long psched_tdiff_t; |
| 43 | 43 | ||
| 44 | /* Avoid doing 64 bit divide by 1000 */ | 44 | /* Avoid doing 64 bit divide */ |
| 45 | #define PSCHED_US2NS(x) ((s64)(x) << 10) | 45 | #define PSCHED_SHIFT 6 |
| 46 | #define PSCHED_NS2US(x) ((x) >> 10) | 46 | #define PSCHED_TICKS2NS(x) ((s64)(x) << PSCHED_SHIFT) |
| 47 | #define PSCHED_NS2TICKS(x) ((x) >> PSCHED_SHIFT) | ||
| 47 | 48 | ||
| 48 | #define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC) | 49 | #define PSCHED_TICKS_PER_SEC PSCHED_NS2TICKS(NSEC_PER_SEC) |
| 49 | #define PSCHED_PASTPERFECT 0 | 50 | #define PSCHED_PASTPERFECT 0 |
| 50 | 51 | ||
| 51 | static inline psched_time_t psched_get_time(void) | 52 | static inline psched_time_t psched_get_time(void) |
| 52 | { | 53 | { |
| 53 | return PSCHED_NS2US(ktime_to_ns(ktime_get())); | 54 | return PSCHED_NS2TICKS(ktime_to_ns(ktime_get())); |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | static inline psched_tdiff_t | 57 | static inline psched_tdiff_t |
diff --git a/include/net/protocol.h b/include/net/protocol.h index ffa5b8b1f1df..1089d5aabd49 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
| @@ -53,7 +53,7 @@ struct inet6_protocol | |||
| 53 | 53 | ||
| 54 | void (*err_handler)(struct sk_buff *skb, | 54 | void (*err_handler)(struct sk_buff *skb, |
| 55 | struct inet6_skb_parm *opt, | 55 | struct inet6_skb_parm *opt, |
| 56 | int type, int code, int offset, | 56 | u8 type, u8 code, int offset, |
| 57 | __be32 info); | 57 | __be32 info); |
| 58 | 58 | ||
| 59 | int (*gso_send_check)(struct sk_buff *skb); | 59 | int (*gso_send_check)(struct sk_buff *skb); |
diff --git a/include/net/rawv6.h b/include/net/rawv6.h index 8a22599f26ba..f6b9b830df8c 100644 --- a/include/net/rawv6.h +++ b/include/net/rawv6.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include <net/protocol.h> | 6 | #include <net/protocol.h> |
| 7 | 7 | ||
| 8 | void raw6_icmp_error(struct sk_buff *, int nexthdr, | 8 | void raw6_icmp_error(struct sk_buff *, int nexthdr, |
| 9 | int type, int code, int inner_offset, __be32); | 9 | u8 type, u8 code, int inner_offset, __be32); |
| 10 | int raw6_local_deliver(struct sk_buff *, int); | 10 | int raw6_local_deliver(struct sk_buff *, int); |
| 11 | 11 | ||
| 12 | extern int rawv6_rcv(struct sock *sk, | 12 | extern int rawv6_rcv(struct sock *sk, |
diff --git a/include/net/regulatory.h b/include/net/regulatory.h new file mode 100644 index 000000000000..47995b81c5d7 --- /dev/null +++ b/include/net/regulatory.h | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | #ifndef __NET_REGULATORY_H | ||
| 2 | #define __NET_REGULATORY_H | ||
| 3 | /* | ||
| 4 | * regulatory support structures | ||
| 5 | * | ||
| 6 | * Copyright 2008-2009 Luis R. Rodriguez <lrodriguez@atheros.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | */ | ||
| 12 | |||
| 13 | |||
| 14 | /** | ||
| 15 | * enum environment_cap - Environment parsed from country IE | ||
| 16 | * @ENVIRON_ANY: indicates country IE applies to both indoor and | ||
| 17 | * outdoor operation. | ||
| 18 | * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation | ||
| 19 | * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation | ||
| 20 | */ | ||
| 21 | enum environment_cap { | ||
| 22 | ENVIRON_ANY, | ||
| 23 | ENVIRON_INDOOR, | ||
| 24 | ENVIRON_OUTDOOR, | ||
| 25 | }; | ||
| 26 | |||
| 27 | /** | ||
| 28 | * struct regulatory_request - used to keep track of regulatory requests | ||
| 29 | * | ||
| 30 | * @wiphy_idx: this is set if this request's initiator is | ||
| 31 | * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This | ||
| 32 | * can be used by the wireless core to deal with conflicts | ||
| 33 | * and potentially inform users of which devices specifically | ||
| 34 | * cased the conflicts. | ||
| 35 | * @initiator: indicates who sent this request, could be any of | ||
| 36 | * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*) | ||
| 37 | * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested | ||
| 38 | * regulatory domain. We have a few special codes: | ||
| 39 | * 00 - World regulatory domain | ||
| 40 | * 99 - built by driver but a specific alpha2 cannot be determined | ||
| 41 | * 98 - result of an intersection between two regulatory domains | ||
| 42 | * @intersect: indicates whether the wireless core should intersect | ||
| 43 | * the requested regulatory domain with the presently set regulatory | ||
| 44 | * domain. | ||
| 45 | * @country_ie_checksum: checksum of the last processed and accepted | ||
| 46 | * country IE | ||
| 47 | * @country_ie_env: lets us know if the AP is telling us we are outdoor, | ||
| 48 | * indoor, or if it doesn't matter | ||
| 49 | * @list: used to insert into the reg_requests_list linked list | ||
| 50 | */ | ||
| 51 | struct regulatory_request { | ||
| 52 | int wiphy_idx; | ||
| 53 | enum nl80211_reg_initiator initiator; | ||
| 54 | char alpha2[2]; | ||
| 55 | bool intersect; | ||
| 56 | u32 country_ie_checksum; | ||
| 57 | enum environment_cap country_ie_env; | ||
| 58 | struct list_head list; | ||
| 59 | }; | ||
| 60 | |||
| 61 | struct ieee80211_freq_range { | ||
| 62 | u32 start_freq_khz; | ||
| 63 | u32 end_freq_khz; | ||
| 64 | u32 max_bandwidth_khz; | ||
| 65 | }; | ||
| 66 | |||
| 67 | struct ieee80211_power_rule { | ||
| 68 | u32 max_antenna_gain; | ||
| 69 | u32 max_eirp; | ||
| 70 | }; | ||
| 71 | |||
| 72 | struct ieee80211_reg_rule { | ||
| 73 | struct ieee80211_freq_range freq_range; | ||
| 74 | struct ieee80211_power_rule power_rule; | ||
| 75 | u32 flags; | ||
| 76 | }; | ||
| 77 | |||
| 78 | struct ieee80211_regdomain { | ||
| 79 | u32 n_reg_rules; | ||
| 80 | char alpha2[2]; | ||
| 81 | struct ieee80211_reg_rule reg_rules[]; | ||
| 82 | }; | ||
| 83 | |||
| 84 | #define MHZ_TO_KHZ(freq) ((freq) * 1000) | ||
| 85 | #define KHZ_TO_MHZ(freq) ((freq) / 1000) | ||
| 86 | #define DBI_TO_MBI(gain) ((gain) * 100) | ||
| 87 | #define MBI_TO_DBI(gain) ((gain) / 100) | ||
| 88 | #define DBM_TO_MBM(gain) ((gain) * 100) | ||
| 89 | #define MBM_TO_DBM(gain) ((gain) / 100) | ||
| 90 | |||
| 91 | #define REG_RULE(start, end, bw, gain, eirp, reg_flags) \ | ||
| 92 | { \ | ||
| 93 | .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \ | ||
| 94 | .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \ | ||
| 95 | .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \ | ||
| 96 | .power_rule.max_antenna_gain = DBI_TO_MBI(gain),\ | ||
| 97 | .power_rule.max_eirp = DBM_TO_MBM(eirp), \ | ||
| 98 | .flags = reg_flags, \ | ||
| 99 | } | ||
| 100 | |||
| 101 | #endif | ||
diff --git a/include/net/route.h b/include/net/route.h index 4e8cae0e5841..40f6346ef496 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
| @@ -210,7 +210,7 @@ static inline struct inet_peer *rt_get_peer(struct rtable *rt) | |||
| 210 | 210 | ||
| 211 | static inline int inet_iif(const struct sk_buff *skb) | 211 | static inline int inet_iif(const struct sk_buff *skb) |
| 212 | { | 212 | { |
| 213 | return skb->rtable->rt_iif; | 213 | return skb_rtable(skb)->rt_iif; |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | #endif /* _ROUTE_H */ | 216 | #endif /* _ROUTE_H */ |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 9f80a7668289..d16a304cbed4 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
| @@ -448,6 +448,7 @@ static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk) | |||
| 448 | { | 448 | { |
| 449 | struct sctp_ulpevent *event = sctp_skb2event(skb); | 449 | struct sctp_ulpevent *event = sctp_skb2event(skb); |
| 450 | 450 | ||
| 451 | skb_orphan(skb); | ||
| 451 | skb->sk = sk; | 452 | skb->sk = sk; |
| 452 | skb->destructor = sctp_sock_rfree; | 453 | skb->destructor = sctp_sock_rfree; |
| 453 | atomic_add(event->rmem_len, &sk->sk_rmem_alloc); | 454 | atomic_add(event->rmem_len, &sk->sk_rmem_alloc); |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 23f08fe1d50a..edfcacf3250e 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
| @@ -1939,10 +1939,8 @@ void sctp_association_free(struct sctp_association *); | |||
| 1939 | void sctp_association_put(struct sctp_association *); | 1939 | void sctp_association_put(struct sctp_association *); |
| 1940 | void sctp_association_hold(struct sctp_association *); | 1940 | void sctp_association_hold(struct sctp_association *); |
| 1941 | 1941 | ||
| 1942 | struct sctp_transport *sctp_assoc_choose_init_transport( | 1942 | struct sctp_transport *sctp_assoc_choose_alter_transport( |
| 1943 | struct sctp_association *); | 1943 | struct sctp_association *, struct sctp_transport *); |
| 1944 | struct sctp_transport *sctp_assoc_choose_shutdown_transport( | ||
| 1945 | struct sctp_association *); | ||
| 1946 | void sctp_assoc_update_retran_path(struct sctp_association *); | 1944 | void sctp_assoc_update_retran_path(struct sctp_association *); |
| 1947 | struct sctp_transport *sctp_assoc_lookup_paddr(const struct sctp_association *, | 1945 | struct sctp_transport *sctp_assoc_lookup_paddr(const struct sctp_association *, |
| 1948 | const union sctp_addr *); | 1946 | const union sctp_addr *); |
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index b259fc5798fb..1580c04f68bc 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h | |||
| @@ -147,6 +147,8 @@ enum sctp_optname { | |||
| 147 | #define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS | 147 | #define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS |
| 148 | SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */ | 148 | SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */ |
| 149 | #define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX | 149 | #define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX |
| 150 | SCTP_SOCKOPT_CONNECTX3, /* CONNECTX requests. (new implementation) */ | ||
| 151 | #define SCTP_SOCKOPT_CONNECTX3 SCTP_SOCKOPT_CONNECTX3 | ||
| 150 | }; | 152 | }; |
| 151 | 153 | ||
| 152 | /* | 154 | /* |
diff --git a/include/net/snmp.h b/include/net/snmp.h index 57c93628695f..8c842e06bec8 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
| @@ -153,6 +153,11 @@ struct linux_xfrm_mib { | |||
| 153 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ | 153 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ |
| 154 | put_cpu(); \ | 154 | put_cpu(); \ |
| 155 | } while (0) | 155 | } while (0) |
| 156 | #define SNMP_ADD_STATS(mib, field, addend) \ | ||
| 157 | do { \ | ||
| 158 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field] += addend; \ | ||
| 159 | put_cpu(); \ | ||
| 160 | } while (0) | ||
| 156 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ | 161 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ |
| 157 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) | 162 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) |
| 158 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | 163 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
| @@ -160,5 +165,17 @@ struct linux_xfrm_mib { | |||
| 160 | per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ | 165 | per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ |
| 161 | put_cpu(); \ | 166 | put_cpu(); \ |
| 162 | } while (0) | 167 | } while (0) |
| 163 | 168 | #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ | |
| 169 | do { \ | ||
| 170 | __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], get_cpu());\ | ||
| 171 | ptr->mibs[basefield##PKTS]++; \ | ||
| 172 | ptr->mibs[basefield##OCTETS] += addend;\ | ||
| 173 | put_cpu(); \ | ||
| 174 | } while (0) | ||
| 175 | #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ | ||
| 176 | do { \ | ||
| 177 | __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id());\ | ||
| 178 | ptr->mibs[basefield##PKTS]++; \ | ||
| 179 | ptr->mibs[basefield##OCTETS] += addend;\ | ||
| 180 | } while (0) | ||
| 164 | #endif | 181 | #endif |
diff --git a/include/net/sock.h b/include/net/sock.h index 4bb1ff9fd15b..352f06bbd7a9 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -218,9 +218,11 @@ struct sock { | |||
| 218 | #define sk_hash __sk_common.skc_hash | 218 | #define sk_hash __sk_common.skc_hash |
| 219 | #define sk_prot __sk_common.skc_prot | 219 | #define sk_prot __sk_common.skc_prot |
| 220 | #define sk_net __sk_common.skc_net | 220 | #define sk_net __sk_common.skc_net |
| 221 | kmemcheck_bitfield_begin(flags); | ||
| 221 | unsigned char sk_shutdown : 2, | 222 | unsigned char sk_shutdown : 2, |
| 222 | sk_no_check : 2, | 223 | sk_no_check : 2, |
| 223 | sk_userlocks : 4; | 224 | sk_userlocks : 4; |
| 225 | kmemcheck_bitfield_end(flags); | ||
| 224 | unsigned char sk_protocol; | 226 | unsigned char sk_protocol; |
| 225 | unsigned short sk_type; | 227 | unsigned short sk_type; |
| 226 | int sk_rcvbuf; | 228 | int sk_rcvbuf; |
| @@ -1206,6 +1208,39 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from, | |||
| 1206 | return 0; | 1208 | return 0; |
| 1207 | } | 1209 | } |
| 1208 | 1210 | ||
| 1211 | /** | ||
| 1212 | * sk_wmem_alloc_get - returns write allocations | ||
| 1213 | * @sk: socket | ||
| 1214 | * | ||
| 1215 | * Returns sk_wmem_alloc minus initial offset of one | ||
| 1216 | */ | ||
| 1217 | static inline int sk_wmem_alloc_get(const struct sock *sk) | ||
| 1218 | { | ||
| 1219 | return atomic_read(&sk->sk_wmem_alloc) - 1; | ||
| 1220 | } | ||
| 1221 | |||
| 1222 | /** | ||
| 1223 | * sk_rmem_alloc_get - returns read allocations | ||
| 1224 | * @sk: socket | ||
| 1225 | * | ||
| 1226 | * Returns sk_rmem_alloc | ||
| 1227 | */ | ||
| 1228 | static inline int sk_rmem_alloc_get(const struct sock *sk) | ||
| 1229 | { | ||
| 1230 | return atomic_read(&sk->sk_rmem_alloc); | ||
| 1231 | } | ||
| 1232 | |||
| 1233 | /** | ||
| 1234 | * sk_has_allocations - check if allocations are outstanding | ||
| 1235 | * @sk: socket | ||
| 1236 | * | ||
| 1237 | * Returns true if socket has write or read allocations | ||
| 1238 | */ | ||
| 1239 | static inline int sk_has_allocations(const struct sock *sk) | ||
| 1240 | { | ||
| 1241 | return sk_wmem_alloc_get(sk) || sk_rmem_alloc_get(sk); | ||
| 1242 | } | ||
| 1243 | |||
| 1209 | /* | 1244 | /* |
| 1210 | * Queue a received datagram if it will fit. Stream and sequenced | 1245 | * Queue a received datagram if it will fit. Stream and sequenced |
| 1211 | * protocols can't normally use this as they need to fit buffers in | 1246 | * protocols can't normally use this as they need to fit buffers in |
| @@ -1217,14 +1252,20 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from, | |||
| 1217 | 1252 | ||
| 1218 | static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk) | 1253 | static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk) |
| 1219 | { | 1254 | { |
| 1220 | sock_hold(sk); | 1255 | skb_orphan(skb); |
| 1221 | skb->sk = sk; | 1256 | skb->sk = sk; |
| 1222 | skb->destructor = sock_wfree; | 1257 | skb->destructor = sock_wfree; |
| 1258 | /* | ||
| 1259 | * We used to take a refcount on sk, but following operation | ||
| 1260 | * is enough to guarantee sk_free() wont free this sock until | ||
| 1261 | * all in-flight packets are completed | ||
| 1262 | */ | ||
| 1223 | atomic_add(skb->truesize, &sk->sk_wmem_alloc); | 1263 | atomic_add(skb->truesize, &sk->sk_wmem_alloc); |
| 1224 | } | 1264 | } |
| 1225 | 1265 | ||
| 1226 | static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) | 1266 | static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) |
| 1227 | { | 1267 | { |
| 1268 | skb_orphan(skb); | ||
| 1228 | skb->sk = sk; | 1269 | skb->sk = sk; |
| 1229 | skb->destructor = sock_rfree; | 1270 | skb->destructor = sock_rfree; |
| 1230 | atomic_add(skb->truesize, &sk->sk_rmem_alloc); | 1271 | atomic_add(skb->truesize, &sk->sk_rmem_alloc); |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 646dbe3962ea..19f4150f4d4d 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -266,6 +266,19 @@ static inline int tcp_too_many_orphans(struct sock *sk, int num) | |||
| 266 | atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]); | 266 | atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]); |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | /* syncookies: remember time of last synqueue overflow */ | ||
| 270 | static inline void tcp_synq_overflow(struct sock *sk) | ||
| 271 | { | ||
| 272 | tcp_sk(sk)->rx_opt.ts_recent_stamp = jiffies; | ||
| 273 | } | ||
| 274 | |||
| 275 | /* syncookies: no recent synqueue overflow on this listening socket? */ | ||
| 276 | static inline int tcp_synq_no_recent_overflow(const struct sock *sk) | ||
| 277 | { | ||
| 278 | unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp; | ||
| 279 | return time_after(jiffies, last_overflow + TCP_TIMEOUT_INIT); | ||
| 280 | } | ||
| 281 | |||
| 269 | extern struct proto tcp_prot; | 282 | extern struct proto tcp_prot; |
| 270 | 283 | ||
| 271 | #define TCP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.tcp_statistics, field) | 284 | #define TCP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.tcp_statistics, field) |
| @@ -889,30 +902,32 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb) | |||
| 889 | { | 902 | { |
| 890 | struct tcp_sock *tp = tcp_sk(sk); | 903 | struct tcp_sock *tp = tcp_sk(sk); |
| 891 | 904 | ||
| 892 | if (!sysctl_tcp_low_latency && tp->ucopy.task) { | 905 | if (sysctl_tcp_low_latency || !tp->ucopy.task) |
| 893 | __skb_queue_tail(&tp->ucopy.prequeue, skb); | 906 | return 0; |
| 894 | tp->ucopy.memory += skb->truesize; | 907 | |
| 895 | if (tp->ucopy.memory > sk->sk_rcvbuf) { | 908 | __skb_queue_tail(&tp->ucopy.prequeue, skb); |
| 896 | struct sk_buff *skb1; | 909 | tp->ucopy.memory += skb->truesize; |
| 897 | 910 | if (tp->ucopy.memory > sk->sk_rcvbuf) { | |
| 898 | BUG_ON(sock_owned_by_user(sk)); | 911 | struct sk_buff *skb1; |
| 899 | 912 | ||
| 900 | while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { | 913 | BUG_ON(sock_owned_by_user(sk)); |
| 901 | sk_backlog_rcv(sk, skb1); | 914 | |
| 902 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPPREQUEUEDROPPED); | 915 | while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { |
| 903 | } | 916 | sk_backlog_rcv(sk, skb1); |
| 904 | 917 | NET_INC_STATS_BH(sock_net(sk), | |
| 905 | tp->ucopy.memory = 0; | 918 | LINUX_MIB_TCPPREQUEUEDROPPED); |
| 906 | } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { | ||
| 907 | wake_up_interruptible(sk->sk_sleep); | ||
| 908 | if (!inet_csk_ack_scheduled(sk)) | ||
| 909 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, | ||
| 910 | (3 * tcp_rto_min(sk)) / 4, | ||
| 911 | TCP_RTO_MAX); | ||
| 912 | } | 919 | } |
| 913 | return 1; | 920 | |
| 921 | tp->ucopy.memory = 0; | ||
| 922 | } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { | ||
| 923 | wake_up_interruptible_poll(sk->sk_sleep, | ||
| 924 | POLLIN | POLLRDNORM | POLLRDBAND); | ||
| 925 | if (!inet_csk_ack_scheduled(sk)) | ||
| 926 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, | ||
| 927 | (3 * tcp_rto_min(sk)) / 4, | ||
| 928 | TCP_RTO_MAX); | ||
| 914 | } | 929 | } |
| 915 | return 0; | 930 | return 1; |
| 916 | } | 931 | } |
| 917 | 932 | ||
| 918 | 933 | ||
diff --git a/include/net/wimax.h b/include/net/wimax.h index 6b3824edb39e..2af7bf839f23 100644 --- a/include/net/wimax.h +++ b/include/net/wimax.h | |||
| @@ -253,7 +253,6 @@ | |||
| 253 | struct net_device; | 253 | struct net_device; |
| 254 | struct genl_info; | 254 | struct genl_info; |
| 255 | struct wimax_dev; | 255 | struct wimax_dev; |
| 256 | struct input_dev; | ||
| 257 | 256 | ||
| 258 | /** | 257 | /** |
| 259 | * struct wimax_dev - Generic WiMAX device | 258 | * struct wimax_dev - Generic WiMAX device |
| @@ -293,8 +292,8 @@ struct input_dev; | |||
| 293 | * See wimax_reset()'s documentation. | 292 | * See wimax_reset()'s documentation. |
| 294 | * | 293 | * |
| 295 | * @name: [fill] A way to identify this device. We need to register a | 294 | * @name: [fill] A way to identify this device. We need to register a |
| 296 | * name with many subsystems (input for RFKILL, workqueue | 295 | * name with many subsystems (rfkill, workqueue creation, etc). |
| 297 | * creation, etc). We can't use the network device name as that | 296 | * We can't use the network device name as that |
| 298 | * might change and in some instances we don't know it yet (until | 297 | * might change and in some instances we don't know it yet (until |
| 299 | * we don't call register_netdev()). So we generate an unique one | 298 | * we don't call register_netdev()). So we generate an unique one |
| 300 | * using the driver name and device bus id, place it here and use | 299 | * using the driver name and device bus id, place it here and use |
| @@ -316,9 +315,6 @@ struct input_dev; | |||
| 316 | * | 315 | * |
| 317 | * @rfkill: [private] integration into the RF-Kill infrastructure. | 316 | * @rfkill: [private] integration into the RF-Kill infrastructure. |
| 318 | * | 317 | * |
| 319 | * @rfkill_input: [private] virtual input device to process the | ||
| 320 | * hardware RF Kill switches. | ||
| 321 | * | ||
| 322 | * @rf_sw: [private] State of the software radio switch (OFF/ON) | 318 | * @rf_sw: [private] State of the software radio switch (OFF/ON) |
| 323 | * | 319 | * |
| 324 | * @rf_hw: [private] State of the hardware radio switch (OFF/ON) | 320 | * @rf_hw: [private] State of the hardware radio switch (OFF/ON) |
diff --git a/include/net/wireless.h b/include/net/wireless.h deleted file mode 100644 index 64a76208580c..000000000000 --- a/include/net/wireless.h +++ /dev/null | |||
| @@ -1,472 +0,0 @@ | |||
| 1 | #ifndef __NET_WIRELESS_H | ||
| 2 | #define __NET_WIRELESS_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * 802.11 device management | ||
| 6 | * | ||
| 7 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <linux/netdevice.h> | ||
| 11 | #include <linux/debugfs.h> | ||
| 12 | #include <linux/list.h> | ||
| 13 | #include <linux/ieee80211.h> | ||
| 14 | #include <net/cfg80211.h> | ||
| 15 | |||
| 16 | /** | ||
| 17 | * enum ieee80211_band - supported frequency bands | ||
| 18 | * | ||
| 19 | * The bands are assigned this way because the supported | ||
| 20 | * bitrates differ in these bands. | ||
| 21 | * | ||
| 22 | * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band | ||
| 23 | * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) | ||
| 24 | */ | ||
| 25 | enum ieee80211_band { | ||
| 26 | IEEE80211_BAND_2GHZ, | ||
| 27 | IEEE80211_BAND_5GHZ, | ||
| 28 | |||
| 29 | /* keep last */ | ||
| 30 | IEEE80211_NUM_BANDS | ||
| 31 | }; | ||
| 32 | |||
| 33 | /** | ||
| 34 | * enum ieee80211_channel_flags - channel flags | ||
| 35 | * | ||
| 36 | * Channel flags set by the regulatory control code. | ||
| 37 | * | ||
| 38 | * @IEEE80211_CHAN_DISABLED: This channel is disabled. | ||
| 39 | * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted | ||
| 40 | * on this channel. | ||
| 41 | * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. | ||
| 42 | * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. | ||
| 43 | * @IEEE80211_CHAN_NO_FAT_ABOVE: extension channel above this channel | ||
| 44 | * is not permitted. | ||
| 45 | * @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel | ||
| 46 | * is not permitted. | ||
| 47 | */ | ||
| 48 | enum ieee80211_channel_flags { | ||
| 49 | IEEE80211_CHAN_DISABLED = 1<<0, | ||
| 50 | IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, | ||
| 51 | IEEE80211_CHAN_NO_IBSS = 1<<2, | ||
| 52 | IEEE80211_CHAN_RADAR = 1<<3, | ||
| 53 | IEEE80211_CHAN_NO_FAT_ABOVE = 1<<4, | ||
| 54 | IEEE80211_CHAN_NO_FAT_BELOW = 1<<5, | ||
| 55 | }; | ||
| 56 | |||
| 57 | /** | ||
| 58 | * struct ieee80211_channel - channel definition | ||
| 59 | * | ||
| 60 | * This structure describes a single channel for use | ||
| 61 | * with cfg80211. | ||
| 62 | * | ||
| 63 | * @center_freq: center frequency in MHz | ||
| 64 | * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz | ||
| 65 | * @hw_value: hardware-specific value for the channel | ||
| 66 | * @flags: channel flags from &enum ieee80211_channel_flags. | ||
| 67 | * @orig_flags: channel flags at registration time, used by regulatory | ||
| 68 | * code to support devices with additional restrictions | ||
| 69 | * @band: band this channel belongs to. | ||
| 70 | * @max_antenna_gain: maximum antenna gain in dBi | ||
| 71 | * @max_power: maximum transmission power (in dBm) | ||
| 72 | * @beacon_found: helper to regulatory code to indicate when a beacon | ||
| 73 | * has been found on this channel. Use regulatory_hint_found_beacon() | ||
| 74 | * to enable this, this is is useful only on 5 GHz band. | ||
| 75 | * @orig_mag: internal use | ||
| 76 | * @orig_mpwr: internal use | ||
| 77 | */ | ||
| 78 | struct ieee80211_channel { | ||
| 79 | enum ieee80211_band band; | ||
| 80 | u16 center_freq; | ||
| 81 | u8 max_bandwidth; | ||
| 82 | u16 hw_value; | ||
| 83 | u32 flags; | ||
| 84 | int max_antenna_gain; | ||
| 85 | int max_power; | ||
| 86 | bool beacon_found; | ||
| 87 | u32 orig_flags; | ||
| 88 | int orig_mag, orig_mpwr; | ||
| 89 | }; | ||
| 90 | |||
| 91 | /** | ||
| 92 | * enum ieee80211_rate_flags - rate flags | ||
| 93 | * | ||
| 94 | * Hardware/specification flags for rates. These are structured | ||
| 95 | * in a way that allows using the same bitrate structure for | ||
| 96 | * different bands/PHY modes. | ||
| 97 | * | ||
| 98 | * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short | ||
| 99 | * preamble on this bitrate; only relevant in 2.4GHz band and | ||
| 100 | * with CCK rates. | ||
| 101 | * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate | ||
| 102 | * when used with 802.11a (on the 5 GHz band); filled by the | ||
| 103 | * core code when registering the wiphy. | ||
| 104 | * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate | ||
| 105 | * when used with 802.11b (on the 2.4 GHz band); filled by the | ||
| 106 | * core code when registering the wiphy. | ||
| 107 | * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate | ||
| 108 | * when used with 802.11g (on the 2.4 GHz band); filled by the | ||
| 109 | * core code when registering the wiphy. | ||
| 110 | * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. | ||
| 111 | */ | ||
| 112 | enum ieee80211_rate_flags { | ||
| 113 | IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, | ||
| 114 | IEEE80211_RATE_MANDATORY_A = 1<<1, | ||
| 115 | IEEE80211_RATE_MANDATORY_B = 1<<2, | ||
| 116 | IEEE80211_RATE_MANDATORY_G = 1<<3, | ||
| 117 | IEEE80211_RATE_ERP_G = 1<<4, | ||
| 118 | }; | ||
| 119 | |||
| 120 | /** | ||
| 121 | * struct ieee80211_rate - bitrate definition | ||
| 122 | * | ||
| 123 | * This structure describes a bitrate that an 802.11 PHY can | ||
| 124 | * operate with. The two values @hw_value and @hw_value_short | ||
| 125 | * are only for driver use when pointers to this structure are | ||
| 126 | * passed around. | ||
| 127 | * | ||
| 128 | * @flags: rate-specific flags | ||
| 129 | * @bitrate: bitrate in units of 100 Kbps | ||
| 130 | * @hw_value: driver/hardware value for this rate | ||
| 131 | * @hw_value_short: driver/hardware value for this rate when | ||
| 132 | * short preamble is used | ||
| 133 | */ | ||
| 134 | struct ieee80211_rate { | ||
| 135 | u32 flags; | ||
| 136 | u16 bitrate; | ||
| 137 | u16 hw_value, hw_value_short; | ||
| 138 | }; | ||
| 139 | |||
| 140 | /** | ||
| 141 | * struct ieee80211_sta_ht_cap - STA's HT capabilities | ||
| 142 | * | ||
| 143 | * This structure describes most essential parameters needed | ||
| 144 | * to describe 802.11n HT capabilities for an STA. | ||
| 145 | * | ||
| 146 | * @ht_supported: is HT supported by the STA | ||
| 147 | * @cap: HT capabilities map as described in 802.11n spec | ||
| 148 | * @ampdu_factor: Maximum A-MPDU length factor | ||
| 149 | * @ampdu_density: Minimum A-MPDU spacing | ||
| 150 | * @mcs: Supported MCS rates | ||
| 151 | */ | ||
| 152 | struct ieee80211_sta_ht_cap { | ||
| 153 | u16 cap; /* use IEEE80211_HT_CAP_ */ | ||
| 154 | bool ht_supported; | ||
| 155 | u8 ampdu_factor; | ||
| 156 | u8 ampdu_density; | ||
| 157 | struct ieee80211_mcs_info mcs; | ||
| 158 | }; | ||
| 159 | |||
| 160 | /** | ||
| 161 | * struct ieee80211_supported_band - frequency band definition | ||
| 162 | * | ||
| 163 | * This structure describes a frequency band a wiphy | ||
| 164 | * is able to operate in. | ||
| 165 | * | ||
| 166 | * @channels: Array of channels the hardware can operate in | ||
| 167 | * in this band. | ||
| 168 | * @band: the band this structure represents | ||
| 169 | * @n_channels: Number of channels in @channels | ||
| 170 | * @bitrates: Array of bitrates the hardware can operate with | ||
| 171 | * in this band. Must be sorted to give a valid "supported | ||
| 172 | * rates" IE, i.e. CCK rates first, then OFDM. | ||
| 173 | * @n_bitrates: Number of bitrates in @bitrates | ||
| 174 | */ | ||
| 175 | struct ieee80211_supported_band { | ||
| 176 | struct ieee80211_channel *channels; | ||
| 177 | struct ieee80211_rate *bitrates; | ||
| 178 | enum ieee80211_band band; | ||
| 179 | int n_channels; | ||
| 180 | int n_bitrates; | ||
| 181 | struct ieee80211_sta_ht_cap ht_cap; | ||
| 182 | }; | ||
| 183 | |||
| 184 | /** | ||
| 185 | * struct wiphy - wireless hardware description | ||
| 186 | * @idx: the wiphy index assigned to this item | ||
| 187 | * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> | ||
| 188 | * @custom_regulatory: tells us the driver for this device | ||
| 189 | * has its own custom regulatory domain and cannot identify the | ||
| 190 | * ISO / IEC 3166 alpha2 it belongs to. When this is enabled | ||
| 191 | * we will disregard the first regulatory hint (when the | ||
| 192 | * initiator is %REGDOM_SET_BY_CORE). | ||
| 193 | * @strict_regulatory: tells us the driver for this device will ignore | ||
| 194 | * regulatory domain settings until it gets its own regulatory domain | ||
| 195 | * via its regulatory_hint(). After its gets its own regulatory domain | ||
| 196 | * it will only allow further regulatory domain settings to further | ||
| 197 | * enhance compliance. For example if channel 13 and 14 are disabled | ||
| 198 | * by this regulatory domain no user regulatory domain can enable these | ||
| 199 | * channels at a later time. This can be used for devices which do not | ||
| 200 | * have calibration information gauranteed for frequencies or settings | ||
| 201 | * outside of its regulatory domain. | ||
| 202 | * @reg_notifier: the driver's regulatory notification callback | ||
| 203 | * @regd: the driver's regulatory domain, if one was requested via | ||
| 204 | * the regulatory_hint() API. This can be used by the driver | ||
| 205 | * on the reg_notifier() if it chooses to ignore future | ||
| 206 | * regulatory domain changes caused by other drivers. | ||
| 207 | * @signal_type: signal type reported in &struct cfg80211_bss. | ||
| 208 | */ | ||
| 209 | struct wiphy { | ||
| 210 | /* assign these fields before you register the wiphy */ | ||
| 211 | |||
| 212 | /* permanent MAC address */ | ||
| 213 | u8 perm_addr[ETH_ALEN]; | ||
| 214 | |||
| 215 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ | ||
| 216 | u16 interface_modes; | ||
| 217 | |||
| 218 | bool custom_regulatory; | ||
| 219 | bool strict_regulatory; | ||
| 220 | |||
| 221 | enum cfg80211_signal_type signal_type; | ||
| 222 | |||
| 223 | int bss_priv_size; | ||
| 224 | u8 max_scan_ssids; | ||
| 225 | |||
| 226 | /* If multiple wiphys are registered and you're handed e.g. | ||
| 227 | * a regular netdev with assigned ieee80211_ptr, you won't | ||
| 228 | * know whether it points to a wiphy your driver has registered | ||
| 229 | * or not. Assign this to something global to your driver to | ||
| 230 | * help determine whether you own this wiphy or not. */ | ||
| 231 | void *privid; | ||
| 232 | |||
| 233 | struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; | ||
| 234 | |||
| 235 | /* Lets us get back the wiphy on the callback */ | ||
| 236 | int (*reg_notifier)(struct wiphy *wiphy, | ||
| 237 | struct regulatory_request *request); | ||
| 238 | |||
| 239 | /* fields below are read-only, assigned by cfg80211 */ | ||
| 240 | |||
| 241 | const struct ieee80211_regdomain *regd; | ||
| 242 | |||
| 243 | /* the item in /sys/class/ieee80211/ points to this, | ||
| 244 | * you need use set_wiphy_dev() (see below) */ | ||
| 245 | struct device dev; | ||
| 246 | |||
| 247 | /* dir in debugfs: ieee80211/<wiphyname> */ | ||
| 248 | struct dentry *debugfsdir; | ||
| 249 | |||
| 250 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | ||
| 251 | }; | ||
| 252 | |||
| 253 | /** struct wireless_dev - wireless per-netdev state | ||
| 254 | * | ||
| 255 | * This structure must be allocated by the driver/stack | ||
| 256 | * that uses the ieee80211_ptr field in struct net_device | ||
| 257 | * (this is intentional so it can be allocated along with | ||
| 258 | * the netdev.) | ||
| 259 | * | ||
| 260 | * @wiphy: pointer to hardware description | ||
| 261 | * @iftype: interface type | ||
| 262 | */ | ||
| 263 | struct wireless_dev { | ||
| 264 | struct wiphy *wiphy; | ||
| 265 | enum nl80211_iftype iftype; | ||
| 266 | |||
| 267 | /* private to the generic wireless code */ | ||
| 268 | struct list_head list; | ||
| 269 | struct net_device *netdev; | ||
| 270 | }; | ||
| 271 | |||
| 272 | /** | ||
| 273 | * wiphy_priv - return priv from wiphy | ||
| 274 | */ | ||
| 275 | static inline void *wiphy_priv(struct wiphy *wiphy) | ||
| 276 | { | ||
| 277 | BUG_ON(!wiphy); | ||
| 278 | return &wiphy->priv; | ||
| 279 | } | ||
| 280 | |||
| 281 | /** | ||
| 282 | * set_wiphy_dev - set device pointer for wiphy | ||
| 283 | */ | ||
| 284 | static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) | ||
| 285 | { | ||
| 286 | wiphy->dev.parent = dev; | ||
| 287 | } | ||
| 288 | |||
| 289 | /** | ||
| 290 | * wiphy_dev - get wiphy dev pointer | ||
| 291 | */ | ||
| 292 | static inline struct device *wiphy_dev(struct wiphy *wiphy) | ||
| 293 | { | ||
| 294 | return wiphy->dev.parent; | ||
| 295 | } | ||
| 296 | |||
| 297 | /** | ||
| 298 | * wiphy_name - get wiphy name | ||
| 299 | */ | ||
| 300 | static inline const char *wiphy_name(struct wiphy *wiphy) | ||
| 301 | { | ||
| 302 | return dev_name(&wiphy->dev); | ||
| 303 | } | ||
| 304 | |||
| 305 | /** | ||
| 306 | * wdev_priv - return wiphy priv from wireless_dev | ||
| 307 | */ | ||
| 308 | static inline void *wdev_priv(struct wireless_dev *wdev) | ||
| 309 | { | ||
| 310 | BUG_ON(!wdev); | ||
| 311 | return wiphy_priv(wdev->wiphy); | ||
| 312 | } | ||
| 313 | |||
| 314 | /** | ||
| 315 | * wiphy_new - create a new wiphy for use with cfg80211 | ||
| 316 | * | ||
| 317 | * create a new wiphy and associate the given operations with it. | ||
| 318 | * @sizeof_priv bytes are allocated for private use. | ||
| 319 | * | ||
| 320 | * the returned pointer must be assigned to each netdev's | ||
| 321 | * ieee80211_ptr for proper operation. | ||
| 322 | */ | ||
| 323 | struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv); | ||
| 324 | |||
| 325 | /** | ||
| 326 | * wiphy_register - register a wiphy with cfg80211 | ||
| 327 | * | ||
| 328 | * register the given wiphy | ||
| 329 | * | ||
| 330 | * Returns a non-negative wiphy index or a negative error code. | ||
| 331 | */ | ||
| 332 | extern int wiphy_register(struct wiphy *wiphy); | ||
| 333 | |||
| 334 | /** | ||
| 335 | * wiphy_unregister - deregister a wiphy from cfg80211 | ||
| 336 | * | ||
| 337 | * unregister a device with the given priv pointer. | ||
| 338 | * After this call, no more requests can be made with this priv | ||
| 339 | * pointer, but the call may sleep to wait for an outstanding | ||
| 340 | * request that is being handled. | ||
| 341 | */ | ||
| 342 | extern void wiphy_unregister(struct wiphy *wiphy); | ||
| 343 | |||
| 344 | /** | ||
| 345 | * wiphy_free - free wiphy | ||
| 346 | */ | ||
| 347 | extern void wiphy_free(struct wiphy *wiphy); | ||
| 348 | |||
| 349 | /** | ||
| 350 | * ieee80211_channel_to_frequency - convert channel number to frequency | ||
| 351 | */ | ||
| 352 | extern int ieee80211_channel_to_frequency(int chan); | ||
| 353 | |||
| 354 | /** | ||
| 355 | * ieee80211_frequency_to_channel - convert frequency to channel number | ||
| 356 | */ | ||
| 357 | extern int ieee80211_frequency_to_channel(int freq); | ||
| 358 | |||
| 359 | /* | ||
| 360 | * Name indirection necessary because the ieee80211 code also has | ||
| 361 | * a function named "ieee80211_get_channel", so if you include | ||
| 362 | * cfg80211's header file you get cfg80211's version, if you try | ||
| 363 | * to include both header files you'll (rightfully!) get a symbol | ||
| 364 | * clash. | ||
| 365 | */ | ||
| 366 | extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, | ||
| 367 | int freq); | ||
| 368 | /** | ||
| 369 | * ieee80211_get_channel - get channel struct from wiphy for specified frequency | ||
| 370 | */ | ||
| 371 | static inline struct ieee80211_channel * | ||
| 372 | ieee80211_get_channel(struct wiphy *wiphy, int freq) | ||
| 373 | { | ||
| 374 | return __ieee80211_get_channel(wiphy, freq); | ||
| 375 | } | ||
| 376 | |||
| 377 | /** | ||
| 378 | * ieee80211_get_response_rate - get basic rate for a given rate | ||
| 379 | * | ||
| 380 | * @sband: the band to look for rates in | ||
| 381 | * @basic_rates: bitmap of basic rates | ||
| 382 | * @bitrate: the bitrate for which to find the basic rate | ||
| 383 | * | ||
| 384 | * This function returns the basic rate corresponding to a given | ||
| 385 | * bitrate, that is the next lower bitrate contained in the basic | ||
| 386 | * rate map, which is, for this function, given as a bitmap of | ||
| 387 | * indices of rates in the band's bitrate table. | ||
| 388 | */ | ||
| 389 | struct ieee80211_rate * | ||
| 390 | ieee80211_get_response_rate(struct ieee80211_supported_band *sband, | ||
| 391 | u32 basic_rates, int bitrate); | ||
| 392 | |||
| 393 | /** | ||
| 394 | * regulatory_hint - driver hint to the wireless core a regulatory domain | ||
| 395 | * @wiphy: the wireless device giving the hint (used only for reporting | ||
| 396 | * conflicts) | ||
| 397 | * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain | ||
| 398 | * should be in. If @rd is set this should be NULL. Note that if you | ||
| 399 | * set this to NULL you should still set rd->alpha2 to some accepted | ||
| 400 | * alpha2. | ||
| 401 | * | ||
| 402 | * Wireless drivers can use this function to hint to the wireless core | ||
| 403 | * what it believes should be the current regulatory domain by | ||
| 404 | * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory | ||
| 405 | * domain should be in or by providing a completely build regulatory domain. | ||
| 406 | * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried | ||
| 407 | * for a regulatory domain structure for the respective country. | ||
| 408 | * | ||
| 409 | * The wiphy must have been registered to cfg80211 prior to this call. | ||
| 410 | * For cfg80211 drivers this means you must first use wiphy_register(), | ||
| 411 | * for mac80211 drivers you must first use ieee80211_register_hw(). | ||
| 412 | * | ||
| 413 | * Drivers should check the return value, its possible you can get | ||
| 414 | * an -ENOMEM. | ||
| 415 | */ | ||
| 416 | extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); | ||
| 417 | |||
| 418 | /** | ||
| 419 | * regulatory_hint_11d - hints a country IE as a regulatory domain | ||
| 420 | * @wiphy: the wireless device giving the hint (used only for reporting | ||
| 421 | * conflicts) | ||
| 422 | * @country_ie: pointer to the country IE | ||
| 423 | * @country_ie_len: length of the country IE | ||
| 424 | * | ||
| 425 | * We will intersect the rd with the what CRDA tells us should apply | ||
| 426 | * for the alpha2 this country IE belongs to, this prevents APs from | ||
| 427 | * sending us incorrect or outdated information against a country. | ||
| 428 | */ | ||
| 429 | extern void regulatory_hint_11d(struct wiphy *wiphy, | ||
| 430 | u8 *country_ie, | ||
| 431 | u8 country_ie_len); | ||
| 432 | /** | ||
| 433 | * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain | ||
| 434 | * @wiphy: the wireless device we want to process the regulatory domain on | ||
| 435 | * @regd: the custom regulatory domain to use for this wiphy | ||
| 436 | * | ||
| 437 | * Drivers can sometimes have custom regulatory domains which do not apply | ||
| 438 | * to a specific country. Drivers can use this to apply such custom regulatory | ||
| 439 | * domains. This routine must be called prior to wiphy registration. The | ||
| 440 | * custom regulatory domain will be trusted completely and as such previous | ||
| 441 | * default channel settings will be disregarded. If no rule is found for a | ||
| 442 | * channel on the regulatory domain the channel will be disabled. | ||
| 443 | */ | ||
| 444 | extern void wiphy_apply_custom_regulatory( | ||
| 445 | struct wiphy *wiphy, | ||
| 446 | const struct ieee80211_regdomain *regd); | ||
| 447 | |||
| 448 | /** | ||
| 449 | * freq_reg_info - get regulatory information for the given frequency | ||
| 450 | * @wiphy: the wiphy for which we want to process this rule for | ||
| 451 | * @center_freq: Frequency in KHz for which we want regulatory information for | ||
| 452 | * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one | ||
| 453 | * you can set this to 0. If this frequency is allowed we then set | ||
| 454 | * this value to the maximum allowed bandwidth. | ||
| 455 | * @reg_rule: the regulatory rule which we have for this frequency | ||
| 456 | * | ||
| 457 | * Use this function to get the regulatory rule for a specific frequency on | ||
| 458 | * a given wireless device. If the device has a specific regulatory domain | ||
| 459 | * it wants to follow we respect that unless a country IE has been received | ||
| 460 | * and processed already. | ||
| 461 | * | ||
| 462 | * Returns 0 if it was able to find a valid regulatory rule which does | ||
| 463 | * apply to the given center_freq otherwise it returns non-zero. It will | ||
| 464 | * also return -ERANGE if we determine the given center_freq does not even have | ||
| 465 | * a regulatory rule for a frequency range in the center_freq's band. See | ||
| 466 | * freq_in_rule_band() for our current definition of a band -- this is purely | ||
| 467 | * subjective and right now its 802.11 specific. | ||
| 468 | */ | ||
| 469 | extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth, | ||
| 470 | const struct ieee80211_reg_rule **reg_rule); | ||
| 471 | |||
| 472 | #endif /* __NET_WIRELESS_H */ | ||
diff --git a/include/net/x25.h b/include/net/x25.h index fc3f03d976f8..2cda04011568 100644 --- a/include/net/x25.h +++ b/include/net/x25.h | |||
| @@ -187,7 +187,7 @@ extern int x25_addr_ntoa(unsigned char *, struct x25_address *, | |||
| 187 | extern int x25_addr_aton(unsigned char *, struct x25_address *, | 187 | extern int x25_addr_aton(unsigned char *, struct x25_address *, |
| 188 | struct x25_address *); | 188 | struct x25_address *); |
| 189 | extern struct sock *x25_find_socket(unsigned int, struct x25_neigh *); | 189 | extern struct sock *x25_find_socket(unsigned int, struct x25_neigh *); |
| 190 | extern void x25_destroy_socket(struct sock *); | 190 | extern void x25_destroy_socket_from_timer(struct sock *); |
| 191 | extern int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int); | 191 | extern int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int); |
| 192 | extern void x25_kill_by_neigh(struct x25_neigh *); | 192 | extern void x25_kill_by_neigh(struct x25_neigh *); |
| 193 | 193 | ||
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 2e9f5c0018ae..9e3a3f4c1f60 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
| @@ -994,7 +994,7 @@ static inline int __xfrm_policy_check2(struct sock *sk, int dir, | |||
| 994 | return __xfrm_policy_check(sk, ndir, skb, family); | 994 | return __xfrm_policy_check(sk, ndir, skb, family); |
| 995 | 995 | ||
| 996 | return (!net->xfrm.policy_count[dir] && !skb->sp) || | 996 | return (!net->xfrm.policy_count[dir] && !skb->sp) || |
| 997 | (skb->dst->flags & DST_NOPOLICY) || | 997 | (skb_dst(skb)->flags & DST_NOPOLICY) || |
| 998 | __xfrm_policy_check(sk, ndir, skb, family); | 998 | __xfrm_policy_check(sk, ndir, skb, family); |
| 999 | } | 999 | } |
| 1000 | 1000 | ||
| @@ -1048,7 +1048,7 @@ static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) | |||
| 1048 | struct net *net = dev_net(skb->dev); | 1048 | struct net *net = dev_net(skb->dev); |
| 1049 | 1049 | ||
| 1050 | return !net->xfrm.policy_count[XFRM_POLICY_OUT] || | 1050 | return !net->xfrm.policy_count[XFRM_POLICY_OUT] || |
| 1051 | (skb->dst->flags & DST_NOXFRM) || | 1051 | (skb_dst(skb)->flags & DST_NOXFRM) || |
| 1052 | __xfrm_route_forward(skb, family); | 1052 | __xfrm_route_forward(skb, family); |
| 1053 | } | 1053 | } |
| 1054 | 1054 | ||
| @@ -1274,7 +1274,7 @@ struct xfrm_tunnel { | |||
| 1274 | struct xfrm6_tunnel { | 1274 | struct xfrm6_tunnel { |
| 1275 | int (*handler)(struct sk_buff *skb); | 1275 | int (*handler)(struct sk_buff *skb); |
| 1276 | int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, | 1276 | int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, |
| 1277 | int type, int code, int offset, __be32 info); | 1277 | u8 type, u8 code, int offset, __be32 info); |
| 1278 | struct xfrm6_tunnel *next; | 1278 | struct xfrm6_tunnel *next; |
| 1279 | int priority; | 1279 | int priority; |
| 1280 | }; | 1280 | }; |
