Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 2.6.23-rc6 Resending] NETWORKING : Edge Triggered EPOLLOUT events get missed for TCP sockets
From: Eric Dumazet @ 2007-09-20  6:11 UTC (permalink / raw)
  To: Nagendra Tomar
  Cc: Davide Libenzi, David Miller, netdev, Linux Kernel Mailing List
In-Reply-To: <331107.71046.qm@web53704.mail.re2.yahoo.com>

Nagendra Tomar a écrit :
> --- Davide Libenzi <davidel@xmailserver.org> wrote:
> 
>> On Wed, 19 Sep 2007, David Miller wrote:
>>
>>> From: Nagendra Tomar <tomer_iisc@yahoo.com>
>>> Date: Wed, 19 Sep 2007 15:37:09 -0700 (PDT)
>>>
>>>> With the SOCK_NOSPACE check in tcp_check_space(), this epoll_wait call will 
>>>> not return, even when the incoming acks free the buffers.
>>>>         Note that this patch assumes that the SOCK_NOSPACE check in
>>>> tcp_check_space is a trivial optimization which can be safely removed.
>>> I already replied to your patch posting explaining that whatever is
>>> not setting SOCK_NOSPACE should be fixed instead.
>>>
>>> Please address that, thanks.
>> You're not planning of putting the notion of a SOCK_NOSPACE bit inside a 
>> completely device-unaware interface like epoll, I hope?
>>
> 
> Definitely not ! 
> 
> The point is that the "tcp write space available" 
> wakeup does not get called if SOCK_NOSPACE bit is not set. This was
> fine when the wakeup was merely a wakeup (since SOCK_NOSPACE bit 
> indicated that someone really cared abt the wakeup). Now after the
> introduction of callback'ed wakeups, we might have some work to
> do inside the callback even if there is nobody interested in the wakeup
> at that point of time. 
> 
> In this particular case the ep_poll_callback is not getting called and
> hence the socket fd is not getting added to the ready list.
> 

Does it means that with your patch each ACK on a ET managed socket will 
trigger an epoll event   ?

Maybe your very sensitive high throuput appication needs to set a flag or 
something at socket level to ask for such a behavior.

The default should stay as is. That is an event should be sent only if someone 
cared about the wakeup.


^ permalink raw reply

* [ofa-general] Re: [Bug, PATCH and another Bug] Was: Fix refcounting problem with netif_rx_reschedule()
From: Krishna Kumar2 @ 2007-09-20  5:54 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, rdreier, ossthema, general
In-Reply-To: <20070919.221224.26966518.davem@davemloft.net>

Ran 4/16/64 thread iperf on latest bits with this patch and no issues after
30 mins. I used to
consistently get the bug within 1-2 mins with just 4 threads prior to this
patch.

Tested-by: Krishna Kumar <krkumar2@in.ibm.com>
(if any value in that)

thanks,

- KK

David Miller <davem@davemloft.net> wrote on 09/20/2007 10:42:24 AM:

> From: Krishna Kumar2 <krkumar2@in.ibm.com>
> Date: Thu, 20 Sep 2007 10:40:33 +0530
>
> > I like the clean changes made by Dave to fix this, and will test it
> > today (if I can get my crashed system to come up).
>
> I would very much appreciate this testing, as I'm rather sure we've
> plugged up the most serious holes at this point.

^ permalink raw reply

* Re: [PATCH 2.6.23-rc6 Resending] NETWORKING : Edge Triggered EPOLLOUT events get missed for TCP sockets
From: Davide Libenzi @ 2007-09-20  5:43 UTC (permalink / raw)
  To: Nagendra Tomar; +Cc: David Miller, netdev, Linux Kernel Mailing List
In-Reply-To: <331107.71046.qm@web53704.mail.re2.yahoo.com>

On Wed, 19 Sep 2007, Nagendra Tomar wrote:

> Definitely not ! 
> 
> The point is that the "tcp write space available" 
> wakeup does not get called if SOCK_NOSPACE bit is not set. This was
> fine when the wakeup was merely a wakeup (since SOCK_NOSPACE bit 
> indicated that someone really cared abt the wakeup). Now after the
> introduction of callback'ed wakeups, we might have some work to
> do inside the callback even if there is nobody interested in the wakeup
> at that point of time. 
> 
> In this particular case the ep_poll_callback is not getting called and
> hence the socket fd is not getting added to the ready list.

I know, I saw the patch. I was just commenting the point where DaveM was 
heading to ;)
This things needs to be looked at a little bit more deeply.


- Davide



^ permalink raw reply

* Re: [Bug, PATCH and another Bug] Was: Fix refcounting problem with netif_rx_reschedule()
From: Krishna Kumar2 @ 2007-09-20  5:18 UTC (permalink / raw)
  To: David Miller; +Cc: general, netdev, rdreier
In-Reply-To: <20070919.090557.24612742.davem@davemloft.net>

Hi Dave,

David Miller <davem@davemloft.net> wrote on 09/19/2007 09:35:57 PM:

> The NAPI_STATE_SCHED flag bit should provide all of the necessary
> synchornization.
>
> Only the setter of that bit should add the NAPI instance to the
> polling list.
>
> The polling loop runs atomically on the cpu where the NAPI instance
> got added to the per-cpu polling list.  And therefore decisions to
> complete NAPI are serialized too.
>
> That serialized completion decision is also when the list deletion
> occurs.

About the "list deletion occurs", isn't the race I mentioned still present?
If done < budget, the driver does netif_rx_complete (at which time some
other
cpu can add this NAPI to their list). But the first cpu might do some more
actions on the napi, like ipoib_poll() calls request_notify_cq(priv->cq),
when other cpu might have started using this napi.

(net_rx_action's 'list_move' however will not execute since work != weight)

Thanks,

- KK


^ permalink raw reply

* Re: [Bug, PATCH and another Bug] Was: Fix refcounting problem with netif_rx_reschedule()
From: David Miller @ 2007-09-20  5:12 UTC (permalink / raw)
  To: krkumar2; +Cc: ossthema, general, netdev, raisch, rdreier
In-Reply-To: <OF42EA8B8A.CAFE186B-ON6525735C.001BE132-6525735C.001C6EC0@in.ibm.com>

From: Krishna Kumar2 <krkumar2@in.ibm.com>
Date: Thu, 20 Sep 2007 10:40:33 +0530

> I like the clean changes made by Dave to fix this, and will test it
> today (if I can get my crashed system to come up).

I would very much appreciate this testing, as I'm rather sure we've
plugged up the most serious holes at this point.

^ permalink raw reply

* Re: [Bug, PATCH and another Bug] Was: Fix refcounting problem with netif_rx_reschedule()
From: Krishna Kumar2 @ 2007-09-20  5:10 UTC (permalink / raw)
  To: Jan-Bernd Themann; +Cc: davem, general, netdev, Christoph Raisch, rdreier
In-Reply-To: <200709191523.48874.ossthema@de.ibm.com>

Hi Jan-Bernd,

Jan-Bernd Themann <ossthema@de.ibm.com> wrote on 09/19/2007 06:53:48 PM:

> If I understood it right the problem you describe (quota update in
> __napi_schdule) can cause further problems when you choose the
> following numbers:
>
> CPU1: A. process 99 pkts
> CPU1: B. netif_rx_complete()
> CPU2: interrupt occures, netif_rx_schedule is called, net_rx_action
triggerd:
> CPU2: C. set quota = 100 (__napi_schedule)
> CPU2: D. call poll(), process 1 pkt
> CPU2: D.2 call netif_rx_complete() (quota not exeeded)
> CPU2: E. net_rx_action: set quota=99
> CPU1: F. net_rx_action: set qutoa=99 - 99 = 0
> CPU1: G. modify list (list_move_tail) altough netif_rx_complete has been
called
>
> Step G would fail as the device is not in the list due
> to netif_rx_complete. This case can occur for all
> devices running on an SMP system where interrupts are not pinned.

I think list_move should be ok whether device is on the list or not.
But it should not come to that code since work (99) != weight (100).
If work == weight, then driver would not have done complete, and the
next/prev would not be set to POISON.

I like the clean changes made by Dave to fix this, and will test it
today (if I can get my crashed system to come up).

Thanks,

- KK


^ permalink raw reply

* [PATCH 1/6] sky2: fix VLAN receive processing
From: Stephen Hemminger @ 2007-09-20  5:06 UTC (permalink / raw)
  To: Jeff Garzk; +Cc: netdev, Pierre-Yves Ritschard
In-Reply-To: <20070920050559.763089637@linux-foundation.org>

[-- Attachment #1: sky2-vlan-len.patch --]
[-- Type: text/plain, Size: 2111 bytes --]

The length check for truncated frames was not correctly handling
the case where VLAN acceleration had already read the tag.
Also, the Yukon EX has some features that use high bit of status
as security tag.

Signed-off-by: Pierre-Yves Ritschard <pyr@spootnik.org>
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

--- a/drivers/net/sky2.c	2007-09-19 21:35:38.000000000 -0700
+++ b/drivers/net/sky2.c	2007-09-19 21:35:53.000000000 -0700
@@ -2146,6 +2146,13 @@ static struct sk_buff *sky2_receive(stru
  	struct sky2_port *sky2 = netdev_priv(dev);
 	struct rx_ring_info *re = sky2->rx_ring + sky2->rx_next;
 	struct sk_buff *skb = NULL;
+	u16 count = (status & GMR_FS_LEN) >> 16;
+
+#ifdef SKY2_VLAN_TAG_USED
+	/* Account for vlan tag */
+	if (sky2->vlgrp && (status & GMR_FS_VLAN))
+		count -= VLAN_HLEN;
+#endif
 
 	if (unlikely(netif_msg_rx_status(sky2)))
 		printk(KERN_DEBUG PFX "%s: rx slot %u status 0x%x len %d\n",
@@ -2160,7 +2167,8 @@ static struct sk_buff *sky2_receive(stru
 	if (!(status & GMR_FS_RX_OK))
 		goto resubmit;
 
-	if (status >> 16 != length)
+	/* if length reported by DMA does not match PHY, packet was truncated */
+	if (length != count)
 		goto len_mismatch;
 
 	if (length < copybreak)
@@ -2176,6 +2184,10 @@ len_mismatch:
 	/* Truncation of overlength packets
 	   causes PHY length to not match MAC length */
 	++sky2->net_stats.rx_length_errors;
+	if (netif_msg_rx_err(sky2) && net_ratelimit())
+		pr_info(PFX "%s: rx length mismatch: length %d status %#x\n",
+			dev->name, length, status);
+	goto resubmit;
 
 error:
 	++sky2->net_stats.rx_errors;
--- a/drivers/net/sky2.h	2007-09-19 21:35:38.000000000 -0700
+++ b/drivers/net/sky2.h	2007-09-19 21:35:53.000000000 -0700
@@ -1633,7 +1633,7 @@ enum {
 
 /* Receive Frame Status Encoding */
 enum {
-	GMR_FS_LEN	= 0xffff<<16, /* Bit 31..16:	Rx Frame Length */
+	GMR_FS_LEN	= 0x7fff<<16, /* Bit 30..16:	Rx Frame Length */
 	GMR_FS_VLAN	= 1<<13, /* VLAN Packet */
 	GMR_FS_JABBER	= 1<<12, /* Jabber Packet */
 	GMR_FS_UN_SIZE	= 1<<11, /* Undersize Packet */

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


^ permalink raw reply

* [PATCH 4/6] sky2: fe+ chip support
From: Stephen Hemminger @ 2007-09-20  5:06 UTC (permalink / raw)
  To: Jeff Garzk; +Cc: netdev
In-Reply-To: <20070920050559.763089637@linux-foundation.org>

[-- Attachment #1: sky2-fe-p.patch --]
[-- Type: text/plain, Size: 8482 bytes --]

Modifications to support for Yukon FE plus chip.
Earlier code was speculative, this is tested on hardware evaluation boards.

This version of the patch is for 2.6.23. It supersedes
the two previous patches that are sitting in netdev-2.6 (upstream branch).

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>


--- a/drivers/net/sky2.c	2007-09-19 21:57:59.000000000 -0700
+++ b/drivers/net/sky2.c	2007-09-19 21:58:08.000000000 -0700
@@ -119,7 +119,7 @@ static const struct pci_device_id sky2_i
 	{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4351) }, /* 88E8036 */
 	{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4352) }, /* 88E8038 */
 	{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4353) }, /* 88E8039 */
-	{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88E8033 */
+	{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4354) }, /* 88E8040 */
 	{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4356) }, /* 88EC033 */
 	{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x435A) }, /* 88E8048 */
 	{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4360) }, /* 88E8052 */
@@ -337,8 +337,7 @@ static void sky2_phy_init(struct sky2_hw
 
 	ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL);
 	if (sky2_is_copper(hw)) {
-		if (hw->chip_id == CHIP_ID_YUKON_FE ||
-		    hw->chip_id == CHIP_ID_YUKON_FE_P) {
+ 		if (!(hw->flags & SKY2_HW_GIGABIT)) {
 			/* enable automatic crossover */
 			ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO) >> 1;
 		} else {
@@ -457,7 +456,7 @@ static void sky2_phy_init(struct sky2_hw
 
 	gma_write16(hw, port, GM_GP_CTRL, reg);
 
-	if (sky2_is_gigabit(hw))
+	if (hw->flags & SKY2_HW_GIGABIT)
 		gm_phy_write(hw, port, PHY_MARV_1000T_CTRL, ct1000);
 
 	gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv);
@@ -483,11 +482,12 @@ static void sky2_phy_init(struct sky2_hw
 
 	case CHIP_ID_YUKON_FE_P:
 		/* Enable Link Partner Next Page */
+		ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL);
 		ctrl |= PHY_M_PC_ENA_LIP_NP;
 
 		/* disable Energy Detect and enable scrambler */
 		ctrl &= ~(PHY_M_PC_ENA_ENE_DT | PHY_M_PC_DIS_SCRAMB);
-		gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl);
+		gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl);
 
 		/* set LED2 -> ACT, LED1 -> LINK, LED0 -> SPEED */
 		ctrl = PHY_M_FELP_LED2_CTRL(LED_PAR_CTRL_ACT_BL) |
@@ -691,25 +691,25 @@ static void sky2_wol_init(struct sky2_po
 
 static void sky2_set_tx_stfwd(struct sky2_hw *hw, unsigned port)
 {
-	if (hw->chip_id == CHIP_ID_YUKON_EX && hw->chip_rev != CHIP_REV_YU_EX_A0) {
+	struct net_device *dev = hw->dev[port];
+
+	if (dev->mtu <= ETH_DATA_LEN)
 		sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
-			     TX_STFW_ENA |
-			     (hw->dev[port]->mtu > ETH_DATA_LEN) ? TX_JUMBO_ENA : TX_JUMBO_DIS);
-	} else {
-		if (hw->dev[port]->mtu > ETH_DATA_LEN) {
-			/* set Tx GMAC FIFO Almost Empty Threshold */
-			sky2_write32(hw, SK_REG(port, TX_GMF_AE_THR),
-				     (ECU_JUMBO_WM << 16) | ECU_AE_THR);
-
-			sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
-				     TX_JUMBO_ENA | TX_STFW_DIS);
-
-			/* Can't do offload because of lack of store/forward */
-			hw->dev[port]->features &= ~(NETIF_F_TSO | NETIF_F_SG
-						     | NETIF_F_ALL_CSUM);
-		} else
-			sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
-				     TX_JUMBO_DIS | TX_STFW_ENA);
+			     TX_JUMBO_DIS | TX_STFW_ENA);
+
+	else if (hw->chip_id != CHIP_ID_YUKON_EC_U)
+		sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
+			     TX_STFW_ENA | TX_JUMBO_ENA);
+	else {
+		/* set Tx GMAC FIFO Almost Empty Threshold */
+		sky2_write32(hw, SK_REG(port, TX_GMF_AE_THR),
+			     (ECU_JUMBO_WM << 16) | ECU_AE_THR);
+
+		sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
+			     TX_JUMBO_ENA | TX_STFW_DIS);
+
+		/* Can't do offload because of lack of store/forward */
+		dev->features &= ~(NETIF_F_TSO | NETIF_F_SG | NETIF_F_ALL_CSUM);
 	}
 }
 
@@ -795,7 +795,8 @@ static void sky2_mac_init(struct sky2_hw
 	/* Configure Rx MAC FIFO */
 	sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR);
 	rx_reg = GMF_OPER_ON | GMF_RX_F_FL_ON;
-	if (hw->chip_id == CHIP_ID_YUKON_EX)
+	if (hw->chip_id == CHIP_ID_YUKON_EX ||
+	    hw->chip_id == CHIP_ID_YUKON_FE_P)
 		rx_reg |= GMF_RX_OVER_ON;
 
 	sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), rx_reg);
@@ -804,7 +805,12 @@ static void sky2_mac_init(struct sky2_hw
 	sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR);
 
 	/* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug  */
-	sky2_write16(hw, SK_REG(port, RX_GMF_FL_THR), RX_GMF_FL_THR_DEF+1);
+	reg = RX_GMF_FL_THR_DEF + 1;
+	/* Another magic mystery workaround from sk98lin */
+	if (hw->chip_id == CHIP_ID_YUKON_FE_P &&
+	    hw->chip_rev == CHIP_REV_YU_FE2_A0)
+		reg = 0x178;
+	sky2_write16(hw, SK_REG(port, RX_GMF_FL_THR), reg);
 
 	/* Configure Tx MAC FIFO */
 	sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR);
@@ -1737,7 +1743,7 @@ static u16 sky2_phy_speed(const struct s
 	if (hw->flags & SKY2_HW_FIBRE_PHY)
 		return SPEED_1000;
 
-	if (!sky2_is_gigabit(hw)) {
+	if (!(hw->flags & SKY2_HW_GIGABIT)) {
 		if (aux & PHY_M_PS_SPEED_100)
 			return SPEED_100;
 		else
@@ -2005,7 +2011,7 @@ static int sky2_change_mtu(struct net_de
 
 	synchronize_irq(hw->pdev->irq);
 
-	if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX)
+	if (!(hw->flags & SKY2_HW_RAMBUFFER))
 		sky2_set_tx_stfwd(hw, port);
 
 	ctl = gma_read16(hw, port, GM_GP_CTRL);
@@ -2248,7 +2254,7 @@ static int sky2_status_intr(struct sky2_
 			}
 
 			/* This chip reports checksum status differently */
-			if (hw->chip_id == CHIP_ID_YUKON_EX) {
+			if (hw->flags & SKY2_HW_NEW_LE) {
 				if (sky2->rx_csum &&
 				    (le->css & (CSS_ISIPV4 | CSS_ISIPV6)) &&
 				    (le->css & CSS_TCPUDPCSOK))
@@ -2289,8 +2295,14 @@ static int sky2_status_intr(struct sky2_
 			if (!sky2->rx_csum)
 				break;
 
-			if (hw->chip_id == CHIP_ID_YUKON_EX)
+			/* If this happens then driver assuming wrong format */
+			if (unlikely(hw->flags & SKY2_HW_NEW_LE)) {
+				if (net_ratelimit())
+					printk(KERN_NOTICE "%s: unexpected"
+					       " checksum status\n",
+					       dev->name);
 				break;
+			}
 
 			/* Both checksum counters are programmed to start at
 			 * the same offset, so unless there is a problem they
@@ -2657,6 +2669,12 @@ static int __devinit sky2_init(struct sk
 		hw->flags = SKY2_HW_RAMBUFFER;
 		break;
 
+	case CHIP_ID_YUKON_FE_P:
+		hw->flags = SKY2_HW_NEWER_PHY
+			| SKY2_HW_NEW_LE
+			| SKY2_HW_AUTO_TX_SUM
+			| SKY2_HW_ADV_POWER_CTL;
+		break;
 	default:
 		dev_err(&hw->pdev->dev, "unsupported chip type 0x%x\n",
 			hw->chip_id);
@@ -2864,7 +2882,9 @@ static int sky2_set_wol(struct net_devic
 
 	sky2->wol = wol->wolopts;
 
-	if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX)
+	if (hw->chip_id == CHIP_ID_YUKON_EC_U ||
+	    hw->chip_id == CHIP_ID_YUKON_EX ||
+	    hw->chip_id == CHIP_ID_YUKON_FE_P)
 		sky2_write32(hw, B0_CTST, sky2->wol
 			     ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF);
 
@@ -3848,6 +3868,13 @@ static __devinit struct net_device *sky2
 	sky2->hw = hw;
 	sky2->msg_enable = netif_msg_init(debug, default_msg);
 
+	/* This chip has hardware problems that generates
+	 * bogus PHY receive status so by default shut up the message.
+	 */
+	if (hw->chip_id == CHIP_ID_YUKON_FE_P &&
+	    hw->chip_rev == CHIP_REV_YU_FE2_A0)
+		sky2->msg_enable &= ~NETIF_MSG_RX_ERR;
+
 	/* Auto speed and flow control */
 	sky2->autoneg = AUTONEG_ENABLE;
 	sky2->flow_mode = FC_BOTH;
@@ -4214,7 +4241,7 @@ static int sky2_resume(struct pci_dev *p
 	pci_enable_wake(pdev, PCI_D0, 0);
 
 	/* Re-enable all clocks */
-	if (hw->chip_id == CHIP_ID_YUKON_EX || hw->chip_id == CHIP_ID_YUKON_EC_U)
+	if (hw->flags & SKY2_HW_ADV_POWER_CTL)
 		pci_write_config_dword(pdev, PCI_DEV_REG3, 0);
 
 	sky2_reset(hw);
--- a/drivers/net/sky2.h	2007-09-19 21:57:42.000000000 -0700
+++ b/drivers/net/sky2.h	2007-09-19 21:58:08.000000000 -0700
@@ -1694,6 +1694,10 @@ enum {
 	GMF_RX_CTRL_DEF	= GMF_OPER_ON | GMF_RX_F_FL_ON,
 };
 
+/*	TX_GMF_EA		32 bit	Tx GMAC FIFO End Address */
+enum {
+	TX_DYN_WM_ENA	= 3,	/* Yukon-FE+ specific */
+};
 
 /*	TX_GMF_CTRL_T	32 bit	Tx GMAC FIFO Control/Test */
 enum {
@@ -2058,12 +2062,6 @@ static inline int sky2_is_copper(const s
 	return !(hw->flags & SKY2_HW_FIBRE_PHY);
 }
 
-static inline int sky2_is_gigabit(const struct sky2_hw *hw)
-{
-	return !(hw->chip_id == CHIP_ID_YUKON_FE
-		 || hw->chip_id == CHIP_ID_YUKON_FE_P);
-}
-
 /* Register accessor for memory mapped device */
 static inline u32 sky2_read32(const struct sky2_hw *hw, unsigned reg)
 {

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


^ permalink raw reply

* [PATCH 5/6] sky2: receive FIFO checking
From: Stephen Hemminger @ 2007-09-20  5:06 UTC (permalink / raw)
  To: Jeff Garzk; +Cc: netdev
In-Reply-To: <20070920050559.763089637@linux-foundation.org>

[-- Attachment #1: sky2-rx-watch.patch --]
[-- Type: text/plain, Size: 4199 bytes --]

A driver writer from another operating system hinted that
the versions of Yukon 2 chip with rambuffer (EC and XL) have
a hardware bug that if the FIFO ever gets completely full it
will hang. Sounds like a classic ring full vs ring empty wrap around
bug.

As a workaround, use the existing watchdog timer to check for
ring full lockup.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

--- a/drivers/net/sky2.c	2007-09-19 21:58:08.000000000 -0700
+++ b/drivers/net/sky2.c	2007-09-19 21:58:09.000000000 -0700
@@ -1652,9 +1652,6 @@ static int sky2_down(struct net_device *
 	if (netif_msg_ifdown(sky2))
 		printk(KERN_INFO PFX "%s: disabling interface\n", dev->name);
 
-	if (netif_carrier_ok(dev) && --hw->active == 0)
-		del_timer(&hw->watchdog_timer);
-
 	/* Stop more packets from being queued */
 	netif_stop_queue(dev);
 
@@ -1781,9 +1778,7 @@ static void sky2_link_up(struct sky2_por
 
 	netif_carrier_on(sky2->netdev);
 
-	if (hw->active++ == 0)
-		mod_timer(&hw->watchdog_timer, jiffies + 1);
-
+	mod_timer(&hw->watchdog_timer, jiffies + 1);
 
 	/* Turn on link LED */
 	sky2_write8(hw, SK_REG(port, LNK_LED_REG),
@@ -1834,11 +1829,6 @@ static void sky2_link_down(struct sky2_p
 
 	netif_carrier_off(sky2->netdev);
 
-	/* Stop watchdog if both ports are not active */
-	if (--hw->active == 0)
-		del_timer(&hw->watchdog_timer);
-
-
 	/* Turn on link LED */
 	sky2_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF);
 
@@ -2484,16 +2474,70 @@ static void sky2_le_error(struct sky2_hw
 	sky2_write32(hw, Q_ADDR(q, Q_CSR), BMU_CLR_IRQ_CHK);
 }
 
-/* Check for lost IRQ once a second */
+static int sky2_rx_hung(struct net_device *dev)
+{
+	struct sky2_port *sky2 = netdev_priv(dev);
+	struct sky2_hw *hw = sky2->hw;
+	unsigned port = sky2->port;
+	unsigned rxq = rxqaddr[port];
+	u32 mac_rp = sky2_read32(hw, SK_REG(port, RX_GMF_RP));
+	u8 mac_lev = sky2_read8(hw, SK_REG(port, RX_GMF_RLEV));
+	u8 fifo_rp = sky2_read8(hw, Q_ADDR(rxq, Q_RP));
+	u8 fifo_lev = sky2_read8(hw, Q_ADDR(rxq, Q_RL));
+
+	/* If idle and MAC or PCI is stuck */
+	if (sky2->check.last == dev->last_rx &&
+	    ((mac_rp == sky2->check.mac_rp &&
+	      mac_lev != 0 && mac_lev >= sky2->check.mac_lev) ||
+	     /* Check if the PCI RX hang */
+	     (fifo_rp == sky2->check.fifo_rp &&
+	      fifo_lev != 0 && fifo_lev >= sky2->check.fifo_lev))) {
+		printk(KERN_DEBUG PFX "%s: hung mac %d:%d fifo %d (%d:%d)\n",
+		       dev->name, mac_lev, mac_rp, fifo_lev, fifo_rp,
+		       sky2_read8(hw, Q_ADDR(rxq, Q_WP)));
+		return 1;
+	} else {
+		sky2->check.last = dev->last_rx;
+		sky2->check.mac_rp = mac_rp;
+		sky2->check.mac_lev = mac_lev;
+		sky2->check.fifo_rp = fifo_rp;
+		sky2->check.fifo_lev = fifo_lev;
+		return 0;
+	}
+}
+
 static void sky2_watchdog(unsigned long arg)
 {
 	struct sky2_hw *hw = (struct sky2_hw *) arg;
+	struct net_device *dev;
 
+	/* Check for lost IRQ */
 	if (sky2_read32(hw, B0_ISRC))
 		napi_schedule(&hw->napi);
+	else {
+		int i, active = 0;
+
+		for (i = 0; i < hw->ports; i++) {
+			dev = hw->dev[i];
+			if (!netif_running(dev))
+				continue;
+			++active;
+
+			/* For chips with Rx FIFO, check if stuck */
+			if ((hw->flags & SKY2_HW_RAMBUFFER) &&
+			     sky2_rx_hung(dev)) {
+				pr_info(PFX "%s: receiver hang detected\n",
+					dev->name);
+				schedule_work(&hw->restart_work);
+				return;
+			}
+		}
+
+		if (active == 0)
+			return;
+	}
 
-	if (hw->active > 0)
-		mod_timer(&hw->watchdog_timer, round_jiffies(jiffies + HZ));
+	mod_timer(&hw->watchdog_timer, round_jiffies(jiffies + HZ));
 }
 
 /* Hardware/software error handling */
--- a/drivers/net/sky2.h	2007-09-19 21:58:08.000000000 -0700
+++ b/drivers/net/sky2.h	2007-09-19 21:58:09.000000000 -0700
@@ -2008,6 +2008,14 @@ struct sky2_port {
 	u16		     rx_tag;
 	struct vlan_group    *vlgrp;
 #endif
+	struct {
+		unsigned long last;
+		u32	mac_rp;
+		u8	mac_lev;
+		u8	fifo_rp;
+		u8	fifo_lev;
+	} check;
+
 
 	dma_addr_t	     rx_le_map;
 	dma_addr_t	     tx_le_map;
@@ -2046,7 +2054,6 @@ struct sky2_hw {
 	u8		     chip_rev;
 	u8		     pmd_type;
 	u8		     ports;
-	u8		     active;
 
 	struct sky2_status_le *st_le;
 	u32		     st_idx;

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


^ permalink raw reply

* [PATCH 6/6] sky2: version 1.18
From: Stephen Hemminger @ 2007-09-20  5:06 UTC (permalink / raw)
  To: Jeff Garzk; +Cc: netdev
In-Reply-To: <20070920050559.763089637@linux-foundation.org>

[-- Attachment #1: sky2-1.19 --]
[-- Type: text/plain, Size: 430 bytes --]

Update version number

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

--- a/drivers/net/sky2.c	2007-09-19 21:58:09.000000000 -0700
+++ b/drivers/net/sky2.c	2007-09-19 21:58:09.000000000 -0700
@@ -52,7 +52,7 @@
 #include "sky2.h"
 
 #define DRV_NAME		"sky2"
-#define DRV_VERSION		"1.17"
+#define DRV_VERSION		"1.18.1"
 #define PFX			DRV_NAME " "
 
 /*

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


^ permalink raw reply

* [PATCH 3/6] sky2: reorganize chip revision features
From: Stephen Hemminger @ 2007-09-20  5:06 UTC (permalink / raw)
  To: Jeff Garzk; +Cc: netdev
In-Reply-To: <20070920050559.763089637@linux-foundation.org>

[-- Attachment #1: sky2-flags.patch --]
[-- Type: text/plain, Size: 11746 bytes --]

This patch should cause no functional changes in driver behaviour.
There are (too) many revisions of the Yukon 2 chip now. Instead of
adding more conditionals based on chip revision; rerganize into a
set of feature flags so adding new versions is less problematic.


Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>


--- a/drivers/net/sky2.c	2007-09-19 21:57:42.000000000 -0700
+++ b/drivers/net/sky2.c	2007-09-19 21:57:59.000000000 -0700
@@ -222,8 +222,7 @@ static void sky2_power_on(struct sky2_hw
 	else
 		sky2_write8(hw, B2_Y2_CLK_GATE, 0);
 
-	if (hw->chip_id == CHIP_ID_YUKON_EC_U ||
-	    hw->chip_id == CHIP_ID_YUKON_EX) {
+	if (hw->flags & SKY2_HW_ADV_POWER_CTL) {
 		struct pci_dev *pdev = hw->pdev;
 		u32 reg;
 
@@ -317,10 +316,8 @@ static void sky2_phy_init(struct sky2_hw
 	struct sky2_port *sky2 = netdev_priv(hw->dev[port]);
 	u16 ctrl, ct1000, adv, pg, ledctrl, ledover, reg;
 
-	if (sky2->autoneg == AUTONEG_ENABLE
-	    && !(hw->chip_id == CHIP_ID_YUKON_XL
-		 || hw->chip_id == CHIP_ID_YUKON_EC_U
-		 || hw->chip_id == CHIP_ID_YUKON_EX)) {
+	if (sky2->autoneg == AUTONEG_ENABLE &&
+	    !(hw->flags & SKY2_HW_NEWER_PHY)) {
 		u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL);
 
 		ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK |
@@ -353,9 +350,7 @@ static void sky2_phy_init(struct sky2_hw
 
 			/* downshift on PHY 88E1112 and 88E1149 is changed */
 			if (sky2->autoneg == AUTONEG_ENABLE
-			    && (hw->chip_id == CHIP_ID_YUKON_XL
-				|| hw->chip_id == CHIP_ID_YUKON_EC_U
-				|| hw->chip_id == CHIP_ID_YUKON_EX)) {
+			    && (hw->flags & SKY2_HW_NEWER_PHY)) {
 				/* set downshift counter to 3x and enable downshift */
 				ctrl &= ~PHY_M_PC_DSC_MSK;
 				ctrl |= PHY_M_PC_DSC(2) | PHY_M_PC_DOWN_S_ENA;
@@ -371,7 +366,7 @@ static void sky2_phy_init(struct sky2_hw
 	gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl);
 
 	/* special setup for PHY 88E1112 Fiber */
-	if (hw->chip_id == CHIP_ID_YUKON_XL && !sky2_is_copper(hw)) {
+	if (hw->chip_id == CHIP_ID_YUKON_XL && (hw->flags & SKY2_HW_FIBRE_PHY)) {
 		pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
 
 		/* Fiber: select 1000BASE-X only mode MAC Specific Ctrl Reg. */
@@ -815,7 +810,7 @@ static void sky2_mac_init(struct sky2_hw
 	sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR);
 	sky2_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON);
 
-	if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) {
+	if (!(hw->flags & SKY2_HW_RAMBUFFER)) {
 		sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8);
 		sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8);
 
@@ -994,19 +989,15 @@ static void sky2_rx_unmap_skb(struct pci
  */
 static void rx_set_checksum(struct sky2_port *sky2)
 {
-	struct sky2_rx_le *le;
+	struct sky2_rx_le *le = sky2_next_rx(sky2);
 
-	if (sky2->hw->chip_id != CHIP_ID_YUKON_EX) {
-		le = sky2_next_rx(sky2);
-		le->addr = cpu_to_le32((ETH_HLEN << 16) | ETH_HLEN);
-		le->ctrl = 0;
-		le->opcode = OP_TCPSTART | HW_OWNER;
-
-		sky2_write32(sky2->hw,
-			     Q_ADDR(rxqaddr[sky2->port], Q_CSR),
-			     sky2->rx_csum ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM);
-	}
+	le->addr = cpu_to_le32((ETH_HLEN << 16) | ETH_HLEN);
+	le->ctrl = 0;
+	le->opcode = OP_TCPSTART | HW_OWNER;
 
+	sky2_write32(sky2->hw,
+		     Q_ADDR(rxqaddr[sky2->port], Q_CSR),
+		     sky2->rx_csum ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM);
 }
 
 /*
@@ -1202,7 +1193,8 @@ static int sky2_rx_start(struct sky2_por
 
 	sky2_prefetch_init(hw, rxq, sky2->rx_le_map, RX_LE_SIZE - 1);
 
-	rx_set_checksum(sky2);
+	if (!(hw->flags & SKY2_HW_NEW_LE))
+		rx_set_checksum(sky2);
 
 	/* Space needed for frame data + headers rounded up */
 	size = roundup(sky2->netdev->mtu + ETH_HLEN + VLAN_HLEN, 8);
@@ -1273,7 +1265,7 @@ static int sky2_up(struct net_device *de
 	struct sky2_port *sky2 = netdev_priv(dev);
 	struct sky2_hw *hw = sky2->hw;
 	unsigned port = sky2->port;
-	u32 ramsize, imask;
+	u32 imask;
 	int cap, err = -ENOMEM;
 	struct net_device *otherdev = hw->dev[sky2->port^1];
 
@@ -1328,13 +1320,13 @@ static int sky2_up(struct net_device *de
 
 	sky2_mac_init(hw, port);
 
-	/* Register is number of 4K blocks on internal RAM buffer. */
-	ramsize = sky2_read8(hw, B2_E_0) * 4;
-	printk(KERN_INFO PFX "%s: ram buffer %dK\n", dev->name, ramsize);
-
-	if (ramsize > 0) {
+	if (hw->flags & SKY2_HW_RAMBUFFER) {
+		/* Register is number of 4K blocks on internal RAM buffer. */
+		u32 ramsize = sky2_read8(hw, B2_E_0) * 4;
 		u32 rxspace;
 
+		printk(KERN_DEBUG PFX "%s: ram buffer %dK\n", dev->name, ramsize);
+
 		if (ramsize < 16)
 			rxspace = ramsize / 2;
 		else
@@ -1467,13 +1459,15 @@ static int sky2_xmit_frame(struct sk_buf
 	/* Check for TCP Segmentation Offload */
 	mss = skb_shinfo(skb)->gso_size;
 	if (mss != 0) {
-		if (hw->chip_id != CHIP_ID_YUKON_EX)
+
+		if (!(hw->flags & SKY2_HW_NEW_LE))
 			mss += ETH_HLEN + ip_hdrlen(skb) + tcp_hdrlen(skb);
 
   		if (mss != sky2->tx_last_mss) {
   			le = get_tx_le(sky2);
   			le->addr = cpu_to_le32(mss);
- 			if (hw->chip_id == CHIP_ID_YUKON_EX)
+
+			if (hw->flags & SKY2_HW_NEW_LE)
 				le->opcode = OP_MSS | HW_OWNER;
 			else
 				le->opcode = OP_LRGLEN | HW_OWNER;
@@ -1499,8 +1493,7 @@ static int sky2_xmit_frame(struct sk_buf
 	/* Handle TCP checksum offload */
 	if (skb->ip_summed == CHECKSUM_PARTIAL) {
 		/* On Yukon EX (some versions) encoding change. */
- 		if (hw->chip_id == CHIP_ID_YUKON_EX
-		    && hw->chip_rev != CHIP_REV_YU_EX_B0)
+ 		if (hw->flags & SKY2_HW_AUTO_TX_SUM)
  			ctrl |= CALSUM;	/* auto checksum */
 		else {
 			const unsigned offset = skb_transport_offset(skb);
@@ -1741,7 +1734,7 @@ static int sky2_down(struct net_device *
 
 static u16 sky2_phy_speed(const struct sky2_hw *hw, u16 aux)
 {
-	if (!sky2_is_copper(hw))
+	if (hw->flags & SKY2_HW_FIBRE_PHY)
 		return SPEED_1000;
 
 	if (!sky2_is_gigabit(hw)) {
@@ -1790,9 +1783,7 @@ static void sky2_link_up(struct sky2_por
 	sky2_write8(hw, SK_REG(port, LNK_LED_REG),
 		    LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF);
 
-	if (hw->chip_id == CHIP_ID_YUKON_XL
-	    || hw->chip_id == CHIP_ID_YUKON_EC_U
-	    || hw->chip_id == CHIP_ID_YUKON_EX) {
+	if (hw->flags & SKY2_HW_NEWER_PHY) {
 		u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
 		u16 led = PHY_M_LEDC_LOS_CTRL(1);	/* link active */
 
@@ -1884,7 +1875,7 @@ static int sky2_autoneg_done(struct sky2
 	/* Since the pause result bits seem to in different positions on
 	 * different chips. look at registers.
 	 */
-	if (!sky2_is_copper(hw)) {
+	if (hw->flags & SKY2_HW_FIBRE_PHY) {
 		/* Shift for bits in fiber PHY */
 		advert &= ~(ADVERTISE_PAUSE_CAP|ADVERTISE_PAUSE_ASYM);
 		lpa &= ~(LPA_PAUSE_CAP|LPA_PAUSE_ASYM);
@@ -2627,24 +2618,55 @@ static int __devinit sky2_init(struct sk
 	sky2_write8(hw, B0_CTST, CS_RST_CLR);
 
 	hw->chip_id = sky2_read8(hw, B2_CHIP_ID);
-	if (hw->chip_id < CHIP_ID_YUKON_XL ||
-	    hw->chip_id > CHIP_ID_YUKON_FE_P) {
-		dev_err(&hw->pdev->dev, "unsupported chip type 0x%x\n",
-			hw->chip_id);
-		return -EOPNOTSUPP;
-	}
-
 	hw->chip_rev = (sky2_read8(hw, B2_MAC_CFG) & CFG_CHIP_R_MSK) >> 4;
 
-	/* This rev is really old, and requires untested workarounds */
-	if (hw->chip_id == CHIP_ID_YUKON_EC && hw->chip_rev == CHIP_REV_YU_EC_A1) {
-		dev_err(&hw->pdev->dev, "unsupported revision Yukon-%s (0x%x) rev %d\n",
-			yukon2_name[hw->chip_id - CHIP_ID_YUKON_XL],
-			hw->chip_id, hw->chip_rev);
+	switch(hw->chip_id) {
+	case CHIP_ID_YUKON_XL:
+		hw->flags = SKY2_HW_GIGABIT
+			| SKY2_HW_NEWER_PHY
+			| SKY2_HW_RAMBUFFER;
+		break;
+
+	case CHIP_ID_YUKON_EC_U:
+		hw->flags = SKY2_HW_GIGABIT
+			| SKY2_HW_NEWER_PHY
+			| SKY2_HW_ADV_POWER_CTL;
+		break;
+
+	case CHIP_ID_YUKON_EX:
+		hw->flags = SKY2_HW_GIGABIT
+			| SKY2_HW_NEWER_PHY
+			| SKY2_HW_NEW_LE
+			| SKY2_HW_ADV_POWER_CTL;
+
+		/* New transmit checksum */
+		if (hw->chip_rev != CHIP_REV_YU_EX_B0)
+			hw->flags |= SKY2_HW_AUTO_TX_SUM;
+		break;
+
+	case CHIP_ID_YUKON_EC:
+		/* This rev is really old, and requires untested workarounds */
+		if (hw->chip_rev == CHIP_REV_YU_EC_A1) {
+			dev_err(&hw->pdev->dev, "unsupported revision Yukon-EC rev A1\n");
+			return -EOPNOTSUPP;
+		}
+		hw->flags = SKY2_HW_GIGABIT | SKY2_HW_RAMBUFFER;
+		break;
+
+	case CHIP_ID_YUKON_FE:
+		hw->flags = SKY2_HW_RAMBUFFER;
+		break;
+
+	default:
+		dev_err(&hw->pdev->dev, "unsupported chip type 0x%x\n",
+			hw->chip_id);
 		return -EOPNOTSUPP;
 	}
 
 	hw->pmd_type = sky2_read8(hw, B2_PMD_TYP);
+	if (hw->pmd_type == 'L' || hw->pmd_type == 'S' || hw->pmd_type == 'P')
+		hw->flags |= SKY2_HW_FIBRE_PHY;
+
 	hw->ports = 1;
 	t8 = sky2_read8(hw, B2_Y2_HW_RES);
 	if ((t8 & CFG_DUAL_MAC_MSK) == CFG_DUAL_MAC_MSK) {
@@ -2860,7 +2882,7 @@ static u32 sky2_supported_modes(const st
 			| SUPPORTED_100baseT_Full
 			| SUPPORTED_Autoneg | SUPPORTED_TP;
 
-		if (hw->chip_id != CHIP_ID_YUKON_FE)
+		if (hw->flags & SKY2_HW_GIGABIT)
 			modes |= SUPPORTED_1000baseT_Half
 				| SUPPORTED_1000baseT_Full;
 		return modes;
@@ -3880,7 +3902,7 @@ static irqreturn_t __devinit sky2_test_i
 		return IRQ_NONE;
 
 	if (status & Y2_IS_IRQ_SW) {
-		hw->msi = 1;
+		hw->flags |= SKY2_HW_USE_MSI;
 		wake_up(&hw->msi_wait);
 		sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ);
 	}
@@ -3908,9 +3930,9 @@ static int __devinit sky2_test_msi(struc
 	sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ);
 	sky2_read8(hw, B0_CTST);
 
-	wait_event_timeout(hw->msi_wait, hw->msi, HZ/10);
+	wait_event_timeout(hw->msi_wait, (hw->flags & SKY2_HW_USE_MSI), HZ/10);
 
-	if (!hw->msi) {
+	if (!(hw->flags & SKY2_HW_USE_MSI)) {
 		/* MSI test failed, go back to INTx mode */
 		dev_info(&pdev->dev, "No interrupt generated using MSI, "
 			 "switching to INTx mode.\n");
@@ -4043,7 +4065,8 @@ static int __devinit sky2_probe(struct p
 		goto err_out_free_netdev;
 	}
 
-	err = request_irq(pdev->irq,  sky2_intr, hw->msi ? 0 : IRQF_SHARED,
+	err = request_irq(pdev->irq, sky2_intr,
+			  (hw->flags & SKY2_HW_USE_MSI) ? 0 : IRQF_SHARED,
 			  dev->name, hw);
 	if (err) {
 		dev_err(&pdev->dev, "cannot assign irq %d\n", pdev->irq);
@@ -4076,7 +4099,7 @@ static int __devinit sky2_probe(struct p
 	return 0;
 
 err_out_unregister:
-	if (hw->msi)
+	if (hw->flags & SKY2_HW_USE_MSI)
 		pci_disable_msi(pdev);
 	unregister_netdev(dev);
 err_out_free_netdev:
@@ -4125,7 +4148,7 @@ static void __devexit sky2_remove(struct
 	sky2_read8(hw, B0_CTST);
 
 	free_irq(pdev->irq, hw);
-	if (hw->msi)
+	if (hw->flags & SKY2_HW_USE_MSI)
 		pci_disable_msi(pdev);
 	pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma);
 	pci_release_regions(pdev);
--- a/drivers/net/sky2.h	2007-09-19 21:57:42.000000000 -0700
+++ b/drivers/net/sky2.h	2007-09-19 21:57:42.000000000 -0700
@@ -2028,6 +2028,15 @@ struct sky2_hw {
 	struct pci_dev	     *pdev;
 	struct napi_struct   napi;
 	struct net_device    *dev[2];
+	unsigned long	     flags;
+#define SKY2_HW_USE_MSI		0x00000001
+#define SKY2_HW_FIBRE_PHY	0x00000002
+#define SKY2_HW_GIGABIT		0x00000004
+#define SKY2_HW_NEWER_PHY	0x00000008
+#define SKY2_HW_RAMBUFFER	0x00000010	/* chip has RAM FIFO */
+#define SKY2_HW_NEW_LE		0x00000020	/* new LSOv2 format */
+#define SKY2_HW_AUTO_TX_SUM	0x00000040	/* new IP decode for Tx */
+#define SKY2_HW_ADV_POWER_CTL	0x00000080	/* additional PHY power regs */
 
 	u8	     	     chip_id;
 	u8		     chip_rev;
@@ -2041,13 +2050,12 @@ struct sky2_hw {
 
 	struct timer_list    watchdog_timer;
 	struct work_struct   restart_work;
-	int		     msi;
 	wait_queue_head_t    msi_wait;
 };
 
 static inline int sky2_is_copper(const struct sky2_hw *hw)
 {
-	return !(hw->pmd_type == 'L' || hw->pmd_type == 'S' || hw->pmd_type == 'P');
+	return !(hw->flags & SKY2_HW_FIBRE_PHY);
 }
 
 static inline int sky2_is_gigabit(const struct sky2_hw *hw)

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


^ permalink raw reply

* [PATCH 0/6] sky2: merged for netdev-2.6 upstream
From: Stephen Hemminger @ 2007-09-20  5:05 UTC (permalink / raw)
  To: Jeff Garzk; +Cc: netdev

Basically, same patches as earlier, but these are for 2.6.24
(via netdev-2.6 upstream branch).

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


^ permalink raw reply

* [PATCH 2/6] sky2: ethtool speed report bug
From: Stephen Hemminger @ 2007-09-20  5:06 UTC (permalink / raw)
  To: Jeff Garzk; +Cc: netdev
In-Reply-To: <20070920050559.763089637@linux-foundation.org>

[-- Attachment #1: sky2-ethtool-100mbit.patch --]
[-- Type: text/plain, Size: 874 bytes --]

On 100mbit versions, the driver always reports gigabit speed
available. The correct modes are already computed, then overwritten.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>


--- a/drivers/net/sky2.c	2007-09-19 21:35:53.000000000 -0700
+++ b/drivers/net/sky2.c	2007-09-19 21:35:57.000000000 -0700
@@ -2880,13 +2880,6 @@ static int sky2_get_settings(struct net_
 	ecmd->supported = sky2_supported_modes(hw);
 	ecmd->phy_address = PHY_ADDR_MARV;
 	if (sky2_is_copper(hw)) {
-		ecmd->supported = SUPPORTED_10baseT_Half
-		    | SUPPORTED_10baseT_Full
-		    | SUPPORTED_100baseT_Half
-		    | SUPPORTED_100baseT_Full
-		    | SUPPORTED_1000baseT_Half
-		    | SUPPORTED_1000baseT_Full
-		    | SUPPORTED_Autoneg | SUPPORTED_TP;
 		ecmd->port = PORT_TP;
 		ecmd->speed = sky2->speed;
 	} else {

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


^ permalink raw reply

* Re: e1000 driver and samba
From: Bill Fink @ 2007-09-20  4:53 UTC (permalink / raw)
  To: L F
  Cc: Tantilov, Emil S, Florian Weimer, Urs Thuermann,
	Brandeburg, Jesse, Kok, Auke-jan H, James Chapman, netdev
In-Reply-To: <780b6f780709190753qd52d099id937a6c75e5d560e@mail.gmail.com>

On Wed, 19 Sep 2007, L F wrote:

> Well,
> the issue seems to have gone away as of this morning, but I am
> somewhat unsure as to why.
> Placement of some things were modified so as to allow shorter cables.
> Now there are 3' CAT6 cables everywhere except for the 15' cable
> between the two switches. All the cables are new, high quality
> 'tested' cables from a company nearby.
> The server is now running 2.6.22.6 with the 7.6.5 e1000 driver from
> intel.com and samba 3.0.26-1 ... and it seems to work. Samba will not
> disconnect, even with all 8 clients running unreasonable read/write
> loads and CRC and MD5 checksums of the transferred files all match.
> The issue therefore seems to have gone away, but the reason why still
> escapes me. I cannot believe that CAT5 cables under 10' in length were
> causing it, because if that were the case
> 1) it would've shown itself, I presume, from the beginning
> 2) I could name dozens of different locations which would be having
> the same problems
> Samba 3.0.25 was definitely part of the problem and I sent a nice
> nastygram to the debian maintainers, because -testing is not
> -unstable, last I checked.
> As to samba having any sort of data integrity capability, to the best
> of my knowledge that has never been the case.
> To answer further questions: I checked for file integrity with
> CRC/CRC32/MD5 checksum utilities. They used to fail fairly
> consistently, they have been fine all this morning.

By any chance did you happen to power cycle some equipment in this
process that you didn't previously power cycle during earlier testing
and debugging?  If so, perhaps that hardware had somehow gotten into
a funky state, and the power cycling might have cleared it up.

Just a thought.

						-Bill

^ permalink raw reply

* Re: [patch 1/1] From: Ursula Braun <braunu@de.ibm.com>
From: Jeff Garzik @ 2007-09-20  4:18 UTC (permalink / raw)
  To: Ursula Braun; +Cc: davem, akpm, netdev, linux-s390
In-Reply-To: <20070919111027.298899000@linux.vnet.ibm.com>

applied



^ permalink raw reply

* Re: [PATCH 1/2] [FS_ENET] TX stuff should use fep->tx_lock, instead of fep->lock.
From: Jeff Garzik @ 2007-09-20  4:18 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linuxppc-dev, netdev, linux-kernel
In-Reply-To: <20070918160527.13525.80935.stgit@localhost.localdomain>

Vitaly Bordug wrote:
> Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> 
> ---
> 
>  drivers/net/fs_enet/fs_enet-main.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)

applied 1-2, after hand-editing the subject line to remove brackets from 
around "[FS_ENET]"

everything within [ and ] is removed, before copying to changelog, so 
please be careful

See http://linux.yyz.us/patch-format.html for more info.

	Jeff



^ permalink raw reply

* Re: netif_rx will not free skb when I use ftp in kernel 2.6.22/2.6.21
From: Chris Snook @ 2007-09-20  4:16 UTC (permalink / raw)
  To: =?x-gbk?Q?=D5=C5=B7=C9?=; +Cc: netdev, atl1-devel
In-Reply-To: <31156967.830941190260738334.JavaMail.coremail@bj126app89.126.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=x-gbk; format=flowed, Size: 2625 bytes --]

ÕÅ·É wrote:
> Dear netdev,
>  
> I have one problem with my NIC driver: whenever I use  
> netif_receive_skb(skb) or netif_rx(skb) to indicate received packet,  
> iperf does work, but ftp does not work, because the kernel seemes not 
> kfree_skb(skb) when I use ftp.  What¡¯s wrong with my NIC  driver? Any 
> suggestions will be appreciated. Thanks in advance.
>  
> When I use iperf to test my NIC driver, it seems okay. When I use ftp, 
> ftp client in kernel 2.6.22 and ftp server is ServUftp at windows2000, 
> it does work too. But, When I use windows2003 server and its contained 
> ftp server, my NIC driver can get file from that ftp server until the 
> memory is used out.  When I get 3G file, then 3G memory will be used and 
> not freed.
>  
> The source code is at : 
> http://sourceforge.krugle.com/kse/files?project=%22Attansic%20L1%20Gigabit%20Ethernet%20driver%22 
> <http://sourceforge.krugle.com/kse/files?project=%22Attansic%20L1%20Gigabit%20Ethernet%20driver%22>
> Please check the function at_clean_rx_irq() and at_alloc_rx_buffers() in 
> file at_main.c.
> I dev_alloc_skb() and pci_map_single() skb in function 
> at_alloc_rx_buffers(), pci_unmap_page() and netif_rx() in function 
> at_clean_rx_irq(), CONFIG_AT_NAPI is not defined.
>  
> Thank csnook.
>  
> Best Regards,
> Fei Zhang

Okay, I didn't know you were talking about the atl1 driver.  Are you 
using the
in-tree driver in 2.6.22, or the pre-merge driver on sourceforge, or the 
vendor
driver from Attansic/Atheros?

Also, can you test this again using the latest 2.6.23-rc7 kernel, with 
the atl1 driver
included in that kernel?

	-- Chris

> ÔÚ2007-09-20£¬"Chris Snook" <csnook@redhat.com> дµÀ£º
> 
>     ÕÅ·É wrote:
>     > Dear csnook,
>     > I have one problem in my NIC driver: whenever I use  
>     > netif_receive_skb(skb) or netif_rx(skb) to indicate received packet, 
>     > iperf does work, but ftp does not work,
>     > because the kernel seemes not kfree_skb(skb).  What¡¯s wrong with my NIC 
>     > driver? Any suggestions will be appreciated. Thanks in advance.
>     > Best wishes,
>     > Fei Zhang
>     >  
>     > Kernel v2.6.22
>     > Cpu : amd64
>     > Memory: 4G
> 
>     I'm going to need way more information than that.  I'm also not certain I'm the 
>     best person to answer the question.  I suggest asking the question again, with a 
>     lot more info, to netdev@vger.kernel.org.  You're welcome to CC me as well. 
>     Please also post a link to the driver source so we can see what exactly you're 
>     doing.
> 
>     	-- Chris

^ permalink raw reply

* Re: [PATCH] NET_SB1250_MAC: Rename to SB1250_MAC
From: Jeff Garzik @ 2007-09-20  4:11 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Andrew Morton, netdev, linux-mips, linux-kernel
In-Reply-To: <Pine.LNX.4.64N.0709141158010.1926@blysk.ds.pg.gda.pl>

Maciej W. Rozycki wrote:
>  Rename NET_SB1250_MAC to SB1250_MAC to follow the convention.
> 
> Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
> ---
>  The NET prefix seems to be used mainly for device groups (NET_ISA, 
> NET_VENDOR_*, etc.) rather than single drivers and adds no information.  I 
> suggest it to be removed.
> 
>  Depends on "patch-netdev-2.6.23-rc6-20070913-sb1250-mac-kconfig-0".

applied

^ permalink raw reply

* Re: [PATCH] sb1250-mac.c: Fix "stats" references
From: Jeff Garzik @ 2007-09-20  4:11 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Andrew Morton, netdev, linux-mips, linux-kernel
In-Reply-To: <Pine.LNX.4.64N.0709141316410.1926@blysk.ds.pg.gda.pl>

applied



^ permalink raw reply

* Re: [PATCH] NET_SB1250_MAC: Update Kconfig entry
From: Jeff Garzik @ 2007-09-20  4:11 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Andrew Morton, netdev, linux-mips, linux-kernel
In-Reply-To: <Pine.LNX.4.64N.0709141148540.1926@blysk.ds.pg.gda.pl>

applied



^ permalink raw reply

* Re: [PATCH] sb1250-mac.c: De-typedef, de-volatile, de-etc...
From: Jeff Garzik @ 2007-09-20  4:10 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: Ralf Baechle, Andrew Morton, netdev, linux-mips, linux-kernel
In-Reply-To: <Pine.LNX.4.64N.0709141135290.1926@blysk.ds.pg.gda.pl>

Maciej W. Rozycki wrote:
>  Remove typedefs, volatiles and convert kmalloc()/memset() pairs to
> kcalloc().  Also reformat the surrounding clutter.
> 
> Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
> ---
> On Thu, 13 Sep 2007, Jeff Garzik wrote:
> 
>> Net driver patches should apply on top of netdev-2.6.git#upstream, which is
>> where changes to net drivers are queued for the next release.
> 
>  I can see Andrew has done some changes to the patch and applied it 
> anyway, but here's a version I generated against your tree.  Please feel 
> free to choose either.
> 
>  You may be pleased (or less so) to hear that the version of sb1250-mac.c 
> in your tree does not even build (because of 
> 42d53d6be113f974d8152979c88e1061b953bd12) and the patch below does not 
> address it.  I ran out of time in the evening, but I will send you a fix 
> shortly.  To be honest I think even with bulk changes it may be worth 
> checking whether they do not break stuff. ;-)

hrm.  I cannot get this to apply on top of linux-2.6.git, 
netdev-2.6.git#upstream (prior to net-2.6.24 rebase) or 
netdev-2.6.git#upstream (after net-2.6.24 rebase)

ACK the changes


^ permalink raw reply

* Re: [PATCH 1/6] sky2: fix VLAN receive processing (resend)
From: Jeff Garzik @ 2007-09-20  3:47 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Pierre-Yves Ritschard
In-Reply-To: <20070919223746.487138191@linux-foundation.org>

ACK patches 1-6

applied 1-2 and 6

patch #3 failed to apply to netdev-2.6.git#upstream (which is built on 
top of net-2.6.24)



^ permalink raw reply

* Re: e1000 driver and samba
From: Bill Fink @ 2007-09-20  2:51 UTC (permalink / raw)
  To: L F
  Cc: Tantilov, Emil S, Florian Weimer, Urs Thuermann,
	Brandeburg, Jesse, Kok, Auke-jan H, James Chapman, netdev
In-Reply-To: <780b6f780709190753qd52d099id937a6c75e5d560e@mail.gmail.com>

On Wed, 19 Sep 2007, L F wrote:

> I have one further question: what should I be doing with the TSO and
> flow control? As of now, TSO is on but flow control is off.
> I'd like to thank everyone who helped and I'll be trying to see if the
> realtek integrated NIC works next.

Just my personal opinion, but unless you want to do more testing,
since you now seem to have a working setup, I would tend to leave
it the way it is.

						-Bill

^ permalink raw reply

* Re: [RFC][NET_SCHED] explict hold dev tx lock
From: jamal @ 2007-09-20  2:43 UTC (permalink / raw)
  To: David Miller; +Cc: herbert, netdev, kaber, dada1, johnpol
In-Reply-To: <1190255605.4818.25.camel@localhost>

[-- Attachment #1: Type: text/plain, Size: 73 bytes --]


Ok, this is from the net-2.6.24 of about an hour ago. 

cheers,
jamal



[-- Attachment #2: nsqr3 --]
[-- Type: text/plain, Size: 2295 bytes --]

[NET_SCHED] explict hold dev tx lock

For N cpus, with full throttle traffic on all N CPUs, funneling traffic
to the same ethernet device, the devices queue lock is contended by all
N CPUs constantly. The TX lock is only contended by a max of 2 CPUS.
In the current mode of operation, after all the work of entering the
dequeue region, we may endup aborting the path if we are unable to get
the tx lock and go back to contend for the queue lock. As N goes up,
this gets worse.

The changes in this patch result in a small increase in performance
with a 4CPU (2xdual-core) with no irq binding. Both e1000 and tg3
showed similar behavior;

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>

---
commit 5973a9734a93903e7c3547dbe19addc42600240f
tree a57bd488e200fdaa3dfef7f27de52cbe02238dd3
parent 31b9dd879cd9fd254484de2950341acdcb62680f
author Jamal Hadi Salim <hadi@cyberus.ca> Wed, 19 Sep 2007 22:29:16 -0400
committer Jamal Hadi Salim <hadi@cyberus.ca> Wed, 19 Sep 2007 22:29:16 -0400

 net/sched/sch_generic.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index e970e8e..95ae119 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -134,34 +134,19 @@ static inline int qdisc_restart(struct net_device *dev)
 {
 	struct Qdisc *q = dev->qdisc;
 	struct sk_buff *skb;
-	unsigned lockless;
 	int ret;
 
 	/* Dequeue packet */
 	if (unlikely((skb = dev_dequeue_skb(dev, q)) == NULL))
 		return 0;
 
-	/*
-	 * When the driver has LLTX set, it does its own locking in
-	 * start_xmit. These checks are worth it because even uncongested
-	 * locks can be quite expensive. The driver can do a trylock, as
-	 * is being done here; in case of lock contention it should return
-	 * NETDEV_TX_LOCKED and the packet will be requeued.
-	 */
-	lockless = (dev->features & NETIF_F_LLTX);
-
-	if (!lockless && !netif_tx_trylock(dev)) {
-		/* Another CPU grabbed the driver tx lock */
-		return handle_dev_cpu_collision(skb, dev, q);
-	}
 
 	/* And release queue */
 	spin_unlock(&dev->queue_lock);
 
+	HARD_TX_LOCK(dev, smp_processor_id());
 	ret = dev_hard_start_xmit(skb, dev);
-
-	if (!lockless)
-		netif_tx_unlock(dev);
+	HARD_TX_UNLOCK(dev);
 
 	spin_lock(&dev->queue_lock);
 	q = dev->qdisc;

^ permalink raw reply related

* Re: [RFC][NET_SCHED] explict hold dev tx lock
From: jamal @ 2007-09-20  2:33 UTC (permalink / raw)
  To: David Miller; +Cc: herbert, netdev, kaber, dada1, johnpol
In-Reply-To: <20070919.090937.32177545.davem@davemloft.net>

On Wed, 2007-19-09 at 09:09 -0700, David Miller wrote:

> Sure, along with a description as to why you want to make this
> change.

Will do. And if you feel that i should sit on it a little more i can do
that too. The good news is it doesnt make things any worse than they
already are and infact shows a slight improvement in a 4 cpu machine.

> I still don't understand the impetus. :)

I will like to use the effect later on to improve batching. 

cheers,
jamal


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox