<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/net/switchdev/switchdev.c, branch v4.8.16</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.8.16</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.8.16'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2016-11-15T06:48:52Z</updated>
<entry>
<title>switchdev: Execute bridge ndos only for bridge ports</title>
<updated>2016-11-15T06:48:52Z</updated>
<author>
<name>Ido Schimmel</name>
<email>idosch@mellanox.com</email>
</author>
<published>2016-10-18T16:50:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4ac3ca8c29335a3e89f478da9e9ebd261eb3eb0f'/>
<id>urn:sha1:4ac3ca8c29335a3e89f478da9e9ebd261eb3eb0f</id>
<content type='text'>
[ Upstream commit 97c242902c209e7d46e365335db5202634484dcb ]

We recently got the following warning after setting up a vlan device on
top of an offloaded bridge and executing 'bridge link':

WARNING: CPU: 0 PID: 18566 at drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:81 mlxsw_sp_port_orig_get.part.9+0x55/0x70 [mlxsw_spectrum]
[...]
 CPU: 0 PID: 18566 Comm: bridge Not tainted 4.8.0-rc7 #1
 Hardware name: Mellanox Technologies Ltd. Mellanox switch/Mellanox switch, BIOS 4.6.5 05/21/2015
  0000000000000286 00000000e64ab94f ffff880406e6f8f0 ffffffff8135eaa3
  0000000000000000 0000000000000000 ffff880406e6f930 ffffffff8108c43b
  0000005106e6f988 ffff8803df398840 ffff880403c60108 ffff880406e6f990
 Call Trace:
  [&lt;ffffffff8135eaa3&gt;] dump_stack+0x63/0x90
  [&lt;ffffffff8108c43b&gt;] __warn+0xcb/0xf0
  [&lt;ffffffff8108c56d&gt;] warn_slowpath_null+0x1d/0x20
  [&lt;ffffffffa01420d5&gt;] mlxsw_sp_port_orig_get.part.9+0x55/0x70 [mlxsw_spectrum]
  [&lt;ffffffffa0142195&gt;] mlxsw_sp_port_attr_get+0xa5/0xb0 [mlxsw_spectrum]
  [&lt;ffffffff816f151f&gt;] switchdev_port_attr_get+0x4f/0x140
  [&lt;ffffffff816f15d0&gt;] switchdev_port_attr_get+0x100/0x140
  [&lt;ffffffff816f15d0&gt;] switchdev_port_attr_get+0x100/0x140
  [&lt;ffffffff816f1d6b&gt;] switchdev_port_bridge_getlink+0x5b/0xc0
  [&lt;ffffffff816f2680&gt;] ? switchdev_port_fdb_dump+0x90/0x90
  [&lt;ffffffff815f5427&gt;] rtnl_bridge_getlink+0xe7/0x190
  [&lt;ffffffff8161a1b2&gt;] netlink_dump+0x122/0x290
  [&lt;ffffffff8161b0df&gt;] __netlink_dump_start+0x15f/0x190
  [&lt;ffffffff815f5340&gt;] ? rtnl_bridge_dellink+0x230/0x230
  [&lt;ffffffff815fab46&gt;] rtnetlink_rcv_msg+0x1a6/0x220
  [&lt;ffffffff81208118&gt;] ? __kmalloc_node_track_caller+0x208/0x2c0
  [&lt;ffffffff815f5340&gt;] ? rtnl_bridge_dellink+0x230/0x230
  [&lt;ffffffff815fa9a0&gt;] ? rtnl_newlink+0x890/0x890
  [&lt;ffffffff8161cf54&gt;] netlink_rcv_skb+0xa4/0xc0
  [&lt;ffffffff815f56f8&gt;] rtnetlink_rcv+0x28/0x30
  [&lt;ffffffff8161c92c&gt;] netlink_unicast+0x18c/0x240
  [&lt;ffffffff8161ccdb&gt;] netlink_sendmsg+0x2fb/0x3a0
  [&lt;ffffffff815c5a48&gt;] sock_sendmsg+0x38/0x50
  [&lt;ffffffff815c6031&gt;] SYSC_sendto+0x101/0x190
  [&lt;ffffffff815c7111&gt;] ? __sys_recvmsg+0x51/0x90
  [&lt;ffffffff815c6b6e&gt;] SyS_sendto+0xe/0x10
  [&lt;ffffffff817017f2&gt;] entry_SYSCALL_64_fastpath+0x1a/0xa4

The problem is that the 8021q module propagates the call to
ndo_bridge_getlink() via switchdev ops, but the switch driver doesn't
recognize the netdev, as it's not offloaded.

While we can ignore calls being made to non-bridge ports inside the
driver, a better fix would be to push this check up to the switchdev
layer.

Note that these ndos can be called for non-bridged netdev, but this only
happens in certain PF drivers which don't call the corresponding
switchdev functions anyway.

Fixes: 99f44bb3527b ("mlxsw: spectrum: Enable L3 interfaces on top of bridge devices")
Signed-off-by: Ido Schimmel &lt;idosch@mellanox.com&gt;
Reported-by: Tamir Winetroub &lt;tamirw@mellanox.com&gt;
Tested-by: Tamir Winetroub &lt;tamirw@mellanox.com&gt;
Signed-off-by: Jiri Pirko &lt;jiri@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>net/switchdev: Export the same parent ID service function</title>
<updated>2016-07-14T20:34:29Z</updated>
<author>
<name>Or Gerlitz</name>
<email>ogerlitz@mellanox.com</email>
</author>
<published>2016-07-14T07:32:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8438884d4ab423161b974854ebb90c08219dd678'/>
<id>urn:sha1:8438884d4ab423161b974854ebb90c08219dd678</id>
<content type='text'>
This helper serves to know if two switchdev port netdevices belong to the
same HW ASIC, e.g to figure out if forwarding offload is possible between them.

Signed-off-by: Or Gerlitz &lt;ogerlitz@mellanox.com&gt;
Signed-off-by: Saeed Mahameed &lt;saeedm@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>switchdev: pass pointer to fib_info instead of copy</title>
<updated>2016-05-17T17:58:49Z</updated>
<author>
<name>Jiri Pirko</name>
<email>jiri@mellanox.com</email>
</author>
<published>2016-05-17T16:58:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=da4ed55165d41b1073f9a476f1c18493e9bf8c8e'/>
<id>urn:sha1:da4ed55165d41b1073f9a476f1c18493e9bf8c8e</id>
<content type='text'>
The problem is that fib_info-&gt;nh is [0] so the struct fib_info
allocation size depends on number of nexthops. If we just copy fib_info,
we do not copy the nexthops info and driver accesses memory which is not
ours.

Given the fact that fib4 does not defer operations and therefore it does
not need copy, just pass the pointer down to drivers as it was done
before.

Fixes: 850d0cbc91 ("switchdev: remove pointers from switchdev objects")
Signed-off-by: Jiri Pirko &lt;jiri@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>switchdev: Adding complete operation to deferred switchdev ops</title>
<updated>2016-04-24T18:23:32Z</updated>
<author>
<name>Elad Raz</name>
<email>eladr@mellanox.com</email>
</author>
<published>2016-04-21T10:52:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7ceb2afbd6aee4643056b47156baad6841db8e78'/>
<id>urn:sha1:7ceb2afbd6aee4643056b47156baad6841db8e78</id>
<content type='text'>
When using switchdev deferred operation (SWITCHDEV_F_DEFER), the operation
is executed in different context and the application doesn't have any way
to get the operation real status.

Adding a completion callback fixes that. This patch adds fields to
switchdev_attr and switchdev_obj "complete_priv" field which is used by
the "complete" callback.

Application can set a complete function which will be called once the
operation executed.

Signed-off-by: Elad Raz &lt;eladr@mellanox.com&gt;
Signed-off-by: Jiri Pirko &lt;jiri@mellanox.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@mellanox.com&gt;
Acked-by: Nikolay Aleksandrov &lt;nikolay@cumulusnetworks.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>switchdev: fix typo in comments/doc</title>
<updated>2016-03-24T18:51:24Z</updated>
<author>
<name>Nicolas Dichtel</name>
<email>nicolas.dichtel@6wind.com</email>
</author>
<published>2016-03-24T15:50:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3e347660488818070bff7533f8561928e09e1d65'/>
<id>urn:sha1:3e347660488818070bff7533f8561928e09e1d65</id>
<content type='text'>
Two minor typo.

Signed-off-by: Nicolas Dichtel &lt;nicolas.dichtel@6wind.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: ndo_fdb_dump should report -EMSGSIZE to rtnl_fdb_dump.</title>
<updated>2016-02-26T20:04:02Z</updated>
<author>
<name>MINOURA Makoto / 箕浦 真</name>
<email>minoura@valinux.co.jp</email>
</author>
<published>2016-02-25T05:20:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=472681d57a5dde7c6d16b05469be57f1c4ed9d99'/>
<id>urn:sha1:472681d57a5dde7c6d16b05469be57f1c4ed9d99</id>
<content type='text'>
When the send skbuff reaches the end, nlmsg_put and friends returns
-EMSGSIZE but it is silently thrown away in ndo_fdb_dump. It is called
within a for_each_netdev loop and the first fdb entry of a following
netdev could fit in the remaining skbuff.  This breaks the mechanism
of cb-&gt;args[0] and idx to keep track of the entries that are already
dumped, which results missing entries in bridge fdb show command.

Signed-off-by: Minoura Makoto &lt;minoura@valinux.co.jp&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>switchdev: Require RTNL mutex to be held when sending FDB notifications</title>
<updated>2016-01-29T00:21:31Z</updated>
<author>
<name>Ido Schimmel</name>
<email>idosch@mellanox.com</email>
</author>
<published>2016-01-27T14:16:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4f2c6ae5c64c353fb1b0425e4747e5603feadba1'/>
<id>urn:sha1:4f2c6ae5c64c353fb1b0425e4747e5603feadba1</id>
<content type='text'>
When switchdev drivers process FDB notifications from the underlying
device they resolve the netdev to which the entry points to and notify
the bridge using the switchdev notifier.

However, since the RTNL mutex is not held there is nothing preventing
the netdev from disappearing in the middle, which will cause
br_switchdev_event() to dereference a non-existing netdev.

Make switchdev drivers hold the lock at the beginning of the
notification processing session and release it once it ends, after
notifying the bridge.

Also, remove switchdev_mutex and fdb_lock, as they are no longer needed
when RTNL mutex is held.

Fixes: 03bf0c281234 ("switchdev: introduce switchdev notifier")
Signed-off-by: Ido Schimmel &lt;idosch@mellanox.com&gt;
Signed-off-by: Jiri Pirko &lt;jiri@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>switchdev: Adding MDB entry offload</title>
<updated>2016-01-10T21:50:20Z</updated>
<author>
<name>Elad Raz</name>
<email>eladr@mellanox.com</email>
</author>
<published>2016-01-10T20:06:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4d41e12593a9a6c4aaf113d44c8c619067b2b0aa'/>
<id>urn:sha1:4d41e12593a9a6c4aaf113d44c8c619067b2b0aa</id>
<content type='text'>
Define HW multicast entry: MAC and VID.
Using a MAC address simplifies support for both IPV4 and IPv6.

Signed-off-by: Elad Raz &lt;eladr@mellanox.com&gt;
Signed-off-by: Ido Schimmel &lt;idosch@mellanox.com&gt;
Signed-off-by: Jiri Pirko &lt;jiri@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>switchdev: Pass original device to port netdev driver</title>
<updated>2015-12-15T16:58:20Z</updated>
<author>
<name>Ido Schimmel</name>
<email>idosch@mellanox.com</email>
</author>
<published>2015-12-15T15:03:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6ff64f6f9242d7e50f3e99cb280f69d1927a5fa6'/>
<id>urn:sha1:6ff64f6f9242d7e50f3e99cb280f69d1927a5fa6</id>
<content type='text'>
switchdev drivers need to know the netdev on which the switchdev op was
invoked. For example, the STP state of a VLAN interface configured on top
of a port can change while being member in a bridge. In this case, the
underlying driver should only change the STP state of that particular
VLAN and not of all the VLANs configured on the port.

However, current switchdev infrastructure only passes the port netdev down
to the driver. Solve that by passing the original device down to the
driver as part of the required switchdev object / attribute.

This doesn't entail any change in current switchdev drivers. It simply
enables those supporting stacked devices to know the originating device
and act accordingly.

Signed-off-by: Ido Schimmel &lt;idosch@mellanox.com&gt;
Signed-off-by: Jiri Pirko &lt;jiri@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>switchdev: respect SKIP_EOPNOTSUPP flag in case there is no recursion</title>
<updated>2015-11-03T18:39:21Z</updated>
<author>
<name>Jiri Pirko</name>
<email>jiri@mellanox.com</email>
</author>
<published>2015-11-03T16:40:53Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0c63d80c3fac4e6eb0f01dff756e47bc7cd50092'/>
<id>urn:sha1:0c63d80c3fac4e6eb0f01dff756e47bc7cd50092</id>
<content type='text'>
Caller passing down the SKIP_EOPNOTSUPP switchdev flag expects that
-EOPNOTSUPP cannot be returned. But in case of direct op call without
recurtion, this may happen. So fix this by checking it always on the
end of __switchdev_port_attr_set function.

Fixes: 464314ea6c11 ("switchdev: skip over ports returning -EOPNOTSUPP when recursing ports")
Signed-off-by: Jiri Pirko &lt;jiri@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
