Message ID | d739aa6d-f1e0-45fa-aad8-b4a1da779b30@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | r8169: Fix GRO-related issue with not disabled device interrupts | expand |
On Tue, May 14, 2024 at 8:50 AM Heiner Kallweit <hkallweit1@gmail.com> wrote: > > For deciding whether to disable device interrupts, drivers may need the > information whether NAPIF_STATE_DISABLE or NAPIF_STATE_SCHED was set. > Therefore add a __napi_schedule_prep() which returns -1 in case > NAPIF_STATE_DISABLE was set. > > Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> > --- net-next is closed. See my feedback on the other patch.
On 14.05.2024 13:07, Eric Dumazet wrote: > On Tue, May 14, 2024 at 8:50 AM Heiner Kallweit <hkallweit1@gmail.com> wrote: >> >> For deciding whether to disable device interrupts, drivers may need the >> information whether NAPIF_STATE_DISABLE or NAPIF_STATE_SCHED was set. >> Therefore add a __napi_schedule_prep() which returns -1 in case >> NAPIF_STATE_DISABLE was set. >> >> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> >> --- > > net-next is closed. > This patch is a prerequisite for the other one. Therefore I don't see it as net-next material. If it would be a standalone patch, I'd agree. > See my feedback on the other patch.
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index cf261fb89..d1515cf8c 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -498,7 +498,12 @@ static inline bool napi_is_scheduled(struct napi_struct *n) return test_bit(NAPI_STATE_SCHED, &n->state); } -bool napi_schedule_prep(struct napi_struct *n); +int __napi_schedule_prep(struct napi_struct *n); + +static inline bool napi_schedule_prep(struct napi_struct *n) +{ + return __napi_schedule_prep(n) > 0; +} /** * napi_schedule - schedule NAPI poll diff --git a/net/core/dev.c b/net/core/dev.c index d2ce91a33..66f55fc50 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6116,21 +6116,21 @@ void __napi_schedule(struct napi_struct *n) EXPORT_SYMBOL(__napi_schedule); /** - * napi_schedule_prep - check if napi can be scheduled + * __napi_schedule_prep - check if napi can be scheduled * @n: napi context * * Test if NAPI routine is already running, and if not mark * it as running. This is used as a condition variable to - * insure only one NAPI poll instance runs. We also make - * sure there is no pending NAPI disable. + * insure only one NAPI poll instance runs. Return -1 if + * there is a pending NAPI disable. */ -bool napi_schedule_prep(struct napi_struct *n) +int __napi_schedule_prep(struct napi_struct *n) { unsigned long new, val = READ_ONCE(n->state); do { if (unlikely(val & NAPIF_STATE_DISABLE)) - return false; + return -1; new = val | NAPIF_STATE_SCHED; /* Sets STATE_MISSED bit if STATE_SCHED was already set @@ -6145,7 +6145,7 @@ bool napi_schedule_prep(struct napi_struct *n) return !(val & NAPIF_STATE_SCHED); } -EXPORT_SYMBOL(napi_schedule_prep); +EXPORT_SYMBOL(__napi_schedule_prep); /** * __napi_schedule_irqoff - schedule for receive
For deciding whether to disable device interrupts, drivers may need the information whether NAPIF_STATE_DISABLE or NAPIF_STATE_SCHED was set. Therefore add a __napi_schedule_prep() which returns -1 in case NAPIF_STATE_DISABLE was set. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> --- include/linux/netdevice.h | 7 ++++++- net/core/dev.c | 12 ++++++------ 2 files changed, 12 insertions(+), 7 deletions(-)