Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3201424pxb; Tue, 13 Apr 2021 22:46:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBLtMETxGUo1pLNICNRtlyhQ5lmU5zkl7D0MSJ+YDQF1mJ1JHx+gKacoLD5OTMJ2hhfsWW X-Received: by 2002:a17:903:189:b029:e5:d7c3:a264 with SMTP id z9-20020a1709030189b02900e5d7c3a264mr36117997plg.6.1618379162141; Tue, 13 Apr 2021 22:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618379162; cv=none; d=google.com; s=arc-20160816; b=rKPHAG+m7zhkzvO1nIwP9PNh8vV8aZJkONIRogTKsR0WXYmdcWltGTfV/CCuNBvH/0 pL2MmMk33x/DV6n+nvcEFwIaQP67fJm+nByAXOEhGmoK2twRyuBwUKokDM55D0B4eQZH bBXgkA5/0xPCgMcFSXbH4mqDUyIijUHzUq9InMEd1PJyvutaTCWrADE2seZxV0nVdLDe eMgt2H9D26MffF/6hkS0gubEqSc0Unmb3cvlFoK6ZRzFbYxIA80IYlFNpIxvWnb/TZzY 7dU0FKVHWHPXESYV5amqLcvxkxM3thoahQ1hM14ACA8AcvMm6jwHrsCYr3D9+NV64nVF /xfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=/NRxwC56E+MI3F93yElfCXf/3hj5Z06is2uycZkM0qQ=; b=WH9T+meelPtTBoyeygI7Wd9ePT2q5zaW38iGeOOhb2/Xym1GJvpKs2POpLrlEfEm+3 wRz0TorROj4sOFt1Njlf0zDNw64D+hu33/IMYLMpqCn1WuDHA/fDtqLtsdrK0dnlPN03 sCPgXTfmJi8TYvodn7cOKANFOWbNZa4raub6yVSc5SJZ3gaM49dAtfNWQlUhsE7+sQZY r1qCPzFhQevMAPpUdelZ2FEc8PrhHq50DqCIz57YkO3opWQSIbzWdcJkVSleS31/onhy AFtoauLA0NcUChEr8GLVgpBrjCV7C8/50jmjDg9PqMQKfbmjC2XjMnE5kSWHrpITsiGO PeqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@waldekranz-com.20150623.gappssmtp.com header.s=20150623 header.b="DvJDXp/d"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 15si21978820pfo.147.2021.04.13.22.45.49; Tue, 13 Apr 2021 22:46:02 -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=@waldekranz-com.20150623.gappssmtp.com header.s=20150623 header.b="DvJDXp/d"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237137AbhDMSQy (ORCPT + 99 others); Tue, 13 Apr 2021 14:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238322AbhDMSQx (ORCPT ); Tue, 13 Apr 2021 14:16:53 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8AEFC061756 for ; Tue, 13 Apr 2021 11:16:28 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id j18so28874148lfg.5 for ; Tue, 13 Apr 2021 11:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=/NRxwC56E+MI3F93yElfCXf/3hj5Z06is2uycZkM0qQ=; b=DvJDXp/d6RVgY9b8RzGDfa4v7bb80kHLSf6aVUTdCUGASXQijU9fey+HkK22mjfMmP Zaw+pH/pdj3l4ftbWEbHMzM/SJic7CkowmqoVf1JbOsKpg5Vx3ODW/XbbiUQg8j0q8Gn 7uczMoJP5hsoj6crQbcJtd1Sg6yQ2CT6uuQ1DHeY3f491MsXleeoanzBwaQtkwqDdCcN hiUXX8ySa8zM4KvxXdmrAfUBEStcXDhvOEjSr+HN3HDAHDvAGQBmqsoMQkO90jNPrxsv CQJySlTXy2HN1FLJCkjF6c5G/5OhNaPrGuQNGRTecrenASSgzpUX5EpIa6MNdUdbZdCK pzYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=/NRxwC56E+MI3F93yElfCXf/3hj5Z06is2uycZkM0qQ=; b=p0SWHq9U7+afruiM9m00TKPjF0Pn2thVEB0GlHSbBfXX5PUej3G1vOwLG4CPddEJiT vABEvWmEpUs7Xb/TfdDHzKC10llQUJ6TaDsGWp1TV8BcMLgYoZZJc/uH6dQTUWsbtcfs QOI7CysBLmR9VB2RieQJS294o6n5Gq9yaL0PaILHrE+CO2AIpldZN1BMhcLsk+iNmkzH PMYRe0dFec74rD7SNK0hD99Cbuxa1UV60aKbBYWuyZJtEOpnHtYQJgnnRIryIt8GQwYM y+cxVoxm3/sBL3vquojd39HNWWpz7MbQV1lljoJ7u4R8N2Wr6Kj0esxKwcpt9g26UGJr IuYw== X-Gm-Message-State: AOAM5313sZjlX0xgPNsjpuw1q/vjbVaOaDKi0wC94t1qn3wYfUvV4yJj vixPsKIGXbkt32ZpYDm5o5WX50QEIaUW+LoE X-Received: by 2002:ac2:58c9:: with SMTP id u9mr11384189lfo.103.1618337786726; Tue, 13 Apr 2021 11:16:26 -0700 (PDT) Received: from wkz-x280 (h-90-88.A259.priv.bahnhof.se. [212.85.90.88]) by smtp.gmail.com with ESMTPSA id v4sm2263993lfe.18.2021.04.13.11.16.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 11:16:25 -0700 (PDT) From: Tobias Waldekranz To: Marek Behun Cc: Vladimir Oltean , 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 In-Reply-To: <20210413171443.1b2b2f88@thinkpad> References: <20210410133454.4768-1-ansuelsmth@gmail.com> <20210411200135.35fb5985@thinkpad> <20210411185017.3xf7kxzzq2vefpwu@skbuf> <878s5nllgs.fsf@waldekranz.com> <20210412213045.4277a598@thinkpad> <8735vvkxju.fsf@waldekranz.com> <20210412235054.73754df9@thinkpad> <87wnt7jgzk.fsf@waldekranz.com> <20210413005518.2f9b9cef@thinkpad> <87r1jfje26.fsf@waldekranz.com> <87o8ejjdu6.fsf@waldekranz.com> <20210413015450.1ae597da@thinkpad> <20210413022730.2a51c083@thinkpad> <87im4qjl87.fsf@waldekranz.com> <20210413171443.1b2b2f88@thinkpad> Date: Tue, 13 Apr 2021 20:16:24 +0200 Message-ID: <87fszujbif.fsf@waldekranz.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 13, 2021 at 17:14, Marek Behun wrote: > On Tue, 13 Apr 2021 16:46:32 +0200 > Tobias Waldekranz wrote: > >> On Tue, Apr 13, 2021 at 02:27, Marek Behun wrote: >> > On Tue, 13 Apr 2021 01:54:50 +0200 >> > Marek Behun wrote: >> > >> >> I will look into this, maybe ask some follow-up questions. >> > >> > Tobias, >> > >> > it seems that currently the LAGs in mv88e6xxx driver do not use the >> > HashTrunk feature (which can be enabled via bit 11 of the >> > MV88E6XXX_G2_TRUNK_MAPPING register). >> >> This should be set at the bottom of mv88e6xxx_lag_sync_masks. >> >> > If we used this feature and if we knew what hash function it uses, we >> > could write a userspace tool that could recompute new MAC >> > addresses for the CPU ports in order to avoid the problem I explained >> > previously... >> > >> > Or the tool can simply inject frames into the switch and try different >> > MAC addresses for the CPU ports until desired load-balancing is reached. >> > >> > What do you think? >> >> As you concluded in your followup, not being able to have a fixed MAC >> for the CPU seems weird. >> >> Maybe you could do the inverse? Allow userspace to set the masks for an >> individual bond/team port in a hash-based LAG, then you can offload that >> to DSA. > > What masks? The table defined in Global2/Register7. When a frame is mapped to a LAG (e.g. by an ATU lookup), all member ports will added to the frame's destination vector. The mask table is the block that then filters the vector to only include a single member. By modifying that table, you can choose which buckets are assigned to which member ports. This includes assigning 7 buckets to one member and 1 to the other for example. At the moment, mv88e6xxx will statically determine this mapping (in mv88e6xxx_lag_set_port_mask), by trying to spread the buckets as evenly as possible. It will also rebalance the assignments whenever a link goes down, or is "detached" in LACP terms. You could imagine a different mode in which the DSA driver would receive the bucket allocation from the bond/team driver (which in turn could come all the way from userspace). Userspace could then implement whatever strategy it wants to maximize utilization, though still bound by the limitations of the hardware in terms of fields considered during hashing of course.