Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5617998pxb; Wed, 26 Jan 2022 16:39:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwORBXD4pnejGMBR9QidY2NoFzYotC6FZAjd66GHAkGfqhfIaaAFPTof26OiidwEmJCRk/7 X-Received: by 2002:a62:7b51:: with SMTP id w78mr1061362pfc.8.1643243987865; Wed, 26 Jan 2022 16:39:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643243987; cv=none; d=google.com; s=arc-20160816; b=Luok6fcnBBRmTFcYiGXArTzaa2psuDe4QgWLBA3PQ5ggdqkzR6UJEdg7XLocV1d2Dz LW1Z2Z7PdNjEhPSiKjUWmImiVCKQRHefbH2u5U3wbk5D+asKXbI6OIF+h+hSh7DTtDK8 afS5gDhbFy2u6lEbGbyMN4vNkFOvkXkS7Vu6G9PfzyqFFEQXnrGRRDuDr9TTauGYeSU6 miBruE/hjCpB0yR+NfwXsft9j1R1nkGEkP42Z4okx3gymc/AAf8K9/hiMSR+JfQUy3V7 A77ZsPJwld225NOR6SOGtImCZu5uh5pBzxFoiOHdKFiwjsOglRYpb/ndfEFPhh1q/cRb UB0A== 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=lEkoIfpLwpN4qDKwjyAgXgxx9hZ83QdosrwUlDdKfoE=; b=y1pojwfGYI/YDTb+YNn9f+uZ18/EGqjnX/wHZ3epBrX7jtlMLbyCoFE/7fZl8Pji+E Xt2H9UsP0qv2nOj2mt0+q9BoegXAAjLdosdTlzA6HA6kF0AiKX2jBeTODVcanOTXQnox HpEHi7E/ZcE4BqR54LA/kDVYelLw5fAf8lulUj1kHR6WXvp2KOYLQvAm4XVGbJgIY0UJ mHzHDwqAXW+DANrjHvjI0yGdNJCwp2iG/4yw14CO1XfUzMASP2sj859IsdBnQ9qJ+mdM ssL22iYh1OMBhFd+gbryMuzhgQgLpUxi67QFLZx/Ni/dgI9XDLnRxUC2lGDB3Wi/2ZGY 0JAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FatyzVxn; 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 i10si745152pgt.437.2022.01.26.16.39.36; Wed, 26 Jan 2022 16:39:47 -0800 (PST) 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=20210112 header.b=FatyzVxn; 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 S231569AbiAZVAF (ORCPT + 99 others); Wed, 26 Jan 2022 16:00:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbiAZVAE (ORCPT ); Wed, 26 Jan 2022 16:00:04 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0966C06161C; Wed, 26 Jan 2022 13:00:03 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id a8so1163149ejc.8; Wed, 26 Jan 2022 13:00:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lEkoIfpLwpN4qDKwjyAgXgxx9hZ83QdosrwUlDdKfoE=; b=FatyzVxn8iwK6oF5QWSlw4gHgbM26lJJtdDThHmjips75V08YS8HIW0FNwTGKWyLyl YCafkxaxDuJ6uM+lHR+ZU+HyLZnYdZeXuw04I1iUeSrgWoU6XKXfTmGPjrHnfK9zof7r xKmaw3u7EYYwxXt5p4HccILZaknEuIkwN0ji/HogCS2rUtNni1ciZx4lzP9pAFMdOTez 51TqDGCS8bLXSXjvxZ16sC4yR9rDsloMeZgo/mGKP3BEs8UNvSzjF76j/HwWHydjMPlm bkeiv7r38XrC78Kt3uIu6q+Qgv7wWHo1+OFaXq9c4ufQ3lP+YtucMbEKFq1baf2t9Z/v kjjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lEkoIfpLwpN4qDKwjyAgXgxx9hZ83QdosrwUlDdKfoE=; b=R25MNVx42SPnDSoyRWNHaeKVomHhsscXnC2KSSp47tIso8lqyzxywCaDh8NBa7AEsq X8oIZrcNKMl+PLEhlAUA8LR46J6Fqrs6ITNAsmP3ZcBeTCjAuFV6oPjJns73Yaqm0ddC 2IiAfu553crz4iOiCWh/ujuacw3fBHJ/uu1Bya2cnFAepxN1tX7oy1QURuDcbDfin/zZ ZtNdY7enPvVYcJ+oggpHSHR1ek+MqcJ0BwRPLKSPeUlc0XvJlqNcRq/eHWu0BAw7+Dv9 yNIWhcTetwHfSWjbR3KD1cZbcjGtwvrJS7JEWoNaPqC7ExMZaZFIKqDfbx4dezhH0sI0 0XgQ== X-Gm-Message-State: AOAM533OjwElxxWyybVk9FVeOzEDjw2gZMFlQcyPYVH9FJl8wGvni7VD a2hw8hqxe8BcnMibPRcPaJY= X-Received: by 2002:a17:906:3b84:: with SMTP id u4mr364282ejf.689.1643230802265; Wed, 26 Jan 2022 13:00:02 -0800 (PST) Received: from skbuf ([188.27.184.105]) by smtp.gmail.com with ESMTPSA id o14sm7872487eju.118.2022.01.26.13.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 13:00:01 -0800 (PST) Date: Wed, 26 Jan 2022 23:00:00 +0200 From: Vladimir Oltean To: Florian Fainelli Cc: Ansuel Smith , Andrew Lunn , Vivien Didelot , "David S. Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Vladimir Oltean Subject: Re: [RFC PATCH v7 01/16] net: dsa: provide switch operations for tracking the master state Message-ID: <20220126210000.qx5hxwgogjwllem7@skbuf> References: <20220123013337.20945-1-ansuelsmth@gmail.com> <20220123013337.20945-2-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 07:22:51PM -0800, Florian Fainelli wrote: > > > On 1/22/2022 5:33 PM, Ansuel Smith wrote: > > From: Vladimir Oltean > > > > Certain drivers may need to send management traffic to the switch for > > things like register access, FDB dump, etc, to accelerate what their > > slow bus (SPI, I2C, MDIO) can already do. > > > > Ethernet is faster (especially in bulk transactions) but is also more > > unreliable, since the user may decide to bring the DSA master down (or > > not bring it up), therefore severing the link between the host and the > > attached switch. > > > > Drivers needing Ethernet-based register access already should have > > fallback logic to the slow bus if the Ethernet method fails, but that > > fallback may be based on a timeout, and the I/O to the switch may slow > > down to a halt if the master is down, because every Ethernet packet will > > have to time out. The driver also doesn't have the option to turn off > > Ethernet-based I/O momentarily, because it wouldn't know when to turn it > > back on. > > > > Which is where this change comes in. By tracking NETDEV_CHANGE, > > NETDEV_UP and NETDEV_GOING_DOWN events on the DSA master, we should know > > the exact interval of time during which this interface is reliably > > available for traffic. Provide this information to switches so they can > > use it as they wish. > > > > An helper is added dsa_port_master_is_operational() to check if a master > > port is operational. "The DSA master is able to pass traffic when it was brought administratively up and is also operationally up. We introduce a helper function named dsa_port_master_is_operational() which checks for the proper conditions on a CPU port's DSA master." > > > > Signed-off-by: Vladimir Oltean > > Signed-off-by: Ansuel Smith > > Reviewed-by: Florian Fainelli > -- > Florian