aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath6kl/btc.h
blob: 71075a8e626e9a82c06a8b5a8267df5066433219 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * Copyright (c) 2004-2011 Atheros Communications Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef BTC_H
#define BTC_H
#include <net/iw_handler.h>

#define EVENT_ID_LEN 2

void cfg80211_send_genevent_to_app(struct net_device *dev,
					u16 event_id,
					u8 *datap, int len)
{
	char *buf;
	u16 size;
	union iwreq_data wrqu;

	size = len + EVENT_ID_LEN;

	if (size > IW_GENERIC_IE_MAX)
		return;

	buf = kmalloc(size, GFP_ATOMIC);
	if (buf == NULL)
		return;

	memset(buf, 0, size);
	memcpy(buf, &event_id, EVENT_ID_LEN);
	memcpy(buf + EVENT_ID_LEN, datap, len);

	memset(&wrqu, 0, sizeof(wrqu));
	wrqu.data.length = size;
	wireless_send_event(dev, IWEVGENIE, &wrqu, buf);
	kfree(buf);
}

void cfg80211_send_event_to_app(struct net_device *dev,
					u16 event_id,
					u8 *datap, int len)
{
	char *buf;
	u16 size;
	union iwreq_data wrqu;

	size = len + EVENT_ID_LEN;

	if (size > IW_CUSTOM_MAX)
		return;

	buf = kmalloc(size, GFP_ATOMIC);
	if (buf == NULL)
		return;

	memset(buf, 0, size);
	memcpy(buf, &event_id, EVENT_ID_LEN);
	memcpy(buf + EVENT_ID_LEN, datap, len);

	memset(&wrqu, 0, sizeof(wrqu));
	wrqu.data.length = size;
	wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
	kfree(buf);
}
#endif