aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-11-06 20:57:51 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-06 20:57:51 -0500
commit10d626f4f444b419046309c10f25515adbffcb16 (patch)
tree216b16bf872bf3b077895443919de0e487da2ea3 /include
parent62d83681e53fd87c91927018cfe5ba9f9e8109a3 (diff)
parentbb1cafb8fc414d6dbe933f888df6540c2ef02101 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan
Diffstat (limited to 'include')
-rw-r--r--include/linux/nl802154.h6
-rw-r--r--include/net/ieee802154_netdev.h16
-rw-r--r--include/net/wpan-phy.h22
3 files changed, 37 insertions, 7 deletions
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index b7d9435d5a9..33d9f517510 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -65,6 +65,9 @@ enum {
65 IEEE802154_ATTR_SEC, 65 IEEE802154_ATTR_SEC,
66 66
67 IEEE802154_ATTR_PAGE, 67 IEEE802154_ATTR_PAGE,
68 IEEE802154_ATTR_CHANNEL_PAGE_LIST,
69
70 IEEE802154_ATTR_PHY_NAME,
68 71
69 __IEEE802154_ATTR_MAX, 72 __IEEE802154_ATTR_MAX,
70}; 73};
@@ -114,6 +117,9 @@ enum {
114 IEEE802154_RX_ENABLE_CONF, /* Not supported yet */ 117 IEEE802154_RX_ENABLE_CONF, /* Not supported yet */
115 118
116 IEEE802154_LIST_IFACE, 119 IEEE802154_LIST_IFACE,
120 IEEE802154_LIST_PHY,
121 IEEE802154_ADD_IFACE,
122 IEEE802154_DEL_IFACE,
117 123
118 __IEEE802154_CMD_MAX, 124 __IEEE802154_CMD_MAX,
119}; 125};
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index 5dc6a61952d..57430555487 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -74,8 +74,12 @@ static inline int mac_cb_type(struct sk_buff *skb)
74#define IEEE802154_MAC_SCAN_PASSIVE 2 74#define IEEE802154_MAC_SCAN_PASSIVE 2
75#define IEEE802154_MAC_SCAN_ORPHAN 3 75#define IEEE802154_MAC_SCAN_ORPHAN 3
76 76
77struct wpan_phy;
77/* 78/*
78 * This should be located at net_device->ml_priv 79 * This should be located at net_device->ml_priv
80 *
81 * get_phy should increment the reference counting on returned phy.
82 * Use wpan_wpy_put to put that reference.
79 */ 83 */
80struct ieee802154_mlme_ops { 84struct ieee802154_mlme_ops {
81 int (*assoc_req)(struct net_device *dev, 85 int (*assoc_req)(struct net_device *dev,
@@ -94,18 +98,20 @@ struct ieee802154_mlme_ops {
94 int (*scan_req)(struct net_device *dev, 98 int (*scan_req)(struct net_device *dev,
95 u8 type, u32 channels, u8 page, u8 duration); 99 u8 type, u32 channels, u8 page, u8 duration);
96 100
101 struct wpan_phy *(*get_phy)(const struct net_device *dev);
102
97 /* 103 /*
98 * FIXME: these should become the part of PIB/MIB interface. 104 * FIXME: these should become the part of PIB/MIB interface.
99 * However we still don't have IB interface of any kind 105 * However we still don't have IB interface of any kind
100 */ 106 */
101 u16 (*get_pan_id)(struct net_device *dev); 107 u16 (*get_pan_id)(const struct net_device *dev);
102 u16 (*get_short_addr)(struct net_device *dev); 108 u16 (*get_short_addr)(const struct net_device *dev);
103 u8 (*get_dsn)(struct net_device *dev); 109 u8 (*get_dsn)(const struct net_device *dev);
104 u8 (*get_bsn)(struct net_device *dev); 110 u8 (*get_bsn)(const struct net_device *dev);
105}; 111};
106 112
107static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops( 113static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops(
108 struct net_device *dev) 114 const struct net_device *dev)
109{ 115{
110 return dev->ml_priv; 116 return dev->ml_priv;
111} 117}
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
index 547b1e271ac..85926231c07 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/wpan-phy.h
@@ -34,20 +34,32 @@ struct wpan_phy {
34 */ 34 */
35 u8 current_channel; 35 u8 current_channel;
36 u8 current_page; 36 u8 current_page;
37 u32 channels_supported; 37 u32 channels_supported[32];
38 u8 transmit_power; 38 u8 transmit_power;
39 u8 cca_mode; 39 u8 cca_mode;
40 40
41 struct device dev; 41 struct device dev;
42 int idx; 42 int idx;
43 43
44 struct net_device *(*add_iface)(struct wpan_phy *phy,
45 const char *name);
46 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
47
44 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 48 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
45}; 49};
46 50
51#define to_phy(_dev) container_of(_dev, struct wpan_phy, dev)
52
47struct wpan_phy *wpan_phy_alloc(size_t priv_size); 53struct wpan_phy *wpan_phy_alloc(size_t priv_size);
48int wpan_phy_register(struct device *parent, struct wpan_phy *phy); 54static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev)
55{
56 phy->dev.parent = dev;
57}
58int wpan_phy_register(struct wpan_phy *phy);
49void wpan_phy_unregister(struct wpan_phy *phy); 59void wpan_phy_unregister(struct wpan_phy *phy);
50void wpan_phy_free(struct wpan_phy *phy); 60void wpan_phy_free(struct wpan_phy *phy);
61/* Same semantics as for class_for_each_device */
62int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data);
51 63
52static inline void *wpan_phy_priv(struct wpan_phy *phy) 64static inline void *wpan_phy_priv(struct wpan_phy *phy)
53{ 65{
@@ -56,6 +68,12 @@ static inline void *wpan_phy_priv(struct wpan_phy *phy)
56} 68}
57 69
58struct wpan_phy *wpan_phy_find(const char *str); 70struct wpan_phy *wpan_phy_find(const char *str);
71
72static inline void wpan_phy_put(struct wpan_phy *phy)
73{
74 put_device(&phy->dev);
75}
76
59static inline const char *wpan_phy_name(struct wpan_phy *phy) 77static inline const char *wpan_phy_name(struct wpan_phy *phy)
60{ 78{
61 return dev_name(&phy->dev); 79 return dev_name(&phy->dev);