On Mon, Sep 02, 2024 at 03:01:28PM +0200, Eric Dumazet wrote: > On Sat, Aug 31, 2024 at 1:32 PM Joe Damato <jdamato@xxxxxxxxxx> wrote: > > > > In commit 6f8b12d661d0 ("net: napi: add hard irqs deferral feature") > > napi_defer_irqs was added to net_device and napi_defer_irqs_count was > > added to napi_struct, both as type int. > > > > This value never goes below zero. Change the type for both from int to > > u32, and add an overflow check to sysfs to limit the value to S32_MAX. > > > > Before this patch: > > > > $ sudo bash -c 'echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs' > > $ cat /sys/class/net/eth4/napi_defer_hard_irqs > > -2147483647 > > > > After this patch: > > > > $ sudo bash -c 'echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs' > > bash: line 0: echo: write error: Numerical result out of range > > > > Fixes: 6f8b12d661d0 ("net: napi: add hard irqs deferral feature") > > Cc: stable@xxxxxxxxxx > > Cc: Eric Dumazet <edumazet@xxxxxxxxxx> > > Suggested-by: Jakub Kicinski <kuba@xxxxxxxxxx> > > Signed-off-by: Joe Damato <jdamato@xxxxxxxxxx> > > --- > > I do not think this deserves a change to stable trees. > > Signed or unsigned, what is the issue ? > > Do you really need one extra bit ? > > /sys/class/net/XXXXX/tx_queue_len has a similar behavior. Sorry, Eric, I'm not following. Are you asking me to allow u32_max for napi_defer_hard_irqs the same way tx_queue_len does and avoid overflow that way: include/linux/netdevice.h: unsigned int tx_queue_len; dev_change_tx_queue_len(..., unsigned long new_len): if (new_len != (unsigned int)new_len) return -ERANGE;