All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: "Rafał Miłecki" <zajec5@gmail.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Vivien Didelot" <vivien.didelot@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>,
	netdev@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com,
	"Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH net-next 0/4] net: dsa: b53: Clean up CPU/IMP ports
Date: Fri, 17 Sep 2021 14:21:16 +0200	[thread overview]
Message-ID: <YUSIPMBSAT93oZKo@lunn.ch> (raw)
In-Reply-To: <20210917100051.254mzlfxwvaromcn@skbuf>

> > That DSA_PORT_TYPE_UNUSED would probably require investigating DSA & b53
> > behaviour *and* discussing it with DSA maintainer to make sure we don't
> > abuse that.
> 
> How absent are these ports in hardware? For DSA_PORT_TYPE_UNUSED we do
> register a devlink port, but if those ports are really not present in
> hardware, I'm thinking maybe the easiest way would be to supply a
> ds->disabled_port_mask before dsa_register_switch(), and DSA will simply
> skip those ports when allocating the dp, the devlink_port etc. So you
> will literally have nothing for them.

The basic idea seems O.K, we just need to be careful.

We have code like:

static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p)
{
	return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_DSA;
}

static inline bool dsa_is_user_port(struct dsa_switch *ds, int p)
{
	return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_USER;
}

dsa_to_port(ds, p) will return NULL, and then bad things will happen.

Maybe it would be safer to add DSA_PORT_TYPE_PHANTOM and do allocate
the dp?

    Andrew

  reply	other threads:[~2021-09-17 12:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 12:03 [PATCH net-next 0/4] net: dsa: b53: Clean up CPU/IMP ports Rafał Miłecki
2021-09-16 12:03 ` [PATCH net-next 1/4] net: dsa: b53: Include all ports in "enabled_ports" Rafał Miłecki
2021-09-16 21:44   ` Florian Fainelli
2021-09-16 12:03 ` [PATCH net-next 2/4] net: dsa: b53: Drop BCM5301x workaround for a wrong CPU/IMP port Rafał Miłecki
2021-09-16 21:44   ` Florian Fainelli
2021-09-16 12:03 ` [PATCH net-next 3/4] net: dsa: b53: Improve flow control setup on BCM5301x Rafał Miłecki
2021-09-16 21:44   ` Florian Fainelli
2021-09-16 12:03 ` [PATCH net-next 4/4] net: dsa: b53: Drop unused "cpu_port" field Rafał Miłecki
2021-09-16 21:44   ` Florian Fainelli
2021-09-16 16:23 ` [PATCH net-next 0/4] net: dsa: b53: Clean up CPU/IMP ports Florian Fainelli
2021-09-16 21:46   ` Florian Fainelli
2021-09-16 22:19     ` Rafał Miłecki
2021-09-17 10:00       ` Vladimir Oltean
2021-09-17 12:21         ` Andrew Lunn [this message]
2021-09-17 12:31           ` Vladimir Oltean
2021-09-17 16:39         ` Florian Fainelli
2021-09-17  2:58 ` Jakub Kicinski

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=YUSIPMBSAT93oZKo@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=rafal@milecki.pl \
    --cc=vivien.didelot@gmail.com \
    --cc=zajec5@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.