Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2654088pxa; Mon, 17 Aug 2020 15:37:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8+TlXkqIKWBEvbVThdJvGe00+t235TR5Go656A4ypdFtbFcx9XUN7g0zZ0mM3LdFAy5cI X-Received: by 2002:a17:906:6d54:: with SMTP id a20mr18148914ejt.501.1597703828839; Mon, 17 Aug 2020 15:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597703828; cv=none; d=google.com; s=arc-20160816; b=PSEXImd3f4jodXbIdv7hM7jY1vpDHdthBKBiqFCy7YOcxvsP1OU5mARWAiJYpNqGnP yv7q6BkXy+pMF0qmcPSKaNcpJnsjJ+7UvSJrHYjtRB4t5xFF4t6dRyoorXs6CcxR7wTH bVJQvt3/yHUOMkbOClFbrYWBUs26E4UkspyejTVff+CcUFEXwV69EXfRKd7kRf6fzRw7 1q9MDuyKtgb82WlS08iaopn3UwzWOdusZ+YBTB3uPcEYSReHBIjq9ZtHyAz0ySfDkhRK I+hjPX1ZCDQwm9sTL5f7n43T1G6Hv+RUnf3BSJwSGYPF+//SGuyBgRgOl1dTDQswMHaE dsiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nZrBf8xHXchPM2P/PcKSwNAjgfapctR4vTv7gIyKC0U=; b=q7wB06uqys1j1fvDerlWz2WlQ+cTwYPmYbh2H4Kca1KDGgYi6vxDX5NG7cRUUhT4FW 7getpDGSpyxYXd7JZ6Ib2HvDbm2vPoWU/6uktjFhIDIiVfcRJXrFg5g65Cfl9wMbghV/ TLkYjU8AQ4ZNWSdLGGye/d40zMt86qZIFXVsHE0sg488WwH+fxKkPEzj5nw7xhqJwHHg U9oj56HN2khb0vNFUE+1V/Fz4y7uXVuGaPzBfE4DnqFFEaOc//sh3A4EjheEeuDunpLs e/8WCYhWQ/mxIcC/IibcwdDMrsNAGnUlMlat7n3ZwEwrZbIJ5V/qWhHM0yj+NVdj2VWm 0xtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jF3SoQRI; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m21si11884220edr.155.2020.08.17.15.36.45; Mon, 17 Aug 2020 15:37:08 -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; dkim=pass header.i=@kernel.org header.s=default header.b=jF3SoQRI; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389506AbgHQRSc (ORCPT + 99 others); Mon, 17 Aug 2020 13:18:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:53370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388805AbgHQQPM (ORCPT ); Mon, 17 Aug 2020 12:15:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D0E29206FA; Mon, 17 Aug 2020 16:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680912; bh=LZEDUxir5qmJ/DDY6kHLkIl4v+t4VAJliT08wxgDnIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jF3SoQRI64o7GPschgDfIEzhHsVgJGbLUGk286l2EFh23A3aEiPxUAFsGfbO2xM8/ W7J6fwYPQX8cn5Tl5Cp+Qeag9qRcSAMOlbCq9VBietYifiLTzwkl6biKyKVpk/uPUf bxhmvGwl23U7LYoz86IMEARqXx/Ow4fLFgrm+GKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, DENG Qingfang , Mauri Sandberg , Florian Fainelli , Linus Walleij , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 108/168] net: dsa: rtl8366: Fix VLAN set-up Date: Mon, 17 Aug 2020 17:17:19 +0200 Message-Id: <20200817143739.085827014@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143733.692105228@linuxfoundation.org> References: <20200817143733.692105228@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Walleij [ Upstream commit 788abc6d9d278ed6fa1fa94db2098481a04152b7 ] Alter the rtl8366_vlan_add() to call rtl8366_set_vlan() inside the loop that goes over all VIDs since we now properly support calling that function more than once. Augment the loop to postincrement as this is more intuitive. The loop moved past the last VID but called rtl8366_set_vlan() with the port number instead of the VID, assuming a 1-to-1 correspondence between ports and VIDs. This was also a bug. Cc: DENG Qingfang Cc: Mauri Sandberg Reviewed-by: Florian Fainelli Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver") Signed-off-by: Linus Walleij Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/dsa/rtl8366.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index 145f34de7b416..7e27c9aff9b72 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -397,7 +397,7 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) dev_err(smi->dev, "port is DSA or CPU port\n"); - for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) { + for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) { int pvid_val = 0; dev_info(smi->dev, "add VLAN %04x\n", vid); @@ -420,13 +420,13 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, if (ret < 0) return; } - } - ret = rtl8366_set_vlan(smi, port, member, untag, 0); - if (ret) - dev_err(smi->dev, - "failed to set up VLAN %04x", - vid); + ret = rtl8366_set_vlan(smi, vid, member, untag, 0); + if (ret) + dev_err(smi->dev, + "failed to set up VLAN %04x", + vid); + } } EXPORT_SYMBOL_GPL(rtl8366_vlan_add); -- 2.25.1