Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1ABCC433F5 for ; Thu, 28 Oct 2021 18:45:36 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6E4F660D43 for ; Thu, 28 Oct 2021 18:45:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6E4F660D43 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 30D9383580; Thu, 28 Oct 2021 20:45:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="N8fJJ/ye"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D57208356D; Thu, 28 Oct 2021 20:45:31 +0200 (CEST) Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 53DE880234 for ; Thu, 28 Oct 2021 20:45:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rfried.dev@gmail.com Received: by mail-ot1-x331.google.com with SMTP id o10-20020a9d718a000000b00554a0fe7ba0so4060507otj.11 for ; Thu, 28 Oct 2021 11:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cAjZ08tYvlvaRLeqJC91XCML4W/82BfgOVfo/5THuec=; b=N8fJJ/ye/u255q2N8NlhRUCeQY8V1L+K+jYuvcCc2DB5FQ79EprmUkGNhoaVZVHE7X R6JB8QOjv5IPnsyUGPEMX2FmIpwsW8T8LvkiFiSsGo2eTWFzj3h//hEVCNSUz5s3KzPS LG/Ay4ZuNuCxpVq5qzaqUMXi13M2234WLGvfvFF0TQgNMs9zLqHc8YK/Sw4ZtC9zEJVE +kHbhW+EVlnhlHYARVNZaQT4TXSouST6XEFXbuVtw2Uph8j08YwY9mN8kUKt45K/k76w I5bNfehjWnWKUVANTkr29J8hft1blaEvoIu8vk+uP1x42OBK/alD/BzC5oSKPceQaEcF 7lZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cAjZ08tYvlvaRLeqJC91XCML4W/82BfgOVfo/5THuec=; b=nSpahAEHPlL7aEvX9PtwkuNNa53mr/qnsBPUlvVoUW0T4fLnxQRQoRpGSvroaYFBLi SkK/H4JjaT33Wl+wjb07goRSPA1Neo4VpOWOzAPvt4Y4KJUm2zdgoWdjbHOjHwEWBSKt P46ZHAJ7HAj/Jodh4a0DyiVHTya1771G6EZVz8zjmVfJSyAwbbNmJEG3GArhgHLRHOK2 s/DLF2wC+/sDuH1OPDv9t91xzfjWtLva+tcpYHFjNrFX1dsL5OwD4YuvsFWocEIXxenr lnTmalG9HT9iTbNznqsRug0yli1h9U3Zs5KQPA0j3y/9KSutKlSA+uz7EMmBM2mh1SMk qcgQ== X-Gm-Message-State: AOAM532/mcL0uLJ6xDqezY6TpzHRp/IT7cqRvBSbWA9qljDF13zQkZZI 8jAYF9AfsdCa1Ht8xopHV+gAwLJPcrCN1ZY0Ytg= X-Google-Smtp-Source: ABdhPJyGHi53bQuuWf8ta/gUJypkQB6C+Cfj/RO5G5DObIYLTdDAbt1bPuZ5f0TjxoEm7Yw0VnmeGZkFKJhp7VUhnJk= X-Received: by 2002:a9d:6b84:: with SMTP id b4mr1467219otq.327.1635446726992; Thu, 28 Oct 2021 11:45:26 -0700 (PDT) MIME-Version: 1.0 References: <20210929150445.1593364-1-vladimir.oltean@nxp.com> <20210929150445.1593364-2-vladimir.oltean@nxp.com> In-Reply-To: From: Ramon Fried Date: Thu, 28 Oct 2021 21:45:16 +0300 Message-ID: Subject: Re: [PATCH v2 01/10] net: tsec: add support for promiscuous mode To: Vladimir Oltean Cc: U-Boot Mailing List , Joe Hershberger , Priyanka Jain , Bin Meng , Michael Walle Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Sat, Oct 16, 2021 at 9:30 PM Ramon Fried wrote: > > On Wed, Sep 29, 2021 at 6:05 PM Vladimir Oltean wrote: > > > > The Freescale TSEC can be a DSA master, and the ports of the attached > > DSA switch can have different MAC addresses compared to the TSEC. > > Nonetheless, the TSEC must receive the packets on behalf of those switch > > ports. Therefore, implement the promiscuous mode method to allow DSA to > > set this. > > > > Note that the init_registers() function called from eth_ops :: start > > overwrites this setting. There is no reason why the RCTRL register > > should be zero-initialized, so just stop clearing it so that the setting > > we applied in eth_ops :: set_promisc sticks. > > > > Signed-off-by: Vladimir Oltean > > Reviewed-by: Ramon Fried > > Reviewed-by: Bin Meng > > --- > > v1->v2: none > > > > drivers/net/tsec.c | 20 ++++++++++++++++---- > > include/tsec.h | 2 ++ > > 2 files changed, 18 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c > > index 0ce97656715f..4354753cab9c 100644 > > --- a/drivers/net/tsec.c > > +++ b/drivers/net/tsec.c > > @@ -156,6 +156,19 @@ static int tsec_mcast_addr(struct udevice *dev, const u8 *mcast_mac, int join) > > return 0; > > } > > > > +static int tsec_set_promisc(struct udevice *dev, bool enable) > > +{ > > + struct tsec_private *priv = dev_get_priv(dev); > > + struct tsec __iomem *regs = priv->regs; > > + > > + if (enable) > > + setbits_be32(®s->rctrl, RCTRL_PROM); > > + else > > + clrbits_be32(®s->rctrl, RCTRL_PROM); > > + > > + return 0; > > +} > > + > > /* > > * Initialized required registers to appropriate values, zeroing > > * those we don't care about (unless zero is bad, in which case, > > @@ -186,8 +199,6 @@ static void init_registers(struct tsec __iomem *regs) > > out_be32(®s->hash.gaddr6, 0); > > out_be32(®s->hash.gaddr7, 0); > > > > - out_be32(®s->rctrl, 0x00000000); > > - > > /* Init RMON mib registers */ > > memset((void *)®s->rmon, 0, sizeof(regs->rmon)); > > > > @@ -454,7 +465,7 @@ void redundant_init(struct tsec_private *priv) > > 0x71, 0x72}; > > > > /* Enable promiscuous mode */ > > - setbits_be32(®s->rctrl, 0x8); > > + setbits_be32(®s->rctrl, RCTRL_PROM); > > /* Enable loopback mode */ > > setbits_be32(®s->maccfg1, MACCFG1_LOOPBACK); > > /* Enable transmit and receive */ > > @@ -506,7 +517,7 @@ void redundant_init(struct tsec_private *priv) > > if (fail) > > panic("eTSEC init fail!\n"); > > /* Disable promiscuous mode */ > > - clrbits_be32(®s->rctrl, 0x8); > > + clrbits_be32(®s->rctrl, RCTRL_PROM); > > /* Disable loopback mode */ > > clrbits_be32(®s->maccfg1, MACCFG1_LOOPBACK); > > } > > @@ -932,6 +943,7 @@ static const struct eth_ops tsec_ops = { > > .free_pkt = tsec_free_pkt, > > .stop = tsec_halt, > > .mcast = tsec_mcast_addr, > > + .set_promisc = tsec_set_promisc, > > }; > > > > static struct tsec_data etsec2_data = { > > diff --git a/include/tsec.h b/include/tsec.h > > index 5433cfd96610..044ee35a91bd 100644 > > --- a/include/tsec.h > > +++ b/include/tsec.h > > @@ -122,6 +122,8 @@ > > #define ECNTRL_REDUCED_MII_MODE 0x00000004 > > #define ECNTRL_SGMII_MODE 0x00000002 > > > > +#define RCTRL_PROM 0x00000008 > > + > > #ifndef CONFIG_SYS_TBIPA_VALUE > > # define CONFIG_SYS_TBIPA_VALUE 0x1f > > #endif > > -- > > 2.25.1 > > > Reviewed-by: Ramon Fried Series applied to u-boot-net/next Thanks, Ramon.