Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp565478ybh; Tue, 21 Jul 2020 02:20:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4vd+KVfs9xdAZYwApw9xrAuoq9gbeO91AKiy4HfZ5ShspJMueDQxr8ChPS9xEWvDv+gpW X-Received: by 2002:a17:906:c2cb:: with SMTP id ch11mr2582222ejb.61.1595323211409; Tue, 21 Jul 2020 02:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595323211; cv=none; d=google.com; s=arc-20160816; b=ylqlpOQyzvAy3YlWBAXS5DxP4CeILFbfsKL8rYv4LoGIB6YhqBUsMiaG4t/HJkNXRk /Y0/kXE6NZm5mSGgGZQitZ8Z6wET1oJ28SH8UXjZG8Lxw/s6bbhRQf+SfqScIrAwO240 IfMwBsW+Ibd40CyLBvYti0j+7e9CiHwhFQ0uBDcEbwUlls3OslM0axhDbBjH4+E+7IS+ zpHd4QhQc5bzdK7VMnFgaKS/xfhs2uAeWCwfuSJsVR3lVWQaBCpdWpHMsV4xiEdf2b0x KtvykCOBYtPCLViw14J2FanLplOxz/b3TYnqY46+FTA3ZMH0llk8RAhR58g7hxU0ht34 aaww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=vQlIKKQf6NqupX/9sDUcU9ivSZe9ALYVdV6GIRE3QE8=; b=pxGIeOYyJSkdDW3f5QgUqnu9n6fvYrx55QKUQpIuolkVDIhpvdEoI1WZ/8JcdMH0h6 rlYDRvT4g3ywV7/TWaWZJ4t9TKl3jien7tPkBd9N2mcqkR45huffQYfEWgbBvdCQjaCy unUH9pyMptUX8WQxxRDhJRCtStAsUZV68Jhh9ZCuma1Xtds7dJD+XohZsOBgZ52Nbn0J icdY7vLFc7hXrT2uDwuZTVJHNATG4H1253e2QVTm9j6APEymabddpYJgoSOdEKFbvbCB JoFgc5pWQ85YKCYiwMgmPeVIBVchU19Jwo1QHVkElgUTSzO/PCTt0OFqAeFT6Ne4CKbh 7I8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bq6si11772956ejb.108.2020.07.21.02.19.48; Tue, 21 Jul 2020 02:20:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728934AbgGUJTg (ORCPT + 99 others); Tue, 21 Jul 2020 05:19:36 -0400 Received: from inva020.nxp.com ([92.121.34.13]:34296 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726990AbgGUJTe (ORCPT ); Tue, 21 Jul 2020 05:19:34 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 25EEB1A05CC; Tue, 21 Jul 2020 11:19:32 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 1A2001A05BD; Tue, 21 Jul 2020 11:19:32 +0200 (CEST) Received: from fsr-ub1864-126.ea.freescale.net (fsr-ub1864-126.ea.freescale.net [10.171.82.212]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id D95C3202A9; Tue, 21 Jul 2020 11:19:31 +0200 (CEST) From: Ioana Ciornei To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, Ioana Ciornei Subject: [PATCH 3/6] staging: dpaa2-ethsw: setup the STP state for all installed VLANs Date: Tue, 21 Jul 2020 12:19:16 +0300 Message-Id: <20200721091919.20394-4-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200721091919.20394-1-ioana.ciornei@nxp.com> References: <20200721091919.20394-1-ioana.ciornei@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Setup the STP state for all VLANs installed on the port. This is also avoiding the error situation when the DEFAULT_VLAN_ID is not installed on the port (thus the firmware complains that it cannot setup the required STP state). Signed-off-by: Ioana Ciornei --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index 530e4105375c..83e6bd4a803b 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -183,21 +183,26 @@ static int ethsw_port_set_flood(struct ethsw_port_priv *port_priv, bool enable) static int ethsw_port_set_stp_state(struct ethsw_port_priv *port_priv, u8 state) { struct dpsw_stp_cfg stp_cfg = { - .vlan_id = DEFAULT_VLAN_ID, .state = state, }; int err; + u16 vid; if (!netif_running(port_priv->netdev) || state == port_priv->stp_state) return 0; /* Nothing to do */ - err = dpsw_if_set_stp(port_priv->ethsw_data->mc_io, 0, - port_priv->ethsw_data->dpsw_handle, - port_priv->idx, &stp_cfg); - if (err) { - netdev_err(port_priv->netdev, - "dpsw_if_set_stp err %d\n", err); - return err; + for (vid = 0; vid <= VLAN_VID_MASK; vid++) { + if (port_priv->vlans[vid] & ETHSW_VLAN_MEMBER) { + stp_cfg.vlan_id = vid; + err = dpsw_if_set_stp(port_priv->ethsw_data->mc_io, 0, + port_priv->ethsw_data->dpsw_handle, + port_priv->idx, &stp_cfg); + if (err) { + netdev_err(port_priv->netdev, + "dpsw_if_set_stp err %d\n", err); + return err; + } + } } port_priv->stp_state = state; -- 2.25.1