On 24/02/12 13:02, Prajosh Premdas wrote:
> From: Felix Varghese <felixvarg...@gmail.com>
> 
> Adds structure definitions and function prototypes for implementing PIB
> get and set primitives

NAK. I have already commented about PIB get/set. Now about
set_trx_state. If you care about direct radio access from MCU, you
probably care about such things. Or if you care about specifying
exactly, how the device should behave. On the other hand, from bigger
point of view, your radio is either off, or listening for incoming
frames. Or you can ask it to transmit something. There is no point
in controlling TRX state directly from higher layer.

> 
> Signed-off-by: Felix Varghese <felixvarg...@gmail.com>
> Signed-off-by: Prajosh Premdas <premdas.praj...@gmail.com>
> ---
>  include/net/mac802154.h   |   10 +++++++
>  net/mac802154/mac802154.h |   58 
> ++++++++++++++++++++++++++++++++++-----------
>  2 files changed, 54 insertions(+), 14 deletions(-)
> 
> diff --git a/include/net/mac802154.h b/include/net/mac802154.h
> index 5eaba60..e274414 100644
> --- a/include/net/mac802154.h
> +++ b/include/net/mac802154.h
> @@ -142,6 +142,16 @@ struct ieee802154_ops {
>                                           unsigned long changed);
>       int             (*ieee_addr)(struct ieee802154_dev *dev,
>                                    u8 addr[IEEE802154_ADDR_LEN]);
> +
> +     /* PLME-SAP */
> +     int             (*set_trx_state)(struct ieee802154_dev *dev,
> +                                     int trx_state);
> +     int             (*get)(struct ieee802154_dev *dev,
> +                                     u8 attribute_id,
> +                                     u8 *attribute_val);
> +     int             (*set)(struct ieee802154_dev *dev,
> +                                     u8 attribute_id,
> +                                     u8 *attribute_val);
>  };
>  
>  struct ieee802154_dev *
> diff --git a/net/mac802154/mac802154.h b/net/mac802154/mac802154.h
> index f0a0c08..0079a96 100644
> --- a/net/mac802154/mac802154.h
> +++ b/net/mac802154/mac802154.h
> @@ -23,6 +23,8 @@
>  #ifndef MAC802154_H
>  #define MAC802154_H
>  
> +#include <net/ieee802154.h>
> +
>  struct mac802154_priv {
>       struct ieee802154_dev   hw;
>       struct ieee802154_ops   *ops;
> @@ -54,6 +56,37 @@ struct mac802154_priv {
>       unsigned running:1;
>  };
>  
> +/* Section 7.4.2 MAC PIB attributes */
> +struct mac_pib_t {
> +     u8  AssociatedPANCoord;
> +     u8  AssociationPermit;
> +     u8  AutoRequest;
> +     u8  BattLifeExt;
> +     u8  BattLifeExtPeriods;
> +     u8  BeaconPayload[aMaxBeaconPayloadLength];
> +     u8  BeaconPayloadLength;
> +     u8  BeaconOrder;
> +     u32 BeaconTxTime;
> +     u8  BSN;
> +     u64 CoordExtendedAddress;
> +     u16 CoordShortAddress;
> +     u8  DSN;
> +     u8  GTSPermit;
> +     u8  MaxBE;
> +     u8  MaxCSMABackoffs;
> +     u16 MaxFrameTotalWaitTime;
> +     u8  MaxFrameRetries;
> +     u8  MinBE;
> +     u16 PANId;
> +     u8  PromiscuousMode;
> +     u16 ResponseWaitTime;
> +     u8  RxOnWhenIdle;
> +     u8  SecurityEnabled;
> +     u16 ShortAddress;
> +     u8  SuperFrameOrder;
> +     u16 TransactionPersistenceTime;
> +};
> +
>  enum {
>       MAC802154_DEVICE_STOPPED,
>       MAC802154_DEVICE_RUN,
> @@ -70,18 +103,8 @@ struct mac802154_sub_if_data {
>  
>       int type;
>  
> -     spinlock_t mib_lock;
> -
> -     __le16 pan_id;
> -     __le16 short_addr;
> -
> -     u8 chan;
> -     u8 page;
> -
> -     /* MAC BSN field */
> -     u8 bsn;
> -     /* MAC DSN field */
> -     u8 dsn;
> +     struct mutex macPIB_lock;
> +     struct mac_pib_t macPIB;
>  };
>  
>  #define mac802154_to_priv(_hw)       container_of(_hw, struct 
> mac802154_priv, hw)
> @@ -101,7 +124,14 @@ void mac802154_monitor_setup(struct net_device *dev);
>  netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
>                        u8 page, u8 chan);
>  
> -/* MIB callbacks */
> -void mac802154_dev_set_ieee_addr(struct net_device *dev);
> +/* MLME_GET request and confirm function definitions */
> +extern int mlme_get_req(struct net_device *dev, u8 PIBattr);
> +extern int internal_get_mac_pib(struct net_device *dev,
> +                             u8 PIBattr, void *PIBval);
> +
> +/* MLME_SET request and confirm function definitions */
> +extern int mlme_set_req(struct net_device *dev, u8 PIBattr, void *PIBval);
> +extern int internal_set_mac_pib(struct net_device *dev,
> +                             u8 PIBattr, void *PIBval);
>  
>  #endif /* MAC802154_H */


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to