From: Christian Marangi <ansuelsmth@gmail.com>
To: Mattias Forsblad <mattias.forsblad@gmail.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux@armlinux.org.uk
Subject: Re: [PATCH net-next v13 2/6] net: dsa: Add convenience functions for frame handling
Date: Fri, 16 Sep 2022 08:06:38 +0200 [thread overview]
Message-ID: <63247bbd.5d0a0220.2e1d3.e804@mx.google.com> (raw)
In-Reply-To: <20220916121817.4061532-3-mattias.forsblad@gmail.com>
On Fri, Sep 16, 2022 at 02:18:13PM +0200, Mattias Forsblad wrote:
> Add common control functions for drivers that need
> to send and wait for control frames.
>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Mattias Forsblad <mattias.forsblad@gmail.com>
> ---
> include/net/dsa.h | 11 +++++++++++
> net/dsa/dsa.c | 17 +++++++++++++++++
> net/dsa/dsa2.c | 2 ++
> 3 files changed, 30 insertions(+)
>
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index f2ce12860546..08f3fff5f4df 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -495,6 +495,8 @@ struct dsa_switch {
> unsigned int max_num_bridges;
>
> unsigned int num_ports;
> +
> + struct completion inband_done;
> };
>
> static inline struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p)
> @@ -1390,6 +1392,15 @@ void dsa_tag_drivers_register(struct dsa_tag_driver *dsa_tag_driver_array[],
> void dsa_tag_drivers_unregister(struct dsa_tag_driver *dsa_tag_driver_array[],
> unsigned int count);
>
> +int dsa_switch_inband_tx(struct dsa_switch *ds, struct sk_buff *skb,
> + struct completion *completion, unsigned long timeout);
> +
> +static inline void dsa_switch_inband_complete(struct dsa_switch *ds, struct completion *completion)
> +{
> + /* Custom completion? */
> + complete(completion ?: &ds->inband_done);
Missing handling for custom completion!
Should be
complete(completion ? completion : &ds->inband_done);
> +}
> +
> #define dsa_tag_driver_module_drivers(__dsa_tag_drivers_array, __count) \
> static int __init dsa_tag_driver_module_init(void) \
> { \
> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> index be7b320cda76..ad870494d68b 100644
> --- a/net/dsa/dsa.c
> +++ b/net/dsa/dsa.c
> @@ -324,6 +324,23 @@ int dsa_switch_resume(struct dsa_switch *ds)
> EXPORT_SYMBOL_GPL(dsa_switch_resume);
> #endif
>
> +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;
Missing handling for custom completion!
Should be
com = completion ? completion : &ds->inband_done;
> +
> + reinit_completion(com);
> +
> + if (skb)
> + dev_queue_xmit(skb);
> +
> + return wait_for_completion_timeout(com, msecs_to_jiffies(timeout));
> +}
> +EXPORT_SYMBOL_GPL(dsa_switch_inband_tx);
> +
> static struct packet_type dsa_pack_type __read_mostly = {
> .type = cpu_to_be16(ETH_P_XDSA),
> .func = dsa_switch_rcv,
> diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
> index ed56c7a554b8..a048a6200789 100644
> --- a/net/dsa/dsa2.c
> +++ b/net/dsa/dsa2.c
> @@ -874,6 +874,8 @@ static int dsa_switch_setup(struct dsa_switch *ds)
> if (ds->setup)
> return 0;
>
> + init_completion(&ds->inband_done);
> +
> /* Initialize ds->phys_mii_mask before registering the slave MDIO bus
> * driver and before ops->setup() has run, since the switch drivers and
> * the slave MDIO bus driver rely on these values for probing PHY
> --
> 2.25.1
>
--
Ansuel
next prev parent reply other threads:[~2022-09-16 13:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-16 12:18 [PATCH net-next v13 0/6] net: dsa: qca8k, mv88e6xxx: rmon: Add RMU support Mattias Forsblad
2022-09-16 6:05 ` Christian Marangi
2022-09-16 12:18 ` [PATCH net-next v13 1/6] net: dsa: mv88e6xxx: Add RMU enable for select switches Mattias Forsblad
2022-09-16 12:18 ` [PATCH net-next v13 2/6] net: dsa: Add convenience functions for frame handling Mattias Forsblad
2022-09-16 6:06 ` Christian Marangi [this message]
2022-09-16 13:47 ` Vladimir Oltean
2022-09-16 6:26 ` Christian Marangi
2022-09-16 12:18 ` [PATCH net-next v13 3/6] net: dsa: Introduce dsa tagger data operation Mattias Forsblad
2022-09-16 12:18 ` [PATCH net-next v13 4/6] net: dsa: mv88e6xxxx: Add RMU functionality Mattias Forsblad
2022-09-17 18:02 ` Andrew Lunn
2022-09-17 18:04 ` Andrew Lunn
2022-09-16 12:18 ` [PATCH net-next v13 5/6] net: dsa: mv88e6xxx: rmon: Use RMU for reading RMON data Mattias Forsblad
2022-09-16 12:18 ` [PATCH net-next v13 6/6] net: dsa: qca8k: Use new convenience functions Mattias Forsblad
2022-09-16 6:09 ` Christian Marangi
2022-09-19 5:18 ` Mattias Forsblad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=63247bbd.5d0a0220.2e1d3.e804@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mattias.forsblad@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.