net/mlx: ensure MTU update is effective
There is no guarantee that the new MTU is effective after writing its value to sysfs. Retrieve it to be sure. Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This commit is contained in:
parent
6e0eab3802
commit
f3b492d7b4
@ -658,7 +658,15 @@ priv_get_mtu(struct priv *priv, uint16_t *mtu)
|
||||
static int
|
||||
priv_set_mtu(struct priv *priv, uint16_t mtu)
|
||||
{
|
||||
return priv_set_sysfs_ulong(priv, "mtu", mtu);
|
||||
uint16_t new_mtu;
|
||||
|
||||
if (priv_set_sysfs_ulong(priv, "mtu", mtu) ||
|
||||
priv_get_mtu(priv, &new_mtu))
|
||||
return -1;
|
||||
if (new_mtu == mtu)
|
||||
return 0;
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -397,7 +397,15 @@ priv_get_mtu(struct priv *priv, uint16_t *mtu)
|
||||
static int
|
||||
priv_set_mtu(struct priv *priv, uint16_t mtu)
|
||||
{
|
||||
return priv_set_sysfs_ulong(priv, "mtu", mtu);
|
||||
uint16_t new_mtu;
|
||||
|
||||
if (priv_set_sysfs_ulong(priv, "mtu", mtu) ||
|
||||
priv_get_mtu(priv, &new_mtu))
|
||||
return -1;
|
||||
if (new_mtu == mtu)
|
||||
return 0;
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user