Message ID | 1322663126-3987-1-git-send-email-alex.bluesman.smirnov@gmail.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On Wed, Nov 30, 2011 at 6:25 PM, Alexander Smirnov <alex.bluesman.smirnov@gmail.com> wrote: > Define light-weight mlme interface. Could you please elaborate, why it is necessary? I created it for the sub-devices which didn't have full IEEE 802.15.4 MLME (like monitoring devices, SMAC or MiWi, or other proprietary protocols), but I don't see support for those coming in this patch set. > > Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov@gmail.com> > --- > include/net/ieee802154_netdev.h | 11 +++++++++++ > net/ieee802154/nl-mac.c | 2 +- > 2 files changed, 12 insertions(+), 1 deletions(-) > > diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h > index 12a7ee4..5264b00 100644 > --- a/include/net/ieee802154_netdev.h > +++ b/include/net/ieee802154_netdev.h > @@ -83,7 +83,12 @@ struct wpan_phy; > * get_phy should increment the reference counting on returned phy. > * Use wpan_wpy_put to put that reference. > */ > +struct simple_mlme_ops { > + struct wpan_phy *(*get_phy)(const struct net_device *dev); > +}; > struct ieee802154_mlme_ops { > + struct simple_mlme_ops wpan_ops; > + > int (*assoc_req)(struct net_device *dev, > struct ieee802154_addr *addr, > u8 channel, u8 page, u8 cap); > @@ -112,6 +117,12 @@ struct ieee802154_mlme_ops { > u8 (*get_bsn)(const struct net_device *dev); > }; > > +static inline struct simple_mlme_ops *simple_mlme_ops( > + const struct net_device *dev) > +{ > + return dev->ml_priv; > +} > + > static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops( > const struct net_device *dev) > { > diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c > index adaf462..1d23aa6 100644 > --- a/net/ieee802154/nl-mac.c > +++ b/net/ieee802154/nl-mac.c > @@ -263,7 +263,7 @@ static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 pid, > if (!hdr) > goto out; > > - phy = ieee802154_mlme_ops(dev)->get_phy(dev); > + phy = simple_mlme_ops(dev)->get_phy(dev); > BUG_ON(!phy); > > NLA_PUT_STRING(msg, IEEE802154_ATTR_DEV_NAME, dev->name); > -- > 1.7.2.3 > >
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h index 12a7ee4..5264b00 100644 --- a/include/net/ieee802154_netdev.h +++ b/include/net/ieee802154_netdev.h @@ -83,7 +83,12 @@ struct wpan_phy; * get_phy should increment the reference counting on returned phy. * Use wpan_wpy_put to put that reference. */ +struct simple_mlme_ops { + struct wpan_phy *(*get_phy)(const struct net_device *dev); +}; struct ieee802154_mlme_ops { + struct simple_mlme_ops wpan_ops; + int (*assoc_req)(struct net_device *dev, struct ieee802154_addr *addr, u8 channel, u8 page, u8 cap); @@ -112,6 +117,12 @@ struct ieee802154_mlme_ops { u8 (*get_bsn)(const struct net_device *dev); }; +static inline struct simple_mlme_ops *simple_mlme_ops( + const struct net_device *dev) +{ + return dev->ml_priv; +} + static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops( const struct net_device *dev) { diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c index adaf462..1d23aa6 100644 --- a/net/ieee802154/nl-mac.c +++ b/net/ieee802154/nl-mac.c @@ -263,7 +263,7 @@ static int ieee802154_nl_fill_iface(struct sk_buff *msg, u32 pid, if (!hdr) goto out; - phy = ieee802154_mlme_ops(dev)->get_phy(dev); + phy = simple_mlme_ops(dev)->get_phy(dev); BUG_ON(!phy); NLA_PUT_STRING(msg, IEEE802154_ATTR_DEV_NAME, dev->name);
Define light-weight mlme interface. Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov@gmail.com> --- include/net/ieee802154_netdev.h | 11 +++++++++++ net/ieee802154/nl-mac.c | 2 +- 2 files changed, 12 insertions(+), 1 deletions(-)