On 27/01/14 20:03, Phoebe Buckheister wrote:
> Listen-before-talk is an alternative to CSMA in uncoordinated networks
> and prescribed by european regulations if one wants to have a device
> with radio duty cycles above 10% (or less in some bands). Add a phy
> property to enable/disable LBT in the phy, including support in the
> at86rf230 driver for RF212 chips.
>
> Signed-off-by: Phoebe Buckheister <[email protected]>
> ---
> +static int
> +at86rf230_set_lbt(struct ieee802154_dev *dev, u8 on)
Judging from datasheets I have, this is rf212-specific. Please name it
so. And the argument is bool, isn't it?
> + IEEE802154_ATTR_LBT_ENABLED,
> + * set_lbt
> + * Enables or disables listen before talk on the device.
> + * Returns either zero, or negative errno.
Again, what about pib_lock here?
> */
> struct ieee802154_ops {
> struct module *owner;
> @@ -134,6 +138,7 @@ struct ieee802154_ops {
> int (*ieee_addr)(struct ieee802154_dev *dev,
> u8 addr[IEEE802154_ADDR_LEN]);
> int (*set_txpower)(struct ieee802154_dev *dev, int db);
> + int (*set_lbt)(struct ieee802154_dev *dev, u8 on);
bool
> };
>
> /* Basic interface to register ieee802154 device */
> diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
> index 44e5e49..30cdae6 100644
> --- a/include/net/wpan-phy.h
> +++ b/include/net/wpan-phy.h
> @@ -47,6 +47,8 @@ struct wpan_phy {
> u8 transmit_power;
> u8 cca_mode;
>
> + u8 lbt:1;
> +
bool!
> struct device dev;
> int idx;
>
> @@ -55,6 +57,7 @@ struct wpan_phy {
> void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
>
> int (*set_txpower)(struct wpan_phy *phy, int txpower);
> + int (*set_lbt)(struct wpan_phy *phy, u8 on);
and here too.
>
> char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
> };
> diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c
> index 3ade8c6..cda6e0d 100644
> --- a/net/ieee802154/nl-phy.c
> +++ b/net/ieee802154/nl-phy.c
> @@ -57,7 +57,8 @@ static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32
> portid,
> nla_put_u8(msg, IEEE802154_ATTR_PAGE, phy->current_page) ||
> nla_put_u8(msg, IEEE802154_ATTR_CHANNEL, phy->current_channel) ||
> nla_put_s32(msg, IEEE802154_ATTR_TXPOWER,
> - ((signed char) (phy->transmit_power << 2)) >>
> 2))
> + ((signed char) (phy->transmit_power << 2)) >> 2) ||
> + nla_put_u8(msg, IEEE802154_ATTR_LBT_ENABLED, phy->lbt))
nla_get/put_flag please.
> goto nla_put_failure;
> for (i = 0; i < 32; i++) {
> if (phy->channels_supported[i])
> }
>
> +static int mac802154_set_lbt(struct wpan_phy *phy, u8 on)
> +{
> + struct mac802154_priv *priv = wpan_phy_priv(phy);
> +
> + return priv->ops->set_lbt(&priv->hw, on);
or return -EOPNOTUSPP
> +}
> +
--
With best wishes
Dmitry
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Linux-zigbee-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel