On Tue, 24 Jun 2025 15:27:27 +0100 Breno Leitao wrote:
> > > +    try:
> > > +        for key, value in config_data.items():
> > > +            if DEBUG:
> > > +                ksft_pr(f"Setting {key} to {value}")
> > > +            with open(
> > > +                f"{NETCONSOLE_CONFIGFS_PATH}/{target_name}/{key}",  
> > 
> > Could be personal preference but I think that using temp variable to
> > store the argument looks better than breaking out the function call
> > over 5 lines..  
> 
> I was not able to get what you mean here, sorry.
> 
> We have config_data, which is a dictionary that stores the netconsole
> keys (as in configfs) and their value, which will be set in the code below.
> 
> What would this temp variable look like, and how it would look like?

                path = f"{NETCONSOLE_CONFIGFS_PATH}/{target_name}/{key}"
                with open(path, "r", encoding="utf-8") as f:
                        ...

> > > +def test_netpoll(cfg: NetDrvEpEnv, netdevnl: NetdevFamily) -> None:
> > > +    """
> > > +    Test netpoll by sending traffic to the interface and then sending
> > > +    netconsole messages to trigger a poll
> > > +    """
> > > +
> > > +    target_name = generate_random_netcons_name()
> > > +    ifname = cfg.dev["ifname"]
> > > +    traffic = None
> > > +
> > > +    try:
> > > +        set_single_rx_tx_queue(ifname)
> > > +        traffic = GenerateTraffic(cfg)
> > > +        check_traffic_flowing(cfg, netdevnl)  
> > 
> > Any reason to perform this check? GenerateTraffic() already waits for
> > traffic to ramp up. Do we need to adjust the logic there, or make some
> > methods public?  
> 
> Not really. I can just remove this code, in fact, given
> GenerateTraffic() already waits for the code. Or, I can add under DEBUG.

Let's not put functional changes under DEBUG, just prints.
It could make it so that the test fails without DEBUG and passes with.

> As we discussed in the RFC thread, I will add support for bpftrace in
> the v2.

Reply via email to