]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - net/wireless/core.h
rt2x00: Fix queue index handling
[mirror_ubuntu-artful-kernel.git] / net / wireless / core.h
CommitLineData
704232c2
JB
1/*
2 * Wireless configuration interface internals.
3 *
4 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
5 */
6#ifndef __NET_WIRELESS_CORE_H
7#define __NET_WIRELESS_CORE_H
8#include <linux/mutex.h>
9#include <linux/list.h>
10#include <linux/netdevice.h>
11#include <net/genetlink.h>
12#include <net/wireless.h>
13#include <net/cfg80211.h>
14
15struct cfg80211_registered_device {
16 struct cfg80211_ops *ops;
17 struct list_head list;
18 /* we hold this mutex during any call so that
19 * we cannot do multiple calls at once, and also
20 * to avoid the deregister call to proceed while
21 * any call is in progress */
22 struct mutex mtx;
23
24 /* wiphy index, internal only */
25 int idx;
26
27 /* associate netdev list */
28 struct mutex devlist_mtx;
29 struct list_head netdev_list;
30
31 /* must be last because of the way we do wiphy_priv(),
32 * and it should at least be aligned to NETDEV_ALIGN */
33 struct wiphy wiphy __attribute__((__aligned__(NETDEV_ALIGN)));
34};
35
36static inline
37struct cfg80211_registered_device *wiphy_to_dev(struct wiphy *wiphy)
38{
39 BUG_ON(!wiphy);
40 return container_of(wiphy, struct cfg80211_registered_device, wiphy);
41}
42
43extern struct mutex cfg80211_drv_mutex;
44extern struct list_head cfg80211_drv_list;
45
55682965
JB
46/*
47 * This function returns a pointer to the driver
48 * that the genl_info item that is passed refers to.
49 * If successful, it returns non-NULL and also locks
50 * the driver's mutex!
51 *
52 * This means that you need to call cfg80211_put_dev()
53 * before being allowed to acquire &cfg80211_drv_mutex!
54 *
55 * This is necessary because we need to lock the global
56 * mutex to get an item off the list safely, and then
57 * we lock the drv mutex so it doesn't go away under us.
58 *
59 * We don't want to keep cfg80211_drv_mutex locked
60 * for all the time in order to allow requests on
61 * other interfaces to go through at the same time.
62 *
63 * The result of this can be a PTR_ERR and hence must
64 * be checked with IS_ERR() for errors.
65 */
66extern struct cfg80211_registered_device *
67cfg80211_get_dev_from_info(struct genl_info *info);
68
69/* identical to cfg80211_get_dev_from_info but only operate on ifindex */
70extern struct cfg80211_registered_device *
71cfg80211_get_dev_from_ifindex(int ifindex);
72
73extern void cfg80211_put_dev(struct cfg80211_registered_device *drv);
74
704232c2
JB
75/* free object */
76extern void cfg80211_dev_free(struct cfg80211_registered_device *drv);
77
55682965
JB
78extern int cfg80211_dev_rename(struct cfg80211_registered_device *drv,
79 char *newname);
80
704232c2 81#endif /* __NET_WIRELESS_CORE_H */