Hi
I wanted help in reviewing these patches. Could anybody please review these
patches . If i have made any mistake in the patch format please point it
out to me.
Sorry for any obvious mistakes.
Regards
Prajosh Premdas
On Fri, Feb 24, 2012 at 2:32 PM, Prajosh Premdas
<premdas.praj...@gmail.com>wrote:
> mlme reset functionality has been added for netlink socket interface
> attributes mentioned are as per the IEEE 802.15.4 - 2006 specification
>
> Tested on SAM9G20-EK board
>
> Signed-off-by: Prajosh Premdas <premdas.praj...@gmail.com>
> ---
> include/linux/nl802154.h | 2 +
> include/net/ieee802154_netdev.h | 2 +
> include/net/nl802154.h | 9 ++++++
> net/ieee802154/nl-mac.c | 57
> +++++++++++++++++++++++++++++++++++++-
> net/ieee802154/nl_policy.c | 2 +
> 5 files changed, 70 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
> index fbd0fdf..69fe03a 100644
> --- a/include/linux/nl802154.h
> +++ b/include/linux/nl802154.h
> @@ -70,6 +70,8 @@ enum {
> IEEE802154_ATTR_PHY_NAME,
> IEEE802154_ATTR_DEV_TYPE,
>
> + IEEE802154_ATTR_SET_DEFAULT_PIB,
> +
> __IEEE802154_ATTR_MAX,
> };
>
> diff --git a/include/net/ieee802154_netdev.h
> b/include/net/ieee802154_netdev.h
> index b27730e..25cb045 100644
> --- a/include/net/ieee802154_netdev.h
> +++ b/include/net/ieee802154_netdev.h
> @@ -92,6 +92,8 @@ struct wpan_phy;
> * So 2 sets of mlme operations are needed
> */
> struct ieee802154_mlme_ops {
> + int (*reset_req)(struct net_device *dev,
> + u8 SetDefaultPIB);
> int (*assoc_req)(struct net_device *dev,
> struct ieee802154_addr *addr,
> u8 channel, u8 page, u8 cap);
> diff --git a/include/net/nl802154.h b/include/net/nl802154.h
> index 99d2ba1..23c2302 100644
> --- a/include/net/nl802154.h
> +++ b/include/net/nl802154.h
> @@ -123,4 +123,13 @@ int ieee802154_nl_beacon_indic(struct net_device
> *dev, u16 panid,
> */
> int ieee802154_nl_start_confirm(struct net_device *dev, u8 status);
>
> +/**
> + * ieee802154_reset_confirm - Notify userland of completion of reset.
> + * @dev: The device which was instructed to scan.
> + * @status: The status of the scan operation.
> + *
> + * Note: This is in section 7.1.9.2 of the IEEE 802.15.4 document.
> + */
> +int ieee802154_reset_confirm(struct net_device *dev, u8 status);
> +
> #endif
> diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c
> index adaf462..2ace28b 100644
> --- a/net/ieee802154/nl-mac.c
> +++ b/net/ieee802154/nl-mac.c
> @@ -1,8 +1,6 @@
> /*
> * Netlink inteface for IEEE 802.15.4 stack
> *
> - * Copyright 2007, 2008 Siemens AG
> - *
> * This program is free software; you can redistribute it and/or modify
> * it under the terms of the GNU General Public License version 2
> * as published by the Free Software Foundation.
> @@ -20,6 +18,8 @@
> * Sergey Lapin <sla...@ossfans.org>
> * Dmitry Eremin-Solenikov <dbarysh...@gmail.com>
> * Maxim Osipov <maxim.osi...@siemens.com>
> + * Felix Varghese <felix.vargh...@atmel.com>
> + * Prajosh Premdas <prajosh.prem...@atmel.com>
> */
>
> #include <linux/gfp.h>
> @@ -519,6 +519,58 @@ static int ieee802154_scan_req(struct sk_buff *skb,
> struct genl_info *info)
> return ret;
> }
>
> +static int ieee802154_reset_req(struct sk_buff *skb, struct genl_info
> *info)
> +{
> + struct net_device *dev;
> + u8 SetDefaultPIB;
> + int ret = -EINVAL;
> +
> + if (!info->attrs[IEEE802154_ATTR_SET_DEFAULT_PIB])
> + return -EINVAL;
> +
> + dev = ieee802154_nl_get_dev(info);
> + if (!dev)
> + return -ENODEV;
> +
> + if (nla_get_u8(info->attrs[IEEE802154_ATTR_SET_DEFAULT_PIB]))
> + SetDefaultPIB = 1;
> + else
> + SetDefaultPIB = 0;
> +
> + ret = ieee802154_mlme_ops(dev)->reset_req(dev, SetDefaultPIB);
> +
> + if (ret == 0)
> + ieee802154_reset_confirm(dev, IEEE802154_SUCCESS);
> + else
> + ieee802154_reset_confirm(dev,
> IEEE802154_INVALID_PARAMETER);
> +
> + dev_put(dev);
> + return ret;
> +}
> +
> +int ieee802154_reset_confirm(struct net_device *dev, u8 status)
> +{
> + struct sk_buff *msg;
> +
> + msg = ieee802154_nl_create(0, IEEE802154_RESET_CONF);
> + if (!msg)
> + return -ENOBUFS;
> +
> + NLA_PUT_STRING(msg, IEEE802154_ATTR_DEV_NAME, dev->name);
> + NLA_PUT_U32(msg, IEEE802154_ATTR_DEV_INDEX, dev->ifindex);
> + NLA_PUT(msg, IEEE802154_ATTR_HW_ADDR, IEEE802154_ADDR_LEN,
> + dev->dev_addr);
> +
> + NLA_PUT_U8(msg, IEEE802154_ATTR_STATUS, status);
> +
> + return ieee802154_nl_mcast(msg, ieee802154_coord_mcgrp.id);
> +
> +nla_put_failure:
> + nlmsg_free(msg);
> + return -ENOBUFS;
> +}
> +EXPORT_SYMBOL(ieee802154_reset_confirm);
> +
> static int ieee802154_list_iface(struct sk_buff *skb,
> struct genl_info *info)
> {
> @@ -581,6 +633,7 @@ cont:
> }
>
> static struct genl_ops ieee802154_coordinator_ops[] = {
> + IEEE802154_OP(IEEE802154_RESET_REQ, ieee802154_reset_req),
> IEEE802154_OP(IEEE802154_ASSOCIATE_REQ, ieee802154_associate_req),
> IEEE802154_OP(IEEE802154_ASSOCIATE_RESP, ieee802154_associate_resp),
> IEEE802154_OP(IEEE802154_DISASSOCIATE_REQ,
> ieee802154_disassociate_req),
> diff --git a/net/ieee802154/nl_policy.c b/net/ieee802154/nl_policy.c
> index 6adda4d..9da1d72 100644
> --- a/net/ieee802154/nl_policy.c
> +++ b/net/ieee802154/nl_policy.c
> @@ -52,5 +52,7 @@ const struct nla_policy
> ieee802154_policy[IEEE802154_ATTR_MAX + 1] = {
> [IEEE802154_ATTR_DURATION] = { .type = NLA_U8, },
> [IEEE802154_ATTR_ED_LIST] = { .len = 27 },
> [IEEE802154_ATTR_CHANNEL_PAGE_LIST] = { .len = 32 * 4, },
> +
> + [IEEE802154_ATTR_SET_DEFAULT_PIB] = { .type = NLA_U8, },
> };
>
> --
> 1.7.4.1
>
>
--
Regards,
Prajosh Premdas
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel