netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] b44: fix manual speed/duplex/autoneg settings
@ 2006-06-16 19:19 Gary Zambrano
  2006-06-20  8:42 ` Jeff Garzik
  2006-06-20 22:34 ` [PATCH 1/6 resend] " Gary Zambrano
  0 siblings, 2 replies; 5+ messages in thread
From: Gary Zambrano @ 2006-06-16 19:19 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Fixes for speed/duplex/autoneg settings and driver settings info.
This is a redo of a previous patch thanks to feedback from Jeff Garzik.

Signed-off-by: Gary Zambrano <zambrano@broadcom.com>

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index d8233e0..41b1618 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1620,8 +1620,6 @@ static int b44_get_settings(struct net_d
 {
 	struct b44 *bp = netdev_priv(dev);

-	if (!netif_running(dev))
-		return -EAGAIN;
 	cmd->supported = (SUPPORTED_Autoneg);
 	cmd->supported |= (SUPPORTED_100baseT_Half |
 			  SUPPORTED_100baseT_Full |
@@ -1649,6 +1647,12 @@ static int b44_get_settings(struct net_d
 		XCVR_INTERNAL : XCVR_EXTERNAL;
 	cmd->autoneg = (bp->flags & B44_FLAG_FORCE_LINK) ?
 		AUTONEG_DISABLE : AUTONEG_ENABLE;
+	if (cmd->autoneg == AUTONEG_ENABLE)
+		cmd->advertising |= ADVERTISED_Autoneg;
+	if (!netif_running(dev)){
+		cmd->speed = 0;
+		cmd->duplex = 0xff;
+	}
 	cmd->maxtxpkt = 0;
 	cmd->maxrxpkt = 0;
 	return 0;
@@ -1658,9 +1662,6 @@ static int b44_set_settings(struct net_d
 {
 	struct b44 *bp = netdev_priv(dev);

-	if (!netif_running(dev))
-		return -EAGAIN;
-
 	/* We do not support gigabit. */
 	if (cmd->autoneg == AUTONEG_ENABLE) {
 		if (cmd->advertising &
@@ -1677,28 +1678,39 @@ static int b44_set_settings(struct net_d
 	spin_lock_irq(&bp->lock);

 	if (cmd->autoneg == AUTONEG_ENABLE) {
-		bp->flags &= ~B44_FLAG_FORCE_LINK;
-		bp->flags &= ~(B44_FLAG_ADV_10HALF |
+		bp->flags &= ~(B44_FLAG_FORCE_LINK |
+			       B44_FLAG_100_BASE_T |
+			       B44_FLAG_FULL_DUPLEX |
+			       B44_FLAG_ADV_10HALF |
 			       B44_FLAG_ADV_10FULL |
 			       B44_FLAG_ADV_100HALF |
 			       B44_FLAG_ADV_100FULL);
-		if (cmd->advertising & ADVERTISE_10HALF)
-			bp->flags |= B44_FLAG_ADV_10HALF;
-		if (cmd->advertising & ADVERTISE_10FULL)
-			bp->flags |= B44_FLAG_ADV_10FULL;
-		if (cmd->advertising & ADVERTISE_100HALF)
-			bp->flags |= B44_FLAG_ADV_100HALF;
-		if (cmd->advertising & ADVERTISE_100FULL)
-			bp->flags |= B44_FLAG_ADV_100FULL;
+		if (cmd->advertising == 0) {
+			bp->flags |= (B44_FLAG_ADV_10HALF |
+				      B44_FLAG_ADV_10FULL |
+				      B44_FLAG_ADV_100HALF |
+				      B44_FLAG_ADV_100FULL);
+		} else {
+			if (cmd->advertising & ADVERTISED_10baseT_Half)
+				bp->flags |= B44_FLAG_ADV_10HALF;
+			if (cmd->advertising & ADVERTISED_10baseT_Full)
+				bp->flags |= B44_FLAG_ADV_10FULL;
+			if (cmd->advertising & ADVERTISED_100baseT_Half)
+				bp->flags |= B44_FLAG_ADV_100HALF;
+			if (cmd->advertising & ADVERTISED_100baseT_Full)
+				bp->flags |= B44_FLAG_ADV_100FULL;
+		}
 	} else {
 		bp->flags |= B44_FLAG_FORCE_LINK;
+		bp->flags &= ~(B44_FLAG_100_BASE_T | B44_FLAG_FULL_DUPLEX);
 		if (cmd->speed == SPEED_100)
 			bp->flags |= B44_FLAG_100_BASE_T;
 		if (cmd->duplex == DUPLEX_FULL)
 			bp->flags |= B44_FLAG_FULL_DUPLEX;
 	}

-	b44_setup_phy(bp);
+	if (netif_running(dev))
+		b44_setup_phy(bp);

 	spin_unlock_irq(&bp->lock);



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

* Re: [PATCH 1/6] b44: fix manual speed/duplex/autoneg settings
  2006-06-16 19:19 [PATCH 1/6] b44: fix manual speed/duplex/autoneg settings Gary Zambrano
@ 2006-06-20  8:42 ` Jeff Garzik
  2006-06-20 22:34   ` Gary Zambrano
  2006-06-20 22:34 ` [PATCH 1/6 resend] " Gary Zambrano
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2006-06-20  8:42 UTC (permalink / raw)
  To: Gary Zambrano; +Cc: netdev

Gary Zambrano wrote:
> Fixes for speed/duplex/autoneg settings and driver settings info.
> This is a redo of a previous patch thanks to feedback from Jeff Garzik.

ACK patches 1-6, but unfortunately failed to apply against latest 
linux-2.6.git:

> [jgarzik@pretzel netdev-2.6]$ git-applymbox /g/tmp/mbox ~/info/signoff.txt
> 6 patch(es) to process.
> 
> Applying 'b44: fix manual speed/duplex/autoneg settings'
> 
> fatal: corrupt patch at line 8


Also, I think I misunderstood the code in our last discussion.  You may 
be right about the advertise-all logic.

	Jeff



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

* Re: [PATCH 1/6] b44: fix manual speed/duplex/autoneg settings
  2006-06-20  8:42 ` Jeff Garzik
@ 2006-06-20 22:34   ` Gary Zambrano
  0 siblings, 0 replies; 5+ messages in thread
From: Gary Zambrano @ 2006-06-20 22:34 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

On Tue, 2006-06-20 at 04:42 -0400, Jeff Garzik wrote:

> ACK patches 1-6, but unfortunately failed to apply against latest 
> linux-2.6.git:
> 
> > [jgarzik@pretzel netdev-2.6]$ git-applymbox /g/tmp/mbox ~/info/signoff.txt
> > 6 patch(es) to process.
> > 
> > Applying 'b44: fix manual speed/duplex/autoneg settings'
> > 
> > fatal: corrupt patch at line 8

Sorry about that. 
They patch ok when using patch, however, the apply failure appears to be
related to me using git-stripspace on the patches before submitting
them.

I am resending patches that have not been git-stripspaced, so you should
not have the apply problem with the resend patches.

Thanks.


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

* [PATCH 1/6 resend] b44: fix manual speed/duplex/autoneg settings
  2006-06-16 19:19 [PATCH 1/6] b44: fix manual speed/duplex/autoneg settings Gary Zambrano
  2006-06-20  8:42 ` Jeff Garzik
@ 2006-06-20 22:34 ` Gary Zambrano
  2006-06-23  3:16   ` Jeff Garzik
  1 sibling, 1 reply; 5+ messages in thread
From: Gary Zambrano @ 2006-06-20 22:34 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Fixes for speed/duplex/autoneg settings and driver settings info.
This is a redo of a previous patch thanks to feedback from Jeff Garzik.

Signed-off-by: Gary Zambrano <zambrano@broadcom.com>

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index d8233e0..41b1618 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1620,8 +1620,6 @@ static int b44_get_settings(struct net_d
 {
 	struct b44 *bp = netdev_priv(dev);
 
-	if (!netif_running(dev))
-		return -EAGAIN;
 	cmd->supported = (SUPPORTED_Autoneg);
 	cmd->supported |= (SUPPORTED_100baseT_Half |
 			  SUPPORTED_100baseT_Full |
@@ -1649,6 +1647,12 @@ static int b44_get_settings(struct net_d
 		XCVR_INTERNAL : XCVR_EXTERNAL;
 	cmd->autoneg = (bp->flags & B44_FLAG_FORCE_LINK) ?
 		AUTONEG_DISABLE : AUTONEG_ENABLE;
+	if (cmd->autoneg == AUTONEG_ENABLE)
+		cmd->advertising |= ADVERTISED_Autoneg;
+	if (!netif_running(dev)){
+		cmd->speed = 0;
+		cmd->duplex = 0xff;
+	}
 	cmd->maxtxpkt = 0;
 	cmd->maxrxpkt = 0;
 	return 0;
@@ -1658,9 +1662,6 @@ static int b44_set_settings(struct net_d
 {
 	struct b44 *bp = netdev_priv(dev);
 
-	if (!netif_running(dev))
-		return -EAGAIN;
-
 	/* We do not support gigabit. */
 	if (cmd->autoneg == AUTONEG_ENABLE) {
 		if (cmd->advertising &
@@ -1677,28 +1678,39 @@ static int b44_set_settings(struct net_d
 	spin_lock_irq(&bp->lock);
 
 	if (cmd->autoneg == AUTONEG_ENABLE) {
-		bp->flags &= ~B44_FLAG_FORCE_LINK;
-		bp->flags &= ~(B44_FLAG_ADV_10HALF |
+		bp->flags &= ~(B44_FLAG_FORCE_LINK |
+			       B44_FLAG_100_BASE_T |
+			       B44_FLAG_FULL_DUPLEX |
+			       B44_FLAG_ADV_10HALF |
 			       B44_FLAG_ADV_10FULL |
 			       B44_FLAG_ADV_100HALF |
 			       B44_FLAG_ADV_100FULL);
-		if (cmd->advertising & ADVERTISE_10HALF)
-			bp->flags |= B44_FLAG_ADV_10HALF;
-		if (cmd->advertising & ADVERTISE_10FULL)
-			bp->flags |= B44_FLAG_ADV_10FULL;
-		if (cmd->advertising & ADVERTISE_100HALF)
-			bp->flags |= B44_FLAG_ADV_100HALF;
-		if (cmd->advertising & ADVERTISE_100FULL)
-			bp->flags |= B44_FLAG_ADV_100FULL;
+		if (cmd->advertising == 0) {
+			bp->flags |= (B44_FLAG_ADV_10HALF |
+				      B44_FLAG_ADV_10FULL |
+				      B44_FLAG_ADV_100HALF |
+				      B44_FLAG_ADV_100FULL);
+		} else {
+			if (cmd->advertising & ADVERTISED_10baseT_Half)
+				bp->flags |= B44_FLAG_ADV_10HALF;
+			if (cmd->advertising & ADVERTISED_10baseT_Full)
+				bp->flags |= B44_FLAG_ADV_10FULL;
+			if (cmd->advertising & ADVERTISED_100baseT_Half)
+				bp->flags |= B44_FLAG_ADV_100HALF;
+			if (cmd->advertising & ADVERTISED_100baseT_Full)
+				bp->flags |= B44_FLAG_ADV_100FULL;
+		}
 	} else {
 		bp->flags |= B44_FLAG_FORCE_LINK;
+		bp->flags &= ~(B44_FLAG_100_BASE_T | B44_FLAG_FULL_DUPLEX);
 		if (cmd->speed == SPEED_100)
 			bp->flags |= B44_FLAG_100_BASE_T;
 		if (cmd->duplex == DUPLEX_FULL)
 			bp->flags |= B44_FLAG_FULL_DUPLEX;
 	}
 
-	b44_setup_phy(bp);
+	if (netif_running(dev))
+		b44_setup_phy(bp);
 
 	spin_unlock_irq(&bp->lock);
 



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

* Re: [PATCH 1/6 resend] b44: fix manual speed/duplex/autoneg settings
  2006-06-20 22:34 ` [PATCH 1/6 resend] " Gary Zambrano
@ 2006-06-23  3:16   ` Jeff Garzik
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2006-06-23  3:16 UTC (permalink / raw)
  To: Gary Zambrano; +Cc: netdev

applied patches 1-6



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

end of thread, other threads:[~2006-06-23  3:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-16 19:19 [PATCH 1/6] b44: fix manual speed/duplex/autoneg settings Gary Zambrano
2006-06-20  8:42 ` Jeff Garzik
2006-06-20 22:34   ` Gary Zambrano
2006-06-20 22:34 ` [PATCH 1/6 resend] " Gary Zambrano
2006-06-23  3:16   ` Jeff Garzik

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).