<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/net/dsa-uclass.c, branch v2022.04-rc2</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/u-boot.git/atom/net/dsa-uclass.c?h=v2022.04-rc2</id>
<link rel='self' href='http://cgit.235523.xyz/u-boot.git/atom/net/dsa-uclass.c?h=v2022.04-rc2'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<updated>2022-01-15T16:49:03Z</updated>
<entry>
<title>net: dsa: fix phydev-&gt;speed being uninitialized for the CPU port fixed PHY</title>
<updated>2022-01-15T16:49:03Z</updated>
<author>
<name>Vladimir Oltean</name>
<email>vladimir.oltean@nxp.com</email>
</author>
<published>2021-12-04T23:00:34Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=0fa4448d5191f9397e5acbd6c83073523cc6c4bd'/>
<id>urn:sha1:0fa4448d5191f9397e5acbd6c83073523cc6c4bd</id>
<content type='text'>
If the DSA API is going to allow drivers to do things such as:

- phy_config in dsa_ops :: port_probe
- phy_startup in dsa_ops :: port_enable

then it would actually be good if the -&gt;port_probe() method would
actually be called in all cases before the -&gt;port_enable() is.

Currently this is true for user ports, but not true for the CPU port,
because the CPU port does not have a udevice registered for it (this is
all part of DSA's design). So the current issue is that after
phy_startup has finished for the CPU port, its phydev-&gt;speed is an
uninitialized value, because phy_config() was never called for the
priv-&gt;cpu_port_fixed_phy, and it is precisely phy_config() who copies
the speed into the phydev in the case of the fixed PHY driver.

So we need to simulate a probing event for the CPU port by manually
calling the driver's -&gt;port_probe() method for the CPU port.

Fixes: 8a2982574854 ("net: dsa: introduce a .port_probe() method in struct dsa_ops")
Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Ramon Fried &lt;rfried.dev@gmail.com&gt;
</content>
</entry>
<entry>
<title>net: dsa: Use true instead of 1 in the set_promisc() call</title>
<updated>2021-11-23T07:57:56Z</updated>
<author>
<name>Bin Meng</name>
<email>bmeng.cn@gmail.com</email>
</author>
<published>2021-11-01T06:15:10Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=c7ae46efdcf42317e3e57d0f14e844c551691ab9'/>
<id>urn:sha1:c7ae46efdcf42317e3e57d0f14e844c551691ab9</id>
<content type='text'>
set_promisc() call accepts the parameter of a bool type. Make it
clear by using true instead of 1.

Signed-off-by: Bin Meng &lt;bmeng.cn@gmail.com&gt;
Reviewed-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Ramon Fried &lt;rfried.dev@gmail.com&gt;
</content>
</entry>
<entry>
<title>net: dsa: allow drivers to get the port OF node</title>
<updated>2021-11-23T07:57:55Z</updated>
<author>
<name>Vladimir Oltean</name>
<email>vladimir.oltean@nxp.com</email>
</author>
<published>2021-09-29T15:04:38Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=0783b16509a1e6d9821084ec64f5be1cc091c7f9'/>
<id>urn:sha1:0783b16509a1e6d9821084ec64f5be1cc091c7f9</id>
<content type='text'>
In the current DSA switch driver API, only the udevice of the switch
(belonging to UCLASS_DSA) is exposed, as well as an "int port" argument.
So drivers do not have access to the udevice of individual ports
(belonging to UCLASS_ETH), one of the reasons being that not all ports
have an associated UCLASS_ETH udevice.

However, all DSA ports have an OF node, and in some cases the driver
needs a handle to it, for all ports including the CPU port. Example: the
following Linux per-port device tree property:

	managed = "in-band-status";

states whether a port should operate with clause 37 in-band autoneg
enabled or not.

This patch exposes a function which can be called by individual drivers
as needed.

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Ramon Fried &lt;rfried.dev@gmail.com&gt;
</content>
</entry>
<entry>
<title>net: dsa: ensure port names are NULL-terminated after DSA_PORT_NAME_LENGTH truncation</title>
<updated>2021-09-28T15:50:57Z</updated>
<author>
<name>Vladimir Oltean</name>
<email>vladimir.oltean@nxp.com</email>
</author>
<published>2021-09-27T11:22:03Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=4fdc7e3530eb49dfe0aca79746b1cda30e94c591'/>
<id>urn:sha1:4fdc7e3530eb49dfe0aca79746b1cda30e94c591</id>
<content type='text'>
strncpy() simply bails out when copying a source string whose size
exceeds the destination string size, potentially leaving the destination
string unterminated.

One possible way to address is to pass DSA_PORT_NAME_LENGTH - 1 and a
previously zero-initialized destination string, but this is more
difficult to maintain.

The chosen alternative is to use strlcpy(), which properly limits the
copy len in the (srclen &gt;= size) case to "size - 1", and which is also
more efficient than the strncpy() byte-by-byte implementation by using
memcpy. The destination string returned by strlcpy() is always NULL
terminated.

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Ramon Fried &lt;rfried.dev@gmail.com&gt;
</content>
</entry>
<entry>
<title>net: dsa: remove unused variables</title>
<updated>2021-09-28T15:50:56Z</updated>
<author>
<name>Vladimir Oltean</name>
<email>vladimir.oltean@nxp.com</email>
</author>
<published>2021-09-18T11:49:56Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=5ecdf0a5a42ae3b2d04cdf0c2ad6314670839037'/>
<id>urn:sha1:5ecdf0a5a42ae3b2d04cdf0c2ad6314670839037</id>
<content type='text'>
"dev" and "dsa_pdata" are unused inside dsa_port_of_to_pdata.

"dsa_priv" is unused inside dsa_port_probe.

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Ramon Fried &lt;rfried.dev@gmail.com&gt;
</content>
</entry>
<entry>
<title>net: dsa: pass CPU port fixed PHY to .port_disable</title>
<updated>2021-09-28T15:50:56Z</updated>
<author>
<name>Vladimir Oltean</name>
<email>vladimir.oltean@nxp.com</email>
</author>
<published>2021-09-18T11:49:55Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=5cc283b781398a02c8a7c919cf4d5dbb5fa8add2'/>
<id>urn:sha1:5cc283b781398a02c8a7c919cf4d5dbb5fa8add2</id>
<content type='text'>
While adding the logic for DSA to register a fixed-link PHY for the CPU
port, I forgot to pass it to the .port_disable method too, just
.port_enable.

Bug had no impact for felix_switch.c, due to the phy argument not being
used, but ksz9477.c does use it =&gt; NULL pointer dereference.

Fixes: fc054d563bfb ("net: Introduce DSA class for Ethernet switches")
Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Ramon Fried &lt;rfried.dev@gmail.com&gt;
</content>
</entry>
<entry>
<title>net: dsa: introduce a .port_probe() method in struct dsa_ops</title>
<updated>2021-09-28T15:50:56Z</updated>
<author>
<name>Vladimir Oltean</name>
<email>vladimir.oltean@nxp.com</email>
</author>
<published>2021-08-24T12:00:41Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=4b46e8388549bd0e52ec742c7e5ed71e0edc1b9f'/>
<id>urn:sha1:4b46e8388549bd0e52ec742c7e5ed71e0edc1b9f</id>
<content type='text'>
Some drivers might want to execute code for each port at probe time, as
opposed to executing code just-in-time for the port selected for
networking.

To cater to that use case, introduce a .port_probe() callback method
into the DSA switch operations which is called for each available port,
at the end of dsa_port_probe().

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Ramon Fried &lt;rfried.dev@gmail.com&gt;
Tested-by: Michael Walle &lt;michael@walle.cc&gt;
</content>
</entry>
<entry>
<title>net: dsa: refactor the code to set the port MAC address into a dedicated function</title>
<updated>2021-09-28T15:50:55Z</updated>
<author>
<name>Vladimir Oltean</name>
<email>vladimir.oltean@nxp.com</email>
</author>
<published>2021-08-24T12:00:40Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=5eee5ab91638c4482dd59ff511feefd3b15a2472'/>
<id>urn:sha1:5eee5ab91638c4482dd59ff511feefd3b15a2472</id>
<content type='text'>
This snippet of code has a bothering "if (...) return 0" in it which
assumes it is the last piece of code running in dsa_port_probe().

This makes it difficult to add further code at the end of dsa_port_probe()
which does not depend on MAC address stuff.

So move the code to a dedicated function which returns void and let the
code flow through.

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Ramon Fried &lt;rfried.dev@gmail.com&gt;
Tested-by: Michael Walle &lt;michael@walle.cc&gt;
</content>
</entry>
<entry>
<title>net: dsa: use "err" instead of "ret" in dsa_port_probe</title>
<updated>2021-09-28T15:50:55Z</updated>
<author>
<name>Vladimir Oltean</name>
<email>vladimir.oltean@nxp.com</email>
</author>
<published>2021-08-24T12:00:39Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=f4b712b840dd5fe0b984aadfe466c1886a31e906'/>
<id>urn:sha1:f4b712b840dd5fe0b984aadfe466c1886a31e906</id>
<content type='text'>
DM DSA uses "err" for error code values, so use this consistently.

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Ramon Fried &lt;rfried.dev@gmail.com&gt;
Tested-by: Michael Walle &lt;michael@walle.cc&gt;
</content>
</entry>
<entry>
<title>net: dsa: enable master promisc mode if available and needed</title>
<updated>2021-07-10T16:12:41Z</updated>
<author>
<name>Tim Harvey</name>
<email>tharvey@gateworks.com</email>
</author>
<published>2021-06-30T23:50:07Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=431f9d72ffa76031808cb2ed9c90d1da3621c8de'/>
<id>urn:sha1:431f9d72ffa76031808cb2ed9c90d1da3621c8de</id>
<content type='text'>
If ports have their own unique MAC addrs and master has a set_promisc
function, call it so that packets will be received for ports.

Signed-off-by: Tim Harvey &lt;tharvey@gateworks.com&gt;
Reviewed-by: Ramon Fried &lt;rfried.dev@gmail.com&gt;
</content>
</entry>
</feed>
