From patchwork Wed Aug 25 08:38:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qingfang Deng X-Patchwork-Id: 12456723 X-Patchwork-Delegate: kuba@kernel.org 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 C2BE8C4338F for ; Wed, 25 Aug 2021 08:38:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A80C9611C9 for ; Wed, 25 Aug 2021 08:38:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239149AbhHYIjn (ORCPT ); Wed, 25 Aug 2021 04:39:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239367AbhHYIjj (ORCPT ); Wed, 25 Aug 2021 04:39:39 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8A4AC0617AE; Wed, 25 Aug 2021 01:38:49 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id w8so22371361pgf.5; Wed, 25 Aug 2021 01:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Dbzh7P/VLZjz7T/PHz/hbVveQrgt7YUkwRS8X1gGPMQ=; b=PTryOgjrkt3xSyLLZ3nI0ySlPsg/rl42Z0nmnf4JRFvvk84qFrsvr2LFark0zt6Zak KupWKcKNvx4c7Kp/JxLfkkMJ5hHP0qa0vGDfzYUEcKlfzYynxZH7176zVLY7hjT/webd RsJkq6SgkfevzO0pn/U5EJneZBoK5QW6SCi+cP1M/1dOLqYHQ+RmwS0iV51F8yTjm0eF r3vARMZhBwWhsOWRwpVF/DAgWgEgb11ZmyT/y6KHl/7s300OE8fwyf9ZYkVgqCCIdvfc fex16reT0nrhHm1tz13SsnBM9Ini/rBK9wRaSpkGpdYP1BhHkX/gxzrIdxd6tnqRFXdH UUrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Dbzh7P/VLZjz7T/PHz/hbVveQrgt7YUkwRS8X1gGPMQ=; b=O2r/U/vM2BuoHwtKOjosuDM8O/WNeZvo29h3Ew5MwnLm3seiPBcWm85IjVwtxZH7ZM SH1JicHeCPPlHTIa1e6HbDv4TsIkICfpcsBNI6pkLBjFzvefDXEKAG6H2KJc5lziQkJk ol0g9bv2du7gvPKYOv4E2bBnuw+zAUL1MWBUoC98DWggGfcL5R3A8dbELeACmW7+x8YN 0ZGXgB8FsNBzUuCzgKGyILk2ED6slOck3pLlVv3DS/9cT/LNNeEFh45W+6lrEac/M8xK nO5vKdOfTHdsOipfGfFz9esWYz2CsyNbJYjpCftA8gMxblbe5/r4uI0YGd+jdS0C8XyN DJNQ== X-Gm-Message-State: AOAM533L7sSKF/xF4apUh34vuoj8g9o/aAehGiK35v2W5xcs06cw2lko h9SvgHRfV4OboE7UZRkWRzE= X-Google-Smtp-Source: ABdhPJwKwchoRLdo4BZ3JiVc2OLHRyzG0ZZZHm30+1GgS/uyS0K2qPV/3P41I55ugBeCg/tJeNDEHA== X-Received: by 2002:a63:3dcd:: with SMTP id k196mr1250905pga.387.1629880729365; Wed, 25 Aug 2021 01:38:49 -0700 (PDT) Received: from haswell-ubuntu20.lan ([138.197.212.246]) by smtp.gmail.com with ESMTPSA id p18sm24872294pgk.28.2021.08.25.01.38.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Aug 2021 01:38:48 -0700 (PDT) From: DENG Qingfang To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Sean Wang , Landen Chao , Matthias Brugger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [RFC net-next 1/2] net: dsa: allow taggers to customise netdev features Date: Wed, 25 Aug 2021 16:38:30 +0800 Message-Id: <20210825083832.2425886-2-dqfext@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210825083832.2425886-1-dqfext@gmail.com> References: <20210825083832.2425886-1-dqfext@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Allow taggers to add netdev features, such as VLAN offload, to slave devices, which will make it possible for taggers to handle VLAN tags themselves. Signed-off-by: DENG Qingfang Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- include/net/dsa.h | 2 ++ net/dsa/slave.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index f9a17145255a..f65442858f71 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -96,6 +96,8 @@ struct dsa_device_ops { * its RX filter. */ bool promisc_on_master; + /* Additional features to be applied to the slave. */ + netdev_features_t features; }; /* This structure defines the control interfaces that are overlayed by the diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 662ff531d4e2..6d6f1aebf1ca 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1885,7 +1885,8 @@ void dsa_slave_setup_tagger(struct net_device *slave) p->xmit = cpu_dp->tag_ops->xmit; - slave->features = master->vlan_features | NETIF_F_HW_TC; + slave->features = master->vlan_features | cpu_dp->tag_ops->features | + NETIF_F_HW_TC; slave->hw_features |= NETIF_F_HW_TC; slave->features |= NETIF_F_LLTX; if (slave->needed_tailroom)