Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2352774pxb; Mon, 20 Sep 2021 19:50:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXvbGObUaxKZmNR6tYIli7kWUI347uOUssHr55tN0c+rOGTLyaxq5s0IRrLUL2fDk4liYq X-Received: by 2002:a05:6e02:13d4:: with SMTP id v20mr19874159ilj.247.1632192611595; Mon, 20 Sep 2021 19:50:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192611; cv=none; d=google.com; s=arc-20160816; b=Az61ayHSBegKxk6+yq/rDAek9jzzTMrUisCXZ69EwT162FrouD6Ex8a/DHpCU+SF0F C10iC2QB1/t8hVtkefim1Q4Zea4DKut826X8I/Ew9k/pWAzEXRtLIRWDq2F9vNMCjJ3N pwgZ3yDBJpnHUfvCpY/AW2bU9IiIBBOP/6z3IYTq+ZFbD+HE9vH/xDJVnuqC1rxy6cvR 2fLYoyq9eKo8MvHP5EiRoL2MRfT7Vrmea5AhpBHrtVZAZ05kqEoEIRClJXFnFMS0+254 ePvxVJru4AjPteYnnFxPZwwh3wU25Qbniv2Sw1f9+yTTSWiRydZvqFzDPku3DrrS5QNc 3uBA== 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=wzWrOWLi28UQqEhs/bv5M4nqfCWrxE++tQtz+7BFwOI=; b=YNgXY0ozeY/4dOb23AdhMud8oVMvq++e/O0Bc5yoBxg7+Mxs7B/hjfa5OrULg6if7L isJEEA+GI8kNxO1VJ/Y6xudzPN9VT+d3DiJ9JymXpC2DXzphDF3TQszSwc6O/+0B3QtS x4AfE9IElWBps6PSp4/k1MFWVNWnsOAo1A+b3xnfRopyzvi2HglK/X6iUi35Hni0YvEF TcsiH8DfkZ5ESjV2/cpWU99Sb0w+Kq+EP1XbxaiXeAipX+8yw0e0howtYp8vPNZ42/g6 bewYlNerscZdiUtO1bmLiUEL87lJhOzLIG/G4ukylgHU3i+cYKPefV6AH7+3sF8I3WPc IA8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qeufLGqB; 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=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 r4si7018319ilb.106.2021.09.20.19.50.00; Mon, 20 Sep 2021 19:50: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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qeufLGqB; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382359AbhITSkU (ORCPT + 99 others); Mon, 20 Sep 2021 14:40:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:52010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379307AbhITSgQ (ORCPT ); Mon, 20 Sep 2021 14:36:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D811F61ABD; Mon, 20 Sep 2021 17:29:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158946; bh=bJW8nCMqEq7PQUJwPZa0hP+gqBaIsHjbiGqYKiTIwlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qeufLGqBxr9yNEdC9yaH7TkQAy+WO9PvK8v7EzwDyHXK1LCAkJBxHBbikQj3423Bn B9qVZAa8l45HApB/QTBPbhH4RGZAgF2J++CJsVCM2CqfNNJr8M90ErnC40+nLEm+/d dK5OeypocAeE8ipIi2p0wG9WD2c1YJiq8Y6vXcJk= 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.10 102/122] net: dsa: tag_rtl4_a: Fix egress tags Date: Mon, 20 Sep 2021 18:44:34 +0200 Message-Id: <20210920163919.140386125@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163915.757887582@linuxfoundation.org> References: <20210920163915.757887582@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) diff --git a/net/dsa/tag_rtl4_a.c b/net/dsa/tag_rtl4_a.c index e9176475bac8..24375ebd684e 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); -- 2.30.2