From: Ido Schimmel <idosch@nvidia.com>
To: r-gunasekaran@ti.com
Cc: kuba@kernel.org, Nikolay Aleksandrov <razor@blackwall.org>,
Vladimir Oltean <olteanv@gmail.com>,
Ravi Gunasekaran <r-gunasekaran@ti.com>,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
bigeasy@linutronix.de, simon.horman@corigine.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
rogerq@kernel.org
Subject: Re: [PATCH v2 net-next] net: hsr: Disable promiscuous mode in offload mode
Date: Mon, 19 Jun 2023 14:14:04 +0300 [thread overview]
Message-ID: <ZJA4fIH6vm9cO2VG@shredder> (raw)
In-Reply-To: <20230615223736.0577fb11@kernel.org>
On Thu, Jun 15, 2023 at 10:37:36PM -0700, Jakub Kicinski wrote:
> On Wed, 14 Jun 2023 17:17:10 +0530 Ravi Gunasekaran wrote:
> > When port-to-port forwarding for interfaces in HSR node is enabled,
> > disable promiscuous mode since L2 frame forward happens at the
> > offloaded hardware.
It's not clear to me why you want to disable promiscuous mode. I'm not
familiar with HSR, but I assume you want the hardware to forward all the
packets between the two ports and not only specific DMACs.
How does the underlying device implement "promiscuous mode" that you
benefit from disabling it?
Thanks
> >
> > Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
> > Reviewed-by: Simon Horman <simon.horman@corigine.com>
>
> Bridge folks any thoughts on this? Is this the behavior bridge has
> and if not should we try to align the two?
>
> > Changes from v1:
> > ===============
> > * Changed the data type of "fwd_offloaded" from "unsigned int" to "bool"
> > and moved it below "net_id" struct member as per Paolo's comment.
> > * Collected Reviewed-by tag from v1 patch.
> >
> > v1: https://lore.kernel.org/all/20230612093933.13267-1-r-gunasekaran@ti.com/
> >
> > net/hsr/hsr_device.c | 5 +++++
> > net/hsr/hsr_main.h | 1 +
> > net/hsr/hsr_slave.c | 15 +++++++++++----
> > 3 files changed, 17 insertions(+), 4 deletions(-)
> >
> > diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
> > index 5a236aae2366..306f942c3b28 100644
> > --- a/net/hsr/hsr_device.c
> > +++ b/net/hsr/hsr_device.c
> > @@ -531,6 +531,11 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
> > if (res)
> > goto err_add_master;
> >
> > + /* HSR forwarding offload supported in lower device? */
> > + if ((slave[0]->features & NETIF_F_HW_HSR_FWD) &&
> > + (slave[1]->features & NETIF_F_HW_HSR_FWD))
> > + hsr->fwd_offloaded = true;
> > +
> > res = register_netdevice(hsr_dev);
> > if (res)
> > goto err_unregister;
> > diff --git a/net/hsr/hsr_main.h b/net/hsr/hsr_main.h
> > index 5584c80a5c79..6851e33df7d1 100644
> > --- a/net/hsr/hsr_main.h
> > +++ b/net/hsr/hsr_main.h
> > @@ -208,6 +208,7 @@ struct hsr_priv {
> > u8 net_id; /* for PRP, it occupies most significant 3 bits
> > * of lan_id
> > */
> > + bool fwd_offloaded; /* Forwarding offloaded to HW */
> > unsigned char sup_multicast_addr[ETH_ALEN] __aligned(sizeof(u16));
> > /* Align to u16 boundary to avoid unaligned access
> > * in ether_addr_equal
> > diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
> > index b70e6bbf6021..e5742f2a2d52 100644
> > --- a/net/hsr/hsr_slave.c
> > +++ b/net/hsr/hsr_slave.c
> > @@ -131,9 +131,14 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev,
> > struct hsr_port *master;
> > int res;
> >
> > - res = dev_set_promiscuity(dev, 1);
> > - if (res)
> > - return res;
> > + /* Don't use promiscuous mode for offload since L2 frame forward
> > + * happens at the offloaded hardware.
> > + */
> > + if (!port->hsr->fwd_offloaded) {
> > + res = dev_set_promiscuity(dev, 1);
> > + if (res)
> > + return res;
> > + }
> >
> > master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
> > hsr_dev = master->dev;
> > @@ -152,7 +157,9 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev,
> > fail_rx_handler:
> > netdev_upper_dev_unlink(dev, hsr_dev);
> > fail_upper_dev_link:
> > - dev_set_promiscuity(dev, -1);
> > + if (!port->hsr->fwd_offloaded)
> > + dev_set_promiscuity(dev, -1);
> > +
> > return res;
> > }
> >
>
next prev parent reply other threads:[~2023-06-19 11:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 11:47 [PATCH v2 net-next] net: hsr: Disable promiscuous mode in offload mode Ravi Gunasekaran
2023-06-16 5:37 ` Jakub Kicinski
2023-06-19 11:14 ` Ido Schimmel [this message]
2023-06-19 12:07 ` Ravi Gunasekaran
2023-06-27 12:19 ` Vladimir Oltean
2023-06-22 0:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZJA4fIH6vm9cO2VG@shredder \
--to=idosch@nvidia.com \
--cc=bigeasy@linutronix.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=r-gunasekaran@ti.com \
--cc=razor@blackwall.org \
--cc=rogerq@kernel.org \
--cc=simon.horman@corigine.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).