Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1310963lqb; Thu, 30 May 2024 06:53:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU3Kk7XoXO4nQY8/Fe4grztIoknqfKVeKJbbPLuqlKnQScj7Kv1ZhVuxU+kZye9gC4NmaRR93cO5d8e78jEGK+43kpdKxW7wH0EjQfFHA== X-Google-Smtp-Source: AGHT+IHPDUtDSqyR1mlgO0lKnPc0UDUfnhZBizKU8adQzaaPOCiIh5JdDBXJRA3JP/qVVmf7oxDS X-Received: by 2002:a05:6358:7285:b0:186:c06f:435c with SMTP id e5c5f4694b2df-199b9748025mr256166455d.24.1717077236881; Thu, 30 May 2024 06:53:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717077236; cv=pass; d=google.com; s=arc-20160816; b=BZxan6O0eB10CofpcxkUOQtJ+XyhC2VtPKBR6ZOcQwGSSfpRbnK3tEygfZreIWOrFY AUg3v/D4drkAY9/mcYTvHq3etgWHiIE7DuCclw8wD3YuFemNXsj7wQLHbHvNvRBe2D3D wlT6kv1j9aMQpIv83SLNTMTSwFtvpqFxXLmCSCMvTjnWU8EtOmKmIyVThezzK9ntAI+G m5XW3ZBt0qZrX6cFfWoj6XqwWVrpzlk29LcVItueOPrDPRQSRWl5k4BlubGVRvQNF7yW MB8kj0F386V3KyWXtZCwTeu8YQJbXHnSZXOYIypCqogD285aQS4EKvL4NvxkAfzHRGJ3 khfg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mvWDuGZydvfwWw+VcnsyJcShHeGi2zyYheK4PDOMSDM=; fh=7vU9NN4LDuQB2LOP6IA2Tnv94DJeMegLdIiIHFVRCsE=; b=g1iWie2+s/WFz9sj7RiNpor2C19EU7E0kfIlhB40nyWMpW8m+c6pnbKiZi420ZJuHV kCf8B0x5MZpru1yQw0ulcufHOvHbbs6Wsxhx4yD1xTbSE/BYyiv1aT0+o+MM+2pUWNFF 76CTfHaA2/fBEpu5ukPpOQxOYiD9fGWK0A9OR3xAJGDkLTFW1lok4oXYXregNwFvsBHT qgnIH/i+JtKATtt4wnMRUBHYaB2+DsJaZs/6b4/hXsfiPtKXUQkPXF69oplLQCT9C3oc DfuKx4numNhNa8VtYCTLySZpGhJgqgcXzOwmuYNizyuYKnnR1ufN4hR/8/DAA4gZmx5f ST0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YUAgkZaz; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-195469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6822779bc55si12154214a12.346.2024.05.30.06.53.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 06:53:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YUAgkZaz; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-195469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 86156B21BCA for ; Thu, 30 May 2024 13:53:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 597A1186E36; Thu, 30 May 2024 13:53:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YUAgkZaz" Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C85AF186E26; Thu, 30 May 2024 13:53:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717077224; cv=none; b=NqQ/BYjrWACK/CSgviuiM2z7ZONCqyN/i91UPXh1+pILEuSwyvXYbGyKiY5r5YvI4ZmFd6VwpfaPRsm3ZKTb1C+JE3V4FVF0Idq0mc3naeIzZljGQdJe7Cs4bVugsIDsSDTwpgy/U8PIN0XplWzKpm4MyqiAG4PK0paH+Tm0+Zc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717077224; c=relaxed/simple; bh=x6es90Rm3xtGO8dDhmEZEJD8Kav3O2vb6Z6KMM1kzb8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LwzhTY9nourQDD27w9wb7+i5sIo7UirNn8ReHn0Nj4uo3qQgxhpv4mXpGrRPO+gTUepb6bibGxu7wHjLf14877r/baR9q4bFq9KhIudK6cA+ofH2TCR5fvxmRYw/fZ2RnbEM68yXhL/mOtMMivxEnPWV/srqip1kfE7YWFuB5+Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YUAgkZaz; arc=none smtp.client-ip=209.85.208.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2e719bab882so9935861fa.3; Thu, 30 May 2024 06:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717077220; x=1717682020; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=mvWDuGZydvfwWw+VcnsyJcShHeGi2zyYheK4PDOMSDM=; b=YUAgkZazkuF0gjm0ZBxTBMtTjwrsrG2Er3yUcpwbIG7ICr1soS+9hFudQUu2cjaK7i AsF8b6a1I0z5zhR8+OMDjS/vSLbx4ASawfIb3y3SRF5hq/nZFOmtmTDopQKPmeknR2Q8 RbIvNS+HGv83L6o5ZBHO3hsK9P5Pkzmq6oJOCSQOF6ui8T1EImXgKsZlwdHQctpqqUph yUgQzFdPV+alkS3GhZjkgMu23vPI2HtDpQ95wqMnD5frCNNVAnIfzvePjmpWa8I3e8JP pNO0YZT9j2I5oQmfiX0A28QGISn6nJq5+cpNIHjTfI1Geucpv0F8j1FmQ+yhoBihahke 0fhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717077220; x=1717682020; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mvWDuGZydvfwWw+VcnsyJcShHeGi2zyYheK4PDOMSDM=; b=VaLMMcnLyyEl8WWzU03k/l4iRrnz/ws8POJv3oLr4iXfljLp7rkLWhBvITVnU3Z/Pu BLIACQU0mbehzv2zq9/3ReEKqc3IGHA0Qp31jOiwrl67MB71NwV7O7a6SBtdBMaLdYph QmwNor/0uBUodamzvMbrTDpVZgTukNLFWTuYk4zI1xLMgD1XHzhr1zZ/JJCKihMT/ptq FT2E003yEDt4x/PlUWYKMtiK7vopZ6i8g8mb7LBtmj5JsbohVHTDBw9YCoeOJzeGhfcO un+UymS7L0SiFgLzECGw6HtZbkK8ETiodnKr9facDV07E1ah7T0Y2ojyJeGaJ2UAetfC jeGQ== X-Forwarded-Encrypted: i=1; AJvYcCXA0X1cIRawq/njisLA/hbfSzBhe0xdKZYTrF5sYRpIHhAqyVUBKVFqzKclH/vIpst5jqvilWUi58plTcX3FFvdBqASrRELVKZ3TdkvsxmNyjnbMtOErxXsVVa+Y9nIuJM49EmD X-Gm-Message-State: AOJu0YzZ/mQYdCq0RLdBomted9SSrE7BBflbkDawN2EStqZ2uDAaejzI vmYEyXPFfitDa4FHAicgRSChAEEYQBOsmrS6XvV5yoQlAU3Q0CIWiugL8eUj X-Received: by 2002:a2e:9858:0:b0:2d4:54f2:c409 with SMTP id 38308e7fff4ca-2ea84892132mr14288601fa.38.1717077219409; Thu, 30 May 2024 06:53:39 -0700 (PDT) Received: from skbuf ([188.25.55.166]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-421270791c7sm25921725e9.31.2024.05.30.06.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 06:53:37 -0700 (PDT) Date: Thu, 30 May 2024 16:53:35 +0300 From: Vladimir Oltean To: "Russell King (Oracle)" Cc: Xiaolei Wang , Andrew Lunn , alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [net v2 PATCH] net: stmmac: Update CBS parameters when speed changes after linking up Message-ID: <20240530135335.yanffjb3ketmoo7u@skbuf> References: <20240530061453.561708-1-xiaolei.wang@windriver.com> <20240530132822.xv23at32wj73hzfj@skbuf> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, May 30, 2024 at 02:40:30PM +0100, Russell King (Oracle) wrote: > On Thu, May 30, 2024 at 04:28:22PM +0300, Vladimir Oltean wrote: > > On Thu, May 30, 2024 at 02:50:52PM +0200, Xiaolei Wang wrote: > > > When the port is relinked, if the speed changes, the CBS parameters > > > should be updated, so saving the user transmission parameters so > > > that idle_slope and send_slope can be recalculated after the speed > > > changes after linking up can help reconfigure CBS after the speed > > > changes. > > > > > > Fixes: 1f705bc61aee ("net: stmmac: Add support for CBS QDISC") > > > Signed-off-by: Xiaolei Wang > > > --- > > > v1 -> v2 > > > - Update CBS parameters when speed changes > > > > May I ask what is the point of this patch? The bandwidth fraction, as > > IEEE 802.1Q defines it, it a function of idleSlope / portTransmitRate, > > the latter of which is a runtime variant. If the link speed changes at > > runtime, which is entirely possible, I see no alternative than to let > > user space figure out that this happened, and decide what to do. This is > > a consequence of the fact that the tc-cbs UAPI takes the raw idleSlope > > as direct input, rather than something more high level like the desired > > bandwidth for the stream itself, which could be dynamically computed by > > the kernel. > > So what should be the behaviour here? Refuse setting CBS parameters if > the link is down, and clear the hardware configuration of the CBS > parameters each and every time there is a link-down event? Isn't that > going to make the driver's in-use settings inconsistent with what the > kernel thinks have been set? AFAIK, tc qdisc's don't vanish from the > kernel just because the link went down. > > I think what you're proposing leads to the hardware being effectively > "de-programmed" for CBS while "tc qdisc show" will probably report > that CBS is active on the interface - which clearly would be absurd. No, just program to hardware right away the idleSlope, sendSlope, loCredit and hiCredit that were communicated by user space. Those were computed for a specific link speed and it is user space's business to monitor that this link speed is maintained for as long as the streams are necessary (otherwise those parameters are no longer valid). One could even recover the portTransmitRate that the parameters were computed for (it should be idleSlope - sendSlope, in Kbps). AKA keep the driver as it is. I don't see why the CBS parameters would need to be de-programmed from hardware on a link down event. Is that some stmmac specific thing? Xiaolei may have a bone to pick with the fact that tc-cbs takes its input the way it does, but that's an entirely different matter..