From patchwork Mon Sep 20 16:44:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 514378 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2344020jao; Mon, 20 Sep 2021 11:55:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9jGz1vZSnzPMCRFRLp7/yOqqCkA7ztW+7dcdpp/sKnDE+12eSh/OLp07oRh5xstOCaVY9 X-Received: by 2002:a17:906:1806:: with SMTP id v6mr30666342eje.420.1632164123992; Mon, 20 Sep 2021 11:55:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632164123; cv=none; d=google.com; s=arc-20160816; b=fxLKgsQGGoDHGqlaJBKQIO2OEbfXYsedNn/hHqrU1yiQWWD2kE8ZvrUR7ezkv5jrZ0 Yxe7XhuotNasVh8XfsWOX/31csHycMzONrb9k99XByXunM2QfY4P5ASrCjAxfXWFXSd1 3HLEpwPguq1I8dwhmD1Qh+Vrk+CEcGhrWcN4yZW+O3pQiGuzBpZ5pOPT0fwiAaJlXmeG ovFxysJK/okDXziRquZS9QS8DUljuHRtQDXCyd7zjZBc3IIy+kYE4ARbxYCo4ziJniUt tQE1jNMvZozmlGyYEr3o+7vCJ3sUwLPUQX2rYLrbEAZJ93jRnqEyHUBpZRHuCbnnJKHO F/Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WomSFrkev5k7qBxar9lrs0GMJFgQoGcp4SwObsbq9yA=; b=jXhLFxBzTBIQYvlFkLP4kP/wtLXdjiU4qC3M3ZdiImMZs3CBJUx6OJ/csoEn8ZXFaN 1Cchk+m52IqXOUsXmG27F0vIeLsPmUIJvi9c96XyM7zu5AIrf0XXtUFjzmYLCOgL2yF7 qexzRtLGRrDlUHvMrrjZjc/RqhsH9fWHp6tfANkIniNYxc92cH8Pzol9PylsrQPf+3Cv ld0H2HOv0Sm2eQ0Tnur+r0FAFBo+xWgIWJv9eOW51KLWNrkrFvqtyiFrjPTDmc44i32P yFacrSMO2Oc/prDbbJ3Op3E+npLrjDnRMdjX4bED7ueMYfWYFbuuTG+zYvZIvZgxrdIx C7Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sJIqLvf3; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (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 6si17997049ejm.251.2021.09.20.11.55.23; Mon, 20 Sep 2021 11:55:23 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@linuxfoundation.org header.s=korg header.b=sJIqLvf3; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387232AbhITS4l (ORCPT + 11 others); Mon, 20 Sep 2021 14:56:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:33540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383438AbhITSsd (ORCPT ); Mon, 20 Sep 2021 14:48:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 685E96337A; Mon, 20 Sep 2021 17:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159252; bh=wxfST2Fog1zgK7JmnzSoNEyc7dj48I3zfUBseGYCqaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sJIqLvf3F4+dbwzivJ/Iwp8uqQwqdIvF93YcmI3i//2FsJjwsmpZ3uFdsxgsqLW1P GX7Nxr/Hl5NDjbT+WU6S5MjP+EkvrIh2QdA5AlOAYMcMEu8U5/GTZJQoPy+Ku3HWLV T7mqpkkWZIKRZmgMMF8mI4HuDUGzeUmife1wgmCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, DENG Qingfang , Mauri Sandberg , Linus Walleij , Florian Fainelli , "David S. Miller" , Sasha Levin Subject: [PATCH 5.14 147/168] net: dsa: tag_rtl4_a: Fix egress tags Date: Mon, 20 Sep 2021 18:44:45 +0200 Message-Id: <20210920163926.489089758@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Walleij [ Upstream commit 0e90dfa7a8d817db755c7b5d89d77b9c485e4180 ] I noticed that only port 0 worked on the RTL8366RB since we started to use custom tags. It turns out that the format of egress custom tags is actually different from ingress custom tags. While the lower bits just contain the port number in ingress tags, egress tags need to indicate destination port by setting the bit for the corresponding port. It was working on port 0 because port 0 added 0x00 as port number in the lower bits, and if you do this the packet appears at all ports, including the intended port. Ooops. Fix this and all ports work again. Use the define for shifting the "type A" into place while we're at it. Tested on the D-Link DIR-685 by sending traffic to each of the ports in turn. It works. Fixes: 86dd9868b878 ("net: dsa: tag_rtl4_a: Support also egress tags") Cc: DENG Qingfang Cc: Mauri Sandberg Signed-off-by: Linus Walleij Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/dsa/tag_rtl4_a.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/net/dsa/tag_rtl4_a.c b/net/dsa/tag_rtl4_a.c index 57c46b4ab2b3..e34b80fa52e1 100644 --- a/net/dsa/tag_rtl4_a.c +++ b/net/dsa/tag_rtl4_a.c @@ -54,9 +54,10 @@ static struct sk_buff *rtl4a_tag_xmit(struct sk_buff *skb, p = (__be16 *)tag; *p = htons(RTL4_A_ETHERTYPE); - out = (RTL4_A_PROTOCOL_RTL8366RB << 12) | (2 << 8); - /* The lower bits is the port number */ - out |= (u8)dp->index; + out = (RTL4_A_PROTOCOL_RTL8366RB << RTL4_A_PROTOCOL_SHIFT) | (2 << 8); + /* The lower bits indicate the port number */ + out |= BIT(dp->index); + p = (__be16 *)(tag + 2); *p = htons(out);