All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/3] aqc111: revert endianess fixes and cleanup mtu logic
@ 2019-05-16 14:52 Igor Russkikh
  2019-05-16 14:52 ` [PATCH net 1/3] Revert "aqc111: fix double endianness swap on BE" Igor Russkikh
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Igor Russkikh @ 2019-05-16 14:52 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Oliver Neukum, Dmitry Bezrukov, Igor Russkikh

Hello!

This reverts no-op commits as it was discussed:

https://lore.kernel.org/netdev/1557839644.11261.4.camel@suse.com/

First and second original patches are already dropped from stable,
No need to stable-queue the third patch as it has no functional impact,
just a logic cleanup.

Igor Russkikh (3):
  Revert "aqc111: fix double endianness swap on BE"
  Revert "aqc111: fix writing to the phy on BE"
  aqc111: cleanup mtu related logic

 drivers/net/usb/aqc111.c | 35 ++++++++++-------------------------
 1 file changed, 10 insertions(+), 25 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net 1/3] Revert "aqc111: fix double endianness swap on BE"
  2019-05-16 14:52 [PATCH net 0/3] aqc111: revert endianess fixes and cleanup mtu logic Igor Russkikh
@ 2019-05-16 14:52 ` Igor Russkikh
  2019-05-16 14:52 ` [PATCH net 2/3] Revert "aqc111: fix writing to the phy " Igor Russkikh
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Igor Russkikh @ 2019-05-16 14:52 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Oliver Neukum, Dmitry Bezrukov, Igor Russkikh

This reverts commit 2cf672709beb005f6e90cb4edbed6f2218ba953e.

The required temporary storage is already done inside of write32/16
helpers.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/usb/aqc111.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
index b86c5ce9a92a..599d560a8450 100644
--- a/drivers/net/usb/aqc111.c
+++ b/drivers/net/usb/aqc111.c
@@ -1428,7 +1428,7 @@ static int aqc111_resume(struct usb_interface *intf)
 {
 	struct usbnet *dev = usb_get_intfdata(intf);
 	struct aqc111_data *aqc111_data = dev->driver_priv;
-	u16 reg16, oldreg16;
+	u16 reg16;
 	u8 reg8;
 
 	netif_carrier_off(dev->net);
@@ -1444,11 +1444,9 @@ static int aqc111_resume(struct usb_interface *intf)
 	/* Configure RX control register => start operation */
 	reg16 = aqc111_data->rxctl;
 	reg16 &= ~SFR_RX_CTL_START;
-	/* needs to be saved in case endianness is swapped */
-	oldreg16 = reg16;
 	aqc111_write16_cmd_nopm(dev, AQ_ACCESS_MAC, SFR_RX_CTL, 2, &reg16);
 
-	reg16 = oldreg16 | SFR_RX_CTL_START;
+	reg16 |= SFR_RX_CTL_START;
 	aqc111_write16_cmd_nopm(dev, AQ_ACCESS_MAC, SFR_RX_CTL, 2, &reg16);
 
 	aqc111_set_phy_speed(dev, aqc111_data->autoneg,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 2/3] Revert "aqc111: fix writing to the phy on BE"
  2019-05-16 14:52 [PATCH net 0/3] aqc111: revert endianess fixes and cleanup mtu logic Igor Russkikh
  2019-05-16 14:52 ` [PATCH net 1/3] Revert "aqc111: fix double endianness swap on BE" Igor Russkikh
@ 2019-05-16 14:52 ` Igor Russkikh
  2019-05-16 14:52 ` [PATCH net 3/3] aqc111: cleanup mtu related logic Igor Russkikh
  2019-05-16 21:25 ` [PATCH net 0/3] aqc111: revert endianess fixes and cleanup mtu logic David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Igor Russkikh @ 2019-05-16 14:52 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Oliver Neukum, Dmitry Bezrukov, Igor Russkikh

This reverts commit 369b46e9fbcfa5136f2cb5f486c90e5f7fa92630.

The required temporary storage is already done inside of write32/16
helpers.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/usb/aqc111.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
index 599d560a8450..408df2d335e3 100644
--- a/drivers/net/usb/aqc111.c
+++ b/drivers/net/usb/aqc111.c
@@ -320,7 +320,6 @@ static int aqc111_get_link_ksettings(struct net_device *net,
 static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed)
 {
 	struct aqc111_data *aqc111_data = dev->driver_priv;
-	u32 phy_on_the_wire;
 
 	aqc111_data->phy_cfg &= ~AQ_ADV_MASK;
 	aqc111_data->phy_cfg |= AQ_PAUSE;
@@ -362,8 +361,7 @@ static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed)
 		}
 	}
 
-	phy_on_the_wire = aqc111_data->phy_cfg;
-	aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, &phy_on_the_wire);
+	aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, &aqc111_data->phy_cfg);
 }
 
 static int aqc111_set_link_ksettings(struct net_device *net,
@@ -757,7 +755,6 @@ static void aqc111_unbind(struct usbnet *dev, struct usb_interface *intf)
 {
 	struct aqc111_data *aqc111_data = dev->driver_priv;
 	u16 reg16;
-	u32 phy_on_the_wire;
 
 	/* Force bz */
 	reg16 = SFR_PHYPWR_RSTCTL_BZ;
@@ -771,9 +768,8 @@ static void aqc111_unbind(struct usbnet *dev, struct usb_interface *intf)
 	aqc111_data->phy_cfg &= ~AQ_ADV_MASK;
 	aqc111_data->phy_cfg |= AQ_LOW_POWER;
 	aqc111_data->phy_cfg &= ~AQ_PHY_POWER_EN;
-	phy_on_the_wire = aqc111_data->phy_cfg;
 	aqc111_write32_cmd_nopm(dev, AQ_PHY_OPS, 0, 0,
-				&phy_on_the_wire);
+				&aqc111_data->phy_cfg);
 
 	kfree(aqc111_data);
 }
@@ -996,7 +992,6 @@ static int aqc111_reset(struct usbnet *dev)
 {
 	struct aqc111_data *aqc111_data = dev->driver_priv;
 	u8 reg8 = 0;
-	u32 phy_on_the_wire;
 
 	dev->rx_urb_size = URB_SIZE;
 
@@ -1009,9 +1004,8 @@ static int aqc111_reset(struct usbnet *dev)
 
 	/* Power up ethernet PHY */
 	aqc111_data->phy_cfg = AQ_PHY_POWER_EN;
-	phy_on_the_wire = aqc111_data->phy_cfg;
 	aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0,
-			   &phy_on_the_wire);
+			   &aqc111_data->phy_cfg);
 
 	/* Set the MAC address */
 	aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_NODE_ID, ETH_ALEN,
@@ -1042,7 +1036,6 @@ static int aqc111_stop(struct usbnet *dev)
 {
 	struct aqc111_data *aqc111_data = dev->driver_priv;
 	u16 reg16 = 0;
-	u32 phy_on_the_wire;
 
 	aqc111_read16_cmd(dev, AQ_ACCESS_MAC, SFR_MEDIUM_STATUS_MODE,
 			  2, &reg16);
@@ -1054,9 +1047,8 @@ static int aqc111_stop(struct usbnet *dev)
 
 	/* Put PHY to low power*/
 	aqc111_data->phy_cfg |= AQ_LOW_POWER;
-	phy_on_the_wire = aqc111_data->phy_cfg;
 	aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0,
-			   &phy_on_the_wire);
+			   &aqc111_data->phy_cfg);
 
 	netif_carrier_off(dev->net);
 
@@ -1332,7 +1324,6 @@ static int aqc111_suspend(struct usb_interface *intf, pm_message_t message)
 	u16 temp_rx_ctrl = 0x00;
 	u16 reg16;
 	u8 reg8;
-	u32 phy_on_the_wire;
 
 	usbnet_suspend(intf, message);
 
@@ -1404,14 +1395,12 @@ static int aqc111_suspend(struct usb_interface *intf, pm_message_t message)
 
 		aqc111_write_cmd(dev, AQ_WOL_CFG, 0, 0,
 				 WOL_CFG_SIZE, &wol_cfg);
-		phy_on_the_wire = aqc111_data->phy_cfg;
 		aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0,
-				   &phy_on_the_wire);
+				   &aqc111_data->phy_cfg);
 	} else {
 		aqc111_data->phy_cfg |= AQ_LOW_POWER;
-		phy_on_the_wire = aqc111_data->phy_cfg;
 		aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0,
-				   &phy_on_the_wire);
+				   &aqc111_data->phy_cfg);
 
 		/* Disable RX path */
 		aqc111_read16_cmd_nopm(dev, AQ_ACCESS_MAC,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 3/3] aqc111: cleanup mtu related logic
  2019-05-16 14:52 [PATCH net 0/3] aqc111: revert endianess fixes and cleanup mtu logic Igor Russkikh
  2019-05-16 14:52 ` [PATCH net 1/3] Revert "aqc111: fix double endianness swap on BE" Igor Russkikh
  2019-05-16 14:52 ` [PATCH net 2/3] Revert "aqc111: fix writing to the phy " Igor Russkikh
@ 2019-05-16 14:52 ` Igor Russkikh
  2019-05-16 21:25 ` [PATCH net 0/3] aqc111: revert endianess fixes and cleanup mtu logic David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Igor Russkikh @ 2019-05-16 14:52 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, Oliver Neukum, Dmitry Bezrukov, Igor Russkikh

Original fix b8b277525e9d was done under impression that invalid data
could be written for mtu configuration higher that 16334.

But the high limit will anyway be rejected my max_mtu check in caller.
Thus, make the code cleaner and allow it doing the configuration without
checking for maximum mtu value.

Fixes: b8b277525e9d ("aqc111: fix endianness issue in aqc111_change_mtu")
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/usb/aqc111.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
index 408df2d335e3..7e44110746dd 100644
--- a/drivers/net/usb/aqc111.c
+++ b/drivers/net/usb/aqc111.c
@@ -437,7 +437,7 @@ static int aqc111_change_mtu(struct net_device *net, int new_mtu)
 	aqc111_write16_cmd(dev, AQ_ACCESS_MAC, SFR_MEDIUM_STATUS_MODE,
 			   2, &reg16);
 
-	if (dev->net->mtu > 12500 && dev->net->mtu <= 16334) {
+	if (dev->net->mtu > 12500) {
 		memcpy(buf, &AQC111_BULKIN_SIZE[2], 5);
 		/* RX bulk configuration */
 		aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_RX_BULKIN_QCTRL,
@@ -451,10 +451,8 @@ static int aqc111_change_mtu(struct net_device *net, int new_mtu)
 		reg16 = 0x1020;
 	else if (dev->net->mtu <= 12500)
 		reg16 = 0x1420;
-	else if (dev->net->mtu <= 16334)
-		reg16 = 0x1A20;
 	else
-		return 0;
+		reg16 = 0x1A20;
 
 	aqc111_write16_cmd(dev, AQ_ACCESS_MAC, SFR_PAUSE_WATERLVL_LOW,
 			   2, &reg16);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net 0/3] aqc111: revert endianess fixes and cleanup mtu logic
  2019-05-16 14:52 [PATCH net 0/3] aqc111: revert endianess fixes and cleanup mtu logic Igor Russkikh
                   ` (2 preceding siblings ...)
  2019-05-16 14:52 ` [PATCH net 3/3] aqc111: cleanup mtu related logic Igor Russkikh
@ 2019-05-16 21:25 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-05-16 21:25 UTC (permalink / raw)
  To: Igor.Russkikh; +Cc: netdev, oneukum, Dmitry.Bezrukov

From: Igor Russkikh <Igor.Russkikh@aquantia.com>
Date: Thu, 16 May 2019 14:52:18 +0000

> This reverts no-op commits as it was discussed:
> 
> https://lore.kernel.org/netdev/1557839644.11261.4.camel@suse.com/
> 
> First and second original patches are already dropped from stable,
> No need to stable-queue the third patch as it has no functional impact,
> just a logic cleanup.

Series applied, thank you.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-05-16 21:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 14:52 [PATCH net 0/3] aqc111: revert endianess fixes and cleanup mtu logic Igor Russkikh
2019-05-16 14:52 ` [PATCH net 1/3] Revert "aqc111: fix double endianness swap on BE" Igor Russkikh
2019-05-16 14:52 ` [PATCH net 2/3] Revert "aqc111: fix writing to the phy " Igor Russkikh
2019-05-16 14:52 ` [PATCH net 3/3] aqc111: cleanup mtu related logic Igor Russkikh
2019-05-16 21:25 ` [PATCH net 0/3] aqc111: revert endianess fixes and cleanup mtu logic David Miller

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.