linux/drivers/net
Jacob Keller 52cc5f3a16 devlink: move flash end and begin to core devlink
When performing a flash update via devlink, device drivers may inform
user space of status updates via
devlink_flash_update_(begin|end|timeout|status)_notify functions.

It is expected that drivers do not send any status notifications unless
they send a begin and end message. If a driver sends a status
notification without sending the appropriate end notification upon
finishing (regardless of success or failure), the current implementation
of the devlink userspace program can get stuck endlessly waiting for the
end notification that will never come.

The current ice driver implementation may send such a status message
without the appropriate end notification in rare cases.

Fixing the ice driver is relatively simple: we just need to send the
begin_notify at the start of the function and always send an end_notify
no matter how the function exits.

Rather than assuming driver authors will always get this right in the
future, lets just fix the API so that it is not possible to get wrong.
Make devlink_flash_update_begin_notify and
devlink_flash_update_end_notify static, and call them in devlink.c core
code. Always send the begin_notify just before calling the driver's
flash_update routine. Always send the end_notify just after the routine
returns regardless of success or failure.

Doing this makes the status notification easier to use from the driver,
as it no longer needs to worry about catching failures and cleaning up
by calling devlink_flash_update_end_notify. It is now no longer possible
to do the wrong thing in this regard. We also save a couple of lines of
code in each driver.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-19 21:41:02 -08:00
..
appletalk docs updates for v5.10-rc1 2020-10-16 15:02:21 -07:00
arcnet
bonding net: bonding, dummy, ifb, team: advertise NETIF_F_GSO_SOFTWARE 2020-11-03 16:53:55 -08:00
caif caif_virtio: Remove redundant initialization of variable err 2020-10-01 18:46:16 -07:00
can Merge https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-11-19 19:08:46 -08:00
dsa Merge https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-11-19 19:08:46 -08:00
ethernet devlink: move flash end and begin to core devlink 2020-11-19 21:41:02 -08:00
fddi net: fddi: skfp: ess: Remove defined but unused variable 'ID_sccs' 2020-11-03 16:35:15 -08:00
fjes
hamradio net: driver: hamradio: Fix potential unterminated string 2020-11-02 16:10:24 -08:00
hippi
hyperv hyperv-next for 5.10 2020-10-14 10:32:10 -07:00
ieee802154 net: ieee802154: ca8210: Fix incorrectly named function param doc 2020-11-03 16:37:09 -08:00
ipa Merge https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-11-19 19:08:46 -08:00
ipvlan
mdio net: phy: Move of_mdio from drivers/of to drivers/net/mdio 2020-10-10 10:55:05 -07:00
netdevsim devlink: move flash end and begin to core devlink 2020-11-19 21:41:02 -08:00
pcs net: pcs-xpcs: depend on MDIO_BUS instead of selecting it 2020-10-16 16:54:11 -07:00
phy Merge https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-11-19 19:08:46 -08:00
plip
ppp
slip
team net: bonding, dummy, ifb, team: advertise NETIF_F_GSO_SOFTWARE 2020-11-03 16:53:55 -08:00
usb Merge https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-11-19 19:08:46 -08:00
vmxnet3 vmxnet3: fix cksum offload issues for non-udp tunnels 2020-09-25 16:41:40 -07:00
wan net: wan: Delete the DLCI / SDLA drivers 2020-11-17 13:33:29 -08:00
wireguard wireguard: switch to dev_get_tstats64 2020-11-09 17:50:28 -08:00
wireless Some updates: 2020-11-13 12:03:22 -08:00
xen-netback xen/netback: use lateeoi irq binding 2020-10-20 10:22:03 +02:00
bareudp.c net: switch to dev_get_tstats64 2020-11-09 17:50:28 -08:00
dummy.c net: bonding, dummy, ifb, team: advertise NETIF_F_GSO_SOFTWARE 2020-11-03 16:53:55 -08:00
eql.c
geneve.c Merge https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-11-19 19:08:46 -08:00
gtp.c gtp: switch to dev_get_tstats64 2020-11-09 17:50:28 -08:00
ifb.c net: bonding, dummy, ifb, team: advertise NETIF_F_GSO_SOFTWARE 2020-11-03 16:53:55 -08:00
Kconfig net: Add mhi-net driver 2020-11-05 16:54:01 -08:00
LICENSE.SRC
loopback.c
macsec.c net: macsec: Add missing documentation for 'gro_cells' 2020-11-03 16:38:28 -08:00
macvlan.c net: macvlan: remove redundant initialization in macvlan_dev_netpoll_setup 2020-11-07 12:18:41 -08:00
macvtap.c
Makefile net: Add mhi-net driver 2020-11-05 16:54:01 -08:00
mdio.c
mhi_net.c net: Add mhi-net driver 2020-11-05 16:54:01 -08:00
mii.c net: mii: Report advertised link capabilities when autonegotiation is off 2020-10-29 19:00:46 -07:00
net_failover.c net: net_failover: Correct parameter name 'standby_dev' 2020-11-03 16:40:23 -08:00
netconsole.c net: netconsole: Add description for 'netconsole_target's extended attribute 2020-11-03 16:40:09 -08:00
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c tun: switch to net core provided statistics counters 2020-11-09 17:50:28 -08:00
veth.c treewide: rename nla_strlcpy to nla_strscpy. 2020-11-16 08:08:54 -08:00
virtio_net.c Revert "virtio-net: ethtool configurable RXCSUM" 2020-10-21 20:33:19 -07:00
vrf.c vrf: Fix fast path output packet handling with async Netfilter rules 2020-11-12 07:47:06 -08:00
vsockmon.c
vxlan.c net: switch to dev_get_tstats64 2020-11-09 17:50:28 -08:00
xen-netfront.c drivers: net: xen-netfront: Fixed W=1 set but unused warnings 2020-11-02 16:03:12 -08:00