<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/net/dsa-uclass.c, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<entry>
<title>net: dsa: Fix OF fallback lookup for ports</title>
<updated>2023-06-14T10:38:25+00:00</updated>
<author>
<name>Marcus Comstedt</name>
<email>marcus.comstedt@requtech.se</email>
</author>
<published>2023-05-15T15:44:23+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=e533228d9ec4713c26f5e9900d27fd65847ed44b'/>
<id>e533228d9ec4713c26f5e9900d27fd65847ed44b</id>
<content type='text'>
The variable 'node' was already invalid, so using it for further
lookup will not work.

Signed-off-by: Marcus Comstedt &lt;marcus.comstedt@requtech.se&gt;
Reviewed-by: Claudiu Manoil &lt;claudiu.manoil@nxp.com&gt;
Signed-off-by: Peng Fan &lt;peng.fan@nxp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The variable 'node' was already invalid, so using it for further
lookup will not work.

Signed-off-by: Marcus Comstedt &lt;marcus.comstedt@requtech.se&gt;
Reviewed-by: Claudiu Manoil &lt;claudiu.manoil@nxp.com&gt;
Signed-off-by: Peng Fan &lt;peng.fan@nxp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: dsa: allow rcv() and xmit() to be optional</title>
<updated>2023-02-02T19:22:08+00:00</updated>
<author>
<name>Tim Harvey</name>
<email>tharvey@gateworks.com</email>
</author>
<published>2022-11-30T17:42:47+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=54d11e2019b73758070632d695cf47f3d5fbf108'/>
<id>54d11e2019b73758070632d695cf47f3d5fbf108</id>
<content type='text'>
Allow rcv() and xmit() dsa driver ops to be optional in case a driver
does not care to mangle a packet as in U-Boot only one network port is
enabled at a time and thus no packet mangling is necessary.

Suggested-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Signed-off-by: Tim Harvey &lt;tharvey@gateworks.com&gt;
Reviewed-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@denx.de&gt;
Signed-off-by: Tim Harvey &lt;tharvey@gateworks.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Allow rcv() and xmit() dsa driver ops to be optional in case a driver
does not care to mangle a packet as in U-Boot only one network port is
enabled at a time and thus no packet mangling is necessary.

Suggested-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Signed-off-by: Tim Harvey &lt;tharvey@gateworks.com&gt;
Reviewed-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@denx.de&gt;
Signed-off-by: Tim Harvey &lt;tharvey@gateworks.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: dsa: ensure dsa driver has proper ops</title>
<updated>2023-02-02T19:22:08+00:00</updated>
<author>
<name>Tim Harvey</name>
<email>tharvey@gateworks.com</email>
</author>
<published>2022-11-30T17:42:46+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=43c2a00a14a7e4567b156a2345870d008485da3c'/>
<id>43c2a00a14a7e4567b156a2345870d008485da3c</id>
<content type='text'>
Add a function to sanity check a dsa driver having proper ops.

Suggested-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Signed-off-by: Tim Harvey &lt;tharvey@gateworks.com&gt;
Reviewed-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@denx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a function to sanity check a dsa driver having proper ops.

Suggested-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Signed-off-by: Tim Harvey &lt;tharvey@gateworks.com&gt;
Reviewed-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@denx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: dsa: move cpu port probe to dsa_post_probe</title>
<updated>2023-02-02T19:22:08+00:00</updated>
<author>
<name>Tim Harvey</name>
<email>tharvey@gateworks.com</email>
</author>
<published>2022-11-30T17:42:45+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=c5868fcd25c670f5c4e37afca2c5eaddadd218b4'/>
<id>c5868fcd25c670f5c4e37afca2c5eaddadd218b4</id>
<content type='text'>
In order to ensure that a DSA driver probe gets called before
dsa_ops-&gt;port_probe move the port_probe of the cpu_port to
a post-probe function.

Signed-off-by: Tim Harvey &lt;tharvey@gateworks.com&gt;
Reviewed-by: Ramon Fried &lt;rfried.dev@gmail.com&gt;
Reviewed-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@denx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to ensure that a DSA driver probe gets called before
dsa_ops-&gt;port_probe move the port_probe of the cpu_port to
a post-probe function.

Signed-off-by: Tim Harvey &lt;tharvey@gateworks.com&gt;
Reviewed-by: Ramon Fried &lt;rfried.dev@gmail.com&gt;
Reviewed-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Fabio Estevam &lt;festevam@denx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: core: Drop ofnode_is_available()</title>
<updated>2022-09-29T20:11:31+00:00</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2022-09-07T02:27:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=8909066199281b86bf4ee7673ec6d7983dd12a26'/>
<id>8909066199281b86bf4ee7673ec6d7983dd12a26</id>
<content type='text'>
This function is also available as ofnode_is_enabled(), so use that
instead.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This function is also available as ofnode_is_enabled(), so use that
instead.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: dsa: Fix segmentation fault if master fails to probe</title>
<updated>2022-06-08T17:59:53+00:00</updated>
<author>
<name>Sean Anderson</name>
<email>sean.anderson@seco.com</email>
</author>
<published>2022-05-05T17:11:36+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=2a5af4049ccef538095bff67ce9770711db5ed58'/>
<id>2a5af4049ccef538095bff67ce9770711db5ed58</id>
<content type='text'>
If the DSA master fails to probe for whatever reason, then DSA devices
will continue on as if nothing is wrong. This can cause incorrect
behavior. In particular, on sandbox, dsa_sandbox_probe attempts to
access the master's private data. This is only safe to do if the master
has been probed first. Fix this by probing the master after we look it
up, and bailing out if we get an error.

Fixes: fc054d563b ("net: Introduce DSA class for Ethernet switches")
Signed-off-by: Sean Anderson &lt;sean.anderson@seco.com&gt;
Reviewed-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the DSA master fails to probe for whatever reason, then DSA devices
will continue on as if nothing is wrong. This can cause incorrect
behavior. In particular, on sandbox, dsa_sandbox_probe attempts to
access the master's private data. This is only safe to do if the master
has been probed first. Fix this by probing the master after we look it
up, and bailing out if we get an error.

Fixes: fc054d563b ("net: Introduce DSA class for Ethernet switches")
Signed-off-by: Sean Anderson &lt;sean.anderson@seco.com&gt;
Reviewed-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: dsa: fix phydev-&gt;speed being uninitialized for the CPU port fixed PHY</title>
<updated>2022-01-15T16:49:03+00:00</updated>
<author>
<name>Vladimir Oltean</name>
<email>vladimir.oltean@nxp.com</email>
</author>
<published>2021-12-04T23:00:34+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=0fa4448d5191f9397e5acbd6c83073523cc6c4bd'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: dsa: Use true instead of 1 in the set_promisc() call</title>
<updated>2021-11-23T07:57:56+00:00</updated>
<author>
<name>Bin Meng</name>
<email>bmeng.cn@gmail.com</email>
</author>
<published>2021-11-01T06:15:10+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=c7ae46efdcf42317e3e57d0f14e844c551691ab9'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: dsa: allow drivers to get the port OF node</title>
<updated>2021-11-23T07:57:55+00:00</updated>
<author>
<name>Vladimir Oltean</name>
<email>vladimir.oltean@nxp.com</email>
</author>
<published>2021-09-29T15:04:38+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=0783b16509a1e6d9821084ec64f5be1cc091c7f9'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: dsa: ensure port names are NULL-terminated after DSA_PORT_NAME_LENGTH truncation</title>
<updated>2021-09-28T15:50:57+00:00</updated>
<author>
<name>Vladimir Oltean</name>
<email>vladimir.oltean@nxp.com</email>
</author>
<published>2021-09-27T11:22:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=4fdc7e3530eb49dfe0aca79746b1cda30e94c591'/>
<id>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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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;
</pre>
</div>
</content>
</entry>
</feed>
