[01/24] net/axgbe: remove use of comm_owned field
Checks
Commit Message
The comm_owned field can hide logic where double locking is attempted
and prevent multiple threads for the same device from accessing the
mutex properly. Remove the comm_owned field and use the mutex API
exclusively for gaining ownership.
Signed-off-by: Venkat Kumar Ande <VenkatKumar.Ande@amd.com>
---
drivers/net/axgbe/axgbe_phy_impl.c | 16 ----------------
1 file changed, 16 deletions(-)
Comments
On 4/12/2024 1:52 PM, Venkat Kumar Ande wrote:
> The comm_owned field can hide logic where double locking is attempted
> and prevent multiple threads for the same device from accessing the
> mutex properly. Remove the comm_owned field and use the mutex API
> exclusively for gaining ownership.
>
> Signed-off-by: Venkat Kumar Ande <VenkatKumar.Ande@amd.com>
>
Hi Venkat,
None of the patches seems requested to be backported to the stable
trees, so users of the LTS release won't be able to benefit from these
fixes.
To backport fixes, it requires "Fixes: .." tag and "Cc: stable@dpdk.org"
For details please check:
https://doc.dpdk.org/guides/contributing/patches.html#patch-for-stable-releases
Can you please update commit logs to add mentioned metadata for backporting?
@@ -205,8 +205,6 @@ struct axgbe_phy_data {
unsigned int mdio_addr;
- unsigned int comm_owned;
-
/* SFP Support */
enum axgbe_sfp_comm sfp_comm;
unsigned int sfp_mux_address;
@@ -254,12 +252,6 @@ static enum axgbe_an_mode axgbe_phy_an_mode(struct axgbe_port *pdata);
static int axgbe_phy_i2c_xfer(struct axgbe_port *pdata,
struct axgbe_i2c_op *i2c_op)
{
- struct axgbe_phy_data *phy_data = pdata->phy_data;
-
- /* Be sure we own the bus */
- if (!phy_data->comm_owned)
- return -EIO;
-
return pdata->i2c_if.i2c_xfer(pdata, i2c_op);
}
@@ -400,10 +392,6 @@ static int axgbe_phy_sfp_get_mux(struct axgbe_port *pdata)
static void axgbe_phy_put_comm_ownership(struct axgbe_port *pdata)
{
- struct axgbe_phy_data *phy_data = pdata->phy_data;
-
- phy_data->comm_owned = 0;
-
pthread_mutex_unlock(&pdata->phy_mutex);
}
@@ -419,9 +407,6 @@ static int axgbe_phy_get_comm_ownership(struct axgbe_port *pdata)
*/
pthread_mutex_lock(&pdata->phy_mutex);
- if (phy_data->comm_owned)
- return 0;
-
/* Clear the mutexes */
XP_IOWRITE(pdata, XP_I2C_MUTEX, AXGBE_MUTEX_RELEASE);
XP_IOWRITE(pdata, XP_MDIO_MUTEX, AXGBE_MUTEX_RELEASE);
@@ -444,7 +429,6 @@ static int axgbe_phy_get_comm_ownership(struct axgbe_port *pdata)
XP_IOWRITE(pdata, XP_I2C_MUTEX, mutex_id);
XP_IOWRITE(pdata, XP_MDIO_MUTEX, mutex_id);
- phy_data->comm_owned = 1;
return 0;
}