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.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 29888C2D0C2 for ; Mon, 30 Dec 2019 14:47:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DB46F20663 for ; Mon, 30 Dec 2019 14:47:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CMk1FM9G"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=dlink.ru header.i=@dlink.ru header.b="ifBh0oM5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB46F20663 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dlink.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jRqEBZaGBiwioBAX61Dmc5dg78Lro68kunWUQ89boJo=; b=CMk1FM9Gedy3ZZ QDXKrAE9cHf4vXPE+E2JFic+e215T7WKizu/2H4t8AMd1IEGmtd6JSsVjNSCd5pz0oTVOfook2PlG KKRx0KL4tOOOvMnM8eAiOlK6uL+YUzTvQJXtUSXdpEeccvxq1JNHRboXeH7laMb6gNCV9UPJDksZw /y3Z8HBsotNYCziF7hG4giYG1yvE7etOMKkD+MzgblhrVUasBrW0PL3jt8GddKCKbtGjZgwOsDuzu Wg50LJAh20Pz/DTkNodXvixuKz9IFcwKA3/eJOBTHqrK2vbXAn/PTgteuNulXGgDmOg8ncHoBkcGo q3NfKsDRxHQjFsxK5Rxw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ilwK5-0008Qk-AT; Mon, 30 Dec 2019 14:47:09 +0000 Received: from mail.dlink.ru ([178.170.168.18] helo=fd.dlink.ru) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ilwFc-0003yk-MR; Mon, 30 Dec 2019 14:42:34 +0000 Received: by fd.dlink.ru (Postfix, from userid 5000) id 8DC4D1B219A9; Mon, 30 Dec 2019 17:33:17 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 fd.dlink.ru 8DC4D1B219A9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dlink.ru; s=mail; t=1577716397; bh=Erjvba4dIKrPISREjV3SM+2wcBTCz6oIK+5iwW6Xun4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ifBh0oM5RjN1pJshxUJUxApGaPZXJAsSdc+JnKIY1A+up2KDhgQw6uZlU3OLZHSa0 ayaubqSP83ACs2fBOlRmtYIkjxO+cRl+qYeuyGgPtIlsyBqh7nWL+2tlB8MNjp9/6T y+d0jFxDU9kQdZnzGiPKwRi66NsWfSl4/uZMqZqE= Received: from mail.rzn.dlink.ru (mail.rzn.dlink.ru [178.170.168.13]) by fd.dlink.ru (Postfix) with ESMTP id 6FBF51B2180E; Mon, 30 Dec 2019 17:31:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 fd.dlink.ru 6FBF51B2180E Received: from mail.rzn.dlink.ru (localhost [127.0.0.1]) by mail.rzn.dlink.ru (Postfix) with ESMTP id 266F41B229D1; Mon, 30 Dec 2019 17:31:19 +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:19 +0300 (MSK) From: Alexander Lobakin To: "David S. Miller" Subject: [PATCH RFC net-next 09/19] net: dsa: tag_gswip: split out common tag accessors Date: Mon, 30 Dec 2019 17:30:17 +0300 Message-Id: <20191230143028.27313-10-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191230_064233_128284_41A26389 X-CRM114-Status: UNSURE ( 9.53 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Song Liu , Jakub Kicinski , Alexander Lobakin , Yoshiki Komachi , linux-kernel@vger.kernel.org, Eric Dumazet , Stanislav Fomichev , Matteo Croce , Edward Cree , Florian Fainelli , Jakub Sitnicki , Daniel Borkmann , Paolo Abeni , Vivien Didelot , Hauke Mehrtens , Sean Wang , Jiri Pirko , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, Paul Blakey , Stephen Hemminger , Taehee Yoo Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org ...to reuse them in GRO callbacks. Signed-off-by: Alexander Lobakin --- net/dsa/tag_gswip.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/net/dsa/tag_gswip.c b/net/dsa/tag_gswip.c index d37289540ef3..e7b36de27fd8 100644 --- a/net/dsa/tag_gswip.c +++ b/net/dsa/tag_gswip.c @@ -55,6 +55,16 @@ /* Byte 7 */ #define GSWIP_RX_SPPID(byte_7) FIELD_GET(GENMASK(6, 4), byte_7) +static inline int gswip_tag_source_port(const u8 *data) +{ + return GSWIP_RX_SPPID(*(data - ETH_HLEN + 7)); +} + +static inline __be16 gswip_tag_encap_proto(const u8 *data) +{ + return *(__be16 *)(data + 6); +} + static struct sk_buff *gswip_tag_xmit(struct sk_buff *skb, struct net_device *dev) { @@ -85,7 +95,7 @@ static struct sk_buff *gswip_tag_rcv(struct sk_buff *skb, return NULL; /* Get source port information */ - port = GSWIP_RX_SPPID(*(skb->data - ETH_HLEN + 7)); + port = gswip_tag_source_port(skb->data); skb->dev = dsa_master_find_slave(dev, 0, port); if (!skb->dev) @@ -101,7 +111,7 @@ static void gswip_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto, int *offset) { *offset = GSWIP_RX_HEADER_LEN; - *proto = *(__be16 *)(skb->data + 6); + *proto = gswip_tag_encap_proto(skb->data); } static const struct dsa_device_ops gswip_netdev_ops = { -- 2.24.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel