From patchwork Tue Aug 31 18:50:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 504659 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp3043821jai; Tue, 31 Aug 2021 11:52:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw04OJ/A1IERr4rNW9ORd+wt1vr4tof40nbfJDg3HL/J4chqIoPCPExK8MadcFITjaeXemi X-Received: by 2002:a17:906:d52:: with SMTP id r18mr32287135ejh.47.1630435976388; Tue, 31 Aug 2021 11:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630435976; cv=none; d=google.com; s=arc-20160816; b=lT0Di+hm83MSlWAV7WcOfgSLZ5sbsdAxUQwF3KwYwA/KHZ8Sfdf37CSubbnAIDfMdm Sg4eQYX+EKhhwyNtls3wNZ3CysQJOobXD4L9aGQKo87GFN3XCAhtzZwNkniKbQEk1guF ToumRZc2/828k1D+lx7miHDfW3WaEkOM+BcIfi8Fv+7OyJepuaIcNQdYDGHXXL8CZetu L0M0aJU0gGQCLBGT+tDe5cpTMnlY4M8WX5gRTm/dJ7tfsT+WdTRGizYVmcg65oTbTlxG piuioendfoyEFEmnK3YAa1HGDEE7Xa//3vVqDdVlAHfWRNrXtRVQqY5QUU/Ue56DK6tq RuVg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=vgf472b2g1DolTkwcFzFHbrCtJ8S8RAubSBTuQ4ufTc=; b=lVSG4d+M0KoPlARZSEheqto3nISENk6itXFFnBDGwOanN+P8NSsZUSj9S6V6nVt62c vTfUjbig6d+9Ac0PcNHMlahYA6aM83f5CVMvU/zrgqDRTVW4O8p/nT4i+B14HYDeF0sy pnYCdfm0VUgeNiN9HDPXJHpeds2vjH07UIRZ/UVlD+vQuyl3iTacCcgvee8sXTevZ4hY AL4ZtsYmQeeX8g24oD3ojTq345gBJZuxCXTf1et3Ck8mXn1SafMfVRnLtRQw9bHnyTLT zlW8p/vHtDfB5wg888qIG+2MIWIVIIqakJElFFmB/Iji8jplHSOK6UQZheYcAEdh8R7r S0mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BZvZRD26; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ox26si4392014ejb.200.2021.08.31.11.52.56; Tue, 31 Aug 2021 11:52:56 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=@linaro.org header.s=google header.b=BZvZRD26; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234439AbhHaSxu (ORCPT + 8 others); Tue, 31 Aug 2021 14:53:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbhHaSxt (ORCPT ); Tue, 31 Aug 2021 14:53:49 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45830C061575 for ; Tue, 31 Aug 2021 11:52:54 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id s10so854399lfr.11 for ; Tue, 31 Aug 2021 11:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vgf472b2g1DolTkwcFzFHbrCtJ8S8RAubSBTuQ4ufTc=; b=BZvZRD26QqpnFRWqwKtezgZIuqV602Iv7JexZlFu/yiZnvEwPGXM3pqx6JgcurJtxW TuVBTkStCjexGRclFU9Y7eUApjHgy7swnJScAbOkFl4WMKHqnzqp0gV5tOeBWkqNow+A DALJSZwa4Fmja+aHH9grEMkcRR5dVcLwosoQ+e6skZcyEisiGQhfWR/r/wblSRQcyFAr NvdcrcFp9qt5yYu+NUKeBMxdXbKWfrSUrbiYIEVMHJB9NQxZiAMkbS09oifpeNM+vKhJ ptjUm512JVQbVsSPkaz6GaEdCTfgen8+LOQEmcmAufBr1w5Hh7etdGv/AbQr71pGx4Fj xGDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vgf472b2g1DolTkwcFzFHbrCtJ8S8RAubSBTuQ4ufTc=; b=qHdCA7Pqy29bSPFbaB5oHK7e0yfj3Pm6Iv0hEFlr+tY3FLFx8B+OKwqwQOvZ8rmz8Q gYJjeut2ThxtgbLjz71vdR3AiLO7V/Z2TFDQnBeB8/GJA0+U2mw/5wQtX6nbKGEb/Kh3 wAmkqPnmAEdxH55R45Dm1/R/zgBJwrtBXvWM4WqW/WwAIGeLNU4KQu4LBSpcbrZkHNYv /lhCUx5jn3/eYeNFCeCYIqVAFzgJJD1T2at1sns8S4TrfIswvv3/zF1aiZxaPpu/tzK9 rDRdWiB35xM5RJ0RSdZQTs16xWOSIN/50Y2uHYqS3k2DzkFBYFscY/d4kzJ6Ejf0j5f+ 4Qcg== X-Gm-Message-State: AOAM531WAQ4MtCU2yYAcNDRJzYeTVyFxHUYuoNyRq9+qLPXQiVgjY639 fstcyRJFiGPsWqF6y0Dp4gYictJY1vWNDA== X-Received: by 2002:ac2:4294:: with SMTP id m20mr22877171lfh.6.1630435972587; Tue, 31 Aug 2021 11:52:52 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id b2sm1799739lfi.283.2021.08.31.11.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 11:52:52 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Linus Walleij , DENG Qingfang , Mauri Sandberg Subject: [PATCH net v2] net: dsa: tag_rtl4_a: Fix egress tags Date: Tue, 31 Aug 2021 20:50:50 +0200 Message-Id: <20210831185050.435767-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- ChangeLog v1->v2: - Drop the removal of bit 9 (2 << 8) so as to not stir up unwanted side effects. --- net/dsa/tag_rtl4_a.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.31.1 Reviewed-by: Florian Fainelli 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);