From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 1549FC2D0C2 for ; Mon, 30 Dec 2019 14:31:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D2C71206DB for ; Mon, 30 Dec 2019 14:31:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=dlink.ru header.i=@dlink.ru header.b="mF95+ayj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727564AbfL3Obi (ORCPT ); Mon, 30 Dec 2019 09:31:38 -0500 Received: from fd.dlink.ru ([178.170.168.18]:39574 "EHLO fd.dlink.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727397AbfL3Obi (ORCPT ); Mon, 30 Dec 2019 09:31:38 -0500 Received: by fd.dlink.ru (Postfix, from userid 5000) id CC7B41B21836; Mon, 30 Dec 2019 17:31:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 fd.dlink.ru CC7B41B21836 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dlink.ru; s=mail; t=1577716293; bh=L55d4XdjAtvKL0l9HxmdxPvldFzgURGS4JiXQm8SXdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mF95+ayjq0zPIcEQSB1FEez6ZDvINbvzYO3CSeoG6RFJNruhxeoyeLh09U3gfsQza YdcpYgteE2a0tAvF8SGGwkDCWonmM8OPFQVkZ7lvKg7IBM7Gy0RzTgsIbNkBQLjmnv 9AQkbrYqtw8Y1jfa43jj34h4mzJuKY3ra/maXCCc= Received: from mail.rzn.dlink.ru (mail.rzn.dlink.ru [178.170.168.13]) by fd.dlink.ru (Postfix) with ESMTP id 83F871B20206; Mon, 30 Dec 2019 17:31:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 fd.dlink.ru 83F871B20206 Received: from mail.rzn.dlink.ru (localhost [127.0.0.1]) by mail.rzn.dlink.ru (Postfix) with ESMTP id C95A91B229D0; Mon, 30 Dec 2019 17:31:03 +0300 (MSK) Received: from localhost.localdomain (unknown [196.196.203.126]) by mail.rzn.dlink.ru (Postfix) with ESMTPA; Mon, 30 Dec 2019 17:31:03 +0300 (MSK) From: Alexander Lobakin To: "David S. Miller" Cc: Edward Cree , Andrew Lunn , Vivien Didelot , Florian Fainelli , Hauke Mehrtens , Sean Wang , Matthias Brugger , Jiri Pirko , Eric Dumazet , Paolo Abeni , Jakub Kicinski , Alexander Lobakin , Taehee Yoo , Stephen Hemminger , Stanislav Fomichev , Daniel Borkmann , Song Liu , Matteo Croce , Jakub Sitnicki , Paul Blakey , Yoshiki Komachi , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC net-next 01/19] net: dsa: make .flow_dissect() callback returning void Date: Mon, 30 Dec 2019 17:30:09 +0300 Message-Id: <20191230143028.27313-2-alobakin@dlink.ru> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191230143028.27313-1-alobakin@dlink.ru> References: <20191230143028.27313-1-alobakin@dlink.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are no tag protocols which return non-zero values from flow_dissect() callback. Remove it to simplify code and save some object size. If a particular tagger can't calculate offset and proto for some reason, it can simply leave the original values untouched. Signed-off-by: Alexander Lobakin --- include/net/dsa.h | 5 ++--- net/core/flow_dissector.c | 8 ++++---- net/dsa/tag_dsa.c | 5 ++--- net/dsa/tag_edsa.c | 5 ++--- net/dsa/tag_mtk.c | 6 ++---- net/dsa/tag_qca.c | 6 ++---- 6 files changed, 14 insertions(+), 21 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index da5578db228e..633d9894ab87 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -72,8 +72,8 @@ struct dsa_device_ops { struct sk_buff *(*xmit)(struct sk_buff *skb, struct net_device *dev); struct sk_buff *(*rcv)(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt); - int (*flow_dissect)(const struct sk_buff *skb, __be16 *proto, - int *offset); + void (*flow_dissect)(const struct sk_buff *skb, __be16 *proto, + int *offset); /* Used to determine which traffic should match the DSA filter in * eth_type_trans, and which, if any, should bypass it and be processed * as regular on the master net device. @@ -774,4 +774,3 @@ static struct dsa_tag_driver *dsa_tag_driver_array[] = { \ }; \ module_dsa_tag_drivers(dsa_tag_driver_array) #endif - diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 2dbbb030fbed..2c9d8c7c76b3 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -971,12 +971,12 @@ bool __skb_flow_dissect(const struct net *net, #if IS_ENABLED(CONFIG_NET_DSA) if (unlikely(skb->dev && netdev_uses_dsa(skb->dev) && proto == htons(ETH_P_XDSA))) { - const struct dsa_device_ops *ops; + typeof_member(struct dsa_device_ops, flow_dissect) fd; int offset = 0; - ops = skb->dev->dsa_ptr->tag_ops; - if (ops->flow_dissect && - !ops->flow_dissect(skb, &proto, &offset)) { + fd = skb->dev->dsa_ptr->tag_ops->flow_dissect; + if (fd) { + fd(skb, &proto, &offset); hlen -= offset; nhoff += offset; } diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c index 7ddec9794477..ef15aee58dfc 100644 --- a/net/dsa/tag_dsa.c +++ b/net/dsa/tag_dsa.c @@ -142,12 +142,11 @@ static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev, return skb; } -static int dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) +static void dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset) { *offset = 4; *proto = ((__be16 *)skb->data)[1]; - return 0; } static const struct dsa_device_ops dsa_netdev_ops = { diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c index e8eaa804ccb9..37a99254b411 100644 --- a/net/dsa/tag_edsa.c +++ b/net/dsa/tag_edsa.c @@ -161,12 +161,11 @@ static struct sk_buff *edsa_rcv(struct sk_buff *skb, struct net_device *dev, return skb; } -static int edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) +static void edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset) { *offset = 8; *proto = ((__be16 *)skb->data)[3]; - return 0; } static const struct dsa_device_ops edsa_netdev_ops = { diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c index b5705cba8318..c3ad7b7b142a 100644 --- a/net/dsa/tag_mtk.c +++ b/net/dsa/tag_mtk.c @@ -89,13 +89,11 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev, return skb; } -static int mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) +static void mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset) { *offset = 4; *proto = ((__be16 *)skb->data)[1]; - - return 0; } static const struct dsa_device_ops mtk_netdev_ops = { diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c index c95885215525..8e2dbaaffe59 100644 --- a/net/dsa/tag_qca.c +++ b/net/dsa/tag_qca.c @@ -90,13 +90,11 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev, return skb; } -static int qca_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, - int *offset) +static void qca_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, + int *offset) { *offset = QCA_HDR_LEN; *proto = ((__be16 *)skb->data)[0]; - - return 0; } static const struct dsa_device_ops qca_netdev_ops = { -- 2.24.1