From patchwork Mon Sep 20 16:44:34 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: 514368 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2329344jao; Mon, 20 Sep 2021 11:36:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDOQ+BYJCxy+23Av2cfYMcycRN+PlaTAr8fGrXES35JoW1gwz1LFUAg9SdKXfdNvv74Mt9 X-Received: by 2002:a05:6e02:1a8d:: with SMTP id k13mr17389204ilv.70.1632163016749; Mon, 20 Sep 2021 11:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632163016; cv=none; d=google.com; s=arc-20160816; b=g8Ggm2WuHcSkViyz98CPRqfvnvmfiYD6XWtEm0XR+Y2jDT2wur0XeHqWQCgBMvME9v ZHAW7b72SHSUX3Sqezd2KoapxpEKirAnUhmZlzlJ+fUvTa1BVCIX+3GqVWuEE0Kq9eo8 JAWEgTsZkNuDaJxWz148L32Tysp9qGWV0xbwi63X+rDLfMEkNYidPQRt/IT3y4YaH8PE ghxlTnDw+bOcF8ftwH5AurgI3Q4akujp4lgCPPtYFDh6j4oAaoT+XgNTiV5QBHqFmMSZ 6RdyXSc4O+u8f5E15OGN3z3NUuS85pCUUarj2H77NqWjeZTja7GJWFcHukzn0kGp1O5P BXhw== 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=DEke7ySS6MrhSbNUEk+yABZPp8CdS+ly9O04st0O+CY6aqXuY5lfRS2vf784PX4Dxy 54fGipMw5MpHN+Dzfme8kqDynkSfLm2taT0A0I+xAyW1gUwHQ6VFAxJQXpaUpr/wtSk1 kLkJ+0lkBmlNiz1epwiT4vXK3NwLtqKDS2WARHRCSQ4+vUNCRPReK+/tPIEWMvdcEYl+ BcF+ZBb9v5knL9CegughEazClD2QhDgUln0VCLwXE7aw4MIgNgs4+hyr0t23RwiwM0qY kO4QrrDxq2C2VyMVngLtdoonZD96Yx4gDlgvOOfntdPKpv0o36egklPaukFyKor0O78/ l1PA== 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 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 t11si9811956ilu.179.2021.09.20.11.36.56; Mon, 20 Sep 2021 11:36:56 -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=qeufLGqB; 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 S1381475AbhITSiR (ORCPT + 11 others); Mon, 20 Sep 2021 14:38:17 -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 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 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);