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; }