Re: [PATCH net] selftests: drv-net: Check if combined-count exists

From: Joe Damato
Date: Tue Feb 25 2025 - 18:55:19 EST


On Tue, Feb 25, 2025 at 03:11:24PM -0800, David Wei wrote:
> On 2025-02-25 10:14, Joe Damato wrote:
[...]
> > diff --git a/tools/testing/selftests/drivers/net/queues.py b/tools/testing/selftests/drivers/net/queues.py
> > index 38303da957ee..baa8845d9f64 100755
> > --- a/tools/testing/selftests/drivers/net/queues.py
> > +++ b/tools/testing/selftests/drivers/net/queues.py
> > @@ -45,10 +45,13 @@ def addremove_queues(cfg, nl) -> None:
> >
> > netnl = EthtoolFamily()
> > channels = netnl.channels_get({'header': {'dev-index': cfg.ifindex}})
> > - if channels['combined-count'] == 0:
> > - rx_type = 'rx'
> > + if 'combined-count' in channels:
> > + if channels['combined-count'] == 0:
> > + rx_type = 'rx'
> > + else:
> > + rx_type = 'combined'
> > else:
> > - rx_type = 'combined'
> > + rx_type = 'rx'
>
> Logic is good but minor nit in reducing nestiness:
>
> rx_type = 'rx'
> if channels.get('combined-count', 0) > 0:
> rx_type = 'combined'

Thanks; will fix in the v2.

---
pw-bot: cr