From patchwork Mon Dec 26 17:11:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alex.bluesman.smirnov@gmail.com X-Patchwork-Id: 133247 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2515BB702F for ; Tue, 27 Dec 2011 03:12:38 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751516Ab1LZQMd (ORCPT ); Mon, 26 Dec 2011 11:12:33 -0500 Received: from mail-ee0-f46.google.com ([74.125.83.46]:39503 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750966Ab1LZQMc (ORCPT ); Mon, 26 Dec 2011 11:12:32 -0500 Received: by eekc4 with SMTP id c4so11134286eek.19 for ; Mon, 26 Dec 2011 08:12:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=Hs6XEVj4IKKQaV9MPk7wBAWhWHHFvioCn+GvgiWW2Eo=; b=UKUTp0uhbSZRFS7JI7wQTyXzEuxk6ZsoVm5jHl/SFBE5KHY7WNf8O2Pg7XaYexja9q O8/Uc6YFPMIwr3mhQhk5S8KyOV+vk+q01LBhL5eO3Z05uHowJDwDV6v3HLUv/Ms5eHeR 7UFtgE2Bvb7E7urhRN8vk3p3yRDrL5NeSRp9g= Received: by 10.213.9.134 with SMTP id l6mr8454610ebl.57.1324915951226; Mon, 26 Dec 2011 08:12:31 -0800 (PST) Received: from localhost.localdomain ([91.213.169.4]) by mx.google.com with ESMTPS id 13sm93742263eeu.1.2011.12.26.08.12.29 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Dec 2011 08:12:30 -0800 (PST) From: Alexander Smirnov To: davem@davemloft.net Cc: dbaryshkov@gmail.com, linux-zigbee-devel@lists.sourceforge.net, netdev@vger.kernel.org, Alexander Smirnov Subject: [PATCH 10/14 v2] ieee802154: interface type to be added Date: Mon, 26 Dec 2011 20:11:34 +0300 Message-Id: <1324919494-15181-1-git-send-email-alex.bluesman.smirnov@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This stack supports several types of slaves interfaces. Another parameter to 'add_iface_ function is added. Signed-off-by: Alexander Smirnov --- include/linux/nl802154.h | 6 ++++++ include/net/wpan-phy.h | 2 +- net/ieee802154/nl-phy.c | 9 ++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h index d2b5ae2..e339c96 100644 --- a/include/linux/nl802154.h +++ b/include/linux/nl802154.h @@ -68,6 +68,7 @@ enum { IEEE802154_ATTR_CHANNEL_PAGE_LIST, IEEE802154_ATTR_PHY_NAME, + IEEE802154_ATTR_DEV_TYPE, __IEEE802154_ATTR_MAX, }; @@ -124,4 +125,9 @@ enum { #define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) +enum { + __IEEE802154_DEV_INVALID = -1, + __IEEE802154_DEV_MAX, +}; + #endif diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h index d86fffd..1437c90 100644 --- a/include/net/wpan-phy.h +++ b/include/net/wpan-phy.h @@ -42,7 +42,7 @@ struct wpan_phy { int idx; struct net_device *(*add_iface)(struct wpan_phy *phy, - const char *name); + const char *name, int type); void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c index c64a38d..2e0ae10 100644 --- a/net/ieee802154/nl-phy.c +++ b/net/ieee802154/nl-phy.c @@ -179,6 +179,7 @@ static int ieee802154_add_iface(struct sk_buff *skb, const char *devname; int rc = -ENOBUFS; struct net_device *dev; + int type = __IEEE802154_DEV_INVALID; pr_debug("%s\n", __func__); @@ -221,7 +222,13 @@ static int ieee802154_add_iface(struct sk_buff *skb, goto nla_put_failure; } - dev = phy->add_iface(phy, devname); + if (info->attrs[IEEE802154_ATTR_DEV_TYPE]) { + type = nla_get_u8(info->attrs[IEEE802154_ATTR_DEV_TYPE]); + if (type >= __IEEE802154_DEV_MAX) + return -EINVAL; + } + + dev = phy->add_iface(phy, devname, type); if (IS_ERR(dev)) { rc = PTR_ERR(dev); goto nla_put_failure;