<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/dsa/slave.c, branch linux-5.17.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.17.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.17.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-01-06T11:59:09Z</updated>
<entry>
<title>net: dsa: merge rtnl_lock sections in dsa_slave_create</title>
<updated>2022-01-06T11:59:09Z</updated>
<author>
<name>Vladimir Oltean</name>
</author>
<published>2022-01-05T23:11:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e31dbd3b6aba585231cd84a87adeb22e7c6a8c19'/>
<id>urn:sha1:e31dbd3b6aba585231cd84a87adeb22e7c6a8c19</id>
<content type='text'>
Currently dsa_slave_create() has two sequences of rtnl_lock/rtnl_unlock
in a row. Remove the rtnl_unlock() and rtnl_lock() in between, such that
the operation can execute slighly faster.

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Florian Fainelli &lt;f.fainelli@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: dsa: reorder PHY initialization with MTU setup in slave.c</title>
<updated>2022-01-06T11:59:09Z</updated>
<author>
<name>Vladimir Oltean</name>
</author>
<published>2022-01-05T23:11:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=904e112ad431492b34f235f59738e8312802bbf9'/>
<id>urn:sha1:904e112ad431492b34f235f59738e8312802bbf9</id>
<content type='text'>
In dsa_slave_create() there are 2 sections that take rtnl_lock():
MTU change and netdev registration. They are separated by PHY
initialization.

There isn't any strict ordering requirement except for the fact that
netdev registration should be last. Therefore, we can perform the MTU
change a bit later, after the PHY setup. A future change will then be
able to merge the two rtnl_lock sections into one.

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Florian Fainelli &lt;f.fainelli@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: dsa: keep the bridge_dev and bridge_num as part of the same structure</title>
<updated>2021-12-08T22:31:16Z</updated>
<author>
<name>Vladimir Oltean</name>
</author>
<published>2021-12-06T16:57:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d3eed0e57d5d1bcbf1bd60f83a4adfe7d7b8dd9c'/>
<id>urn:sha1:d3eed0e57d5d1bcbf1bd60f83a4adfe7d7b8dd9c</id>
<content type='text'>
The main desire behind this is to provide coherent bridge information to
the fast path without locking.

For example, right now we set dp-&gt;bridge_dev and dp-&gt;bridge_num from
separate code paths, it is theoretically possible for a packet
transmission to read these two port properties consecutively and find a
bridge number which does not correspond with the bridge device.

Another desire is to start passing more complex bridge information to
dsa_switch_ops functions. For example, with FDB isolation, it is
expected that drivers will need to be passed the bridge which requested
an FDB/MDB entry to be offloaded, and along with that bridge_dev, the
associated bridge_num should be passed too, in case the driver might
want to implement an isolation scheme based on that number.

We already pass the {bridge_dev, bridge_num} pair to the TX forwarding
offload switch API, however we'd like to remove that and squash it into
the basic bridge join/leave API. So that means we need to pass this
pair to the bridge join/leave API.

During dsa_port_bridge_leave, first we unset dp-&gt;bridge_dev, then we
call the driver's .port_bridge_leave with what used to be our
dp-&gt;bridge_dev, but provided as an argument.

When bridge_dev and bridge_num get folded into a single structure, we
need to preserve this behavior in dsa_port_bridge_leave: we need a copy
of what used to be in dp-&gt;bridge.

Switch drivers check bridge membership by comparing dp-&gt;bridge_dev with
the provided bridge_dev, but now, if we provide the struct dsa_bridge as
a pointer, they cannot keep comparing dp-&gt;bridge to the provided
pointer, since this only points to an on-stack copy. To make this
obvious and prevent driver writers from forgetting and doing stupid
things, in this new API, the struct dsa_bridge is provided as a full
structure (not very large, contains an int and a pointer) instead of a
pointer. An explicit comparison function needs to be used to determine
bridge membership: dsa_port_offloads_bridge().

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Alvin Šipraga &lt;alsi@bang-olufsen.dk&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: dsa: rename dsa_port_offloads_bridge to dsa_port_offloads_bridge_dev</title>
<updated>2021-12-08T22:31:15Z</updated>
<author>
<name>Vladimir Oltean</name>
</author>
<published>2021-12-06T16:57:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=936db8a2dba26c7f1c90a71be65c126cf1c9f52a'/>
<id>urn:sha1:936db8a2dba26c7f1c90a71be65c126cf1c9f52a</id>
<content type='text'>
Currently the majority of dsa_port_bridge_dev_get() calls in drivers is
just to check whether a port is under the bridge device provided as
argument by the DSA API.

We'd like to change that DSA API so that a more complex structure is
provided as argument. To keep things more generic, and considering that
the new complex structure will be provided by value and not by
reference, direct comparisons between dp-&gt;bridge and the provided bridge
will be broken. The generic way to do the checking would simply be to
do something like dsa_port_offloads_bridge(dp, &amp;bridge).

But there's a problem, we already have a function named that way, which
actually takes a bridge_dev net_device as argument. Rename it so that we
can use dsa_port_offloads_bridge for something else.

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Alvin Šipraga &lt;alsi@bang-olufsen.dk&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: dsa: hide dp-&gt;bridge_dev and dp-&gt;bridge_num in the core behind helpers</title>
<updated>2021-12-08T22:31:15Z</updated>
<author>
<name>Vladimir Oltean</name>
</author>
<published>2021-12-06T16:57:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=36cbf39b56908bb2e7e8e392e5f08895c3ca4326'/>
<id>urn:sha1:36cbf39b56908bb2e7e8e392e5f08895c3ca4326</id>
<content type='text'>
The location of the bridge device pointer and number is going to change.
It is not going to be kept individually per port, but in a common
structure allocated dynamically and which will have lockdep validation.

Create helpers to access these elements so that we have a migration path
to the new organization.

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: dsa: consolidate phylink creation</title>
<updated>2021-12-02T02:58:00Z</updated>
<author>
<name>Russell King (Oracle)</name>
</author>
<published>2021-11-30T13:09:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=21bd64bd717dedac96f53b668144cbe37d3c12d4'/>
<id>urn:sha1:21bd64bd717dedac96f53b668144cbe37d3c12d4</id>
<content type='text'>
The code in port.c and slave.c creating the phylink instance is very
similar - let's consolidate this into a single function.

Signed-off-by: Russell King (Oracle) &lt;rmk+kernel@armlinux.org.uk&gt;
Reviewed-by: Marek Behún &lt;kabel@kernel.org&gt;
Reviewed-by: Andrew Lunn &lt;andrew@lunn.ch&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: dsa: populate supported_interfaces member</title>
<updated>2021-11-01T13:06:32Z</updated>
<author>
<name>Marek Behún</name>
</author>
<published>2021-10-28T17:00:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c07c6e8eb4b38bae921f9e2f108d1e7f8e14226e'/>
<id>urn:sha1:c07c6e8eb4b38bae921f9e2f108d1e7f8e14226e</id>
<content type='text'>
Add a new DSA switch operation, phylink_get_interfaces, which should
fill in which PHY_INTERFACE_MODE_* are supported by given port.

Use this before phylink_create() to fill phylinks supported_interfaces
member, allowing phylink to determine which PHY_INTERFACE_MODEs are
supported.

Signed-off-by: Marek Behún &lt;kabel@kernel.org&gt;
[tweaked patch and description to add more complete support -- rmk]
Signed-off-by: Russell King &lt;rmk+kernel@armlinux.org.uk&gt;
Signed-off-by: Russell King (Oracle) &lt;rmk+kernel@armlinux.org.uk&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: switchdev: merge switchdev_handle_fdb_{add,del}_to_device</title>
<updated>2021-10-27T13:54:02Z</updated>
<author>
<name>Vladimir Oltean</name>
</author>
<published>2021-10-26T14:27:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=716a30a97a52aa78afd70db48d522855f624e7e0'/>
<id>urn:sha1:716a30a97a52aa78afd70db48d522855f624e7e0</id>
<content type='text'>
To reduce code churn, the same patch makes multiple changes, since they
all touch the same lines:

1. The implementations for these two are identical, just with different
   function pointers. Reduce duplications and name the function pointers
   "mod_cb" instead of "add_cb" and "del_cb". Pass the event as argument.

2. Drop the "const" attribute from "orig_dev". If the driver needs to
   check whether orig_dev belongs to itself and then
   call_switchdev_notifiers(orig_dev, SWITCHDEV_FDB_OFFLOADED), it
   can't, because call_switchdev_notifiers takes a non-const struct
   net_device *.

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@nvidia.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: dsa: stop calling dev_hold in dsa_slave_fdb_event</title>
<updated>2021-10-26T14:07:35Z</updated>
<author>
<name>Vladimir Oltean</name>
</author>
<published>2021-10-26T09:25:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=425d19cedef8f5ad5cff07ac545d51feec29733c'/>
<id>urn:sha1:425d19cedef8f5ad5cff07ac545d51feec29733c</id>
<content type='text'>
Now that we guarantee that SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE events have
finished executing by the time we leave our bridge upper interface,
we've established a stronger boundary condition for how long the
dsa_slave_switchdev_event_work() might run.

As such, it is no longer possible for DSA slave interfaces to become
unregistered, since they are still bridge ports.

So delete the unnecessary dev_hold() and dev_put().

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: dsa: drop rtnl_lock from dsa_slave_switchdev_event_work</title>
<updated>2021-10-25T11:59:42Z</updated>
<author>
<name>Vladimir Oltean</name>
</author>
<published>2021-10-24T17:17:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0faf890fc519a10573472ae6b5c244156cf0bff3'/>
<id>urn:sha1:0faf890fc519a10573472ae6b5c244156cf0bff3</id>
<content type='text'>
After talking with Ido Schimmel, it became clear that rtnl_lock is not
actually required for anything that is done inside the
SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE deferred work handlers.

The reason why it was probably added by Arkadi Sharshevsky in commit
c9eb3e0f8701 ("net: dsa: Add support for learning FDB through
notification") was to offer the same locking/serialization guarantees as
.ndo_fdb_{add,del} and avoid reworking any drivers.

DSA has implemented .ndo_fdb_add and .ndo_fdb_del until commit
b117e1e8a86d ("net: dsa: delete dsa_legacy_fdb_add and
dsa_legacy_fdb_del") - that is to say, until fairly recently.

But those methods have been deleted, so now we are free to drop the
rtnl_lock as well.

Note that exposing DSA switch drivers to an unlocked method which was
previously serialized by the rtnl_mutex is a potentially dangerous
affair. Driver writers couldn't ensure that their internal locking
scheme does the right thing even if they wanted.

We could err on the side of paranoia and introduce a switch-wide lock
inside the DSA framework, but that seems way overreaching. Instead, we
could check as many drivers for regressions as we can, fix those first,
then let this change go in once it is assumed to be fairly safe.

Signed-off-by: Vladimir Oltean &lt;vladimir.oltean@nxp.com&gt;
Reviewed-by: Florian Fainelli &lt;f.fainelli@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
