From patchwork Fri Sep 23 13:08:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Dedecker X-Patchwork-Id: 674070 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sgYd239QTz9t14 for ; Fri, 23 Sep 2016 23:10:30 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=TIxmgpA6; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 242BEB92CF7; Fri, 23 Sep 2016 15:08:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP; Fri, 23 Sep 2016 15:08:49 +0200 (CEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 44D71B92CD4 for ; Fri, 23 Sep 2016 15:08:41 +0200 (CEST) X-policyd-weight: using cached result; rate:hard: -7 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Fri, 23 Sep 2016 15:08:41 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id l132so2735799wmf.1 for ; Fri, 23 Sep 2016 06:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3hTICw9P5HDzFAQz0pcXlddtBsM9IBG9t8m7xitbCZo=; b=TIxmgpA6tZUFk0W0CPCr5qQopDp4YlncPH3wH4WS7EhP5UOGX8iyYi1cC17LSgkLfM NeDVwx7iGNUtVfO/31AdkeEkPloiL4uvwZ3RLBBUeqfY1ZPNNrfqGeml75l5wxmpZVyA KfuJ5DrGCRrM4AEM7KmCxhF0aKZVbzQbijy58NLS3o/yEc8+PPeny9TlqyPA5hu+QoYq /MWvq9t4bI2c/8QevC29+YTQ1PC+yDT7JasifvZ6RaUtY0ARtupLibDa6XnlhLyQfh1k WTIxEZfUx+U/UPpPcxZ4tB1a/X08YYZHQnb7B/LhkkRIbxLzXppS7AMNGODPKBrM6bJD Macg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3hTICw9P5HDzFAQz0pcXlddtBsM9IBG9t8m7xitbCZo=; b=UPBaY0Gg2xNEuAEglifpNWsbqT4Q0ncGxCPXijFd34nkMAhXU3YbSpY2tUR1yxnZpv FCCblNqTtMLH5ZxNH6m2cj0mtTIPQbGuxGRHjAq475sOCxdlP/9LhC+6R6zAUp+RxNtg ndj3gUHpIbUexiMkS3PLf6HDZandL+uk/++oGURqw9bO5W+G+WSCHbmXbPPVr+UiUq6w yJ2egRRonpb7pv6hkSYM16XwyOK1zKGswo5ta1B0RjhJ+CDTSGO12KpopAMvoMLGxBOB ccm3MoJqZ8SCgGVYGCiD1sESJSbw/j84Tr51ETku6LoPGypiyrmW7YUhrs5UUI6pZUJ1 PS4w== X-Gm-Message-State: AA6/9Rm0n1VfagTlBYPM2aMS98Vgj6FMm3ruMi279L8F0iHV8twP53uHTSbjI2tpV1RU+w== X-Received: by 10.194.18.202 with SMTP id y10mr6853131wjd.174.1474636120853; Fri, 23 Sep 2016 06:08:40 -0700 (PDT) Received: from cplx43.eu.thmulti.com ([141.11.62.7]) by smtp.gmail.com with ESMTPSA id u124sm3069784wmu.10.2016.09.23.06.08.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Sep 2016 06:08:40 -0700 (PDT) From: Hans Dedecker To: nbd@nbd.name, lede-dev@lists.infradead.org, openwrt-devel@lists.openwrt.org Date: Fri, 23 Sep 2016 15:08:22 +0200 Message-Id: <1474636103-25093-6-git-send-email-dedeckeh@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474636103-25093-1-git-send-email-dedeckeh@gmail.com> References: <1474636103-25093-1-git-send-email-dedeckeh@gmail.com> Subject: [OpenWrt-Devel] [PATCH netifd 6/7] vlandev: Rework 8021ad/8021q detection based on vlandevice type X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hans Dedecker MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Signed-off-by: Hans Dedecker --- vlandev.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/vlandev.c b/vlandev.c index b065c27..7e46251 100644 --- a/vlandev.c +++ b/vlandev.c @@ -20,14 +20,12 @@ #include "system.h" enum { - VLANDEV_ATTR_TYPE, VLANDEV_ATTR_IFNAME, VLANDEV_ATTR_VID, __VLANDEV_ATTR_MAX }; static const struct blobmsg_policy vlandev_attrs[__VLANDEV_ATTR_MAX] = { - [VLANDEV_ATTR_TYPE] = { "type", BLOBMSG_TYPE_STRING }, [VLANDEV_ATTR_IFNAME] = { "ifname", BLOBMSG_TYPE_STRING }, [VLANDEV_ATTR_VID] = { "vid", BLOBMSG_TYPE_INT32 }, }; @@ -40,6 +38,8 @@ static const struct uci_blob_param_list vlandev_attr_list = { .next = { &device_attr_list }, }; +static struct device_type vlan8021q_device_type; + struct vlandev_device { struct device dev; struct device_user parent; @@ -158,15 +158,10 @@ vlandev_apply_settings(struct vlandev_device *mvdev, struct blob_attr **tb) struct vlandev_config *cfg = &mvdev->config; struct blob_attr *cur; - cfg->proto = VLAN_PROTO_8021Q; + cfg->proto = (mvdev->dev.type == &vlan8021q_device_type) ? + VLAN_PROTO_8021Q : VLAN_PROTO_8021AD; cfg->vid = 1; - if ((cur = tb[VLANDEV_ATTR_TYPE])) - { - if(!strcmp(blobmsg_data(cur), "8021ad")) - cfg->proto = VLAN_PROTO_8021AD; - } - if ((cur = tb[VLANDEV_ATTR_VID])) cfg->vid = (uint16_t) blobmsg_get_u32(cur); }