Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp841824ybl; Fri, 6 Dec 2019 07:07:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwegj/A3C1RWUiCoh/NnxCQ034B+qq4/rzK5IADbmr67e6gskztqXj508inQaN8b+wymuQS X-Received: by 2002:a9d:7a46:: with SMTP id z6mr11336773otm.194.1575644866057; Fri, 06 Dec 2019 07:07:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575644866; cv=none; d=google.com; s=arc-20160816; b=WAknpV26onAhJxDjETLk2+ZMHNAtiDwEqEmc4vovXB/rCDTunCDLmJhgY1QXXqj0sP 3Gwz5KKetD+3dK9h65PE4v38k2e62Qp03loRXonQ0JSGtWmZ4thOz/9/m8Q3aJ5lVJMJ 6voucaozidxCas/GGYo4lWyqi0X6l1/qPfqzlkujsED78+H6DXnRngtDiOBxgYX/YKyg lVTcHS+aaKV9ze3wUJeURIwiwYJ+IUCruqas0dmHAt4cqWGLSbOARjE27XkSzgus8IFn rPFvwnLMrSRceu2V783a7CIm1JQlDm9ccgQtuoYvnm7ryk529Vv6R251WEpCVYBoe9Cu ZZpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-filter:dkim-signature:dkim-filter; bh=TNURWtYg5VbgmOVt3Zu3a5GrkMmxUJgdKkf+0OlgfLQ=; b=HD+wb6wBr64tjt6YR/Ub2nmTO6kvRB1OiAFi05Jizme+J04UvSigiQ9isg/zWv/E4O dHCyszPsx1lc34Q7wh/09zE9MYc/P3hV7ChMk8hEY0NCqadySiVYMe5lTfkDpdcQbRsj 50QpaLeW3Dk14LO/IfaEAcJjobmpI/yqSu2LjZlV4Z4UPfJpDqTydwPcrGGyNz2n+/hV dIzPDlvcyqjgf8ER6+JXOGH1iGwplxDzW3aO9N8jbm5zbdUDn/U0NM7FTfs6/tP7rT6B lll2v2uC0xm9733D7sbpmaQep7ZeNx3Pde1EjCyPDwSxkz4ph7mK+G6L34lo0m9wVkpE 1waA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dlink.ru header.s=mail header.b=lHbMNkR+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2si601141otk.177.2019.12.06.07.07.31; Fri, 06 Dec 2019 07:07:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@dlink.ru header.s=mail header.b=lHbMNkR+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726472AbfLFPG1 (ORCPT + 99 others); Fri, 6 Dec 2019 10:06:27 -0500 Received: from fd.dlink.ru ([178.170.168.18]:43908 "EHLO fd.dlink.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfLFPG0 (ORCPT ); Fri, 6 Dec 2019 10:06:26 -0500 Received: by fd.dlink.ru (Postfix, from userid 5000) id 46DE61B214D6; Fri, 6 Dec 2019 18:06:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 fd.dlink.ru 46DE61B214D6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dlink.ru; s=mail; t=1575644783; bh=TNURWtYg5VbgmOVt3Zu3a5GrkMmxUJgdKkf+0OlgfLQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=lHbMNkR+fWnv0r2T339Yr8QNbkjw+56435jESnAW0VZswNTpRQnSVj+ZlsqIe6Qd2 HFxFiBh+Odu+eYudoZNs+eXtT3GqmfNsm5+yv+vgUEx//zGosjtjUPM2YGryvMuBxR bXMODReAz4v6JrvN0JHsgxpD9ugyYCAPg4RyeQGQ= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.dlink.ru X-Spam-Level: X-Spam-Status: No, score=-99.2 required=7.5 tests=BAYES_50,URIBL_BLOCKED, USER_IN_WHITELIST autolearn=disabled version=3.4.2 Received: from mail.rzn.dlink.ru (mail.rzn.dlink.ru [178.170.168.13]) by fd.dlink.ru (Postfix) with ESMTP id 00AD41B21308; Fri, 6 Dec 2019 18:06:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 fd.dlink.ru 00AD41B21308 Received: from mail.rzn.dlink.ru (localhost [127.0.0.1]) by mail.rzn.dlink.ru (Postfix) with ESMTP id 8D5981B20228; Fri, 6 Dec 2019 18:06:09 +0300 (MSK) Received: from mail.rzn.dlink.ru (localhost [127.0.0.1]) by mail.rzn.dlink.ru (Postfix) with ESMTPA; Fri, 6 Dec 2019 18:06:09 +0300 (MSK) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Fri, 06 Dec 2019 18:06:09 +0300 From: Alexander Lobakin To: "David S. Miller" Cc: Florian Fainelli , Muciri Gatimu , Shashidhar Lakkavalli , John Crispin , Andrew Lunn , Vivien Didelot , Stanislav Fomichev , Daniel Borkmann , Song Liu , Alexei Starovoitov , Matteo Croce , Jakub Sitnicki , Eric Dumazet , Paul Blakey , Yoshiki Komachi , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: dsa: fix flow dissection on Tx path In-Reply-To: <5d3d0907-4f99-ccda-82f4-12e514c5edb2@gmail.com> References: <20191205100235.14195-1-alobakin@dlink.ru> <5d3d0907-4f99-ccda-82f4-12e514c5edb2@gmail.com> User-Agent: Roundcube Webmail/1.4.0 Message-ID: <71305dd0f15bd065f9b1eedd4f61123e@dlink.ru> X-Sender: alobakin@dlink.ru Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Florian Fainelli wrote 06.12.2019 06:28: > On 12/5/2019 2:02 AM, Alexander Lobakin wrote: >> Commit 43e665287f93 ("net-next: dsa: fix flow dissection") added an >> ability to override protocol and network offset during flow dissection >> for DSA-enabled devices (i.e. controllers shipped as switch CPU ports) >> in order to fix skb hashing for RPS on Rx path. >> >> However, skb_hash() and added part of code can be invoked not only on >> Rx, but also on Tx path if we have a multi-queued device and: >> - kernel is running on UP system or >> - XPS is not configured. >> >> The call stack in this two cases will be like: dev_queue_xmit() -> >> __dev_queue_xmit() -> netdev_core_pick_tx() -> netdev_pick_tx() -> >> skb_tx_hash() -> skb_get_hash(). >> >> The problem is that skbs queued for Tx have both network offset and >> correct protocol already set up even after inserting a CPU tag by DSA >> tagger, so calling tag_ops->flow_dissect() on this path actually only >> breaks flow dissection and hashing. >> >> This can be observed by adding debug prints just before and right >> after >> tag_ops->flow_dissect() call to the related block of code: >> >> Before the patch: >> >> Rx path (RPS): >> >> [ 19.240001] Rx: proto: 0x00f8, nhoff: 0 /* ETH_P_XDSA */ >> [ 19.244271] tag_ops->flow_dissect() >> [ 19.247811] Rx: proto: 0x0800, nhoff: 8 /* ETH_P_IP */ >> >> [ 19.215435] Rx: proto: 0x00f8, nhoff: 0 /* ETH_P_XDSA */ >> [ 19.219746] tag_ops->flow_dissect() >> [ 19.223241] Rx: proto: 0x0806, nhoff: 8 /* ETH_P_ARP */ >> >> [ 18.654057] Rx: proto: 0x00f8, nhoff: 0 /* ETH_P_XDSA */ >> [ 18.658332] tag_ops->flow_dissect() >> [ 18.661826] Rx: proto: 0x8100, nhoff: 8 /* ETH_P_8021Q */ >> >> Tx path (UP system): >> >> [ 18.759560] Tx: proto: 0x0800, nhoff: 26 /* ETH_P_IP */ >> [ 18.763933] tag_ops->flow_dissect() >> [ 18.767485] Tx: proto: 0x920b, nhoff: 34 /* junk */ >> >> [ 22.800020] Tx: proto: 0x0806, nhoff: 26 /* ETH_P_ARP */ >> [ 22.804392] tag_ops->flow_dissect() >> [ 22.807921] Tx: proto: 0x920b, nhoff: 34 /* junk */ >> >> [ 16.898342] Tx: proto: 0x86dd, nhoff: 26 /* ETH_P_IPV6 */ >> [ 16.902705] tag_ops->flow_dissect() >> [ 16.906227] Tx: proto: 0x920b, nhoff: 34 /* junk */ >> >> After: >> >> Rx path (RPS): >> >> [ 16.520993] Rx: proto: 0x00f8, nhoff: 0 /* ETH_P_XDSA */ >> [ 16.525260] tag_ops->flow_dissect() >> [ 16.528808] Rx: proto: 0x0800, nhoff: 8 /* ETH_P_IP */ >> >> [ 15.484807] Rx: proto: 0x00f8, nhoff: 0 /* ETH_P_XDSA */ >> [ 15.490417] tag_ops->flow_dissect() >> [ 15.495223] Rx: proto: 0x0806, nhoff: 8 /* ETH_P_ARP */ >> >> [ 17.134621] Rx: proto: 0x00f8, nhoff: 0 /* ETH_P_XDSA */ >> [ 17.138895] tag_ops->flow_dissect() >> [ 17.142388] Rx: proto: 0x8100, nhoff: 8 /* ETH_P_8021Q */ >> >> Tx path (UP system): >> >> [ 15.499558] Tx: proto: 0x0800, nhoff: 26 /* ETH_P_IP */ >> >> [ 20.664689] Tx: proto: 0x0806, nhoff: 26 /* ETH_P_ARP */ >> >> [ 18.565782] Tx: proto: 0x86dd, nhoff: 26 /* ETH_P_IPV6 */ >> >> In order to fix that we can add the check 'proto == htons(ETH_P_XDSA)' >> to prevent code from calling tag_ops->flow_dissect() on Tx. >> I also decided to initialize 'offset' variable so tagger callbacks can >> now safely leave it untouched without provoking a chaos. >> >> Fixes: 43e665287f93 ("net-next: dsa: fix flow dissection") >> Signed-off-by: Alexander Lobakin > > Reviewed-by: Florian Fainelli So Dave, you can pick it up into your fixes tree if I understand correctly. There will be further work on DSA Rx path, but it's a subject for next Linux release cycles essentially. Regards, ᚷ ᛖ ᚢ ᚦ ᚠ ᚱ