lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220919221445.a7gypaggf2wmnf5i@skbuf>
Date:   Tue, 20 Sep 2022 01:14:45 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     Mattias Forsblad <mattias.forsblad@...il.com>
Cc:     netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, linux@...linux.org.uk,
        ansuelsmth@...il.com
Subject: Re: [PATCH net-next v14 2/7] net: dsa: Add convenience functions for
 frame handling

On Mon, Sep 19, 2022 at 01:08:42PM +0200, Mattias Forsblad wrote:
> +int dsa_switch_inband_tx(struct dsa_switch *ds, struct sk_buff *skb,
> +			 struct completion *completion, unsigned long timeout)
> +{
> +	struct completion *com;
> +
> +	/* Custom completion? */
> +	com = completion ? : &ds->inband_done;
> +
> +	reinit_completion(com);
> +
> +	if (skb)
> +		dev_queue_xmit(skb);

Does it make sense from an API perspective to call dsa_switch_inband_tx()
with a NULL skb? If yes, please add a comment explaining why. If not,
please delete this check.

> +
> +	return wait_for_completion_timeout(com, msecs_to_jiffies(timeout));

If this is going to be provided as a DSA common layer "helper" function,
at least make an effort to document the expected return code.

Hint, wait_for_completion_timeout() returns an unsigned long time_left,
you return an int. What does it mean?!

At the bare minimum, leave a comment, especially when it's not obvious
(DSA typically uses negative integer values as error codes, and zero on
success. Here, zero is an error - timeout. If the amount of time left
does not matter, do translate this into 0 for success, and -ETIMEDOUT
for timeout). If you're also feeling generous, do please also update
Documentation/networking/dsa/dsa.rst with the info about the flow of
Ethernet-based register access that you wish was available while you
were figuring out how things worked.

> +}
> +EXPORT_SYMBOL_GPL(dsa_switch_inband_tx);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ