From mboxrd@z Thu Jan 1 00:00:00 1970 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 E5FF0C433F5 for ; Sat, 30 Oct 2021 07:45:59 +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 1738960FC0 for ; Sat, 30 Oct 2021 07:45:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1738960FC0 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 6DC0282DF6; Sat, 30 Oct 2021 09:45:56 +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="RS6kk02t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7DB29831B2; Sat, 30 Oct 2021 09:45:54 +0200 (CEST) Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) (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 AB71982D95 for ; Sat, 30 Oct 2021 09:45:50 +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-x334.google.com with SMTP id w12-20020a056830410c00b0054e7ceecd88so17046075ott.2 for ; Sat, 30 Oct 2021 00:45:50 -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=qGfYUZL+9l3GnDkOqhaL49Kq5OI/a8XTFN7YzJkpu/8=; b=RS6kk02tzoiAifzn43jQRQnxcI6HRniqbJAuS1K2PiDJHz6G6l5+CPwU/r4j6ubt4p oFqk/sVd/i7342b3ykQ5iO8JUY8nusv+YABy0fcKU3KwOUj731m5O4pIUqUQVzbJlWwi MOJ1AruNQAOdfEM5u8sKN/IGlgBaoFYMwGvYFkfmalPDNUsr/YCfYjYAWl/ru0tkpjS2 3U1XF+3Wca2xnAbfxHZthP7DTW9MkhOl/AnyGajb8afly9wFZlR2MA5p81W0Bdhhg0xH 4AEm92RlMyi+FfxIrcfnsjR0MSgRv+FoqY/+F0JjfjCWRX915xgpVCMKGpxokP3HMrd6 vkRA== 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=qGfYUZL+9l3GnDkOqhaL49Kq5OI/a8XTFN7YzJkpu/8=; b=HLoLdVfLRJ+YzXNlt/l9QOZRxvUhDpn/H4BMEOEnBwaIsYFr5olA9ZPP0Kq5qmi+xW FN5zl/bgQF1v7qbbkGMxnfNbGYil0Eo78SVmlJM2nst8VqmpzAksbEA2SI3yYQli2OEf QK5plnEwBalJ5fyJC8SLgRR6FbUXCQpmAMBkNmo9pdJ4WWq0d2YmwSQsI25wnrAgfWa3 mYDVAHmK/o9wG3XjXn9OXOdwFpgwZ5AAT7GB9u/7ypVdDcxBYgtMO9Ujv2qA4XvXtCZ+ c9JVLjgqqjT0Y7DaHlPEE+nVjhFOQT5E50nu1vFZdHLPyGETdNPSbJou+82EQ3i7xMaF Ya6Q== X-Gm-Message-State: AOAM532iEeNFKidjG2WTcf+KFx8G2FEjkyNy/OTmKQ1DT1FLcElkvfjt wdL4GS5HaPL8sUtcilUNqhOBxveqMK5f1eO5J/0= X-Google-Smtp-Source: ABdhPJwncok/uJuBOYVsd/0+huXzF3o+rVeLfEUKb76CE+Vu1xr387aZvL99Cwa40pYbjTYR/+jkuOY8e6DHFv7cPKw= X-Received: by 2002:a9d:6b84:: with SMTP id b4mr8736608otq.327.1635579949461; Sat, 30 Oct 2021 00:45:49 -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: Sat, 30 Oct 2021 10:45:38 +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 Thu, Oct 28, 2021 at 9:45 PM Ramon Fried wrote: > > 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. CI Build for 32bit ARM targets failed for this patch: drivers/net/tsec.c:159:12: error: 'tsec_set_promisc' defined but not used [-Werror=unused-function] 159 | static int tsec_set_promisc(struct udevice *dev, bool enable) | ^~~~~~~~~~~~~~~~