<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/net/netdevsim/dev.c, branch v6.1-rc3</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>netdevsim: remove dir in nsim_dev_debugfs_init() when creating ports dir failed</title>
<updated>2022-10-27T17:47:29+00:00</updated>
<author>
<name>Zhengchao Shao</name>
<email>shaozhengchao@huawei.com</email>
</author>
<published>2022-10-26T01:46:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a6aa8d0ce2cfba57ac0f23293fcb3be0b9f53fba'/>
<id>a6aa8d0ce2cfba57ac0f23293fcb3be0b9f53fba</id>
<content type='text'>
Remove dir in nsim_dev_debugfs_init() when creating ports dir failed.
Otherwise, the netdevsim device will not be created next time. Kernel
reports an error: debugfs: Directory 'netdevsim1' with parent 'netdevsim'
already present!

Fixes: ab1d0cc004d7 ("netdevsim: change debugfs tree topology")
Signed-off-by: Zhengchao Shao &lt;shaozhengchao@huawei.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove dir in nsim_dev_debugfs_init() when creating ports dir failed.
Otherwise, the netdevsim device will not be created next time. Kernel
reports an error: debugfs: Directory 'netdevsim1' with parent 'netdevsim'
already present!

Fixes: ab1d0cc004d7 ("netdevsim: change debugfs tree topology")
Signed-off-by: Zhengchao Shao &lt;shaozhengchao@huawei.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>netdevsim: fix memory leak in nsim_drv_probe() when nsim_dev_resources_register() failed</title>
<updated>2022-10-27T17:47:24+00:00</updated>
<author>
<name>Zhengchao Shao</name>
<email>shaozhengchao@huawei.com</email>
</author>
<published>2022-10-26T01:46:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6b1da9f7126f05e857da6db24c6a04aa7974d644'/>
<id>6b1da9f7126f05e857da6db24c6a04aa7974d644</id>
<content type='text'>
If some items in nsim_dev_resources_register() fail, memory leak will
occur. The following is the memory leak information.

unreferenced object 0xffff888074c02600 (size 128):
  comm "echo", pid 8159, jiffies 4294945184 (age 493.530s)
  hex dump (first 32 bytes):
    40 47 ea 89 ff ff ff ff 01 00 00 00 00 00 00 00  @G..............
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
  backtrace:
    [&lt;0000000011a31c98&gt;] kmalloc_trace+0x22/0x60
    [&lt;0000000027384c69&gt;] devl_resource_register+0x144/0x4e0
    [&lt;00000000a16db248&gt;] nsim_drv_probe+0x37a/0x1260
    [&lt;000000007d1f448c&gt;] really_probe+0x20b/0xb10
    [&lt;00000000c416848a&gt;] __driver_probe_device+0x1b3/0x4a0
    [&lt;00000000077e0351&gt;] driver_probe_device+0x49/0x140
    [&lt;0000000054f2465a&gt;] __device_attach_driver+0x18c/0x2a0
    [&lt;000000008538f359&gt;] bus_for_each_drv+0x151/0x1d0
    [&lt;0000000038e09747&gt;] __device_attach+0x1c9/0x4e0
    [&lt;00000000dd86e533&gt;] bus_probe_device+0x1d5/0x280
    [&lt;00000000839bea35&gt;] device_add+0xae0/0x1cb0
    [&lt;000000009c2abf46&gt;] new_device_store+0x3b6/0x5f0
    [&lt;00000000fb823d7f&gt;] bus_attr_store+0x72/0xa0
    [&lt;000000007acc4295&gt;] sysfs_kf_write+0x106/0x160
    [&lt;000000005f50cb4d&gt;] kernfs_fop_write_iter+0x3a8/0x5a0
    [&lt;0000000075eb41bf&gt;] vfs_write+0x8f0/0xc80

Fixes: 37923ed6b8ce ("netdevsim: Add simple FIB resource controller via devlink")
Signed-off-by: Zhengchao Shao &lt;shaozhengchao@huawei.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If some items in nsim_dev_resources_register() fail, memory leak will
occur. The following is the memory leak information.

unreferenced object 0xffff888074c02600 (size 128):
  comm "echo", pid 8159, jiffies 4294945184 (age 493.530s)
  hex dump (first 32 bytes):
    40 47 ea 89 ff ff ff ff 01 00 00 00 00 00 00 00  @G..............
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
  backtrace:
    [&lt;0000000011a31c98&gt;] kmalloc_trace+0x22/0x60
    [&lt;0000000027384c69&gt;] devl_resource_register+0x144/0x4e0
    [&lt;00000000a16db248&gt;] nsim_drv_probe+0x37a/0x1260
    [&lt;000000007d1f448c&gt;] really_probe+0x20b/0xb10
    [&lt;00000000c416848a&gt;] __driver_probe_device+0x1b3/0x4a0
    [&lt;00000000077e0351&gt;] driver_probe_device+0x49/0x140
    [&lt;0000000054f2465a&gt;] __device_attach_driver+0x18c/0x2a0
    [&lt;000000008538f359&gt;] bus_for_each_drv+0x151/0x1d0
    [&lt;0000000038e09747&gt;] __device_attach+0x1c9/0x4e0
    [&lt;00000000dd86e533&gt;] bus_probe_device+0x1d5/0x280
    [&lt;00000000839bea35&gt;] device_add+0xae0/0x1cb0
    [&lt;000000009c2abf46&gt;] new_device_store+0x3b6/0x5f0
    [&lt;00000000fb823d7f&gt;] bus_attr_store+0x72/0xa0
    [&lt;000000007acc4295&gt;] sysfs_kf_write+0x106/0x160
    [&lt;000000005f50cb4d&gt;] kernfs_fop_write_iter+0x3a8/0x5a0
    [&lt;0000000075eb41bf&gt;] vfs_write+0x8f0/0xc80

Fixes: 37923ed6b8ce ("netdevsim: Add simple FIB resource controller via devlink")
Signed-off-by: Zhengchao Shao &lt;shaozhengchao@huawei.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>netdevsim: remove redundant variable ret</title>
<updated>2022-09-02T03:50:48+00:00</updated>
<author>
<name>Jinpeng Cui</name>
<email>cui.jinpeng2@zte.com.cn</email>
</author>
<published>2022-08-31T15:43:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5603072e0b3733c076529e49ee3150cbb3a7a5cc'/>
<id>5603072e0b3733c076529e49ee3150cbb3a7a5cc</id>
<content type='text'>
Return value directly from nsim_dev_reload_create()
instead of getting value from redundant variable ret.

Reported-by: Zeal Robot &lt;zealci@zte.com.cn&gt;
Signed-off-by: Jinpeng Cui &lt;cui.jinpeng2@zte.com.cn&gt;
Link: https://lore.kernel.org/r/20220831154329.305372-1-cui.jinpeng2@zte.com.cn
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Return value directly from nsim_dev_reload_create()
instead of getting value from redundant variable ret.

Reported-by: Zeal Robot &lt;zealci@zte.com.cn&gt;
Signed-off-by: Jinpeng Cui &lt;cui.jinpeng2@zte.com.cn&gt;
Link: https://lore.kernel.org/r/20220831154329.305372-1-cui.jinpeng2@zte.com.cn
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: devlink: limit flash component name to match version returned by info_get()</title>
<updated>2022-08-25T20:22:53+00:00</updated>
<author>
<name>Jiri Pirko</name>
<email>jiri@nvidia.com</email>
</author>
<published>2022-08-24T12:20:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f94b606325c194adadaee2265b4db990802c4850'/>
<id>f94b606325c194adadaee2265b4db990802c4850</id>
<content type='text'>
Limit the acceptance of component name passed to cmd_flash_update() to
match one of the versions returned by info_get(), marked by version type.
This makes things clearer and enforces 1:1 mapping between exposed
version and accepted flash component.

Check VERSION_TYPE_COMPONENT version type during cmd_flash_update()
execution by calling info_get() with different "req" context.
That causes info_get() to lookup the component name instead of
filling-up the netlink message.

Remove "UPDATE_COMPONENT" flag which becomes used.

Signed-off-by: Jiri Pirko &lt;jiri@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Limit the acceptance of component name passed to cmd_flash_update() to
match one of the versions returned by info_get(), marked by version type.
This makes things clearer and enforces 1:1 mapping between exposed
version and accepted flash component.

Check VERSION_TYPE_COMPONENT version type during cmd_flash_update()
execution by calling info_get() with different "req" context.
That causes info_get() to lookup the component name instead of
filling-up the netlink message.

Remove "UPDATE_COMPONENT" flag which becomes used.

Signed-off-by: Jiri Pirko &lt;jiri@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>netdevsim: add version fw.mgmt info info_get() and mark as a component</title>
<updated>2022-08-25T20:22:53+00:00</updated>
<author>
<name>Jiri Pirko</name>
<email>jiri@nvidia.com</email>
</author>
<published>2022-08-24T12:20:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0c1989754f76b52bd30581ff543890cab8c75a9d'/>
<id>0c1989754f76b52bd30581ff543890cab8c75a9d</id>
<content type='text'>
Fix the only component user which is netdevsim. It uses component named
"fw.mgmt" in selftests. So add this version to info_get() output with
version type component.

Signed-off-by: Jiri Pirko &lt;jiri@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix the only component user which is netdevsim. It uses component named
"fw.mgmt" in selftests. So add this version to info_get() output with
version type component.

Signed-off-by: Jiri Pirko &lt;jiri@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: devlink: convert reload command to take implicit devlink-&gt;lock</title>
<updated>2022-08-01T11:14:00+00:00</updated>
<author>
<name>Jiri Pirko</name>
<email>jiri@nvidia.com</email>
</author>
<published>2022-07-29T07:10:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=644a66c60f02f302d82c3008ae2ffe67cf495383'/>
<id>644a66c60f02f302d82c3008ae2ffe67cf495383</id>
<content type='text'>
Convert reload command to behave the same way as the rest of the
commands and let if be called with devlink-&gt;lock held. Remove the
temporary devl_lock taking from drivers. As the DEVLINK_NL_FLAG_NO_LOCK
flag is no longer used, remove it alongside.

Signed-off-by: Jiri Pirko &lt;jiri@nvidia.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Convert reload command to behave the same way as the rest of the
commands and let if be called with devlink-&gt;lock held. Remove the
temporary devl_lock taking from drivers. As the DEVLINK_NL_FLAG_NO_LOCK
flag is no longer used, remove it alongside.

Signed-off-by: Jiri Pirko &lt;jiri@nvidia.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>netdevsim: convert driver to use unlocked devlink API during init/fini</title>
<updated>2022-07-19T03:10:48+00:00</updated>
<author>
<name>Jiri Pirko</name>
<email>jiri@nvidia.com</email>
</author>
<published>2022-07-16T11:02:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=012ec02ae4410207f796a9b280a60b80b6cc790a'/>
<id>012ec02ae4410207f796a9b280a60b80b6cc790a</id>
<content type='text'>
Prepare for devlink reload being called with devlink-&gt;lock held and
convert the netdevsim driver to use unlocked devlink API during init and
fini flows. Take devl_lock() in reload_down() and reload_up() ops in the
meantime before reload cmd is converted to take the lock itself.

Signed-off-by: Jiri Pirko &lt;jiri@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Prepare for devlink reload being called with devlink-&gt;lock held and
convert the netdevsim driver to use unlocked devlink API during init and
fini flows. Take devl_lock() in reload_down() and reload_up() ops in the
meantime before reload cmd is converted to take the lock itself.

Signed-off-by: Jiri Pirko &lt;jiri@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>devlink: hold the instance lock during eswitch_mode callbacks</title>
<updated>2022-03-21T14:11:38+00:00</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2022-03-18T19:23:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=14e426bf1a4d77ac87d0fa2a964092a23f863e44'/>
<id>14e426bf1a4d77ac87d0fa2a964092a23f863e44</id>
<content type='text'>
Make the devlink core hold the instance lock during eswitch_mode
callbacks. Cheat in case of mlx5 (see the cover letter).

Reviewed-by: Leon Romanovsky &lt;leonro@nvidia.com&gt;
Reviewed-by: Jiri Pirko &lt;jiri@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make the devlink core hold the instance lock during eswitch_mode
callbacks. Cheat in case of mlx5 (see the cover letter).

Reviewed-by: Leon Romanovsky &lt;leonro@nvidia.com&gt;
Reviewed-by: Jiri Pirko &lt;jiri@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>netdevsim: replace vfs_lock with devlink instance lock</title>
<updated>2022-03-21T14:11:38+00:00</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2022-03-18T19:23:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=aff3a925094633a5b77058b9a715efbb12fc2698'/>
<id>aff3a925094633a5b77058b9a715efbb12fc2698</id>
<content type='text'>
Similarly to the previous commit, use the devlink instance
lock and let it replace the vfs_lock.

nsim_esw_legacy_enable() was locked by both port lock and
vfs lock so one set of lock/unlocks goes away.

netdevsim's .eswitch_mode_set callback is now ready for
the callback to take the instance lock.

Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Similarly to the previous commit, use the devlink instance
lock and let it replace the vfs_lock.

nsim_esw_legacy_enable() was locked by both port lock and
vfs lock so one set of lock/unlocks goes away.

netdevsim's .eswitch_mode_set callback is now ready for
the callback to take the instance lock.

Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>netdevsim: replace port_list_lock with devlink instance lock</title>
<updated>2022-03-21T14:11:38+00:00</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2022-03-18T19:23:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=76eea6c2e663f7e9fbc258c82811ad9e657e085f'/>
<id>76eea6c2e663f7e9fbc258c82811ad9e657e085f</id>
<content type='text'>
Take advantage of the devlink instance lock for protecting
the port list. This will simplify locking even more once
all devlink callbacks hold the instance lock.

We need to add locking in nsim_dev_port_add_all() which used
to assume higher layer protection when accessing the list.

Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Take advantage of the devlink instance lock for protecting
the port list. This will simplify locking even more once
all devlink callbacks hold the instance lock.

We need to add locking in nsim_dev_port_add_all() which used
to assume higher layer protection when accessing the list.

Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
</feed>
