Re: [PATCH net-next v4 10/10] tsnep: Support XDP BPF program setup
From: Jakub Kicinski <kuba@kernel.org>
Date: 2023-01-11 00:12:46
On Tue, 10 Jan 2023 22:38:04 +0100 Gerhard Engleder wrote:
quoted
As I called out earlier the __TSNEP_DOWN is just !IFF_UP so you don't need that bit. The fact that netif_carrier_off is here also points out the fact that the code in the Tx path isn't needed regarding __TSNEP_DOWN and you can probably just check netif_carrier_ok if you need the check.tsnep_netdev_close() is called directly during bpf prog setup (see tsnep_xdp_setup_prog() in this commit). If the following tsnep_netdev_open() call fails, then this flag signals that the device is already down and nothing needs to be cleaned up if tsnep_netdev_close() is called later (because IFF_UP is still set).
TBH we've been pushing pretty hard for a while now to stop people from implementing the: close() change config open() sort of reconfiguration. I did that myself when I was a was implementing my first Ethernet driver and DaveM nacked the change. Must have been a decade ago. Imagine you're working on a remote box via SSH and the box is under transient memory pressure. Allocations fail, we don't want the machine to fall off the network :(