Re: [PATCH rfc v2 02/10] net: dsa: qca8k: Move completion into DSA core
flat view
From: Vladimir Oltean <vladimir.oltean@nxp.com>
Date: 2022-09-22 18:59:32
On Thu, Sep 22, 2022 at 07:58:13PM +0200, Andrew Lunn wrote:
quoted hunk ↗ jump to hunk
@@ -1528,7 +1516,7 @@ static void qca8k_mib_autocast_handler(struct dsa_switch *ds, struct sk_buff *sk exit: /* Complete on receiving all the mib packet */ if (refcount_dec_and_test(&mib_eth_data->port_parsed)) - complete(&mib_eth_data->rw_done); + dsa_inband_complete(&mib_eth_data->inband); } static int@@ -1543,8 +1531,6 @@ qca8k_get_ethtool_stats_eth(struct dsa_switch *ds, int port, u64 *data) mutex_lock(&mib_eth_data->mutex); - reinit_completion(&mib_eth_data->rw_done); - mib_eth_data->req_port = dp->index; mib_eth_data->data = data; refcount_set(&mib_eth_data->port_parsed, QCA8K_NUM_PORTS);@@ -1562,7 +1548,8 @@ qca8k_get_ethtool_stats_eth(struct dsa_switch *ds, int port, u64 *data) if (ret) goto exit; - ret = wait_for_completion_timeout(&mib_eth_data->rw_done, QCA8K_ETHERNET_TIMEOUT); + ret = dsa_inband_wait_for_completion(&mib_eth_data->inband, + QCA8K_ETHERNET_TIMEOUT);
Doesn't the reinit_completion from qca8k_get_ethtool_stats_eth() still race with qca8k_mib_autocast_handler()? From the comments, it appears to me that the regmap_update_bits() call is what triggers a MIB autocast, and so, reinit_completion() needs to be before that.