diff mbox series

[next,S88,1/8] i40e: Properly check allowed advertisement capabilities

Message ID 20180312140022.59580-1-alice.michael@intel.com
State Superseded
Headers show
Series [next,S88,1/8] i40e: Properly check allowed advertisement capabilities | expand

Commit Message

Michael, Alice March 12, 2018, 2 p.m. UTC
From: Jan Sokolowski <jan.sokolowski@intel.com>

The i40e_set_link_ksettings and i40e_get_link_ksettings use different
codepaths to check available and supported advertisement modes. This
creates scenarios where it's possible to set a mode that's not allowed,
resulting in a link down.

Fix setting advertisement in i40e_set_link_ksettings by calling
i40e_get_link_ksettings to check what modes are allowed.

Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

Comments

Saleem, Shiraz March 12, 2018, 10:55 p.m. UTC | #1
>Subject: [next PATCH S88 3/8] i40e: Close client on suspend and restore client
>MSIx on resume
>
>From: Shiraz Saleem <shiraz.saleem@intel.com>
>
>During suspend client MSIx vectors are freed while they are still in use causing a
>crash on entering S3.
>
>Fix this calling client close before freeing up its MSIx vectors.
>Also update the client MSIx vectors on resume before client open is called.
>
>Fixes commit b980c0634fe5 ("i40e: shutdown all IRQs and disable MSI-X when
>suspended")
>
>Reported-by: Stefan Assmann <sassmann@redhat.com>
>Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
>---

ACK. Thank you Alice!
Malek, Patryk March 13, 2018, 8:20 a.m. UTC | #2
ACK, thanks

-----Original Message-----
From: Michael, Alice 

Sent: Monday, March 12, 2018 15:00
To: alice.michael; intel-wired-lan@lists.osuosl.org
Cc: Malek, Patryk <patryk.malek@intel.com>
Subject: [next PATCH S88 6/8] i40e: Prevent setting link speed on I40E_DEV_ID_25G_B

From: Patryk Małek <patryk.malek@intel.com>


Setting link settings on backplane devices shouldn't be allowed.
This patch adds one more device id to the list which we check that against.

Signed-off-by: Patryk Małek <patryk.malek@intel.com>

---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index d86d090..722eb6b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -861,6 +861,7 @@ static int i40e_set_link_ksettings(struct net_device *netdev,
 	    hw->device_id == I40E_DEV_ID_KX_C ||
 	    hw->device_id == I40E_DEV_ID_20G_KR2 ||
 	    hw->device_id == I40E_DEV_ID_20G_KR2_A ||
+	    hw->device_id == I40E_DEV_ID_25G_B ||
 	    hw->device_id == I40E_DEV_ID_KX_X722) {
 		netdev_info(netdev, "Changing settings is not supported on backplane.\n");
 		return -EOPNOTSUPP;
--
2.9.5

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index f9493f1..9bb85da 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -871,23 +871,21 @@  static int i40e_set_link_ksettings(struct net_device *netdev,
 	/* save autoneg out of ksettings */
 	autoneg = copy_ks.base.autoneg;
 
-	memset(&safe_ks, 0, sizeof(safe_ks));
+	/* get our own copy of the bits to check against */
+	memset(&safe_ks, 0, sizeof(struct ethtool_link_ksettings));
+	safe_ks.base.cmd = copy_ks.base.cmd;
+	safe_ks.base.link_mode_masks_nwords =
+		copy_ks.base.link_mode_masks_nwords;
+	i40e_get_link_ksettings(netdev, &safe_ks);
+
 	/* Get link modes supported by hardware and check against modes
 	 * requested by the user.  Return an error if unsupported mode was set.
 	 */
-	i40e_phy_type_to_ethtool(pf, &safe_ks);
 	if (!bitmap_subset(copy_ks.link_modes.advertising,
 			   safe_ks.link_modes.supported,
 			   __ETHTOOL_LINK_MODE_MASK_NBITS))
 		return -EINVAL;
 
-	/* get our own copy of the bits to check against */
-	memset(&safe_ks, 0, sizeof(struct ethtool_link_ksettings));
-	safe_ks.base.cmd = copy_ks.base.cmd;
-	safe_ks.base.link_mode_masks_nwords =
-		copy_ks.base.link_mode_masks_nwords;
-	i40e_get_link_ksettings(netdev, &safe_ks);
-
 	/* set autoneg back to what it currently is */
 	copy_ks.base.autoneg = safe_ks.base.autoneg;