diff mbox series

[net-next,v1,1/1] net: asix: add optional flow control support

Message ID 20220624080208.3143093-1-o.rempel@pengutronix.de (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v1,1/1] net: asix: add optional flow control support | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 4 maintainers not CCed: paskripkin@gmail.com linux-usb@vger.kernel.org andrew@lunn.ch linux@rempel-privat.de
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Oleksij Rempel June 24, 2022, 8:02 a.m. UTC
Add optional flow control support with respect to the link partners
abilities.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/usb/asix_common.c  | 10 ++++++++++
 drivers/net/usb/asix_devices.c |  2 ++
 2 files changed, 12 insertions(+)

Comments

Oleksij Rempel June 24, 2022, 8:03 a.m. UTC | #1
On Fri, Jun 24, 2022 at 10:02:07AM +0200, Oleksij Rempel wrote:
> Add optional flow control support with respect to the link partners
> abilities.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

This is a net-next patch, depending on other net patch:
https://lore.kernel.org/all/20220624075139.3139300-2-o.rempel@pengutronix.de/

> ---
>  drivers/net/usb/asix_common.c  | 10 ++++++++++
>  drivers/net/usb/asix_devices.c |  2 ++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
> index b4a1b7abcfc9..c9df7cd8daae 100644
> --- a/drivers/net/usb/asix_common.c
> +++ b/drivers/net/usb/asix_common.c
> @@ -420,6 +420,8 @@ void asix_adjust_link(struct net_device *netdev)
>  	u16 mode = 0;
>  
>  	if (phydev->link) {
> +		bool tx_pause, rx_pause;
> +
>  		mode = AX88772_MEDIUM_DEFAULT;
>  
>  		if (phydev->duplex == DUPLEX_HALF)
> @@ -427,6 +429,14 @@ void asix_adjust_link(struct net_device *netdev)
>  
>  		if (phydev->speed != SPEED_100)
>  			mode &= ~AX_MEDIUM_PS;
> +
> +		phy_get_pause(phydev, &tx_pause, &rx_pause);
> +
> +		if (rx_pause)
> +			mode |= AX_MEDIUM_RFC;
> +
> +		if (tx_pause)
> +			mode |= AX_MEDIUM_TFC;
>  	}
>  
>  	asix_write_medium_mode(dev, mode, 0);
> diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
> index 5b5eb630c4b7..1bb12bbc34bf 100644
> --- a/drivers/net/usb/asix_devices.c
> +++ b/drivers/net/usb/asix_devices.c
> @@ -677,6 +677,8 @@ static int ax88772_init_phy(struct usbnet *dev)
>  	phy_suspend(priv->phydev);
>  	priv->phydev->mac_managed_pm = 1;
>  
> +	phy_support_asym_pause(priv->phydev);
> +
>  	phy_attached_info(priv->phydev);
>  
>  	if (priv->embd_phy)
> -- 
> 2.30.2
> 
>
Jakub Kicinski June 24, 2022, 5:23 p.m. UTC | #2
On Fri, 24 Jun 2022 10:03:37 +0200 Oleksij Rempel wrote:
> On Fri, Jun 24, 2022 at 10:02:07AM +0200, Oleksij Rempel wrote:
> > Add optional flow control support with respect to the link partners
> > abilities.
> > 
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>  
> 
> This is a net-next patch, depending on other net patch:
> https://lore.kernel.org/all/20220624075139.3139300-2-o.rempel@pengutronix.de/

Unfortunately you're gonna have to repost if there's a dependency.
We're a full week away from the fixes making it to net-next, so
too long to keep a patch sitting in pw with the current patch rate.
diff mbox series

Patch

diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index b4a1b7abcfc9..c9df7cd8daae 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -420,6 +420,8 @@  void asix_adjust_link(struct net_device *netdev)
 	u16 mode = 0;
 
 	if (phydev->link) {
+		bool tx_pause, rx_pause;
+
 		mode = AX88772_MEDIUM_DEFAULT;
 
 		if (phydev->duplex == DUPLEX_HALF)
@@ -427,6 +429,14 @@  void asix_adjust_link(struct net_device *netdev)
 
 		if (phydev->speed != SPEED_100)
 			mode &= ~AX_MEDIUM_PS;
+
+		phy_get_pause(phydev, &tx_pause, &rx_pause);
+
+		if (rx_pause)
+			mode |= AX_MEDIUM_RFC;
+
+		if (tx_pause)
+			mode |= AX_MEDIUM_TFC;
 	}
 
 	asix_write_medium_mode(dev, mode, 0);
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 5b5eb630c4b7..1bb12bbc34bf 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -677,6 +677,8 @@  static int ax88772_init_phy(struct usbnet *dev)
 	phy_suspend(priv->phydev);
 	priv->phydev->mac_managed_pm = 1;
 
+	phy_support_asym_pause(priv->phydev);
+
 	phy_attached_info(priv->phydev);
 
 	if (priv->embd_phy)