From patchwork Sat Aug 7 12:07:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qingfang Deng X-Patchwork-Id: 493588 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A5F3C4338F for ; Sat, 7 Aug 2021 12:07:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B48B61004 for ; Sat, 7 Aug 2021 12:07:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232213AbhHGMIG (ORCPT ); Sat, 7 Aug 2021 08:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232190AbhHGMIF (ORCPT ); Sat, 7 Aug 2021 08:08:05 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F707C0613D3; Sat, 7 Aug 2021 05:07:47 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id u13-20020a17090abb0db0290177e1d9b3f7so26704939pjr.1; Sat, 07 Aug 2021 05:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0uAUIoE5JB2C9srWWQ8+N9NzyVb4/41rqs1bQEBbz3w=; b=jjzvsdhoFNB2jItyXltAKHcvm0jSXfZQoXcgCJJSIqnQ945vSaP+9z/dOyUYtfg+SE iOO9IbeIHNJ38MKRObzFaWk3eVfBWpPoT9qcpAwILiYnCT3eJ/OT7d2eQx4EOo+bqcSf Di6nVSFDoBmL/OJozK8vIldU1uzhF78x0NPPneB2p9JwSZrtlO6qnlFy+zvOQIj9hQIP mY99IJT1E0rWDcU1LP5t7dwPdhYa5o+1UIABXNjXm2zlp2Dk598cJEcjgeZyvor0Tv/t l4bKpmJL8nUwrkJZmZSM1c2oGxLU71dphJgdtjq4SKZHE7L+YAiHJvsnSK7nUDlhk7wn LdsQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=0uAUIoE5JB2C9srWWQ8+N9NzyVb4/41rqs1bQEBbz3w=; b=qE/70AQfv7wzfTtocRuO3kEmg9Uci5CHdwToqwQyx/PYgq6pEDGBhpcjxWnPUxluiD UWJ2oyZ7NepywfbdoZ/QKnoqk/QZ3t+9SIyHzRPRIVyEJxK/8QgEQCo/nZV4bZp8ELaA tiD4bNFeCn7FmmbBte/RdB5QB0t6WLz6tXigGVCNMUNaGsbKu2eJvv403itddtCFGt6j KA74Z08PiEV2pIWZwpQzHWq7kjoIljz3+n0vtHUBDy2piqir0QnvLEJbvmbV0GI70Rrf 7IsvglC7l65+OLggXYENnRJnOnU8UkwAU1v2zAPp9rFOHLolO6w/YOlo5YZklecUdA4j Na4g== X-Gm-Message-State: AOAM530kTLvc/PB6Er8whkJzBI8XkBqbtQrEzx1NQH1X0jf0NNgiNENB wfwMFcgwnV0frQXg9myBwzc= X-Google-Smtp-Source: ABdhPJzrfUOyLkVPnV+tr6HYvoTFFXGmbtWLjKzwCZE5GIFiP3WAL1SoP64V/Eq50ChsmrKOTxBNog== X-Received: by 2002:a17:90a:c286:: with SMTP id f6mr26177385pjt.121.1628338067063; Sat, 07 Aug 2021 05:07:47 -0700 (PDT) Received: from haswell-ubuntu20.lan ([138.197.212.246]) by smtp.gmail.com with ESMTPSA id b15sm16471035pgj.60.2021.08.07.05.07.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Aug 2021 05:07:46 -0700 (PDT) From: DENG Qingfang To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Russell King , netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Cc: Ansuel Smith , Jonathan McDowell , =?utf-8?b?TWljaGFsIFZva8OhxI0=?= , Christian Lamparter , Nishka Dasgupta , Xiaofei Shen , John Crispin , Stefan Lippers-Hollmann , Hannu Nyman , Imran Khan , Frank Wunderlich , Nick Lowe , =?utf-8?q?Andr=C3=A9_Valentin?= Subject: [RFC net-next 1/3] net: dsa: qca8k: offload bridge flags Date: Sat, 7 Aug 2021 20:07:24 +0800 Message-Id: <20210807120726.1063225-2-dqfext@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210807120726.1063225-1-dqfext@gmail.com> References: <20210807120726.1063225-1-dqfext@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The hardware supports controlling per-port flooding and learning. Do not enable learning by default, instead configure them in .port_bridge_flags function. Signed-off-by: DENG Qingfang --- drivers/net/dsa/qca8k.c | 60 +++++++++++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c index 1f63f50f73f1..798bc548e5b0 100644 --- a/drivers/net/dsa/qca8k.c +++ b/drivers/net/dsa/qca8k.c @@ -987,10 +987,11 @@ qca8k_setup(struct dsa_switch *ds) return ret; } - /* Disable forwarding by default on all ports */ + /* Disable forwarding and learning by default on all ports */ for (i = 0; i < QCA8K_NUM_PORTS; i++) { ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i), - QCA8K_PORT_LOOKUP_MEMBER, 0); + QCA8K_PORT_LOOKUP_MEMBER | + QCA8K_PORT_LOOKUP_LEARN, 0); if (ret) return ret; } @@ -1028,12 +1029,6 @@ qca8k_setup(struct dsa_switch *ds) if (ret) return ret; - /* Enable ARP Auto-learning by default */ - ret = qca8k_reg_set(priv, QCA8K_PORT_LOOKUP_CTRL(i), - QCA8K_PORT_LOOKUP_LEARN); - if (ret) - return ret; - /* For port based vlans to work we need to set the * default egress vid */ @@ -1504,6 +1499,53 @@ qca8k_port_stp_state_set(struct dsa_switch *ds, int port, u8 state) QCA8K_PORT_LOOKUP_STATE_MASK, stp_state); } +static int +qca8k_port_pre_bridge_flags(struct dsa_switch *ds, int port, + struct switchdev_brport_flags flags, + struct netlink_ext_ack *extack) +{ + if (flags.mask & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | + BR_BCAST_FLOOD)) + return -EINVAL; + + return 0; +} + +static int +qca8k_port_bridge_flags(struct dsa_switch *ds, int port, + struct switchdev_brport_flags flags, + struct netlink_ext_ack *extack) +{ + struct qca8k_priv *priv = ds->priv; + int ret = 0; + + if (!ret && flags.mask & BR_LEARNING) + ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port), + QCA8K_PORT_LOOKUP_LEARN, + flags.val & BR_LEARNING ? + QCA8K_PORT_LOOKUP_LEARN : 0); + + if (!ret && flags.mask & BR_FLOOD) + ret = qca8k_rmw(priv, QCA8K_REG_GLOBAL_FW_CTRL1, + BIT(port + QCA8K_GLOBAL_FW_CTRL1_UC_DP_S), + flags.val & BR_FLOOD ? + BIT(port + QCA8K_GLOBAL_FW_CTRL1_UC_DP_S) : 0); + + if (!ret && flags.mask & BR_MCAST_FLOOD) + ret = qca8k_rmw(priv, QCA8K_REG_GLOBAL_FW_CTRL1, + BIT(port + QCA8K_GLOBAL_FW_CTRL1_MC_DP_S), + flags.val & BR_MCAST_FLOOD ? + BIT(port + QCA8K_GLOBAL_FW_CTRL1_MC_DP_S) : 0); + + if (!ret && flags.mask & BR_BCAST_FLOOD) + ret = qca8k_rmw(priv, QCA8K_REG_GLOBAL_FW_CTRL1, + BIT(port + QCA8K_GLOBAL_FW_CTRL1_BC_DP_S), + flags.val & BR_BCAST_FLOOD ? + BIT(port + QCA8K_GLOBAL_FW_CTRL1_BC_DP_S) : 0); + + return ret; +} + static int qca8k_port_bridge_join(struct dsa_switch *ds, int port, struct net_device *br) { @@ -1764,6 +1806,8 @@ static const struct dsa_switch_ops qca8k_switch_ops = { .port_change_mtu = qca8k_port_change_mtu, .port_max_mtu = qca8k_port_max_mtu, .port_stp_state_set = qca8k_port_stp_state_set, + .port_pre_bridge_flags = qca8k_port_pre_bridge_flags, + .port_bridge_flags = qca8k_port_bridge_flags, .port_bridge_join = qca8k_port_bridge_join, .port_bridge_leave = qca8k_port_bridge_leave, .port_fdb_add = qca8k_port_fdb_add, From patchwork Sat Aug 7 12:07:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qingfang Deng X-Patchwork-Id: 493819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A8B3C4338F for ; Sat, 7 Aug 2021 12:07:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1CBC060FE7 for ; Sat, 7 Aug 2021 12:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232260AbhHGMIO (ORCPT ); Sat, 7 Aug 2021 08:08:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232237AbhHGMIN (ORCPT ); Sat, 7 Aug 2021 08:08:13 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44557C0613CF; Sat, 7 Aug 2021 05:07:55 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id pj14-20020a17090b4f4eb029017786cf98f9so22134544pjb.2; Sat, 07 Aug 2021 05:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nHNcflnG0a4A9LfEWKsvfNtPEZu1Ro6r81VoleoWmDs=; b=mU6imz/bwXHRCKkt9haQM7HUPdT/OsRXdwPx8HHOv6bGROuIqvIVUiSUZDN8WKDIUM KeFtZGJ4gWfTGX4EsR8eYSVD7jYimKDOlW6rDMDDNdITOZM8rzRSH7lw3vKBDUIFYp1G RF/Y9pDdxLS1Et7lgHPtfDoo78nS8f462Tp66JgUYeKTca07/3Se69S53oMrDXCxBdvz Cwj2fQNuiCVIcXHBV0jcm2AFLjp5daTqusG9miXgFyY9oaS8Isik0PgWESSwRMd+dstQ RA5+tzLc/pVfY7kZVEgy4l9D46nbrqVbZt40PP1dGxFSD6TEkm/14hCg9Jptv5IUebMk 2Btg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=nHNcflnG0a4A9LfEWKsvfNtPEZu1Ro6r81VoleoWmDs=; b=IU6yLEBRTZwnUA7Z0uxFapctAWel/OybmJFg3ZA6Ctu1qD8yEb+MAnwHpSuEtOsj5H /IQiYT5VaU5ugPYKlor7vVrsY/djoAjYHOZH5i8zzpey6JGeySvHuktMdAkhV43uXZgm SSQD8fVyB/EMmEw6WL68JzAZbpoO6JNYQNQl4+KnRAu2sqLVVWeYZ7WdKGV0jG8b3/XF VoLxr5/6ES7r6eZHPfSn5yi49VunnRFVnfcQM+yIuhcsk9w8dhWSXBAqhsGjfRwGoSAQ J9z+TWHkO0ua9mKxk88yYEYbTmNMzqhA+9GECR0u8mJ+/fKxj8RtTHM2RM3mcQXnvRwS l1IA== X-Gm-Message-State: AOAM533jmMG16qH2NhDBa8rc7989PlU66tQIYpco2CQNpmBq6ye5be33 fM93+hzyp3E+ivji48DInUQ= X-Google-Smtp-Source: ABdhPJybRBEtj4boTWrozQ+AoJLBGIqC8C4EFEtrv6HMyXSjUgpR4n23eo6084tWzOluZu7jmJZXcw== X-Received: by 2002:a17:902:d501:b029:12c:3386:96ed with SMTP id b1-20020a170902d501b029012c338696edmr12676391plg.39.1628338074863; Sat, 07 Aug 2021 05:07:54 -0700 (PDT) Received: from haswell-ubuntu20.lan ([138.197.212.246]) by smtp.gmail.com with ESMTPSA id b15sm16471035pgj.60.2021.08.07.05.07.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Aug 2021 05:07:54 -0700 (PDT) From: DENG Qingfang To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Russell King , netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Cc: Ansuel Smith , Jonathan McDowell , =?utf-8?b?TWljaGFsIFZva8OhxI0=?= , Christian Lamparter , Nishka Dasgupta , Xiaofei Shen , John Crispin , Stefan Lippers-Hollmann , Hannu Nyman , Imran Khan , Frank Wunderlich , Nick Lowe , =?utf-8?q?Andr=C3=A9_Valentin?= Subject: [RFC net-next 2/3] net: dsa: qca8k: enable assisted learning on CPU port Date: Sat, 7 Aug 2021 20:07:25 +0800 Message-Id: <20210807120726.1063225-3-dqfext@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210807120726.1063225-1-dqfext@gmail.com> References: <20210807120726.1063225-1-dqfext@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Enable assisted learning on CPU port to fix roaming issues. Although hardware learning is available, it won't work well with software bridging fallback or multiple CPU ports. Signed-off-by: DENG Qingfang --- drivers/net/dsa/qca8k.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c index 798bc548e5b0..de2aa7812d1c 100644 --- a/drivers/net/dsa/qca8k.c +++ b/drivers/net/dsa/qca8k.c @@ -1114,6 +1114,8 @@ qca8k_setup(struct dsa_switch *ds) /* We don't have interrupts for link changes, so we need to poll */ ds->pcs_poll = true; + ds->assisted_learning_on_cpu_port = true; + return 0; } From patchwork Sat Aug 7 12:07:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qingfang Deng X-Patchwork-Id: 493587 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52DD7C4338F for ; Sat, 7 Aug 2021 12:08:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3569261058 for ; Sat, 7 Aug 2021 12:08:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232274AbhHGMIZ (ORCPT ); Sat, 7 Aug 2021 08:08:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232243AbhHGMIW (ORCPT ); Sat, 7 Aug 2021 08:08:22 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2A4CC0613CF; Sat, 7 Aug 2021 05:08:03 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id u2so10837666plg.10; Sat, 07 Aug 2021 05:08:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Fe+Qj13L2fpPtbQOlPpWUWp2MGqwowpxswIvzZUFPvw=; b=pwxgEYD4YDmvPKT65ehV5p9rq2kaMo1WsBdQc0LPMOsK1ocpIMQExH6S9dM+nWEIUJ NeD9P1sVLAAoZLx1pH33AZzFQ8FI5u+ob9GqsJEJjfWvDcB5BEa84neHewUlfLIgzmhb Q1AqIEtcRcbi2LNjRE3k8egJj2XClxNeqyLseB3clw6RpNRoCdPEFW98HyaxqWyNpZSE hsSzo+T7tDsvO8kzAuxsP8e78zoyx4Ht3deLvxZkiLDC5EIxAw488igkkvwbMHyR8UV7 BxOVfPwSdCxmbcFVq9ViT/PBRb3dN88DaIiO+nzuG1RnCg96karkTqlwRxKqPuvFSD/u PgbA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Fe+Qj13L2fpPtbQOlPpWUWp2MGqwowpxswIvzZUFPvw=; b=HIuUgCzZHJ/gYh//5AeaGG7ZN1ynA9xZMnXStmH4i/Gl0beGnN9TC2V5GSiIt8QuAc tU7ePlnEsRqceERLCWool8DBjPGaDoB5t+VpyEbq5QTfIuhhFhk5qhAU0HpkQaRsvTyk +tpESWPmgGChSrMUcFQAJAZCGojGYIwZU43L81RiKD/rJAEYjLsQTU9mwDPDL7mOFqOf VOOvYli4hlDaIzFHMId04m9iXGILTANWhomCCk6T2riOorqbmAJPZ8ScXyhcK+eThX07 t7JaCvsnbYfmoAd8Ao2YLtZwqKgu45LP6HSVmvFAAEPIsxHtgENm6LNqlF/2pWhgPlrb Ge3g== X-Gm-Message-State: AOAM530pVNXC71GmM+9qr1EQ/ARFSEV0UkY7KsEAlCAS+OHbfaG/thBF M+5Vl+p6pzAtUFPhGtOk43I= X-Google-Smtp-Source: ABdhPJxzlYppj5h2KdgEpEL+dwojRRtBt/bO/LqjU8q0P/dgmC+3e1Vcm8yjwm+DTIahIHNxOtigvw== X-Received: by 2002:a62:9709:0:b029:3b2:ef36:6872 with SMTP id n9-20020a6297090000b02903b2ef366872mr15186759pfe.34.1628338083415; Sat, 07 Aug 2021 05:08:03 -0700 (PDT) Received: from haswell-ubuntu20.lan ([138.197.212.246]) by smtp.gmail.com with ESMTPSA id b15sm16471035pgj.60.2021.08.07.05.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Aug 2021 05:08:02 -0700 (PDT) From: DENG Qingfang To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Russell King , netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Cc: Ansuel Smith , Jonathan McDowell , =?utf-8?b?TWljaGFsIFZva8OhxI0=?= , Christian Lamparter , Nishka Dasgupta , Xiaofei Shen , John Crispin , Stefan Lippers-Hollmann , Hannu Nyman , Imran Khan , Frank Wunderlich , Nick Lowe , =?utf-8?q?Andr=C3=A9_Valentin?= Subject: [RFC net-next 3/3] net: dsa: tag_qca: set offload_fwd_mark Date: Sat, 7 Aug 2021 20:07:26 +0800 Message-Id: <20210807120726.1063225-4-dqfext@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210807120726.1063225-1-dqfext@gmail.com> References: <20210807120726.1063225-1-dqfext@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org As we offload flooding and forwarding, set offload_fwd_mark according to Atheros header's type. Signed-off-by: DENG Qingfang --- net/dsa/tag_qca.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c index 6e3136990491..ee5c1fdfef47 100644 --- a/net/dsa/tag_qca.c +++ b/net/dsa/tag_qca.c @@ -50,7 +50,7 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev) static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev) { - u8 ver; + u8 ver, type; u16 hdr; int port; __be16 *phdr; @@ -82,6 +82,15 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev) if (!skb->dev) return NULL; + type = (hdr & QCA_HDR_RECV_TYPE_MASK) >> QCA_HDR_RECV_TYPE_S; + switch (type) { + case 0x00: /* Normal packet */ + case 0x19: /* Flooding to CPU */ + case 0x1a: /* Forwarding to CPU */ + dsa_default_offload_fwd_mark(skb); + break; + } + return skb; }