Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2392291pxb; Tue, 13 Apr 2021 00:18:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsXpnoPM0CwiL3zx9NwjoHHdj7TMZdcwTeDufU1mlvVwCvFDu+KcnqxGREx7uL/6mwH/W4 X-Received: by 2002:aa7:c1c8:: with SMTP id d8mr18725754edp.236.1618298288322; Tue, 13 Apr 2021 00:18:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618298288; cv=none; d=google.com; s=arc-20160816; b=rEiqUV7aSWN1dtEh4pSCtvERrlvlgeSRn7czZNCUmDQEYsXfvGAuVpRV3cMnG2rrwN 9BJyO8IywiuyyAktvYIJYaKux/P74US5w1C1ONaOgLQSONqTD7SixbL8Hh3k2d8Uhmqr RPsRNMFs1dSjRcob23Mnk6j/0u7xLiVtcSk/7sAtzgXRe6uSmuP6kndU6g8/I44FH3X6 wcM5JWscNBOwE2hkAzXi9LsogWBtzUYdKdeX9fLcCnnwVWCY51SfOzYDaNtIubG2/ej2 +ADtIUI3gtAfOYeq7qj51N+fr5M36yFpz2WqWOQlbCCRu0tNPyBTBWcxzlzjB4lqY1sz lr3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZBakd+wFpZqBkXZhtANFGvZ6nMhELmLlM7Z0eCX6SN8=; b=E3oDy3C4EsrVL7s6j6ANq2rSfI/WWlNLDQ8iqW6OYUA8cds2fwJXGxw4dZOl9A8tzN 9uUwM3vEI47mUW6nGIyuulJoT78aD9xb9XNeUyVA0Pk01Ly3nooFtx/uZencmlM2Wq1B Qxu3gCbE63uoxxP161Z+Z5ymLey2z943tyTQMUqfzC2QpK/OQIISRUf4xy3KeviSFcHq qJyulrEdhiGSmJ8rxtgFEZDI7Uutu68h1erO0n+BW5sED+VKRtDHQHNVi3dvqvk9NJYP JMWozwLdADd+UczgT+LtJ9dNkAuCqSqfAq3hHYSyfu1CS8opgp83iUO+ZMjsbxbz/gG9 lEfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eGbkvdRy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t4si9425118ejs.517.2021.04.13.00.17.41; Tue, 13 Apr 2021 00:18:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eGbkvdRy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240321AbhDLVei (ORCPT + 99 others); Mon, 12 Apr 2021 17:34:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237701AbhDLVei (ORCPT ); Mon, 12 Apr 2021 17:34:38 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1A34C061574; Mon, 12 Apr 2021 14:34:19 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id s14so2514814pjl.5; Mon, 12 Apr 2021 14:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZBakd+wFpZqBkXZhtANFGvZ6nMhELmLlM7Z0eCX6SN8=; b=eGbkvdRyxJwvo9f0LKfNeASx+ALduFoFcmO66YuNkQa81z66RbIP9ZatbBV3TXi+0U bIZN+TVxgF8Gz/zBhb90MzA8r7VvNmPtLvu8LiiDCZ6MdlwnL4JnX8XJ45U5LZTotUDI YM0lHRlF+6kLSHpxSRacbnLQlf3ASbCMf7XwrExLYo+2/cRBOzpbKa+naycJaffrT6wq ZSrQaoNtg63pwXxf3dFwb5uuiRXJaDYuxBLzbOdYDMDzB35Zdz7uIVEYUHW1I++UOFvs zRjI522nj6C7fHaD4VKT5l6d+tbKyZy6gmP2ADaZERHKUp2/Ol8UkOADJY0V51kbZDVg 1F8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZBakd+wFpZqBkXZhtANFGvZ6nMhELmLlM7Z0eCX6SN8=; b=JQKAqZpW2Nx7QvQPSE6zpwF3JXl35uN4y/pnL5jvVIfhlyQ6g8NcdzmgwHY3xrLkug fT1ZcgdA4VES1E0x7X2WMTvJ543DTbnZ7tGgyzy8IozpvawqEbY5EDhYnkWD3IMGckr9 VUg86ZGuIG5df8cmcYomOg8sPNVph54hq8lD8JF9pXzk6VYSzhgsXkUnnlZjLkisFySx 3ZgWHv1OUoGxTtU79emNc/8+qA/z2yUVPXMFH9M8wrLYV+oMiVegDt+jXsnWRV89vDBv AyzRmbQvx+sq+8xUAlVTSQNuigI0pRyVmv7LTmAJFP9KiwPew9jJVEovj3g6q6PkQA8b DrFw== X-Gm-Message-State: AOAM531szmTRSbAd1Xwoq7rTkZtEz7WeBG2M3lFEF6H9qbl7zrhTiO+R rJP89eSN8hIqRNxn3E1mDNs= X-Received: by 2002:a17:90a:94ca:: with SMTP id j10mr1296432pjw.126.1618263259009; Mon, 12 Apr 2021 14:34:19 -0700 (PDT) Received: from skbuf (5-12-16-165.residential.rdsnet.ro. [5.12.16.165]) by smtp.gmail.com with ESMTPSA id gb15sm316927pjb.32.2021.04.12.14.34.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 14:34:18 -0700 (PDT) Date: Tue, 13 Apr 2021 00:34:02 +0300 From: Vladimir Oltean To: Tobias Waldekranz Cc: Marek Behun , Ansuel Smith , netdev@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Andrew Lunn , Vivien Didelot , Florian Fainelli , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eric Dumazet , Wei Wang , Cong Wang , Taehee Yoo , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , zhang kai , Weilong Chen , Roopa Prabhu , Di Zhu , Francis Laniel , linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC net-next 0/3] Multi-CPU DSA support Message-ID: <20210412213402.vwvon2fdtzf4hnrt@skbuf> References: <20210410133454.4768-1-ansuelsmth@gmail.com> <20210411200135.35fb5985@thinkpad> <20210411185017.3xf7kxzzq2vefpwu@skbuf> <878s5nllgs.fsf@waldekranz.com> <20210412213045.4277a598@thinkpad> <8735vvkxju.fsf@waldekranz.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8735vvkxju.fsf@waldekranz.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 12, 2021 at 11:22:45PM +0200, Tobias Waldekranz wrote: > On Mon, Apr 12, 2021 at 21:30, Marek Behun wrote: > > On Mon, 12 Apr 2021 14:46:11 +0200 > > Tobias Waldekranz wrote: > > > >> I agree. Unless you only have a few really wideband flows, a LAG will > >> typically do a great job with balancing. This will happen without the > >> user having to do any configuration at all. It would also perform well > >> in "router-on-a-stick"-setups where the incoming and outgoing port is > >> the same. > > > > TLDR: The problem with LAGs how they are currently implemented is that > > for Turris Omnia, basically in 1/16 of configurations the traffic would > > go via one CPU port anyway. > > > > > > > > One potencial problem that I see with using LAGs for aggregating CPU > > ports on mv88e6xxx is how these switches determine the port for a > > packet: only the src and dst MAC address is used for the hash that > > chooses the port. > > > > The most common scenario for Turris Omnia, for example, where we have 2 > > CPU ports and 5 user ports, is that into these 5 user ports the user > > plugs 5 simple devices (no switches, so only one peer MAC address for > > port). So we have only 5 pairs of src + dst MAC addresses. If we simply > > fill the LAG table as it is done now, then there is 2 * 0.5^5 = 1/16 > > chance that all packets would go through one CPU port. > > > > In order to have real load balancing in this scenario, we would either > > have to recompute the LAG mask table depending on the MAC addresses, or > > rewrite the LAG mask table somewhat randomly periodically. (This could > > be in theory offloaded onto the Z80 internal CPU for some of the > > switches of the mv88e6xxx family, but not for Omnia.) > > I thought that the option to associate each port netdev with a DSA > master would only be used on transmit. Are you saying that there is a > way to configure an mv88e6xxx chip to steer packets to different CPU > ports depending on the incoming port? > > The reason that the traffic is directed towards the CPU is that some > kind of entry in the ATU says so, and the destination of that entry will > either be a port vector or a LAG. Of those two, only the LAG will offer > any kind of balancing. What am I missing? > > Transmit is easy; you are already in the CPU, so you can use an > arbitrarily fancy hashing algo/ebpf classifier/whatever to load balance > in that case. Say a user port receives a broadcast frame. Based on your understanding where user-to-CPU port assignments are used only for TX, which CPU port should be selected by the switch for this broadcast packet, and by which mechanism?