netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3.16]r8169:  Implement definitions from linux/mii.h header
@ 2016-03-25 10:25 Corcodel Marian
  2016-03-25 11:46 ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Corcodel Marian @ 2016-03-25 10:25 UTC (permalink / raw)
  To: netdev; +Cc: Francois Romieu, Corcodel Marian

 Add definitions from mii and inhibit 0 to advertise.

Signed-off-by: Corcodel Marian <asd@marian1000.go.ro>
---
 drivers/net/ethernet/realtek/r8169.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index a57b650..a450656 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1679,29 +1679,19 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
 		int auto_nego;
 
 		auto_nego = rtl_readphy(tp, MII_ADVERTISE);
-		auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL |
-				ADVERTISE_100HALF | ADVERTISE_100FULL);
-
-		if (adv & ADVERTISED_10baseT_Half)
-			auto_nego |= ADVERTISE_10HALF;
-		if (adv & ADVERTISED_10baseT_Full)
-			auto_nego |= ADVERTISE_10FULL;
-		if (adv & ADVERTISED_100baseT_Half)
-			auto_nego |= ADVERTISE_100HALF;
-		if (adv & ADVERTISED_100baseT_Full)
-			auto_nego |= ADVERTISE_100FULL;
+		auto_nego &= ~(0 | ADVERTISE_10HALF | ADVERTISE_10FULL |
+				ADVERTISE_100HALF | ADVERTISE_100FULL |
+				ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM);
 
+		auto_nego |= ethtool_adv_to_mii_adv_t(adv);
 		auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
 
 		giga_ctrl = rtl_readphy(tp, MII_CTRL1000);
-		giga_ctrl &= ~(ADVERTISE_1000FULL | ADVERTISE_1000HALF);
+		giga_ctrl &= ~(0 | ADVERTISE_1000FULL | ADVERTISE_1000HALF);
 
 		/* The 8100e/8101e/8102e do Fast Ethernet only. */
 		if (tp->mii.supports_gmii) {
-			if (adv & ADVERTISED_1000baseT_Half)
-				giga_ctrl |= ADVERTISE_1000HALF;
-			if (adv & ADVERTISED_1000baseT_Full)
-				giga_ctrl |= ADVERTISE_1000FULL;
+			giga_ctrl |= ethtool_adv_to_mii_ctrl1000_t(adv);
 		} else if (adv & (ADVERTISED_1000baseT_Half |
 				  ADVERTISED_1000baseT_Full)) {
 			netif_info(tp, link, dev,
-- 
2.1.4

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

* Re: [PATCH net-next v3.16]r8169: Implement definitions from linux/mii.h header
  2016-03-25 10:25 [PATCH net-next v3.16]r8169: Implement definitions from linux/mii.h header Corcodel Marian
@ 2016-03-25 11:46 ` Sergei Shtylyov
  2016-03-25 14:00   ` Corcodel Marian
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2016-03-25 11:46 UTC (permalink / raw)
  To: Corcodel Marian, netdev; +Cc: Francois Romieu

Hello.

On 3/25/2016 1:25 PM, Corcodel Marian wrote:

>   Add definitions from mii and inhibit 0 to advertise.
>
> Signed-off-by: Corcodel Marian <asd@marian1000.go.ro>
> ---
>   drivers/net/ethernet/realtek/r8169.c | 22 ++++++----------------
>   1 file changed, 6 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index a57b650..a450656 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
> @@ -1679,29 +1679,19 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
>   		int auto_nego;
>
>   		auto_nego = rtl_readphy(tp, MII_ADVERTISE);
> -		auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL |
> -				ADVERTISE_100HALF | ADVERTISE_100FULL);
> -
> -		if (adv & ADVERTISED_10baseT_Half)
> -			auto_nego |= ADVERTISE_10HALF;
> -		if (adv & ADVERTISED_10baseT_Full)
> -			auto_nego |= ADVERTISE_10FULL;
> -		if (adv & ADVERTISED_100baseT_Half)
> -			auto_nego |= ADVERTISE_100HALF;
> -		if (adv & ADVERTISED_100baseT_Full)
> -			auto_nego |= ADVERTISE_100FULL;
> +		auto_nego &= ~(0 | ADVERTISE_10HALF | ADVERTISE_10FULL |

    ORing with 0 doesn't change the result.

> +				ADVERTISE_100HALF | ADVERTISE_100FULL |
> +				ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM);
>
> +		auto_nego |= ethtool_adv_to_mii_adv_t(adv);
>   		auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
>
>   		giga_ctrl = rtl_readphy(tp, MII_CTRL1000);
> -		giga_ctrl &= ~(ADVERTISE_1000FULL | ADVERTISE_1000HALF);
> +		giga_ctrl &= ~(0 | ADVERTISE_1000FULL | ADVERTISE_1000HALF);

    Likewise.

[...]

MBR, Sergei

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

* Re: [PATCH net-next v3.16]r8169: Implement definitions from linux/mii.h header
  2016-03-25 11:46 ` Sergei Shtylyov
@ 2016-03-25 14:00   ` Corcodel Marian
  0 siblings, 0 replies; 3+ messages in thread
From: Corcodel Marian @ 2016-03-25 14:00 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev, Francois Romieu

On Fri, 25 Mar 2016 14:46:03 +0300
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:

> Hello.
> 
> On 3/25/2016 1:25 PM, Corcodel Marian wrote:
> 
> >   Add definitions from mii and inhibit 0 to advertise.
> >
> > Signed-off-by: Corcodel Marian <asd@marian1000.go.ro>
> > ---
> >   drivers/net/ethernet/realtek/r8169.c | 22 ++++++----------------
> >   1 file changed, 6 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/realtek/r8169.c
> > b/drivers/net/ethernet/realtek/r8169.c index a57b650..a450656 100644
> > --- a/drivers/net/ethernet/realtek/r8169.c
> > +++ b/drivers/net/ethernet/realtek/r8169.c
> > @@ -1679,29 +1679,19 @@ static int rtl8169_set_speed_xmii(struct
> > net_device *dev, int auto_nego;
> >
> >   		auto_nego = rtl_readphy(tp, MII_ADVERTISE);
> > -		auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL
> > |
> > -				ADVERTISE_100HALF |
> > ADVERTISE_100FULL); -
> > -		if (adv & ADVERTISED_10baseT_Half)
> > -			auto_nego |= ADVERTISE_10HALF;
> > -		if (adv & ADVERTISED_10baseT_Full)
> > -			auto_nego |= ADVERTISE_10FULL;
> > -		if (adv & ADVERTISED_100baseT_Half)
> > -			auto_nego |= ADVERTISE_100HALF;
> > -		if (adv & ADVERTISED_100baseT_Full)
> > -			auto_nego |= ADVERTISE_100FULL;
> > +		auto_nego &= ~(0 | ADVERTISE_10HALF |
> > ADVERTISE_10FULL |
> 
>     ORing with 0 doesn't change the result.
> 
> > +				ADVERTISE_100HALF |
> > ADVERTISE_100FULL |
> > +				ADVERTISE_PAUSE_CAP |
> > ADVERTISE_PAUSE_ASYM);
> >
> > +		auto_nego |= ethtool_adv_to_mii_adv_t(adv);
> >   		auto_nego |= ADVERTISE_PAUSE_CAP |
> > ADVERTISE_PAUSE_ASYM;
> >
> >   		giga_ctrl = rtl_readphy(tp, MII_CTRL1000);
> > -		giga_ctrl &= ~(ADVERTISE_1000FULL |
> > ADVERTISE_1000HALF);
> > +		giga_ctrl &= ~(0 | ADVERTISE_1000FULL |
> > ADVERTISE_1000HALF);
> 
>     Likewise.
> 
> [...]
> 
> MBR, Sergei
> 

>Zero not change result but is defined mii_adv_to_ethtool_adv_t,
>ethtool_adv_to_mii_ctrl1000_t and not want to set because on
>first bit from register is set on default and only 
>CSMA/CD protocol is supported.For more info see mii.h file from
>kernel

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

end of thread, other threads:[~2016-03-25 14:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-25 10:25 [PATCH net-next v3.16]r8169: Implement definitions from linux/mii.h header Corcodel Marian
2016-03-25 11:46 ` Sergei Shtylyov
2016-03-25 14:00   ` Corcodel Marian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).