Re: Natsemi DP83815 driver spaming

2007-05-03 Thread Rafał Bilski
 What about module option?
 
 That would work, though you crossed in the post with me writing a patch
 adding a sysfs file; I merged the two for overkill (below).  I also have
 a patch which changes the log message for the workaround so that it is
 displayed by default in order to make this easier to diagnose.

Applied. I set default value to 0. Flashed. However
 + if (!NATSEMI_CREATE_FILE(pdev, dspcfg_workaround))
 + goto err_create_file;
is going to err_create_file. Without these lines drivers works fine.

Rafał



--
NIE KUPUJ!!!
...zanim nie porownasz cen  http://link.interia.pl/f1a5e



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ETHTOOL]: Add 2.5G bit definitions.

2007-05-03 Thread Michael Chan
[ETHTOOL]: Add 2.5G bit definitions.

Add 2.5G supported and advertising bit definitions.  2.5G is supported
by the bnx2 driver.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c6310ae..f2d248f 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -434,6 +434,7 @@ struct ethtool_ops {
 #define SUPPORTED_1baseT_Full  (1  12)
 #define SUPPORTED_Pause(1  13)
 #define SUPPORTED_Asym_Pause   (1  14)
+#define SUPPORTED_2500baseX_Full   (1  15)
 
 /* Indicates what features are advertised by the interface. */
 #define ADVERTISED_10baseT_Half(1  0)
@@ -451,6 +452,7 @@ struct ethtool_ops {
 #define ADVERTISED_1baseT_Full (1  12)
 #define ADVERTISED_Pause   (1  13)
 #define ADVERTISED_Asym_Pause  (1  14)
+#define ADVERTISED_2500baseX_Full  (1  15)
 
 /* The following are all involved in forcing a particular link
  * mode for the device for setting things.  When getting the


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ethtool: Add 2.5G support

2007-05-03 Thread Michael Chan
Add 2.5G Serdes support to ethtool user program and ethtool.8 man
page.  The missing pause bits are also added to keep ethtool-copy.h
in sync with the kernel's version.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/ethtool-copy.h b/ethtool-copy.h
index 30f5e05..4615ef6 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -306,6 +306,9 @@ struct ethtool_stats {
 #define SUPPORTED_FIBRE(1  10)
 #define SUPPORTED_BNC  (1  11)
 #define SUPPORTED_1baseT_Full  (1  12)
+#define SUPPORTED_Pause(1  13)
+#define SUPPORTED_Asym_Pause   (1  14)
+#define SUPPORTED_2500baseX_Full   (1  15)
 
 /* Indicates what features are advertised by the interface. */
 #define ADVERTISED_10baseT_Half(1  0)
@@ -321,6 +324,9 @@ struct ethtool_stats {
 #define ADVERTISED_FIBRE   (1  10)
 #define ADVERTISED_BNC (1  11)
 #define ADVERTISED_1baseT_Full (1  12)
+#define ADVERTISED_Pause   (1  13)
+#define ADVERTISED_Asym_Pause  (1  14)
+#define ADVERTISED_2500baseX_Full  (1  15)
 
 /* The following are all involved in forcing a particular link
  * mode for the device for setting things.  When getting the
@@ -332,6 +338,7 @@ struct ethtool_stats {
 #define SPEED_10   10
 #define SPEED_100  100
 #define SPEED_1000 1000
+#define SPEED_2500 2500
 #define SPEED_11
 
 /* Duplex, half or full. */
diff --git a/ethtool.8 b/ethtool.8
index d6561bf..248260a 100644
--- a/ethtool.8
+++ b/ethtool.8
@@ -175,7 +175,7 @@ ethtool \- Display or change ethernet card settings
 
 .B ethtool \-s
 .I ethX
-.B4 speed 10 100 1000 1
+.B4 speed 10 100 1000 2500 1
 .B2 duplex half full
 .B4 port tp aui bnc mii fibre
 .B2 autoneg on off
@@ -326,7 +326,7 @@ All following options only apply if
 .B \-s
 was specified.
 .TP
-.A4 speed 10 100 1000 1
+.A4 speed 10 100 1000 2500 1
 Set speed in Mb/s.
 .B ethtool
 with just the device name as an argument will show you the supported device 
speeds.
@@ -360,6 +360,8 @@ a hexidecimal value using one or a combination of the 
following values:
 .TP 3
 .BR 0x020 1000 Full
 .TP 3
+.BR 0x80002500 Full (not supported by IEEE standards)
+.TP 3
 .BR 0x800 1 Full
 .TP 3
 .BR 0x03F Auto
diff --git a/ethtool.c b/ethtool.c
index 1fbad09..4aa8e06 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -98,7 +98,7 @@ static struct option {
 char *opthelp;
 } args[] = {
 { -s, --change, MODE_SSET, Change generic options,
-  [ speed 10|100|1000|1 ]\n
+  [ speed 10|100|1000|2500|1 ]\n
   [ duplex half|full ]\n
   [ port tp|aui|bnc|mii|fibre ]\n
   [ autoneg on|off ]\n
@@ -521,6 +521,8 @@ static void parse_cmdline(int argc, char **argp)
speed_wanted = SPEED_100;
else if (!strcmp(argp[i], 1000))
speed_wanted = SPEED_1000;
+   else if (!strcmp(argp[i], 2500))
+   speed_wanted = SPEED_2500;
else if (!strcmp(argp[1], 1))
speed_wanted = SPEED_1;
else
@@ -649,6 +651,9 @@ static void parse_cmdline(int argc, char **argp)
else if (speed_wanted == SPEED_1000 
 duplex_wanted == DUPLEX_FULL)
advertising_wanted = ADVERTISED_1000baseT_Full;
+   else if (speed_wanted == SPEED_2500 
+duplex_wanted == DUPLEX_FULL)
+   advertising_wanted = ADVERTISED_2500baseX_Full;
else if (speed_wanted == SPEED_1 
 duplex_wanted == DUPLEX_FULL)
advertising_wanted = ADVERTISED_1baseT_Full;
@@ -712,6 +717,13 @@ static void dump_supported(struct ethtool_cmd *ep)
if (mask  SUPPORTED_1000baseT_Full) {
did1++; fprintf(stdout, 1000baseT/Full );
}
+   if (did1  (mask  SUPPORTED_2500baseX_Full)) {
+   fprintf(stdout, \n);
+   fprintf(stdout,);
+   }
+   if (mask  SUPPORTED_2500baseX_Full) {
+   did1++; fprintf(stdout, 2500baseX/Full );
+   }
fprintf(stdout, \n);
 
fprintf(stdout,Supports auto-negotiation: );
@@ -754,6 +766,13 @@ static void dump_advertised(struct ethtool_cmd *ep)
if (mask  ADVERTISED_1000baseT_Full) {
did1++; fprintf(stdout, 1000baseT/Full );
}
+   if (did1  (mask  ADVERTISED_2500baseX_Full)) {
+   fprintf(stdout, \n);
+   fprintf(stdout,);
+   }
+   if 

[PATCH v2 0/16][BNX2]: Bug fixes and more 5709 suppot.

2007-05-03 Thread Michael Chan
Version 2 of the BNX2 patchset.  I've modified the 40-bit workaround to
just set the dma masks, combined the 5709 firmware into 1 patch which is
now 500K, pulled out the heartbeat chnages, and separated the patch for
ethtool.h.  Earlier, I sent 1 patch for ethtool.h for the kernel, and
another patch for user mode ethtool to support 2.5G.

Thanks to David, Jeff, and others for their feedback.

[PATCH v2 1/16][BNX2]: Block MII access when ifdown.
[PATCH v2 2/16][BNX2]: Fix register and memory test on 5709.
[PATCH v2 3/16][BNX2]: Add 40-bit DMA workaround for 5708.
[PATCH v2 4/16][BNX2]: Fix race conditions when calling register_netdev().
[PATCH v2 5/16][BNX2]: Save PCI state during suspend.
[PATCH v2 6/16][BNX2]: Update 5708 firmware.
[PATCH v2 7/16][BNX2]: Update 5709 firmware.
[PATCH v2 8/16][BNX2]: Add ipv6 TSO and checksum for 5709.
[PATCH v2 9/16][BNX2]: Put MII register offsets in the bnx2 struct.
[PATCH v2 10/16][BNX2]: Re-structure the 2.5G Serdes code.
[PATCH v2 11/16][BNX2]: Add support for 5709 Serdes.
[PATCH v2 12/16][BNX2]: Add indirect spinlock.
[PATCH v2 13/16][BNX2]: Restructure PHY event handling.
[PATCH v2 14/16][BNX2]: Add 1-shot MSI handler for 5709.
[PATCH v2 15/16][BNX2]: Print bus information for PCIE devices.
[PATCH v2 16/16][BNX2]: Update version and reldate.


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/16][BNX2]: Block MII access when ifdown.

2007-05-03 Thread Michael Chan
[BNX2]: Block MII access when ifdown.

The device may be in D3hot state and should not allow MII register
access.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index f98a220..9f0a067 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -5562,6 +5562,9 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int 
cmd)
case SIOCGMIIREG: {
u32 mii_regval;
 
+   if (!netif_running(dev))
+   return -EAGAIN;
+
spin_lock_bh(bp-phy_lock);
err = bnx2_read_phy(bp, data-reg_num  0x1f, mii_regval);
spin_unlock_bh(bp-phy_lock);
@@ -5575,6 +5578,9 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int 
cmd)
if (!capable(CAP_NET_ADMIN))
return -EPERM;
 
+   if (!netif_running(dev))
+   return -EAGAIN;
+
spin_lock_bh(bp-phy_lock);
err = bnx2_write_phy(bp, data-reg_num  0x1f, data-val_in);
spin_unlock_bh(bp-phy_lock);


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/16][BNX2]: Add 40-bit DMA workaround for 5708.

2007-05-03 Thread Michael Chan
[BNX2]: Add 40-bit DMA workaround for 5708.

The internal PCIE-to-PCIX bridge of the 5708 has the same 40-bit DMA
limitation as some of the tg3 chips.  Set dma_mask and persistent DMA
mask to 40-bit to workaround.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 6d05397..679ee66 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -5711,6 +5711,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device 
*dev)
unsigned long mem_len;
int rc;
u32 reg;
+   u64 dma_mask, persist_dma_mask;
 
SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, pdev-dev);
@@ -5749,21 +5750,6 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device 
*dev)
goto err_out_release;
}
 
-   if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) == 0) {
-   bp-flags |= USING_DAC_FLAG;
-   if (pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK) != 0) {
-   dev_err(pdev-dev,
-   pci_set_consistent_dma_mask failed, 
aborting.\n);
-   rc = -EIO;
-   goto err_out_release;
-   }
-   }
-   else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) {
-   dev_err(pdev-dev, System does not support DMA, aborting.\n);
-   rc = -EIO;
-   goto err_out_release;
-   }
-
bp-dev = dev;
bp-pdev = pdev;
 
@@ -5805,6 +5791,26 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device 
*dev)
}
}
 
+   /* 5708 cannot support DMA addresses  40-bit.  */
+   if (CHIP_NUM(bp) == CHIP_NUM_5708)
+   persist_dma_mask = dma_mask = DMA_40BIT_MASK;
+   else
+   persist_dma_mask = dma_mask = DMA_64BIT_MASK;
+
+   /* Configure DMA attributes. */
+   if (pci_set_dma_mask(pdev, dma_mask) == 0) {
+   dev-features |= NETIF_F_HIGHDMA;
+   rc = pci_set_consistent_dma_mask(pdev, persist_dma_mask);
+   if (rc) {
+   dev_err(pdev-dev,
+   pci_set_consistent_dma_mask failed, 
aborting.\n);
+   goto err_out_unmap;
+   }
+   } else if ((rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) != 0) {
+   dev_err(pdev-dev, System does not support DMA, aborting.\n);
+   goto err_out_unmap;
+   }
+
/* Get bus information. */
reg = REG_RD(bp, BNX2_PCICFG_MISC_STATUS);
if (reg  BNX2_PCICFG_MISC_STATUS_PCIX_DET) {
@@ -6114,8 +6120,6 @@ bnx2_init_one(struct pci_dev *pdev, const struct 
pci_device_id *ent)
printk(\n);
 
dev-features |= NETIF_F_SG;
-   if (bp-flags  USING_DAC_FLAG)
-   dev-features |= NETIF_F_HIGHDMA;
dev-features |= NETIF_F_IP_CSUM;
 #ifdef BCM_VLAN
dev-features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 878eee5..8e7b29a 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6433,7 +6433,6 @@ struct bnx2 {
 #define PCI_32BIT_FLAG 2
 #define ONE_TDMA_FLAG  4   /* no longer used */
 #define NO_WOL_FLAG8
-#define USING_DAC_FLAG 0x10
 #define USING_MSI_FLAG 0x20
 #define ASF_ENABLE_FLAG0x40
 


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/16][BNX2]: Fix race conditions when calling register_netdev().

2007-05-03 Thread Michael Chan
[BNX2]: Fix race conditions when calling register_netdev().

Hot-plug scripts can call bnx2_open() as soon as register_netdev() is
called in bnx2_init_one().  We need to call pci_set_drvdata() and
setup everything before calling register_netdev(). netif_carrier_off()
also needs to be moved to bnx2_open() to avoid race conditions with
the irq.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 679ee66..cffdec3 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -4350,6 +4350,8 @@ bnx2_open(struct net_device *dev)
struct bnx2 *bp = netdev_priv(dev);
int rc;
 
+   netif_carrier_off(dev);
+
bnx2_set_power_state(bp, PCI_D0);
bnx2_disable_int(bp);
 
@@ -6086,6 +6088,18 @@ bnx2_init_one(struct pci_dev *pdev, const struct 
pci_device_id *ent)
dev-poll_controller = poll_bnx2;
 #endif
 
+   pci_set_drvdata(pdev, dev);
+
+   memcpy(dev-dev_addr, bp-mac_addr, 6);
+   memcpy(dev-perm_addr, bp-mac_addr, 6);
+   bp-name = board_info[ent-driver_data].name;
+
+   dev-features |= NETIF_F_IP_CSUM | NETIF_F_SG;
+#ifdef BCM_VLAN
+   dev-features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
+#endif
+   dev-features |= NETIF_F_TSO | NETIF_F_TSO_ECN;
+
if ((rc = register_netdev(dev))) {
dev_err(pdev-dev, Cannot register net device\n);
if (bp-regview)
@@ -6097,11 +6111,6 @@ bnx2_init_one(struct pci_dev *pdev, const struct 
pci_device_id *ent)
return rc;
}
 
-   pci_set_drvdata(pdev, dev);
-
-   memcpy(dev-dev_addr, bp-mac_addr, 6);
-   memcpy(dev-perm_addr, bp-mac_addr, 6);
-   bp-name = board_info[ent-driver_data].name,
printk(KERN_INFO %s: %s (%c%d) PCI%s %s %dMHz found at mem %lx, 
IRQ %d, ,
dev-name,
@@ -6119,15 +6128,6 @@ bnx2_init_one(struct pci_dev *pdev, const struct 
pci_device_id *ent)
printk(%2.2x, dev-dev_addr[i]);
printk(\n);
 
-   dev-features |= NETIF_F_SG;
-   dev-features |= NETIF_F_IP_CSUM;
-#ifdef BCM_VLAN
-   dev-features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
-#endif
-   dev-features |= NETIF_F_TSO | NETIF_F_TSO_ECN;
-
-   netif_carrier_off(bp-dev);
-
return 0;
 }
 


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 5/16][BNX2]: Save PCI state during suspend.

2007-05-03 Thread Michael Chan
[BNX2]: Save PCI state during suspend.

This is needed to save the MSI state which will be lost during
suspend.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index cffdec3..89681b3 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -6172,6 +6172,7 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
bnx2_reset_chip(bp, reset_code);
bnx2_free_skbs(bp);
+   pci_save_state(pdev);
bnx2_set_power_state(bp, pci_choose_state(pdev, state));
return 0;
 }
@@ -6185,6 +6186,7 @@ bnx2_resume(struct pci_dev *pdev)
if (!netif_running(dev))
return 0;
 
+   pci_restore_state(pdev);
bnx2_set_power_state(bp, PCI_D0);
netif_device_attach(dev);
bnx2_init_nic(bp);


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 8/16][BNX2]: Add ipv6 TSO and checksum for 5709.

2007-05-03 Thread Michael Chan
[BNX2]: Add ipv6 TSO and checksum for 5709.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 89681b3..01977de 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -4537,35 +4537,49 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device 
*dev)
u32 tcp_opt_len, ip_tcp_len;
struct iphdr *iph;
 
-   if (skb_header_cloned(skb) 
-   pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
-   dev_kfree_skb(skb);
-   return NETDEV_TX_OK;
-   }
-
vlan_tag_flags |= TX_BD_FLAGS_SW_LSO;
 
-   tcp_opt_len = 0;
-   if (tcp_hdr(skb)-doff  5)
-   tcp_opt_len = tcp_optlen(skb);
+   tcp_opt_len = tcp_optlen(skb);
+
+   if (skb_shinfo(skb)-gso_type  SKB_GSO_TCPV6) {
+   u32 tcp_off = skb_transport_offset(skb) -
+ sizeof(struct ipv6hdr) - ETH_HLEN;
 
-   ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
+   vlan_tag_flags |= ((tcp_opt_len  2)  8) |
+ TX_BD_FLAGS_SW_FLAGS;
+   if (likely(tcp_off == 0))
+   vlan_tag_flags = ~TX_BD_FLAGS_TCP6_OFF0_MSK;
+   else {
+   tcp_off = 3;
+   vlan_tag_flags |= ((tcp_off  0x3) 
+  TX_BD_FLAGS_TCP6_OFF0_SHL) |
+ ((tcp_off  0x10) 
+  TX_BD_FLAGS_TCP6_OFF4_SHL);
+   mss |= (tcp_off  0xc)  TX_BD_TCP6_OFF2_SHL;
+   }
+   } else {
+   if (skb_header_cloned(skb) 
+   pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
+   dev_kfree_skb(skb);
+   return NETDEV_TX_OK;
+   }
 
-   iph = ip_hdr(skb);
-   iph-check = 0;
-   iph-tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
-   tcp_hdr(skb)-check = ~csum_tcpudp_magic(iph-saddr,
-iph-daddr, 0,
-IPPROTO_TCP, 0);
-   if (tcp_opt_len || (iph-ihl  5)) {
-   vlan_tag_flags |= ((iph-ihl - 5) +
-  (tcp_opt_len  2))  8;
+   ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
+
+   iph = ip_hdr(skb);
+   iph-check = 0;
+   iph-tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
+   tcp_hdr(skb)-check = ~csum_tcpudp_magic(iph-saddr,
+iph-daddr, 0,
+IPPROTO_TCP,
+0);
+   if (tcp_opt_len || (iph-ihl  5)) {
+   vlan_tag_flags |= ((iph-ihl - 5) +
+  (tcp_opt_len  2))  8;
+   }
}
-   }
-   else
-   {
+   } else
mss = 0;
-   }
 
mapping = pci_map_single(bp-pdev, skb-data, len, PCI_DMA_TODEVICE);
 
@@ -5233,10 +5247,15 @@ bnx2_set_rx_csum(struct net_device *dev, u32 data)
 static int
 bnx2_set_tso(struct net_device *dev, u32 data)
 {
-   if (data)
+   struct bnx2 *bp = netdev_priv(dev);
+
+   if (data) {
dev-features |= NETIF_F_TSO | NETIF_F_TSO_ECN;
-   else
-   dev-features = ~(NETIF_F_TSO | NETIF_F_TSO_ECN);
+   if (CHIP_NUM(bp) == CHIP_NUM_5709)
+   dev-features |= NETIF_F_TSO6;
+   } else
+   dev-features = ~(NETIF_F_TSO | NETIF_F_TSO6 |
+  NETIF_F_TSO_ECN);
return 0;
 }
 
@@ -5534,6 +5553,17 @@ bnx2_phys_id(struct net_device *dev, u32 data)
return 0;
 }
 
+static int
+bnx2_set_tx_csum(struct net_device *dev, u32 data)
+{
+   struct bnx2 *bp = netdev_priv(dev);
+
+   if (CHIP_NUM(bp) == CHIP_NUM_5709)
+   return (ethtool_op_set_tx_hw_csum(dev, data));
+   else
+   return (ethtool_op_set_tx_csum(dev, data));
+}
+
 static const struct ethtool_ops bnx2_ethtool_ops = {
.get_settings   = bnx2_get_settings,
.set_settings   = bnx2_set_settings,
@@ -5556,7 +5586,7 @@ static const struct ethtool_ops bnx2_ethtool_ops = {
.get_rx_csum= bnx2_get_rx_csum,
.set_rx_csum= bnx2_set_rx_csum,
.get_tx_csum= 

[PATCH v2 9/16][BNX2]: Put MII register offsets in the bnx2 struct.

2007-05-03 Thread Michael Chan
[BNX2]: Put MII register offsets in the bnx2 struct.

The 5709 Serdes device uses non-standard MII register offsets.  This
re-structuring will make it easier to support 5709 Serdes.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 01977de..a634315 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -572,8 +572,8 @@ bnx2_report_fw_link(struct bnx2 *bp)
if (bp-autoneg) {
fw_link_status |= BNX2_LINK_STATUS_AN_ENABLED;
 
-   bnx2_read_phy(bp, MII_BMSR, bmsr);
-   bnx2_read_phy(bp, MII_BMSR, bmsr);
+   bnx2_read_phy(bp, bp-mii_bmsr, bmsr);
+   bnx2_read_phy(bp, bp-mii_bmsr, bmsr);
 
if (!(bmsr  BMSR_ANEGCOMPLETE) ||
bp-phy_flags  PHY_PARALLEL_DETECT_FLAG)
@@ -654,8 +654,8 @@ bnx2_resolve_flow_ctrl(struct bnx2 *bp)
return;
}
 
-   bnx2_read_phy(bp, MII_ADVERTISE, local_adv);
-   bnx2_read_phy(bp, MII_LPA, remote_adv);
+   bnx2_read_phy(bp, bp-mii_adv, local_adv);
+   bnx2_read_phy(bp, bp-mii_lpa, remote_adv);
 
if (bp-phy_flags  PHY_SERDES_FLAG) {
u32 new_local_adv = 0;
@@ -736,7 +736,7 @@ bnx2_5706s_linkup(struct bnx2 *bp)
bp-link_up = 1;
bp-line_speed = SPEED_1000;
 
-   bnx2_read_phy(bp, MII_BMCR, bmcr);
+   bnx2_read_phy(bp, bp-mii_bmcr, bmcr);
if (bmcr  BMCR_FULLDPLX) {
bp-duplex = DUPLEX_FULL;
}
@@ -748,8 +748,8 @@ bnx2_5706s_linkup(struct bnx2 *bp)
return 0;
}
 
-   bnx2_read_phy(bp, MII_ADVERTISE, local_adv);
-   bnx2_read_phy(bp, MII_LPA, remote_adv);
+   bnx2_read_phy(bp, bp-mii_adv, local_adv);
+   bnx2_read_phy(bp, bp-mii_lpa, remote_adv);
 
common = local_adv  remote_adv;
if (common  (ADVERTISE_1000XHALF | ADVERTISE_1000XFULL)) {
@@ -770,7 +770,7 @@ bnx2_copper_linkup(struct bnx2 *bp)
 {
u32 bmcr;
 
-   bnx2_read_phy(bp, MII_BMCR, bmcr);
+   bnx2_read_phy(bp, bp-mii_bmcr, bmcr);
if (bmcr  BMCR_ANENABLE) {
u32 local_adv, remote_adv, common;
 
@@ -787,8 +787,8 @@ bnx2_copper_linkup(struct bnx2 *bp)
bp-duplex = DUPLEX_HALF;
}
else {
-   bnx2_read_phy(bp, MII_ADVERTISE, local_adv);
-   bnx2_read_phy(bp, MII_LPA, remote_adv);
+   bnx2_read_phy(bp, bp-mii_adv, local_adv);
+   bnx2_read_phy(bp, bp-mii_lpa, remote_adv);
 
common = local_adv  remote_adv;
if (common  ADVERTISE_100FULL) {
@@ -911,8 +911,8 @@ bnx2_set_link(struct bnx2 *bp)
 
link_up = bp-link_up;
 
-   bnx2_read_phy(bp, MII_BMSR, bmsr);
-   bnx2_read_phy(bp, MII_BMSR, bmsr);
+   bnx2_read_phy(bp, bp-mii_bmsr, bmsr);
+   bnx2_read_phy(bp, bp-mii_bmsr, bmsr);
 
if ((bp-phy_flags  PHY_SERDES_FLAG) 
(CHIP_NUM(bp) == CHIP_NUM_5706)) {
@@ -971,13 +971,13 @@ bnx2_reset_phy(struct bnx2 *bp)
int i;
u32 reg;
 
-bnx2_write_phy(bp, MII_BMCR, BMCR_RESET);
+bnx2_write_phy(bp, bp-mii_bmcr, BMCR_RESET);
 
 #define PHY_RESET_MAX_WAIT 100
for (i = 0; i  PHY_RESET_MAX_WAIT; i++) {
udelay(10);
 
-   bnx2_read_phy(bp, MII_BMCR, reg);
+   bnx2_read_phy(bp, bp-mii_bmcr, reg);
if (!(reg  BMCR_RESET)) {
udelay(20);
break;
@@ -1033,10 +1033,10 @@ bnx2_setup_serdes_phy(struct bnx2 *bp)
u32 new_bmcr;
int force_link_down = 0;
 
-   bnx2_read_phy(bp, MII_ADVERTISE, adv);
+   bnx2_read_phy(bp, bp-mii_adv, adv);
adv = ~(ADVERTISE_1000XFULL | ADVERTISE_1000XHALF);
 
-   bnx2_read_phy(bp, MII_BMCR, bmcr);
+   bnx2_read_phy(bp, bp-mii_bmcr, bmcr);
new_bmcr = bmcr  ~(BMCR_ANENABLE | BCM5708S_BMCR_FORCE_2500);
new_bmcr |= BMCR_SPEED1000;
if (bp-req_line_speed == SPEED_2500) {
@@ -1067,19 +1067,19 @@ bnx2_setup_serdes_phy(struct bnx2 *bp)
if ((new_bmcr != bmcr) || (force_link_down)) {
/* Force a link down visible on the other side */
if (bp-link_up) {
-   bnx2_write_phy(bp, MII_ADVERTISE, adv 
+   bnx2_write_phy(bp, bp-mii_adv, adv 
   ~(ADVERTISE_1000XFULL |
 ADVERTISE_1000XHALF));
-   bnx2_write_phy(bp, MII_BMCR, bmcr |
+   bnx2_write_phy(bp, bp-mii_bmcr, bmcr |
BMCR_ANRESTART | BMCR_ANENABLE);
 
  

[PATCH v2 10/16][BNX2]: Re-structure the 2.5G Serdes code.

2007-05-03 Thread Michael Chan
[BNX2]: Re-structure the 2.5G Serdes code.

Add some common procedures to handle enabling and disabling 2.5G.
Add some missing code to resolve flow control.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index a634315..944f547 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -899,6 +899,86 @@ bnx2_set_mac_link(struct bnx2 *bp)
 }
 
 static int
+bnx2_test_and_enable_2g5(struct bnx2 *bp)
+{
+   u32 up1;
+   int ret = 1;
+
+   if (!(bp-phy_flags  PHY_2_5G_CAPABLE_FLAG))
+   return 0;
+
+   if (bp-autoneg  AUTONEG_SPEED)
+   bp-advertising |= ADVERTISED_2500baseX_Full;
+
+   bnx2_read_phy(bp, bp-mii_up1, up1);
+   if (!(up1  BCM5708S_UP1_2G5)) {
+   up1 |= BCM5708S_UP1_2G5;
+   bnx2_write_phy(bp, bp-mii_up1, up1);
+   ret = 0;
+   }
+
+   return ret;
+}
+
+static int
+bnx2_test_and_disable_2g5(struct bnx2 *bp)
+{
+   u32 up1;
+   int ret = 0;
+
+   if (!(bp-phy_flags  PHY_2_5G_CAPABLE_FLAG))
+   return 0;
+
+   bnx2_read_phy(bp, bp-mii_up1, up1);
+   if (up1  BCM5708S_UP1_2G5) {
+   up1 = ~BCM5708S_UP1_2G5;
+   bnx2_write_phy(bp, bp-mii_up1, up1);
+   ret = 1;
+   }
+
+   return ret;
+}
+
+static void
+bnx2_enable_forced_2g5(struct bnx2 *bp)
+{
+   u32 bmcr;
+
+   if (!(bp-phy_flags  PHY_2_5G_CAPABLE_FLAG))
+   return;
+
+   if (CHIP_NUM(bp) == CHIP_NUM_5708) {
+   bnx2_read_phy(bp, bp-mii_bmcr, bmcr);
+   bmcr |= BCM5708S_BMCR_FORCE_2500;
+   }
+
+   if (bp-autoneg  AUTONEG_SPEED) {
+   bmcr = ~BMCR_ANENABLE;
+   if (bp-req_duplex == DUPLEX_FULL)
+   bmcr |= BMCR_FULLDPLX;
+   }
+   bnx2_write_phy(bp, bp-mii_bmcr, bmcr);
+}
+
+static void
+bnx2_disable_forced_2g5(struct bnx2 *bp)
+{
+   u32 bmcr;
+
+   if (!(bp-phy_flags  PHY_2_5G_CAPABLE_FLAG))
+   return;
+
+   if (CHIP_NUM(bp) == CHIP_NUM_5708) {
+   bnx2_read_phy(bp, bp-mii_bmcr, bmcr);
+   bmcr = ~BCM5708S_BMCR_FORCE_2500;
+   }
+
+   if (bp-autoneg  AUTONEG_SPEED)
+   bmcr |= BMCR_SPEED1000 | BMCR_ANENABLE | BMCR_ANRESTART;
+   bnx2_write_phy(bp, bp-mii_bmcr, bmcr);
+}
+
+static int
 bnx2_set_link(struct bnx2 *bp)
 {
u32 bmsr;
@@ -941,17 +1021,9 @@ bnx2_set_link(struct bnx2 *bp)
}
else {
if ((bp-phy_flags  PHY_SERDES_FLAG) 
-   (bp-autoneg  AUTONEG_SPEED)) {
+   (bp-autoneg  AUTONEG_SPEED))
+   bnx2_disable_forced_2g5(bp);
 
-   u32 bmcr;
-
-   bnx2_read_phy(bp, MII_BMCR, bmcr);
-   bmcr = ~BCM5708S_BMCR_FORCE_2500;
-   if (!(bmcr  BMCR_ANENABLE)) {
-   bnx2_write_phy(bp, MII_BMCR, bmcr |
-   BMCR_ANENABLE);
-   }
-   }
bp-phy_flags = ~PHY_PARALLEL_DETECT_FLAG;
bp-link_up = 0;
}
@@ -1026,34 +1098,32 @@ bnx2_phy_get_pause_adv(struct bnx2 *bp)
 static int
 bnx2_setup_serdes_phy(struct bnx2 *bp)
 {
-   u32 adv, bmcr, up1;
+   u32 adv, bmcr;
u32 new_adv = 0;
 
if (!(bp-autoneg  AUTONEG_SPEED)) {
u32 new_bmcr;
int force_link_down = 0;
 
+   if (bp-req_line_speed == SPEED_2500) {
+   if (!bnx2_test_and_enable_2g5(bp))
+   force_link_down = 1;
+   } else if (bp-req_line_speed == SPEED_1000) {
+   if (bnx2_test_and_disable_2g5(bp))
+   force_link_down = 1;
+   }
bnx2_read_phy(bp, bp-mii_adv, adv);
adv = ~(ADVERTISE_1000XFULL | ADVERTISE_1000XHALF);
 
bnx2_read_phy(bp, bp-mii_bmcr, bmcr);
-   new_bmcr = bmcr  ~(BMCR_ANENABLE | BCM5708S_BMCR_FORCE_2500);
+   new_bmcr = bmcr  ~BMCR_ANENABLE;
new_bmcr |= BMCR_SPEED1000;
-   if (bp-req_line_speed == SPEED_2500) {
-   new_bmcr |= BCM5708S_BMCR_FORCE_2500;
-   bnx2_read_phy(bp, BCM5708S_UP1, up1);
-   if (!(up1  BCM5708S_UP1_2G5)) {
-   up1 |= BCM5708S_UP1_2G5;
-   bnx2_write_phy(bp, BCM5708S_UP1, up1);
-   force_link_down = 1;
-   }
-   } else if (CHIP_NUM(bp) == CHIP_NUM_5708) {
-   bnx2_read_phy(bp, BCM5708S_UP1, up1);
-   if (up1  BCM5708S_UP1_2G5) {
-   up1 = ~BCM5708S_UP1_2G5;
-   bnx2_write_phy(bp, BCM5708S_UP1, up1);
-   

[PATCH v2 11/16][BNX2]: Add support for 5709 Serdes.

2007-05-03 Thread Michael Chan
[BNX2]: Add support for 5709 Serdes.

Add PCI ID and code to support the 5709 Serdes PHY.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 944f547..ab58909 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -84,6 +84,7 @@ typedef enum {
BCM5708,
BCM5708S,
BCM5709,
+   BCM5709S,
 } board_t;
 
 /* indexed by board_t, above */
@@ -98,6 +99,7 @@ static const struct {
{ Broadcom NetXtreme II BCM5708 1000Base-T },
{ Broadcom NetXtreme II BCM5708 1000Base-SX },
{ Broadcom NetXtreme II BCM5709 1000Base-T },
+   { Broadcom NetXtreme II BCM5709 1000Base-SX },
};
 
 static struct pci_device_id bnx2_pci_tbl[] = {
@@ -117,6 +119,8 @@ static struct pci_device_id bnx2_pci_tbl[] = {
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5708S },
{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_NX2_5709,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5709 },
+   { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_NX2_5709S,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5709S },
{ 0, }
 };
 
@@ -700,6 +704,45 @@ bnx2_resolve_flow_ctrl(struct bnx2 *bp)
 }
 
 static int
+bnx2_5709s_linkup(struct bnx2 *bp)
+{
+   u32 val, speed;
+
+   bp-link_up = 1;
+
+   bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_GP_STATUS);
+   bnx2_read_phy(bp, MII_BNX2_GP_TOP_AN_STATUS1, val);
+   bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_COMBO_IEEEB0);
+
+   if ((bp-autoneg  AUTONEG_SPEED) == 0) {
+   bp-line_speed = bp-req_line_speed;
+   bp-duplex = bp-req_duplex;
+   return 0;
+   }
+   speed = val  MII_BNX2_GP_TOP_AN_SPEED_MSK;
+   switch (speed) {
+   case MII_BNX2_GP_TOP_AN_SPEED_10:
+   bp-line_speed = SPEED_10;
+   break;
+   case MII_BNX2_GP_TOP_AN_SPEED_100:
+   bp-line_speed = SPEED_100;
+   break;
+   case MII_BNX2_GP_TOP_AN_SPEED_1G:
+   case MII_BNX2_GP_TOP_AN_SPEED_1GKV:
+   bp-line_speed = SPEED_1000;
+   break;
+   case MII_BNX2_GP_TOP_AN_SPEED_2_5G:
+   bp-line_speed = SPEED_2500;
+   break;
+   }
+   if (val  MII_BNX2_GP_TOP_AN_FD)
+   bp-duplex = DUPLEX_FULL;
+   else
+   bp-duplex = DUPLEX_HALF;
+   return 0;
+}
+
+static int
 bnx2_5708s_linkup(struct bnx2 *bp)
 {
u32 val;
@@ -898,6 +941,24 @@ bnx2_set_mac_link(struct bnx2 *bp)
return 0;
 }
 
+static void
+bnx2_enable_bmsr1(struct bnx2 *bp)
+{
+   if ((bp-phy_flags  PHY_SERDES_FLAG) 
+   (CHIP_NUM(bp) == CHIP_NUM_5709))
+   bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
+  MII_BNX2_BLK_ADDR_GP_STATUS);
+}
+
+static void
+bnx2_disable_bmsr1(struct bnx2 *bp)
+{
+   if ((bp-phy_flags  PHY_SERDES_FLAG) 
+   (CHIP_NUM(bp) == CHIP_NUM_5709))
+   bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
+  MII_BNX2_BLK_ADDR_COMBO_IEEEB0);
+}
+
 static int
 bnx2_test_and_enable_2g5(struct bnx2 *bp)
 {
@@ -910,6 +971,9 @@ bnx2_test_and_enable_2g5(struct bnx2 *bp)
if (bp-autoneg  AUTONEG_SPEED)
bp-advertising |= ADVERTISED_2500baseX_Full;
 
+   if (CHIP_NUM(bp) == CHIP_NUM_5709)
+   bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_OVER1G);
+
bnx2_read_phy(bp, bp-mii_up1, up1);
if (!(up1  BCM5708S_UP1_2G5)) {
up1 |= BCM5708S_UP1_2G5;
@@ -917,6 +981,10 @@ bnx2_test_and_enable_2g5(struct bnx2 *bp)
ret = 0;
}
 
+   if (CHIP_NUM(bp) == CHIP_NUM_5709)
+   bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
+  MII_BNX2_BLK_ADDR_COMBO_IEEEB0);
+
return ret;
 }
 
@@ -929,6 +997,9 @@ bnx2_test_and_disable_2g5(struct bnx2 *bp)
if (!(bp-phy_flags  PHY_2_5G_CAPABLE_FLAG))
return 0;
 
+   if (CHIP_NUM(bp) == CHIP_NUM_5709)
+   bnx2_write_phy(bp, MII_BNX2_BLK_ADDR, MII_BNX2_BLK_ADDR_OVER1G);
+
bnx2_read_phy(bp, bp-mii_up1, up1);
if (up1  BCM5708S_UP1_2G5) {
up1 = ~BCM5708S_UP1_2G5;
@@ -936,6 +1007,10 @@ bnx2_test_and_disable_2g5(struct bnx2 *bp)
ret = 1;
}
 
+   if (CHIP_NUM(bp) == CHIP_NUM_5709)
+   bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
+  MII_BNX2_BLK_ADDR_COMBO_IEEEB0);
+
return ret;
 }
 
@@ -947,7 +1022,21 @@ bnx2_enable_forced_2g5(struct bnx2 *bp)
if (!(bp-phy_flags  PHY_2_5G_CAPABLE_FLAG))
return;
 
-   if (CHIP_NUM(bp) == CHIP_NUM_5708) {
+   if (CHIP_NUM(bp) == CHIP_NUM_5709) {
+   u32 val;
+
+   bnx2_write_phy(bp, MII_BNX2_BLK_ADDR,
+  MII_BNX2_BLK_ADDR_SERDES_DIG);
+   

[PATCH v2 12/16][BNX2]: Add indirect spinlock.

2007-05-03 Thread Michael Chan
[BNX2]: Add indirect spinlock.

The indirect register access method will be used by more than one
caller in BH context (NAPI poll and timer), so a spinlock is required.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index ab58909..cb74f12 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -234,21 +234,29 @@ static inline u32 bnx2_tx_avail(struct bnx2 *bp)
 static u32
 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset)
 {
+   u32 val;
+
+   spin_lock_bh(bp-indirect_lock);
REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset);
-   return (REG_RD(bp, BNX2_PCICFG_REG_WINDOW));
+   val = REG_RD(bp, BNX2_PCICFG_REG_WINDOW);
+   spin_unlock_bh(bp-indirect_lock);
+   return val;
 }
 
 static void
 bnx2_reg_wr_ind(struct bnx2 *bp, u32 offset, u32 val)
 {
+   spin_lock_bh(bp-indirect_lock);
REG_WR(bp, BNX2_PCICFG_REG_WINDOW_ADDRESS, offset);
REG_WR(bp, BNX2_PCICFG_REG_WINDOW, val);
+   spin_unlock_bh(bp-indirect_lock);
 }
 
 static void
 bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val)
 {
offset += cid_addr;
+   spin_lock_bh(bp-indirect_lock);
if (CHIP_NUM(bp) == CHIP_NUM_5709) {
int i;
 
@@ -266,6 +274,7 @@ bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 
val)
REG_WR(bp, BNX2_CTX_DATA_ADR, offset);
REG_WR(bp, BNX2_CTX_DATA, val);
}
+   spin_unlock_bh(bp-indirect_lock);
 }
 
 static int
@@ -6039,6 +6048,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device 
*dev)
bp-pdev = pdev;
 
spin_lock_init(bp-phy_lock);
+   spin_lock_init(bp-indirect_lock);
INIT_WORK(bp-reset_task, bnx2_reset_task);
 
dev-base_addr = dev-mem_start = pci_resource_start(pdev, 0);
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 124bd03..ba175a8 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6522,6 +6522,7 @@ struct bnx2 {
 
/* Used to synchronize phy accesses. */
spinlock_t  phy_lock;
+   spinlock_t  indirect_lock;
 
u32 phy_flags;
 #define PHY_SERDES_FLAG1


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 13/16][BNX2]: Restructure PHY event handling.

2007-05-03 Thread Michael Chan
[BNX2]: Restructure PHY event handling.

Restructure by adding bnx2_phy_event_is_set() to make code cleaner
and easier to understand.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index cb74f12..f072028 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -1942,25 +1942,33 @@ bnx2_alloc_rx_skb(struct bnx2 *bp, u16 index)
return 0;
 }
 
-static void
-bnx2_phy_int(struct bnx2 *bp)
+static int
+bnx2_phy_event_is_set(struct bnx2 *bp, u32 event)
 {
+   struct status_block *sblk = bp-status_blk;
u32 new_link_state, old_link_state;
+   int is_set = 1;
 
-   new_link_state = bp-status_blk-status_attn_bits 
-   STATUS_ATTN_BITS_LINK_STATE;
-   old_link_state = bp-status_blk-status_attn_bits_ack 
-   STATUS_ATTN_BITS_LINK_STATE;
+   new_link_state = sblk-status_attn_bits  event;
+   old_link_state = sblk-status_attn_bits_ack  event;
if (new_link_state != old_link_state) {
-   if (new_link_state) {
-   REG_WR(bp, BNX2_PCICFG_STATUS_BIT_SET_CMD,
-   STATUS_ATTN_BITS_LINK_STATE);
-   }
-   else {
-   REG_WR(bp, BNX2_PCICFG_STATUS_BIT_CLEAR_CMD,
-   STATUS_ATTN_BITS_LINK_STATE);
-   }
+   if (new_link_state)
+   REG_WR(bp, BNX2_PCICFG_STATUS_BIT_SET_CMD, event);
+   else
+   REG_WR(bp, BNX2_PCICFG_STATUS_BIT_CLEAR_CMD, event);
+   } else
+   is_set = 0;
+
+   return is_set;
+}
+
+static void
+bnx2_phy_int(struct bnx2 *bp)
+{
+   if (bnx2_phy_event_is_set(bp, STATUS_ATTN_BITS_LINK_STATE)) {
+   spin_lock(bp-phy_lock);
bnx2_set_link(bp);
+   spin_unlock(bp-phy_lock);
}
 }
 
@@ -2283,6 +2291,8 @@ bnx2_interrupt(int irq, void *dev_instance)
return IRQ_HANDLED;
 }
 
+#define STATUS_ATTN_EVENTS STATUS_ATTN_BITS_LINK_STATE
+
 static inline int
 bnx2_has_work(struct bnx2 *bp)
 {
@@ -2292,8 +2302,8 @@ bnx2_has_work(struct bnx2 *bp)
(sblk-status_tx_quick_consumer_index0 != bp-hw_tx_cons))
return 1;
 
-   if ((sblk-status_attn_bits  STATUS_ATTN_BITS_LINK_STATE) !=
-   (sblk-status_attn_bits_ack  STATUS_ATTN_BITS_LINK_STATE))
+   if ((sblk-status_attn_bits  STATUS_ATTN_EVENTS) !=
+   (sblk-status_attn_bits_ack  STATUS_ATTN_EVENTS))
return 1;
 
return 0;
@@ -2303,15 +2313,14 @@ static int
 bnx2_poll(struct net_device *dev, int *budget)
 {
struct bnx2 *bp = netdev_priv(dev);
+   struct status_block *sblk = bp-status_blk;
+   u32 status_attn_bits = sblk-status_attn_bits;
+   u32 status_attn_bits_ack = sblk-status_attn_bits_ack;
 
-   if ((bp-status_blk-status_attn_bits 
-   STATUS_ATTN_BITS_LINK_STATE) !=
-   (bp-status_blk-status_attn_bits_ack 
-   STATUS_ATTN_BITS_LINK_STATE)) {
+   if ((status_attn_bits  STATUS_ATTN_EVENTS) !=
+   (status_attn_bits_ack  STATUS_ATTN_EVENTS)) {
 
-   spin_lock(bp-phy_lock);
bnx2_phy_int(bp);
-   spin_unlock(bp-phy_lock);
 
/* This is needed to take care of transient status
 * during link changes.
@@ -3760,7 +3769,7 @@ bnx2_init_chip(struct bnx2 *bp)
/* Clear internal stats counters. */
REG_WR(bp, BNX2_HC_COMMAND, BNX2_HC_COMMAND_CLR_STAT_NOW);
 
-   REG_WR(bp, BNX2_HC_ATTN_BITS_ENABLE, STATUS_ATTN_BITS_LINK_STATE);
+   REG_WR(bp, BNX2_HC_ATTN_BITS_ENABLE, STATUS_ATTN_EVENTS);
 
if (REG_RD_IND(bp, bp-shmem_base + BNX2_PORT_FEATURE) 
BNX2_PORT_FEATURE_ASF_ENABLED)


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 14/16][BNX2]: Add 1-shot MSI handler for 5709.

2007-05-03 Thread Michael Chan
[BNX2]: Add 1-shot MSI handler for 5709.

The 5709 supports the one-shot MSI handler similar to some of the tg3
chips.  In this mode, the MSI disables itself automatically until it
is re-enabled at the end of NAPI poll.

Put the request_irq/free_irq logic in common procedures.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index f072028..97ed400 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -2262,6 +2262,23 @@ bnx2_msi(int irq, void *dev_instance)
 }
 
 static irqreturn_t
+bnx2_msi_1shot(int irq, void *dev_instance)
+{
+   struct net_device *dev = dev_instance;
+   struct bnx2 *bp = netdev_priv(dev);
+
+   prefetch(bp-status_blk);
+
+   /* Return here if interrupt is disabled. */
+   if (unlikely(atomic_read(bp-intr_sem) != 0))
+   return IRQ_HANDLED;
+
+   netif_rx_schedule(dev);
+
+   return IRQ_HANDLED;
+}
+
+static irqreturn_t
 bnx2_interrupt(int irq, void *dev_instance)
 {
struct net_device *dev = dev_instance;
@@ -3759,13 +3776,17 @@ bnx2_init_chip(struct bnx2 *bp)
REG_WR(bp, BNX2_HC_STAT_COLLECT_TICKS, 0xbb8);  /* 3ms */
 
if (CHIP_ID(bp) == CHIP_ID_5706_A1)
-   REG_WR(bp, BNX2_HC_CONFIG, BNX2_HC_CONFIG_COLLECT_STATS);
+   val = BNX2_HC_CONFIG_COLLECT_STATS;
else {
-   REG_WR(bp, BNX2_HC_CONFIG, BNX2_HC_CONFIG_RX_TMR_MODE |
-  BNX2_HC_CONFIG_TX_TMR_MODE |
-  BNX2_HC_CONFIG_COLLECT_STATS);
+   val = BNX2_HC_CONFIG_RX_TMR_MODE | BNX2_HC_CONFIG_TX_TMR_MODE |
+ BNX2_HC_CONFIG_COLLECT_STATS;
}
 
+   if (bp-flags  ONE_SHOT_MSI_FLAG)
+   val |= BNX2_HC_CONFIG_ONE_SHOT;
+
+   REG_WR(bp, BNX2_HC_CONFIG, val);
+
/* Clear internal stats counters. */
REG_WR(bp, BNX2_HC_COMMAND, BNX2_HC_COMMAND_CLR_STAT_NOW);
 
@@ -4610,6 +4631,38 @@ bnx2_restart_timer:
mod_timer(bp-timer, jiffies + bp-current_interval);
 }
 
+static int
+bnx2_request_irq(struct bnx2 *bp)
+{
+   struct net_device *dev = bp-dev;
+   int rc = 0;
+
+   if (bp-flags  USING_MSI_FLAG) {
+   irq_handler_t   fn = bnx2_msi;
+
+   if (bp-flags  ONE_SHOT_MSI_FLAG)
+   fn = bnx2_msi_1shot;
+
+   rc = request_irq(bp-pdev-irq, fn, 0, dev-name, dev);
+   } else
+   rc = request_irq(bp-pdev-irq, bnx2_interrupt,
+IRQF_SHARED, dev-name, dev);
+   return rc;
+}
+
+static void
+bnx2_free_irq(struct bnx2 *bp)
+{
+   struct net_device *dev = bp-dev;
+
+   if (bp-flags  USING_MSI_FLAG) {
+   free_irq(bp-pdev-irq, dev);
+   pci_disable_msi(bp-pdev);
+   bp-flags = ~(USING_MSI_FLAG | ONE_SHOT_MSI_FLAG);
+   } else
+   free_irq(bp-pdev-irq, dev);
+}
+
 /* Called with rtnl_lock */
 static int
 bnx2_open(struct net_device *dev)
@@ -4626,24 +4679,15 @@ bnx2_open(struct net_device *dev)
if (rc)
return rc;
 
-   if ((CHIP_ID(bp) != CHIP_ID_5706_A0) 
-   (CHIP_ID(bp) != CHIP_ID_5706_A1) 
-   !disable_msi) {
-
+   if ((bp-flags  MSI_CAP_FLAG)  !disable_msi) {
if (pci_enable_msi(bp-pdev) == 0) {
bp-flags |= USING_MSI_FLAG;
-   rc = request_irq(bp-pdev-irq, bnx2_msi, 0, dev-name,
-   dev);
+   if (CHIP_NUM(bp) == CHIP_NUM_5709)
+   bp-flags |= ONE_SHOT_MSI_FLAG;
}
-   else {
-   rc = request_irq(bp-pdev-irq, bnx2_interrupt,
-   IRQF_SHARED, dev-name, dev);
-   }
-   }
-   else {
-   rc = request_irq(bp-pdev-irq, bnx2_interrupt, IRQF_SHARED,
-   dev-name, dev);
}
+   rc = bnx2_request_irq(bp);
+
if (rc) {
bnx2_free_mem(bp);
return rc;
@@ -4652,11 +4696,7 @@ bnx2_open(struct net_device *dev)
rc = bnx2_init_nic(bp);
 
if (rc) {
-   free_irq(bp-pdev-irq, dev);
-   if (bp-flags  USING_MSI_FLAG) {
-   pci_disable_msi(bp-pdev);
-   bp-flags = ~USING_MSI_FLAG;
-   }
+   bnx2_free_irq(bp);
bnx2_free_skbs(bp);
bnx2_free_mem(bp);
return rc;
@@ -4680,16 +4720,13 @@ bnx2_open(struct net_device *dev)
   bp-dev-name);
 
bnx2_disable_int(bp);
-   free_irq(bp-pdev-irq, dev);
-   pci_disable_msi(bp-pdev);
-   bp-flags = ~USING_MSI_FLAG;
+   bnx2_free_irq(bp);
 
rc = bnx2_init_nic(bp);
 
-   if (!rc) {
-  

[PATCH v2 15/16][BNX2]: Print bus information for PCIE devices.

2007-05-03 Thread Michael Chan
[BNX2]: Print bus information for PCIE devices.

Fix the code to print PCI or PCIE bus information for all devices.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 97ed400..85760f7 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -6040,6 +6040,58 @@ bnx2_get_5709_media(struct bnx2 *bp)
}
 }
 
+static void __devinit
+bnx2_get_pci_speed(struct bnx2 *bp)
+{
+   u32 reg;
+
+   reg = REG_RD(bp, BNX2_PCICFG_MISC_STATUS);
+   if (reg  BNX2_PCICFG_MISC_STATUS_PCIX_DET) {
+   u32 clkreg;
+
+   bp-flags |= PCIX_FLAG;
+
+   clkreg = REG_RD(bp, BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS);
+
+   clkreg = BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET;
+   switch (clkreg) {
+   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_133MHZ:
+   bp-bus_speed_mhz = 133;
+   break;
+
+   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_95MHZ:
+   bp-bus_speed_mhz = 100;
+   break;
+
+   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_66MHZ:
+   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_80MHZ:
+   bp-bus_speed_mhz = 66;
+   break;
+
+   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_48MHZ:
+   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_55MHZ:
+   bp-bus_speed_mhz = 50;
+   break;
+
+   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_LOW:
+   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_32MHZ:
+   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_38MHZ:
+   bp-bus_speed_mhz = 33;
+   break;
+   }
+   }
+   else {
+   if (reg  BNX2_PCICFG_MISC_STATUS_M66EN)
+   bp-bus_speed_mhz = 66;
+   else
+   bp-bus_speed_mhz = 33;
+   }
+
+   if (reg  BNX2_PCICFG_MISC_STATUS_32BIT_DET)
+   bp-flags |= PCI_32BIT_FLAG;
+
+}
+
 static int __devinit
 bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 {
@@ -6118,7 +6170,15 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device 
*dev)
 
bp-chip_id = REG_RD(bp, BNX2_MISC_ID);
 
-   if (CHIP_NUM(bp) != CHIP_NUM_5709) {
+   if (CHIP_NUM(bp) == CHIP_NUM_5709) {
+   if (pci_find_capability(pdev, PCI_CAP_ID_EXP) == 0) {
+   dev_err(pdev-dev,
+   Cannot find PCIE capability, aborting.\n);
+   rc = -EIO;
+   goto err_out_unmap;
+   }
+   bp-flags |= PCIE_FLAG;
+   } else {
bp-pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX);
if (bp-pcix_cap == 0) {
dev_err(pdev-dev,
@@ -6153,51 +6213,8 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device 
*dev)
goto err_out_unmap;
}
 
-   /* Get bus information. */
-   reg = REG_RD(bp, BNX2_PCICFG_MISC_STATUS);
-   if (reg  BNX2_PCICFG_MISC_STATUS_PCIX_DET) {
-   u32 clkreg;
-
-   bp-flags |= PCIX_FLAG;
-
-   clkreg = REG_RD(bp, BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS);
-
-   clkreg = BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET;
-   switch (clkreg) {
-   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_133MHZ:
-   bp-bus_speed_mhz = 133;
-   break;
-
-   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_95MHZ:
-   bp-bus_speed_mhz = 100;
-   break;
-
-   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_66MHZ:
-   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_80MHZ:
-   bp-bus_speed_mhz = 66;
-   break;
-
-   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_48MHZ:
-   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_55MHZ:
-   bp-bus_speed_mhz = 50;
-   break;
-
-   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_LOW:
-   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_32MHZ:
-   case BNX2_PCICFG_PCI_CLOCK_CONTROL_BITS_PCI_CLK_SPD_DET_38MHZ:
-   bp-bus_speed_mhz = 33;
-   break;
-   }
-   }
-   else {
-   if (reg  BNX2_PCICFG_MISC_STATUS_M66EN)
-   bp-bus_speed_mhz = 66;
-   else
-   bp-bus_speed_mhz = 33;
-   }
-
-   if (reg  BNX2_PCICFG_MISC_STATUS_32BIT_DET)
-   

[PATCH v2 16/16][BNX2]: Update version and reldate.

2007-05-03 Thread Michael Chan
[BNX2]: Update version and reldate.

Update version to 1.5.10.

Signed-off-by: Michael Chan [EMAIL PROTECTED]

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 85760f7..605347f 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -1,6 +1,6 @@
 /* bnx2.c: Broadcom NX2 network driver.
  *
- * Copyright (c) 2004, 2005, 2006 Broadcom Corporation
+ * Copyright (c) 2004-2007 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -54,8 +54,8 @@
 
 #define DRV_MODULE_NAMEbnx2
 #define PFX DRV_MODULE_NAME: 
-#define DRV_MODULE_VERSION 1.5.8
-#define DRV_MODULE_RELDATE April 24, 2007
+#define DRV_MODULE_VERSION 1.5.10
+#define DRV_MODULE_RELDATE May 1, 2007
 
 #define RUN_AT(x) (jiffies + (x))
 
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 322153c..bd6288d 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -1,6 +1,6 @@
 /* bnx2.h: Broadcom NX2 network driver.
  *
- * Copyright (c) 2004, 2005, 2006 Broadcom Corporation
+ * Copyright (c) 2004-2007 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: kernel BUG at include/net/tcp.h:739

2007-05-03 Thread Ilpo Järvinen
On Wed, 2 May 2007, Michal Piotrowski wrote:

 Please take a look at this bug
 
 [15236.638092] kernel BUG at /mnt/md0/devel/linux-git/include/net/tcp.h:739!
 [15236.644860] invalid opcode:  [#1]
 [15236.648514] PREEMPT SMP 
 [15236.651075] Modules linked in: ipt_MASQUERADE iptable_nat nf_nat autofs4 
 af_packet nf_conntrack_netbios_ns ipt_REJECT nf_conntrack_ipv4 xt_state 
 nf_conntrack nfnetlink iptable_filter ip_tables ip6t_REJECT xt_tcpudp 
 ip6table_filter ip6_tables x_tables ipv6 binfmt_misc thermal processor fan 
 container nvram snd_intel8x0 snd_ac97_codec ac97_bus snd_seq_dummy 
 snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss 
 snd_mixer_oss snd_pcm evdev snd_timer snd intel_agp i2c_i801 soundcore 
 agpgart snd_page_alloc ide_cd cdrom rtc unix
 [15236.698898] CPU:0
 [15236.698899] EIP:0060:[c02f798b]Not tainted VLI
 [15236.698900] EFLAGS: 00010206   (2.6.21-gdc87c398 #169)
 [15236.711580] EIP is at tcp_ack+0xc54/0x16a0
 [15236.715664] eax: 0017   ebx:    ecx: 0003   edx: 010e
 [15236.722433] esi: d5bc1254   edi: 010e   ebp: c0462e18   esp: c0462da8
 [15236.729202] ds: 007b   es: 007b   fs: 00d8  gs:   ss: 0068
 [15236.735019] Process swapper (pid: 0, ti=c0462000 task=c03f14e0 
 task.ti=c0427000)
 [15236.742219] Stack:    0198 0100  
  0018 
 [15236.750698]3b4d5775 0ffef1c0 3b4d79ad 0001 0018 0006 
 3b4d79ad 003f14e0 
 [15236.759178]0006 082a d4b9cde0 00e4059a 000c  
  0130204a 
 [15236.767649] Call Trace:
 [15236.770286]  [c0105039] show_trace_log_lvl+0x1a/0x2f
 [15236.775438]  [c01050eb] show_stack_log_lvl+0x9d/0xa5
 [15236.780590]  [c01052e0] show_registers+0x1ed/0x32c
 [15236.785569]  [c0105537] die+0x118/0x22f
 [15236.789588]  [c01056c7] do_trap+0x79/0x91
 [15236.793781]  [c0105f57] do_invalid_op+0x97/0xa1
 [15236.798501]  [c031f38c] error_code+0x7c/0x84
 [15236.802960]  [c02fafb7] tcp_rcv_established+0x568/0x645
 [15236.808354]  [c03000bd] tcp_v4_do_rcv+0x2b/0x32c
 [15236.813144]  [c030243a] tcp_v4_rcv+0x7f9/0x86b
 [15236.81]  [c02e9dd3] ip_local_deliver+0x170/0x235
 [15236.822928]  [c02e9c2a] ip_rcv+0x4f3/0x52c
 [15236.827199]  [c02d4909] netif_receive_skb+0x1b9/0x252
 [15236.832437]  [c02635c2] skge_poll+0x47a/0x545
 [15236.836967]  [c02d68df] net_rx_action+0x9f/0x192
 [15236.841772]  [c0126408] __do_softirq+0x6d/0xea
 [15236.846407]  [c01069b5] do_softirq+0x64/0xd1
 [15236.850867]  ===
 [15236.854437] Code: 69 42 c0 f7 d0 64 8b 15 04 00 00 00 8b 04 90 ff 80 a4 00 
 00 00 8b 9e 70 05 00 00 89 d8 03 86 74 05 00 00 3b 86 8c 04 00 00 76 04 0f 
 0b eb fe 89 86 90 04 00 00 8a 86 88 03 00 00 84 c0 75 3c 83 
 [15236.874343] EIP: [c02f798b] tcp_ack+0xc54/0x16a0 SS:ESP 0068:c0462da8
 
 l *0xc02f798b
 0xc02f798b is in tcp_ack (/mnt/md0/devel/linux-git/include/net/tcp.h:739).
 734 (tp-snd_cwnd  2)));
 735 }
 736
 737 static inline void tcp_sync_left_out(struct tcp_sock *tp)
 738 {
 739 BUG_ON(tp-sacked_out + tp-lost_out  tp-packets_out);
 740 tp-left_out = tp-sacked_out + tp-lost_out;
 741 }
 742
 743 extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
 
 Caused by commit 34588b4c046c34773e5a1a962da7b78b05c4d1bd 

I think I found the reason:

tcp_clean_rtx_queue without SACK it does not decrement sacked_out but
tcp_reset_reno_sack/remove_reno_sack is being called later in
tcp_fastretrans_alert. Before that, tcp_sync_left_out is being called, 
at least by tcp_fastretrans_alert itself, which sees sacked_out that 
includes also segments that are no longer in window (this also explains 
why the original code did not do the reduction in the non-SACK case). Also 
tcp_process_frto calls tcp_sync_left_out, so it would also lead to the 
same problem.

Here is a change that ignores this trap without SACK. However, it would be 
useful to trap this without SACK too as S+L skb causes potentially a 
negative packets in flight (= large one) disturbing cwnd compares. 


[PATCH] [TCP]: Use S+L catcher only with SACK for now

TCP has a transitional state when SACK is not in use during
which this invariant is temporarily broken. Without SACK,
tcp_clean_rtx_queue does not decrement sacked_out. Therefore
calls to tcp_sync_left_out before sacked_out is again
corrected by tcp_fastretrans_alert can trigger this trap as
sacked_out still has couple of segments that are already out
of window.

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
---
 include/net/tcp.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index ef8f9d4..e22b4f0 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -736,7 +736,8 @@ static inline __u32 tcp_current_ssthresh
 
 static inline void tcp_sync_left_out(struct tcp_sock *tp)
 {
-   BUG_ON(tp-sacked_out + tp-lost_out  tp-packets_out);
+   

[PATCH 2.6.21] AT91RM9200 Ethernet: Support additional PHYs

2007-05-03 Thread Andrew Victor
Add support for a number of new PHY's in the AT91RM9200 Ethernet driver.
- Teridian 78Q21x3
- SMSC LAN83C185
  (Patch from Luca Gamma)
- National Semiconductor DP83848
  (Patches from Ivan Kuten  Thomas Foldesi)

Signed-off-by: Andrew Victor [EMAIL PROTECTED]


diff -urN linux-2.6.21.new/drivers/net/arm/at91_ether.c 
linux-2.6.21/drivers/net/arm/at91_ether.c
--- linux-2.6.21.new/drivers/net/arm/at91_ether.c   Thu May  3 08:32:10 2007
+++ linux-2.6.21/drivers/net/arm/at91_ether.c   Thu May  3 08:58:34 2007
@@ -225,6 +225,16 @@
if (!(phy  ((1  2) | 1)))
goto done;
}
+   else if (lp-phy_type == MII_T78Q21x3_ID) { /* ack 
interrupt in Teridian PHY */
+   read_phy(lp-phy_address, MII_T78Q21INT_REG, phy);
+   if (!(phy  ((1  2) | 1)))
+   goto done;
+   }
+   else if (lp-phy_type == MII_DP83848_ID) {
+   read_phy(lp-phy_address, MII_DPPHYSTS_REG, phy);  /* ack 
interrupt in DP83848 PHY */
+   if (!(phy  (1  7)))
+   goto done;
+   }
 
update_linkspeed(dev, 0);
 
@@ -280,6 +290,19 @@
dsintr = (1  10) | ( 1  8);
write_phy(lp-phy_address, MII_TPISTATUS, dsintr);
}
+   else if (lp-phy_type == MII_T78Q21x3_ID) { /* for Teridian PHY */
+   read_phy(lp-phy_address, MII_T78Q21INT_REG, dsintr);
+   dsintr = dsintr | 0x500;/* set bits 8, 10 */
+   write_phy(lp-phy_address, MII_T78Q21INT_REG, dsintr);
+   }
+   else if (lp-phy_type == MII_DP83848_ID) {  /* National 
Semiconductor DP83848 PHY */
+   read_phy(lp-phy_address, MII_DPMISR_REG, dsintr);
+   dsintr = dsintr | 0x3c; /* set bits 2..5 */
+   write_phy(lp-phy_address, MII_DPMISR_REG, dsintr);
+   read_phy(lp-phy_address, MII_DPMICR_REG, dsintr);
+   dsintr = dsintr | 0x3;  /* set bits 0,1 */
+   write_phy(lp-phy_address, MII_DPMICR_REG, dsintr);
+   }
 
disable_mdi();
spin_unlock_irq(lp-lock);
@@ -323,6 +346,19 @@
dsintr = ~((1  10) | (1  8));
write_phy(lp-phy_address, MII_TPISTATUS, dsintr);
}
+   else if (lp-phy_type == MII_T78Q21x3_ID) { /* for Teridian PHY */
+   read_phy(lp-phy_address, MII_T78Q21INT_REG, dsintr);
+   dsintr = dsintr  ~0x500;   /* clear bits 
8, 10 */
+   write_phy(lp-phy_address, MII_T78Q21INT_REG, dsintr);
+   }
+   else if (lp-phy_type == MII_DP83848_ID) {  /* National 
Semiconductor DP83848 PHY */
+   read_phy(lp-phy_address, MII_DPMICR_REG, dsintr);
+   dsintr = dsintr  ~0x3; /* clear bits 
0, 1 */
+   write_phy(lp-phy_address, MII_DPMICR_REG, dsintr);
+   read_phy(lp-phy_address, MII_DPMISR_REG, dsintr);
+   dsintr = dsintr  ~0x3c;/* clear bits 
2..5 */
+   write_phy(lp-phy_address, MII_DPMISR_REG, dsintr);
+   }
 
disable_mdi();
spin_unlock_irq(lp-lock);
@@ -1063,10 +1099,16 @@
printk(KERN_INFO %s: Broadcom BCM5221 PHY\n, dev-name);
else if (phy_type == MII_DP83847_ID)
printk(KERN_INFO %s: National Semiconductor DP83847 PHY\n, 
dev-name);
+   else if (phy_type == MII_DP83848_ID)
+   printk(KERN_INFO %s: National Semiconductor DP83848 PHY\n, 
dev-name);
else if (phy_type == MII_AC101L_ID)
printk(KERN_INFO %s: Altima AC101L PHY\n, dev-name);
else if (phy_type == MII_KS8721_ID)
printk(KERN_INFO %s: Micrel KS8721 PHY\n, dev-name);
+   else if (phy_type == MII_T78Q21x3_ID)
+   printk(KERN_INFO %s: Teridian 78Q21x3 PHY\n, dev-name);
+   else if (phy_type == MII_LAN83C185_ID)
+   printk(KERN_INFO %s: SMSC LAN83C185 PHY\n, dev-name);
 
return 0;
 }
@@ -1104,8 +1146,11 @@
case MII_RTL8201_ID:/* Realtek RTL8201: 
PHY_ID1 = 0, PHY_ID2 = 0x8201 */
case MII_BCM5221_ID:/* Broadcom BCM5221: 
PHY_ID1 = 0x40, PHY_ID2 = 0x61e0 */
case MII_DP83847_ID:/* National 
Semiconductor DP83847:  */
+   case MII_DP83848_ID:/* National 
Semiconductor DP83848:  */
case MII_AC101L_ID: /* Altima AC101L: 
PHY_ID1 = 0x22, PHY_ID2 = 0x5520 */
case MII_KS8721_ID: /* Micrel KS8721: 
PHY_ID1 = 0x22, PHY_ID2 = 0x1610 */
+   case MII_T78Q21x3_ID:   /* Teridian 78Q21x3: 
PHY_ID1 = 0x0E, PHY_ID2 = 7237 */
+   case MII_LAN83C185_ID:  /* SMSC LAN83C185: 
PHY_ID1 = 0x0007, PHY_ID2 = 0xC0A1 */

Re: netfront for review

2007-05-03 Thread Gerd Hoffmann

  Hi,


Gerd, in change 11196:b85da7cd9ea5 front: Fix rx buffer leak when
tearing down an interface. you added a call to
add_id_to_freelist(np-rx_skbs, id);.  However, rx_skbs doesn't have
an extra entry for the list head, and there's never any corresponding
get_id_from_freelist(np-rx_skbs).  What should it be?


The function has an effect in page flipping mode only.  It walks the 
whole list of rx skbufs (id is the loop variable ...), checks whenever 
they are handed out to the frontend driver to fill in packet data and 
not returned yet, and if so reclaim them ...



+   err = xenbus_scanf(XBT_NIL, np-xbdev-otherend,
+  feature-rx-flip, %u, feature_rx_flip);
+   if (err != 1)
+   feature_rx_flip = 1;


This second one deserves a comment.  If it doesn't set feature_rx_flip
it's *on*?  Historical reasons


Guess so.  It defaults to flip.  I simplified the rx_copy/flip module
parameter to a simple rx_mode=0/1, but this is preserved from the
original.  My guess is that originally there was only flip, and copy was
added later.


Yep, page flipping is the old (pre xen 3.0.3) way, copy was added (and 
made the default) later.


cheers,
  Gerd
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ppp_generic.c recursive spinlock_bh(pch-downl)

2007-05-03 Thread Guennadi Liakhovetski
Hi Paul,

This has been discussed on these lists since some time already, but as we 
don't seem to come to a proper fix, I decided to summarize our problem 
once again.

A short summary from the ppp PoV:

ppp_push()
{
spin_lock_bh(pch-downl);
pch-chan-ops-start_xmit(pch-chan, skb)
{
...
ppp_output_wakeup()
{
ppp_channel_push()
{
spin_lock_bh(pch-downl);
BANG!...

This happens with IrNET. So, the question is, is it legitimate to call 
ppp_channel_push() from the .start_xmit() method? How do other ppp drivers 
do it? Looks like, for examplke, ppp_async checks explicitly for 
recursion, synctty does a try_spinlock_bh()... Is it just a bug in IrNET 
and one just cannot do this, or is there a simple fix for this?

Samuel's suggestion is to offload the call to ppp_output_wakeup() to the 
keventd workqueue, but we haven't been able to make this work properly so 
far.

I have a dirty workaround, whereby I explicitly verify recursion in 
ppp_channel_push(). This works, but it doesn't seem to be a good solution.

Thanks
Guennadi
-
Guennadi Liakhovetski, Ph.D.
DSA Daten- und Systemtechnik GmbH
Pascalstr. 28
D-52076 Aachen
Germany
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


finding your own dead CONFIG_ variables

2007-05-03 Thread Robert P. J. Day

  while there's still a pile of possible dead CONFIG_ variables under
the fs/ and drivers/ directories i haven't posted yet, you don't need
to wait for me to generate them.  take a minute and run the script
yourself:

http://fsdev.net/wiki/index.php?title=Dead_CONFIG_variables

  a couple of examples:

$ ../dead_config.sh net/wanrouter
== WANPIPE_MULTPPP ==
net/wanrouter/wanmain.c:#ifdef CONFIG_WANPIPE_MULTPPP
net/wanrouter/wanmain.c:#ifdef CONFIG_WANPIPE_MULTPPP
net/wanrouter/wanmain.c:#ifdef CONFIG_WANPIPE_MULTPPP

$ ../dead_config.sh drivers/net/wireless
== BCM947XX ==
drivers/net/wireless/bcm43xx/bcm43xx_dma.c:663:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.h:36:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:64:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:145:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:789:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:799:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:1228:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:1390://FIXME: Do we _really_ want 
#ifndef CONFIG_BCM947XX here?
drivers/net/wireless/bcm43xx/bcm43xx_main.c:1392:#ifndef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:2143:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:2155:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:2648:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:4147:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx.h:661:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx.h:792:#ifdef CONFIG_BCM947XX
$

  go wild.

rday
-- 

Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] natsemi: Improve diagnostics for DspCfg workaround

2007-05-03 Thread Mark Brown
The natsemi driver has a workaround for broken hardware which resets itself
from time to time.  There is a diagnostic message for this workaround but
it is not printed by default, making the driver behavior more obscure than
it needs to be.  Make the message be displayed by default.

Signed-Off-By: Mark Brown [EMAIL PROTECTED]
---

 drivers/net/natsemi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index a8d7ff2..109e802 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -1756,7 +1756,7 @@ static void netdev_timer(unsigned long data)
if (dspcfg != np-dspcfg) {
if (!netif_queue_stopped(dev)) {
spin_unlock_irq(np-lock);
-   if (netif_msg_hw(np))
+   if (netif_msg_drv(np))
printk(KERN_NOTICE %s: possible phy 
reset: 
re-initializing\n, dev-name);
disable_irq(dev-irq);

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: finding your own dead CONFIG_ variables

2007-05-03 Thread Satyam Sharma

http://fsdev.net/wiki/index.php?title=Dead_CONFIG_variables



kcfiles=$(find . -name Kconfig*)


Suggest: configfiles=$(find . -name 'Kconfig*' -or -name '*defconfig*')

Some CONFIG_ options exist that are not declared anywhere in the
Kconfig files but defined directly in the arch/.../*defconfig* files.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] Subject: natsemi: Allow users to disable workaround for DspCfg reset

2007-05-03 Thread Mark Brown
The natsemi driver contains a workaround for broken hardware which can
partially reset the chip at unpredictable times, detected by checking for
spontaneous changes in the DspCfg register.  The effects of the hardware
bug appear to be variable and can range from minor problems like small
numbers of corrupted packets to major ones such as the chip becoming
non-functional.  In the case of minor problems the chip reconfiguration
required to work around the hardware can cause more problems than the bug
itself.

Since we have no way of automatically determining how badly the problem
manifests on any given system provide an option in sysfs allowing users to
disable the workaround at runtime and provides a module option to set the
default.

Signed-Off-By: Mark Brown [EMAIL PROTECTED]
---

 drivers/net/natsemi.c |   68 -
 1 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 109e802..223e0e6 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -81,6 +81,8 @@ static const int multicast_filter_limit = 100;
Setting to  1518 effectively disables this feature. */
 static int rx_copybreak;
 
+static int dspcfg_workaround = 1;
+
 /* Used to pass the media type, etc.
Both 'options[]' and 'full_duplex[]' should exist for driver
interoperability.
@@ -139,12 +141,14 @@ MODULE_LICENSE(GPL);
 module_param(mtu, int, 0);
 module_param(debug, int, 0);
 module_param(rx_copybreak, int, 0);
+module_param(dspcfg_workaround, int, 1);
 module_param_array(options, int, NULL, 0);
 module_param_array(full_duplex, int, NULL, 0);
 MODULE_PARM_DESC(mtu, DP8381x MTU (all boards));
 MODULE_PARM_DESC(debug, DP8381x default debug level);
 MODULE_PARM_DESC(rx_copybreak,
DP8381x copy breakpoint for copy-only-tiny-frames);
+MODULE_PARM_DESC(dspcfg_workaround, DP8381x: control DspCfg workaround);
 MODULE_PARM_DESC(options,
DP8381x: Bits 0-3: media type, bit 17: full duplex);
 MODULE_PARM_DESC(full_duplex, DP8381x full duplex setting(s) (1));
@@ -590,6 +594,7 @@ struct netdev_private {
u32 srr;
/* expected DSPCFG value */
u16 dspcfg;
+   int dspcfg_workaround;
/* parms saved in ethtool format */
u16 speed;  /* The forced speed, 10Mb, 100Mb, gigabit */
u8  duplex; /* Duplex, half or full */
@@ -656,6 +661,56 @@ static int netdev_get_regs(struct net_device *dev, u8 
*buf);
 static int netdev_get_eeprom(struct net_device *dev, u8 *buf);
 static const struct ethtool_ops ethtool_ops;
 
+#define NATSEMI_ATTR(_name) \
+static ssize_t natsemi_show_##_name(struct device *dev, \
+ struct device_attribute *attr, char *buf); \
+static ssize_t natsemi_set_##_name(struct device *dev, \
+   struct device_attribute *attr, \
+   const char *buf, size_t count); \
+static DEVICE_ATTR(_name, 0644, natsemi_show_##_name, 
natsemi_set_##_name)
+
+#define NATSEMI_CREATE_FILE(_dev, _name) \
+ device_create_file(_dev-dev, dev_attr_##_name)
+#define NATSEMI_REMOVE_FILE(_dev, _name) \
+ device_create_file(_dev-dev, dev_attr_##_name)
+
+NATSEMI_ATTR(dspcfg_workaround);
+
+static ssize_t natsemi_show_dspcfg_workaround(struct device *dev,
+ struct device_attribute *attr, 
+ char *buf)
+{
+   struct netdev_private *np = netdev_priv(to_net_dev(dev));
+
+   return sprintf(buf, %s\n, np-dspcfg_workaround ? on : off);
+}
+
+static ssize_t natsemi_set_dspcfg_workaround(struct device *dev,
+struct device_attribute *attr,
+const char *buf, size_t count)
+{
+   struct netdev_private *np = netdev_priv(to_net_dev(dev));
+   int new_setting;
+   u32 flags;
+
+/* Find out the new setting */
+if (!strncmp(on, buf, count - 1) || !strncmp(1, buf, count - 1))
+new_setting = 1;
+else if (!strncmp(off, buf, count - 1)
+ || !strncmp(0, buf, count - 1))
+   new_setting = 0;
+   else
+ return count; 
+
+   spin_lock_irqsave(np-lock, flags);
+
+   np-dspcfg_workaround = new_setting;
+
+   spin_unlock_irqrestore(np-lock, flags);
+
+   return count;
+}
+
 static inline void __iomem *ns_ioaddr(struct net_device *dev)
 {
return (void __iomem *) dev-base_addr;
@@ -820,6 +875,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
np-ignore_phy = 1;
else
np-ignore_phy = 0;
+   np-dspcfg_workaround = dspcfg_workaround;
 
/* Initial port:
 * - If configured to ignore the PHY set up for external.
@@ -899,6 +955,9 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
if (i)
goto err_register_netdev;
 
+   if 

[PATCH 0/2] natsemi: Improve DspCfg workaround

2007-05-03 Thread Mark Brown
The natsemi driver contains a workaround for broken hardware which can
on some boards cause more problems than it solves.  The following patch
series improves this by making the diagnostic more obvious and allowing
users to disable the workaround if it causes them problems.

-- 
You grabbed my hand and we fell into it, like a daydream - or a fever.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: finding your own dead CONFIG_ variables

2007-05-03 Thread Robert P. J. Day
On Thu, 3 May 2007, Satyam Sharma wrote:

  http://fsdev.net/wiki/index.php?title=Dead_CONFIG_variables

  kcfiles=$(find . -name Kconfig*)

 Suggest: configfiles=$(find . -name 'Kconfig*' -or -name '*defconfig*')

 Some CONFIG_ options exist that are not declared anywhere in the
 Kconfig files but defined directly in the arch/.../*defconfig*
 files.

it's my understanding that entries in any defconfig files are
*automatically* pruned at some point once a CONFIG_ variable no longer
exists in any Kconfig file, so i'm not going to be touching those
files.  also, adding that extra check wouldn't add anything useful to
the output.

rday

-- 

Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] [NETLINK]: Fix use after free in netlink_recvmsg

2007-05-03 Thread David Howells
When the user passes in MSG_TRUNC the skb is used after getting freed.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David Howells [EMAIL PROTECTED]
---

 net/netlink/af_netlink.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 42d2fb9..7419f70 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1245,16 +1245,14 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct 
socket *sock,
siocb-scm = scm;
}
siocb-scm-creds = *NETLINK_CREDS(skb);
+   if (flags  MSG_TRUNC)
+   copied = skb-len;
skb_free_datagram(sk, skb);
 
if (nlk-cb  atomic_read(sk-sk_rmem_alloc) = sk-sk_rcvbuf / 2)
netlink_dump(sk);
 
scm_recv(sock, msg, siocb-scm, flags);
-
-   if (flags  MSG_TRUNC)
-   copied = skb-len;
-
 out:
netlink_rcv_wake(sk);
return err ? : copied;

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] [NET]: Add __dev_getfirstbyhwtype

2007-05-03 Thread David Howells
Add __dev_getfirstbyhwtype for callers that don't want a reference but
some data from the device and thus need to take the rtnl anyway.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David Howells [EMAIL PROTECTED]
---

 include/linux/netdevice.h |1 +
 net/core/dev.c|   21 -
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ac0c92b..4428f1c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -582,6 +582,7 @@ extern int  netdev_boot_setup_check(struct 
net_device *dev);
 extern unsigned long   netdev_boot_base(const char *prefix, int unit);
 extern struct net_device*dev_getbyhwaddr(unsigned short type, char 
*hwaddr);
 extern struct net_device *dev_getfirstbyhwtype(unsigned short type);
+extern struct net_device *__dev_getfirstbyhwtype(unsigned short type);
 extern voiddev_add_pack(struct packet_type *pt);
 extern voiddev_remove_pack(struct packet_type *pt);
 extern void__dev_remove_pack(struct packet_type *pt);
diff --git a/net/core/dev.c b/net/core/dev.c
index eb99900..c305819 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -576,17 +576,28 @@ struct net_device *dev_getbyhwaddr(unsigned short type, 
char *ha)
 
 EXPORT_SYMBOL(dev_getbyhwaddr);
 
-struct net_device *dev_getfirstbyhwtype(unsigned short type)
+struct net_device *__dev_getfirstbyhwtype(unsigned short type)
 {
struct net_device *dev;
 
-   rtnl_lock();
+   ASSERT_RTNL();
for (dev = dev_base; dev; dev = dev-next) {
-   if (dev-type == type) {
-   dev_hold(dev);
+   if (dev-type == type)
break;
-   }
}
+   return dev;
+}
+
+EXPORT_SYMBOL(__dev_getfirstbyhwtype);
+
+struct net_device *dev_getfirstbyhwtype(unsigned short type)
+{
+   struct net_device *dev;
+
+   rtnl_lock();
+   dev = __dev_getfirstbyhwtype(type);
+   if (dev)
+   dev_hold(dev);
rtnl_unlock();
return dev;
 }

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] [AFS]: Fix memory leak in SRXAFSCB_GetCapabilities

2007-05-03 Thread David Howells
The interface array is not freed on exit.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David Howells [EMAIL PROTECTED]
---

 fs/afs/cmservice.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
index 6685f4c..d5b2ad6 100644
--- a/fs/afs/cmservice.c
+++ b/fs/afs/cmservice.c
@@ -443,6 +443,7 @@ static void SRXAFSCB_GetCapabilities(struct work_struct 
*work)
reply.ia.netmask[loop] = ifs[loop].netmask.s_addr;
reply.ia.mtu[loop] = htonl(ifs[loop].mtu);
}
+   kfree(ifs);
}
 
reply.cap.capcount = htonl(1);

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] [AFS]: Replace rtnetlink client by direct dev_base walking

2007-05-03 Thread David Howells
Replace the large and complicated rtnetlink client by two simple
functions for getting the MAC address for the first ethernet device
and building a list of IPv4 addresses.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David Howells [EMAIL PROTECTED]
---

 fs/afs/Makefile|2 
 fs/afs/internal.h  |1 
 fs/afs/netdevices.c|   54 +
 fs/afs/use-rtnetlink.c |  473 
 4 files changed, 55 insertions(+), 475 deletions(-)

diff --git a/fs/afs/Makefile b/fs/afs/Makefile
index 01545eb..cf83e5d 100644
--- a/fs/afs/Makefile
+++ b/fs/afs/Makefile
@@ -18,7 +18,7 @@ kafs-objs := \
security.o \
server.o \
super.o \
-   use-rtnetlink.o \
+   netdevices.o \
vlclient.o \
vlocation.o \
vnode.o \
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 3363e31..551db89 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -349,7 +349,6 @@ struct afs_permits {
  * record of one of a system's set of network interfaces
  */
 struct afs_interface {
-   unsignedindex;  /* interface index */
struct in_addr  address;/* IPv4 address bound to interface */
struct in_addr  netmask;/* netmask applied to address */
unsignedmtu;/* MTU of interface */
diff --git a/fs/afs/netdevices.c b/fs/afs/netdevices.c
new file mode 100644
index 000..2b30873
--- /dev/null
+++ b/fs/afs/netdevices.c
@@ -0,0 +1,54 @@
+/* AFS network device helpers
+ *
+ * Copyright (c) 2007 Patrick McHardy [EMAIL PROTECTED]
+ */
+
+#include linux/string.h
+#include linux/rtnetlink.h
+#include linux/inetdevice.h
+#include linux/netdevice.h
+#include linux/if_arp.h
+#include internal.h
+
+int afs_get_MAC_address(u8 mac[ETH_ALEN])
+{
+   struct net_device *dev;
+   int ret = -ENODEV;
+
+   rtnl_lock();
+   dev = __dev_getfirstbyhwtype(ARPHRD_ETHER);
+   if (dev) {
+   memcpy(mac, dev-dev_addr, ETH_ALEN);
+   ret = 0;
+   }
+   rtnl_unlock();
+   return ret;
+}
+
+int afs_get_ipv4_interfaces(struct afs_interface *bufs, size_t maxbufs,
+   bool wantloopback)
+{
+   struct net_device *dev;
+   struct in_device *idev;
+   int n = 0;
+
+   rtnl_lock();
+   for (dev = dev_base; dev; dev = dev-next) {
+   if (dev-type == ARPHRD_LOOPBACK  !wantloopback)
+   continue;
+   idev = __in_dev_get_rtnl(dev);
+   if (!idev)
+   continue;
+   for_primary_ifa(idev) {
+   if (n == maxbufs)
+   goto out;
+   bufs[n].address.s_addr = ifa-ifa_address;
+   bufs[n].netmask.s_addr = ifa-ifa_mask;
+   bufs[n].mtu = dev-mtu;
+   n++;
+   } endfor_ifa(idev)
+   }
+out:
+   rtnl_unlock();
+   return n;
+}
diff --git a/fs/afs/use-rtnetlink.c b/fs/afs/use-rtnetlink.c
deleted file mode 100644
index f8991c7..000
--- a/fs/afs/use-rtnetlink.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/* RTNETLINK client
- *
- * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
- * Written by David Howells ([EMAIL PROTECTED])
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-#include linux/netlink.h
-#include linux/rtnetlink.h
-#include linux/if_addr.h
-#include linux/if_arp.h
-#include linux/inetdevice.h
-#include net/netlink.h
-#include internal.h
-
-struct afs_rtm_desc {
-   struct socket   *nlsock;
-   struct afs_interface*bufs;
-   u8  *mac;
-   size_t  nbufs;
-   size_t  maxbufs;
-   void*data;
-   ssize_t datalen;
-   size_t  datamax;
-   int msg_seq;
-   unsignedmac_index;
-   boolwantloopback;
-   int (*parse)(struct afs_rtm_desc *, struct nlmsghdr *);
-};
-
-/*
- * parse an RTM_GETADDR response
- */
-static int afs_rtm_getaddr_parse(struct afs_rtm_desc *desc,
-struct nlmsghdr *nlhdr)
-{
-   struct afs_interface *this;
-   struct ifaddrmsg *ifa;
-   struct rtattr *rtattr;
-   const char *name;
-   size_t len;
-
-   ifa = (struct ifaddrmsg *) NLMSG_DATA(nlhdr);
-
-   _enter({ix=%d,af=%d}, ifa-ifa_index, ifa-ifa_family);
-
-   if (ifa-ifa_family != AF_INET) {
-   _leave( = 0 [family %d], ifa-ifa_family);
-   return 0;
-   }
-   if (desc-nbufs = desc-maxbufs) {
-   _leave( = 0 [max %zu/%zu], desc-nbufs, desc-maxbufs);
- 

[PATCH 5/5] AFS: Adjust the new netdevice scanning code

2007-05-03 Thread David Howells
Adjust the new netdevice scanning code provided by Patrick McHardy:

 (1) Restore the function banner comments that were dropped.

 (2) Rather than using an array size of 6 in some places and an array size of
 ETH_ALEN in others, pass a pointer instead and pass the array size
 through so that we can actually check it.

 (3) Do the buffer fill count check before checking the for_primary_ifa
 condition again.  This permits us to skip that check should maxbufs be
 reached before we run out of interfaces.

Signed-off-by: David Howells [EMAIL PROTECTED]
---

 fs/afs/internal.h   |2 +-
 fs/afs/main.c   |2 +-
 fs/afs/netdevices.c |   24 +++-
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 551db89..d90c158 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -563,7 +563,7 @@ extern void afs_fs_exit(void);
  * use-rtnetlink.c
  */
 extern int afs_get_ipv4_interfaces(struct afs_interface *, size_t, bool);
-extern int afs_get_MAC_address(u8 [6]);
+extern int afs_get_MAC_address(u8 *, size_t);
 
 /*
  * vlclient.c
diff --git a/fs/afs/main.c b/fs/afs/main.c
index 40c2704..80ec6fd 100644
--- a/fs/afs/main.c
+++ b/fs/afs/main.c
@@ -54,7 +54,7 @@ static int __init afs_get_client_UUID(void)
 
/* read the MAC address of one of the external interfaces and construct
 * a UUID from it */
-   ret = afs_get_MAC_address(afs_uuid.node);
+   ret = afs_get_MAC_address(afs_uuid.node, sizeof(afs_uuid.node));
if (ret  0)
return ret;
 
diff --git a/fs/afs/netdevices.c b/fs/afs/netdevices.c
index 2b30873..ce08977 100644
--- a/fs/afs/netdevices.c
+++ b/fs/afs/netdevices.c
@@ -10,21 +10,33 @@
 #include linux/if_arp.h
 #include internal.h
 
-int afs_get_MAC_address(u8 mac[ETH_ALEN])
+/*
+ * get a MAC address from a random ethernet interface that has a real one
+ * - the buffer will normally be 6 bytes in size
+ */
+int afs_get_MAC_address(u8 *mac, size_t maclen)
 {
struct net_device *dev;
int ret = -ENODEV;
 
+   if (maclen != ETH_ALEN)
+   BUG();
+
rtnl_lock();
dev = __dev_getfirstbyhwtype(ARPHRD_ETHER);
if (dev) {
-   memcpy(mac, dev-dev_addr, ETH_ALEN);
+   memcpy(mac, dev-dev_addr, maclen);
ret = 0;
}
rtnl_unlock();
return ret;
 }
 
+/*
+ * get a list of this system's interface IPv4 addresses, netmasks and MTUs
+ * - maxbufs must be at least 1
+ * - returns the number of interface records in the buffer
+ */
 int afs_get_ipv4_interfaces(struct afs_interface *bufs, size_t maxbufs,
bool wantloopback)
 {
@@ -32,6 +44,8 @@ int afs_get_ipv4_interfaces(struct afs_interface *bufs, 
size_t maxbufs,
struct in_device *idev;
int n = 0;
 
+   ASSERT(maxbufs  0);
+
rtnl_lock();
for (dev = dev_base; dev; dev = dev-next) {
if (dev-type == ARPHRD_LOOPBACK  !wantloopback)
@@ -40,13 +54,13 @@ int afs_get_ipv4_interfaces(struct afs_interface *bufs, 
size_t maxbufs,
if (!idev)
continue;
for_primary_ifa(idev) {
-   if (n == maxbufs)
-   goto out;
bufs[n].address.s_addr = ifa-ifa_address;
bufs[n].netmask.s_addr = ifa-ifa_mask;
bufs[n].mtu = dev-mtu;
n++;
-   } endfor_ifa(idev)
+   if (n = maxbufs)
+   goto out;
+   } endfor_ifa(idev);
}
 out:
rtnl_unlock();

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: finding your own dead CONFIG_ variables

2007-05-03 Thread Arnd Bergmann
On Thursday 03 May 2007, Robert P. J. Day wrote:
  Suggest: configfiles=$(find . -name 'Kconfig*' -or -name '*defconfig*')
 
  Some CONFIG_ options exist that are not declared anywhere in the
  Kconfig files but defined directly in the arch/.../*defconfig*
  files.
 
 it's my understanding that entries in any defconfig files are
 *automatically* pruned at some point once a CONFIG_ variable no longer
 exists in any Kconfig file, so i'm not going to be touching those
 files.  also, adding that extra check wouldn't add anything useful to
 the output.


An interesting category would be a symbol that is

- used in a source file
- defined in an old defconfig
- not present in any Kconfig* file

If any of these exist, I would consider them _worse_ than the ones
found by your initial script, because some functionality that once
was there has been recently removed.

Arnd 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] IPV6 : get rid of __HAVE_ARCH_ADDR_SET

2007-05-03 Thread David Miller
From: Eric Dumazet [EMAIL PROTECTED]
Date: Tue, 01 May 2007 06:00:09 +0200

 __HAVE_ARCH_ADDR_SET seems unused these days, just get rid of it.
 
 Signed-off-by: Eric Dumazet [EMAIL PROTECTED]

Applied, thanks Eric.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] AFS: Make the match_*() functions take const options

2007-05-03 Thread David Miller
From: David Howells [EMAIL PROTECTED]
Date: Tue, 01 May 2007 18:47:47 +0100

 Make the match_*() functions take a const pointer to the options table and
 make strings pointers in the options table const too.
 
 Signed-off-by: David Howells [EMAIL PROTECTED]

I'll take this, applied, thanks David.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] AFS/AF_RXRPC: Miscellaneous fixes

2007-05-03 Thread David Miller
From: David Howells [EMAIL PROTECTED]
Date: Tue, 01 May 2007 18:47:52 +0100

 Make miscellaneous fixes to AFS and AF_RXRPC:
 
  (*) Make AF_RXRPC select KEYS rather than RXKAD or AFS_FS in Kconfig.
 
  (*) Don't use FS_BINARY_MOUNTDATA.
 
  (*) Remove a done 'TODO' item in a comemnt on afs_get_sb().
 
  (*) Don't pass a void * as the page pointer argument of kmap_atomic() as this
  breaks on m68k.  Patch from Geert Uytterhoeven [EMAIL PROTECTED].
 
  (*) Use match_*() functions rather than doing my own parsing.
 
 Signed-off-by: David Howells [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] AFS: Fix use of __exit functions from __init path

2007-05-03 Thread David Miller
From: David Howells [EMAIL PROTECTED]
Date: Tue, 01 May 2007 19:17:06 +0100

 Fix use of __exit functions from __init path.
 
 Signed-off-by: David Howells [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] smc91x SuperH support

2007-05-03 Thread Nobuhiro Iwamatsu
Hi, all.

This patch supports SuperH of smc91x. 
smc91x installed on the board of SuperH comes to work by applying this patch. 
Please apply this patch .

regards,
 Nobuhiro

-- 
Nobuhiro Iwamatsu
E-Mail : [EMAIL PROTECTED]
GPG ID : 3170EBE9 

Signed-off-by:  Nobuhiro Iwamatsu [EMAIL PROTECTED]

--- a/drivers/net/smc91x.h  2007-05-03 18:47:19.0 +0900
+++ b/drivers/net/smc91x.h  2007-05-03 18:48:59.0 +0900
@@ -232,6 +232,40 @@
 #define SMC_insw(a, r, p, l)   insw((a) + (r), p, l)
 #define SMC_outsw(a, r, p, l)  outsw((a) + (r), p, l)
 
+#elif   defined(CONFIG_SUPERH)
+
+#if defined(CONFIG_SH_7780_SOLUTION_ENGINE) || 
defined(CONFIG_SH_7722_SOLUTION_ENGINE)
+#define SMC_CAN_USE_8BIT   0
+#define SMC_CAN_USE_16BIT  1
+#define SMC_CAN_USE_32BIT  0
+#define SMC_IO_SHIFT   0
+#define SMC_NOWAIT 1
+
+#define SMC_inb(a, r)  (inw((a) + ((r)~1))  (8*(r%2)))0xff
+#define SMC_inw(a, r)  inw((a) + (r))
+#define SMC_outb(v, a, r)  outw(((inw((a)+((r)~1))*(0xff8*(r%2 | 
((v)(8*(r2, (a) + ((r)~1))
+
+#define SMC_outw(v, a, r)  outw(v, (a) + (r))
+#define SMC_insw(a, r, p, l)   insw((a) + (r), p, l)
+#define SMC_outsw(a, r, p, l)  outsw((a) + (r), p, l)
+
+#else /* BOARDS */
+
+#define SMC_CAN_USE_8BIT   1
+#define SMC_CAN_USE_16BIT  1
+#define SMC_CAN_USE_32BIT  1
+
+#define SMC_inb(a, r)  inb((a) + (r))
+#define SMC_inw(a, r)  inw((a) + (r))
+#define SMC_outb(v, a, r)  outb(v, (a) + (r))
+#define SMC_outw(v, a, r)  outw(v, (a) + (r))
+#define SMC_insw(a, r, p, l)   insw((a) + (r), p, l)
+#define SMC_outsw(a, r, p, l)  outsw((a) + (r), p, l)
+
+#endif  /* BOARDS */
+
+#define set_irq_type(irq, type) do {} while (0)
+
 #elif   defined(CONFIG_M32R)
 
 #define SMC_CAN_USE_8BIT   0
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp

2007-05-03 Thread David Miller
From: Mitsuru Chinen [EMAIL PROTECTED]
Date: Wed, 2 May 2007 10:05:13 +0900

 [IPV4] SNMP: Display new statistics at /proc/net/netstat
 
 This displays the statistics specified in the updated IP-MIB RFC
 (RFC4293) in /proc/net/netstat. The reason why these are not added
 to /proc/net/snmp is that some existing utilities are developed under
 the assumption that ipstat items in /proc/net/snmp is unchanged.
 
 Signed-off-by: Mitsuru Chinen [EMAIL PROTECTED]

Magic constant 17 is not the best, somebody will break this
next time this table it touched.

Why not use another sentinel, or something like that, to mark
the entry groups?
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] skbuff: fix kernel-doc

2007-05-03 Thread David Miller
From: Randy Dunlap [EMAIL PROTECTED]
Date: Tue, 1 May 2007 18:21:56 -0700

 From: Randy Dunlap [EMAIL PROTECTED]
 
 Fix skbuff.h kernel-doc:
 linux-2.6.21-git4//include/linux/skbuff.h:316): No description found for 
 parameter 'transport_header'
 
 Signed-off-by: Randy Dunlap [EMAIL PROTECTED]

Applied, thanks Randy.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [NETLINK] Don't attach callback to a going-away netlink socket

2007-05-03 Thread David Miller
From: Herbert Xu [EMAIL PROTECTED]
Date: Wed, 2 May 2007 14:12:22 +1000

 Dave, thanks for reminding me.  Here it is.
 
 [NETLINK]: Kill CB only when socket is unused
 
 Since we can still receive packets until all references to the
 socket are gone, we don't need to kill the CB until that happens.
 This also aligns ourselves with the receive queue purging which
 happens at that point.
 
 Signed-off-by: Herbert Xu [EMAIL PROTECTED]

Applied, thanks Herbert.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: finding your own dead CONFIG_ variables

2007-05-03 Thread Robert P. J. Day
On Thu, 3 May 2007, Arnd Bergmann wrote:

 On Thursday 03 May 2007, Robert P. J. Day wrote:
   Suggest: configfiles=$(find . -name 'Kconfig*' -or -name '*defconfig*')
  
   Some CONFIG_ options exist that are not declared anywhere in the
   Kconfig files but defined directly in the arch/.../*defconfig*
   files.
 
  it's my understanding that entries in any defconfig files are
  *automatically* pruned at some point once a CONFIG_ variable no longer
  exists in any Kconfig file, so i'm not going to be touching those
  files.  also, adding that extra check wouldn't add anything useful to
  the output.


 An interesting category would be a symbol that is

 - used in a source file
 - defined in an old defconfig
 - not present in any Kconfig* file

 If any of these exist, I would consider them _worse_ than the ones
 found by your initial script, because some functionality that once
 was there has been recently removed.

hmm ... i see your point now -- not present in any Kconfig file
but still being selected by a defconfig file that might still be
affecting the eventual build.  that's an easy enough change to make
but, as i've mentioned before, this output could be reduced
substantially if developers stopped using CONFIG_ prefixed macro names
for their own non-Kconfig variables (*cough* MTD *cough* :-).

but, again, some of that issue might disappear if those defconfig
files were auto-regenerated on a timely basis (if that is, in fact,
how they're kept up to date).

rday

-- 

Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page


Re: [PATCH] Rework dev_base via list_head

2007-05-03 Thread David Miller
From: Pavel Emelianov [EMAIL PROTECTED]
Date: Wed, 02 May 2007 17:40:56 +0400

 Cleanup of dev_base list use, with the aim to simplify making
 device list per-namespace. In almost every occasion, use of
 dev_base variable and dev-next pointer could be easily replaced
 by  for_each_netdev loop. A few most complicated places were
 converted to using first_netdev()/next_netdev().
 
 Fits 2.6.21-rc7 tree.
 
 Signed-off-by: Pavel Emelianov [EMAIL PROTECTED]
 Acked-by: Kirill Korotaev [EMAIL PROTECTED]

Overall this looks mostly good.

One thing I want to audit before applying this is
loop termination conditions.

With the old loop, if you do something like this:

for (dev = dev_base; dev; dev = dev-next) {
if (dev == what_I_want)
break;
}

you can test for a successful find after the loop with:

if (dev) {
I_found_it();
}

That doesn't work with for_each_netdev(), if the loop
runs till the end of the list, the iterator will not
be left at NULL.

I just want to make sure you didn't leave any code around which wants
that behavior still.

This is one of the subtle things about using the list iterators in
linux/list.h, vs. a traditional by-hand singly linked list
implementation.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] [NETLINK]: Fix use after free in netlink_recvmsg

2007-05-03 Thread David Miller
From: David Howells [EMAIL PROTECTED]
Date: Thu, 03 May 2007 10:53:15 +0100

 When the user passes in MSG_TRUNC the skb is used after getting freed.
 
 Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
 Signed-off-by: David Howells [EMAIL PROTECTED]

Ugh, good catch, applied :-)
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/5] [NET]: Add __dev_getfirstbyhwtype

2007-05-03 Thread David Miller
From: David Howells [EMAIL PROTECTED]
Date: Thu, 03 May 2007 10:53:26 +0100

 Add __dev_getfirstbyhwtype for callers that don't want a reference but
 some data from the device and thus need to take the rtnl anyway.
 
 Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
 Signed-off-by: David Howells [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] AFS: Adjust the new netdevice scanning code

2007-05-03 Thread David Miller
From: David Howells [EMAIL PROTECTED]
Date: Thu, 03 May 2007 10:53:36 +0100

 Adjust the new netdevice scanning code provided by Patrick McHardy:
 
  (1) Restore the function banner comments that were dropped.
 
  (2) Rather than using an array size of 6 in some places and an array size of
  ETH_ALEN in others, pass a pointer instead and pass the array size
  through so that we can actually check it.
 
  (3) Do the buffer fill count check before checking the for_primary_ifa
  condition again.  This permits us to skip that check should maxbufs be
  reached before we run out of interfaces.
 
 Signed-off-by: David Howells [EMAIL PROTECTED]

Applied, thanks.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: kernel BUG at include/net/tcp.h:739

2007-05-03 Thread David Miller
From: Ilpo_Järvinen [EMAIL PROTECTED]
Date: Thu, 3 May 2007 09:51:36 +0300 (EEST)

 [PATCH] [TCP]: Use S+L catcher only with SACK for now
 
 TCP has a transitional state when SACK is not in use during
 which this invariant is temporarily broken. Without SACK,
 tcp_clean_rtx_queue does not decrement sacked_out. Therefore
 calls to tcp_sync_left_out before sacked_out is again
 corrected by tcp_fastretrans_alert can trigger this trap as
 sacked_out still has couple of segments that are already out
 of window.
 
 Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]

It would be nice to fix non-SACK as you say, but this is good
enough for now.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/5] [AFS]: Fix memory leak in SRXAFSCB_GetCapabilities

2007-05-03 Thread David Miller
From: David Howells [EMAIL PROTECTED]
Date: Thu, 03 May 2007 10:53:20 +0100

 The interface array is not freed on exit.
 
 Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
 Signed-off-by: David Howells [EMAIL PROTECTED]

Applied, thanks.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Rework dev_base via list_head

2007-05-03 Thread Pavel Emelianov
David Miller wrote:
 From: Pavel Emelianov [EMAIL PROTECTED]
 Date: Wed, 02 May 2007 17:40:56 +0400
 
 Cleanup of dev_base list use, with the aim to simplify making
 device list per-namespace. In almost every occasion, use of
 dev_base variable and dev-next pointer could be easily replaced
 by  for_each_netdev loop. A few most complicated places were
 converted to using first_netdev()/next_netdev().

 Fits 2.6.21-rc7 tree.

 Signed-off-by: Pavel Emelianov [EMAIL PROTECTED]
 Acked-by: Kirill Korotaev [EMAIL PROTECTED]
 
 Overall this looks mostly good.
 
 One thing I want to audit before applying this is
 loop termination conditions.
 
 With the old loop, if you do something like this:
 
   for (dev = dev_base; dev; dev = dev-next) {
   if (dev == what_I_want)
   break;
   }
 
 you can test for a successful find after the loop with:
 
   if (dev) {
   I_found_it();
   }
 
 That doesn't work with for_each_netdev(), if the loop
 runs till the end of the list, the iterator will not
 be left at NULL.
 
 I just want to make sure you didn't leave any code around which wants
 that behavior still.

My fault :( I've found some places where this was missed.
I will make a new patch shortly.

 This is one of the subtle things about using the list iterators in
 linux/list.h, vs. a traditional by-hand singly linked list
 implementation.
 

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ETHTOOL]: Add 2.5G bit definitions.

2007-05-03 Thread Jeff Garzik

Michael Chan wrote:

[ETHTOOL]: Add 2.5G bit definitions.

Add 2.5G supported and advertising bit definitions.  2.5G is supported
by the bnx2 driver.

Signed-off-by: Michael Chan [EMAIL PROTECTED]


ACK.  If DaveM does not apply this (since it's required for bnx2), I 
will apply it.



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Rework dev_base via list_head (v2)

2007-05-03 Thread Pavel Emelianov
Cleanup of dev_base list use, with the aim to simplify making
device list per-namespace. In almost every occasion, use of
dev_base variable and dev-next pointer could be easily replaced
by  for_each_netdev loop. A few most complicated places were
converted to using first_netdev()/next_netdev().

Changes:
* David's comment about loop termination;
* Applies to todays netdev git tree.

Signed-off-by: Pavel Emelianov [EMAIL PROTECTED]
Acked-by: Kirill Korotaev [EMAIL PROTECTED]

---

diff --git a/arch/s390/appldata/appldata_net_sum.c 
b/arch/s390/appldata/appldata_net_sum.c
index a43f348..2180ac1 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -107,7 +107,7 @@ static void appldata_get_net_sum_data(vo
tx_dropped = 0;
collisions = 0;
read_lock(dev_base_lock);
-   for (dev = dev_base; dev != NULL; dev = dev-next) {
+   for_each_netdev(dev) {
stats = dev-get_stats(dev);
rx_packets += stats-rx_packets;
tx_packets += stats-tx_packets;
diff --git a/arch/sparc64/solaris/ioctl.c b/arch/sparc64/solaris/ioctl.c
index 330743c..18352a4 100644
--- a/arch/sparc64/solaris/ioctl.c
+++ b/arch/sparc64/solaris/ioctl.c
@@ -686,7 +686,8 @@ static inline int solaris_i(unsigned int
int i = 0;

read_lock_bh(dev_base_lock);
-   for (d = dev_base; d; d = d-next) i++;
+   for_each_netdev(d)
+   i++;
read_unlock_bh(dev_base_lock);
 
if (put_user (i, (int __user *)A(arg)))
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 1a6aeac..01fbdd3 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -194,15 +194,15 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigne
sl = sl_tail = NULL;
 
read_lock(dev_base_lock);
-   for (ifp = dev_base; ifp; dev_put(ifp), ifp = ifp-next) {
+   for_each_netdev(ifp) {
dev_hold(ifp);
if (!is_aoe_netif(ifp))
-   continue;
+   goto cont;
 
skb = new_skb(sizeof *h + sizeof *ch);
if (skb == NULL) {
printk(KERN_INFO aoe: skb alloc failure\n);
-   continue;
+   goto cont;
}
skb_put(skb, sizeof *h + sizeof *ch);
skb-dev = ifp;
@@ -221,6 +221,8 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigne
 
skb-next = sl;
sl = skb;
+cont:
+   dev_put(ifp);
}
read_unlock(dev_base_lock);
 
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 2a299a0..ef32a5c 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -1971,8 +1971,7 @@ static struct net_device *get_strip_dev(
  sizeof(zero_address))) {
struct net_device *dev;
read_lock_bh(dev_base_lock);
-   dev = dev_base;
-   while (dev) {
+   for_each_netdev(dev) {
if (dev-type == strip_info-dev-type 
!memcmp(dev-dev_addr,
strip_info-true_dev_addr,
@@ -1983,7 +1982,6 @@ static struct net_device *get_strip_dev(
read_unlock_bh(dev_base_lock);
return (dev);
}
-   dev = dev-next;
}
read_unlock_bh(dev_base_lock);
}
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index 3df82fe..98be288 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -365,7 +365,7 @@ static __inline__ int led_get_net_activi
 * for reading should be OK */
read_lock(dev_base_lock);
rcu_read_lock();
-   for (dev = dev_base; dev; dev = dev-next) {
+   for_each_netdev(dev) {
struct net_device_stats *stats;
struct in_device *in_dev = __in_dev_get_rcu(dev);
if (!in_dev || !in_dev-ifa_list)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ac0c92b..782eb1d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -304,7 +304,7 @@ struct net_device
 
unsigned long   state;
 
-   struct net_device   *next;
+   struct list_headdev_list;

/* The device initialization function. Called only once. */
int (*init)(struct net_device *dev);
@@ -575,9 +575,31 @@ struct packet_type {
 #include linux/notifier.h
 
 extern struct net_device   loopback_dev;   /* The loopback 
*/
-extern struct net_device   *dev_base;  /* All devices 
*/
+extern struct list_head

dead CONFIG_ variables: net/

2007-05-03 Thread Robert P. J. Day

  based on a request from patrick mchardy, i'm posting the list of
(ostensibly) dead CONFIG_ variables found under the entire net/
directory.  admittedly, there are false positives in this list for a
variety of reasons so don't take everything too seriously, but give it
a perusal to identify actual mistakes or typoes.  (i'll post the same
output for the drivers/net/ output shortly.)



== BR2684_FAST_TRANS ==
net/atm/br2684.c:463:#ifdef CONFIG_BR2684_FAST_TRANS
net/atm/br2684.c:467:#endif /* CONFIG_BR2684_FAST_TRANS */
== BT_BNEP_DEBUG ==
net/bluetooth/bnep/netdev.c:48:#ifndef CONFIG_BT_BNEP_DEBUG
net/bluetooth/bnep/sock.c:53:#ifndef CONFIG_BT_BNEP_DEBUG
net/bluetooth/bnep/core.c:59:#ifndef CONFIG_BT_BNEP_DEBUG
== BT_CMTP_DEBUG ==
net/bluetooth/cmtp/capi.c:45:#ifndef CONFIG_BT_CMTP_DEBUG
net/bluetooth/cmtp/sock.c:46:#ifndef CONFIG_BT_CMTP_DEBUG
net/bluetooth/cmtp/core.c:46:#ifndef CONFIG_BT_CMTP_DEBUG
== BT_HCI_CORE_DEBUG ==
net/bluetooth/hci_core.c:50:#ifndef CONFIG_BT_HCI_CORE_DEBUG
net/bluetooth/hci_conn.c:48:#ifndef CONFIG_BT_HCI_CORE_DEBUG
net/bluetooth/hci_event.c:48:#ifndef CONFIG_BT_HCI_CORE_DEBUG
net/bluetooth/hci_sysfs.c:11:#ifndef CONFIG_BT_HCI_CORE_DEBUG
== BT_HCI_SOCK_DEBUG ==
net/bluetooth/hci_sock.c:51:#ifndef CONFIG_BT_HCI_SOCK_DEBUG
== BT_HIDP_DEBUG ==
net/bluetooth/hidp/sock.c:42:#ifndef CONFIG_BT_HIDP_DEBUG
net/bluetooth/hidp/core.c:49:#ifndef CONFIG_BT_HIDP_DEBUG
== BT_L2CAP_DEBUG ==
net/bluetooth/l2cap.c:53:#ifndef CONFIG_BT_L2CAP_DEBUG
== BT_RFCOMM_DEBUG ==
net/bluetooth/rfcomm/tty.c:44:#ifndef CONFIG_BT_RFCOMM_DEBUG
net/bluetooth/rfcomm/sock.c:55:#ifndef CONFIG_BT_RFCOMM_DEBUG
net/bluetooth/rfcomm/core.c:50:#ifndef CONFIG_BT_RFCOMM_DEBUG
== BT_SCO_DEBUG ==
net/bluetooth/sco.c:51:#ifndef CONFIG_BT_SCO_DEBUG
== BT_SOCK_DEBUG ==
net/bluetooth/af_bluetooth.c:46:#ifndef CONFIG_BT_SOCK_DEBUG
== IP_FIB_TRIE_STATS ==
net/ipv4/fib_trie.c:84:#undef CONFIG_IP_FIB_TRIE_STATS
net/ipv4/fib_trie.c:138:#ifdef CONFIG_IP_FIB_TRIE_STATS
net/ipv4/fib_trie.c:160:#ifdef CONFIG_IP_FIB_TRIE_STATS
net/ipv4/fib_trie.c:571:#ifdef CONFIG_IP_FIB_TRIE_STATS
net/ipv4/fib_trie.c:612:#ifdef CONFIG_IP_FIB_TRIE_STATS
net/ipv4/fib_trie.c:878:#ifdef CONFIG_IP_FIB_TRIE_STATS
net/ipv4/fib_trie.c:1313:#ifdef CONFIG_IP_FIB_TRIE_STATS
net/ipv4/fib_trie.c:1318:#ifdef CONFIG_IP_FIB_TRIE_STATS
net/ipv4/fib_trie.c:1347:#ifdef CONFIG_IP_FIB_TRIE_STATS
net/ipv4/fib_trie.c:1370:#ifdef CONFIG_IP_FIB_TRIE_STATS
net/ipv4/fib_trie.c:1504:#ifdef CONFIG_IP_FIB_TRIE_STATS
net/ipv4/fib_trie.c:2155:#ifdef CONFIG_IP_FIB_TRIE_STATS
net/ipv4/fib_trie.c:2166:#endif /*  CONFIG_IP_FIB_TRIE_STATS */
== IP_NF_NAT ==
net/ipv4/netfilter/Kconfig:256:# If they want FTP, set to $CONFIG_IP_NF_NAT (m 
or y),
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c:157:#if 
!defined(CONFIG_IP_NF_NAT)  !defined(CONFIG_IP_NF_NAT_MODULE)
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c:157:#if 
!defined(CONFIG_IP_NF_NAT)  !defined(CONFIG_IP_NF_NAT_MODULE)
== IP_NOSIOCRT ==
net/ipv4/fib_frontend.c:253:#ifndef CONFIG_IP_NOSIOCRT
== IP_PIMSM ==
net/ipv4/ipmr.c:68:#define CONFIG_IP_PIMSM  1
net/ipv4/ipmr.c:174:#ifdef CONFIG_IP_PIMSM
net/ipv4/ipmr.c:265:#ifdef CONFIG_IP_PIMSM
net/ipv4/ipmr.c:399:#ifdef CONFIG_IP_PIMSM
net/ipv4/ipmr.c:455:#ifdef CONFIG_IP_PIMSM
net/ipv4/ipmr.c:549:#ifdef CONFIG_IP_PIMSM
net/ipv4/ipmr.c:559:#ifdef CONFIG_IP_PIMSM
net/ipv4/ipmr.c:946:#ifdef CONFIG_IP_PIMSM
net/ipv4/ipmr.c:992:#ifdef CONFIG_IP_PIMSM
net/ipv4/ipmr.c:1009:#ifdef CONFIG_IP_PIMSM
net/ipv4/ipmr.c:1154:#ifdef CONFIG_IP_PIMSM
== IP_ROUTE_PERVASIVE ==
net/ipv4/fib_semantics.c:525:#ifdef CONFIG_IP_ROUTE_PERVASIVE
== IP_VS_DH_TAB_BITS ==
net/ipv4/ipvs/ip_vs_dh.c:58:#ifndef CONFIG_IP_VS_DH_TAB_BITS
net/ipv4/ipvs/ip_vs_dh.c:59:#define CONFIG_IP_VS_DH_TAB_BITS8
net/ipv4/ipvs/ip_vs_dh.c:61:#define IP_VS_DH_TAB_BITS   
CONFIG_IP_VS_DH_TAB_BITS
net/ipv4/ipvs/ip_vs_dh.c:61:#define IP_VS_DH_TAB_BITS   
CONFIG_IP_VS_DH_TAB_BITS
net/ipv4/ipvs/ip_vs_dh.c:62:#define IP_VS_DH_TAB_SIZE   (1  
IP_VS_DH_TAB_BITS)
== IP_VS_LBLCR_DEBUG ==
net/ipv4/ipvs/ip_vs_lblcr.c:550:#ifdef CONFIG_IP_VS_LBLCR_DEBUG
net/ipv4/ipvs/ip_vs_lblcr.c:652:#ifdef CONFIG_IP_VS_LBLCR_DEBUG
net/ipv4/ipvs/ip_vs_lblcr.c:845:#ifdef CONFIG_IP_VS_LBLCR_DEBUG
net/ipv4/ipvs/ip_vs_lblcr.c:854:#ifdef CONFIG_IP_VS_LBLCR_DEBUG
== IP_VS_LBLCR_TAB_BITS ==
net/ipv4/ipvs/ip_vs_lblcr.c:77:#ifndef CONFIG_IP_VS_LBLCR_TAB_BITS
net/ipv4/ipvs/ip_vs_lblcr.c:78:#define CONFIG_IP_VS_LBLCR_TAB_BITS  10
net/ipv4/ipvs/ip_vs_lblcr.c:80:#define IP_VS_LBLCR_TAB_BITS 
CONFIG_IP_VS_LBLCR_TAB_BITS
net/ipv4/ipvs/ip_vs_lblcr.c:80:#define IP_VS_LBLCR_TAB_BITS 
CONFIG_IP_VS_LBLCR_TAB_BITS
net/ipv4/ipvs/ip_vs_lblcr.c:81:#define 

Re: [PATCH] Rework dev_base via list_head (v2)

2007-05-03 Thread Patrick McHardy
Pavel Emelianov wrote:
 Cleanup of dev_base list use, with the aim to simplify making
 device list per-namespace. In almost every occasion, use of
 dev_base variable and dev-next pointer could be easily replaced
 by  for_each_netdev loop. A few most complicated places were
 converted to using first_netdev()/next_netdev().
 
 Changes:
 * David's comment about loop termination;
 * Applies to todays netdev git tree.


This seems to be missing fs/afs/netdevices.c.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


dead CONFIG_ variables: drivers/net/

2007-05-03 Thread Robert P. J. Day

  as with the earlier post for net/, this is for drivers/net/.  once
again, there are clearly false positives but i'm sure there's
*something* in there that might need fixing.

== ARCH_INNOKOM ==
drivers/net/smc91x.h:145:#elif  defined(CONFIG_ARCH_INNOKOM) || \
arch/arm/tools/mach-types:275:innokom   ARCH_INNOKOM
INNOKOM 258
== ARCH_RAMSES ==
drivers/net/smc91x.h:148:   defined(CONFIG_ARCH_RAMSES)
arch/arm/tools/mach-types:252:mnci  ARCH_RAMSES 
RAMSES  235
== BCM947XX ==
drivers/net/wireless/bcm43xx/bcm43xx_dma.c:663:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.h:36:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:64:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:145:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:789:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:799:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:1228:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:1390://FIXME: Do we _really_ want 
#ifndef CONFIG_BCM947XX here?
drivers/net/wireless/bcm43xx/bcm43xx_main.c:1392:#ifndef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:2143:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:2155:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:2648:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx_main.c:4147:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx.h:661:#ifdef CONFIG_BCM947XX
drivers/net/wireless/bcm43xx/bcm43xx.h:792:#ifdef CONFIG_BCM947XX
== CASSINI_MULTICAST_REG_WRITE ==
drivers/net/cassini.c:3099:#ifdef CONFIG_CASSINI_MULTICAST_REG_WRITE
drivers/net/cassini.c:3169:#ifndef CONFIG_CASSINI_MULTICAST_REG_WRITE
== CASSINI_NAPI ==
drivers/net/cassini.c:107:#if defined(CONFIG_CASSINI_NAPI)  
defined(HAVE_NETDEV_POLL)
== CASSINI_QGE_DEBUG ==
drivers/net/cassini.h:4362:#ifdef CONFIG_CASSINI_QGE_DEBUG
== CHELSIO_T1_COUGAR ==
drivers/net/chelsio/subr.c:188:#ifdef CONFIG_CHELSIO_T1_COUGAR
drivers/net/chelsio/subr.c:283:#if defined(CONFIG_CHELSIO_T1_1G) || 
defined(CONFIG_CHELSIO_T1_COUGAR)
drivers/net/chelsio/subr.c:323:#if defined(CONFIG_CHELSIO_T1_1G) || 
defined(CONFIG_CHELSIO_T1_COUGAR)
drivers/net/chelsio/subr.c:750:#ifdef CONFIG_CHELSIO_T1_COUGAR
drivers/net/chelsio/subr.c:1002:#ifdef CONFIG_CHELSIO_T1_COUGAR
drivers/net/chelsio/subr.c:1059:#ifdef CONFIG_CHELSIO_T1_COUGAR
drivers/net/chelsio/subr.c:1082:#ifdef CONFIG_CHELSIO_T1_COUGAR
== ETRAX_NETWORK_RED_ON_NO_CONNECTION ==
drivers/net/cris/eth_v10.c:1783:#if 
defined(CONFIG_ETRAX_NETWORK_RED_ON_NO_CONNECTION)
== FIXED_MII_DUPLEX ==
drivers/net/phy/fixed.c:335:#ifdef CONFIG_FIXED_MII_DUPLEX
== GILBARCONAP ==
drivers/net/fec.c:99:#elif defined(CONFIG_GILBARCONAP) || defined(CONFIG_SCALES)
== LMC_IGNORE_HARDWARE_HANDSHAKE ==
drivers/net/wan/lmc/lmc_media.c:33:#define CONFIG_LMC_IGNORE_HARDWARE_HANDSHAKE 
1
drivers/net/wan/lmc/lmc_media.c:743:#ifdef CONFIG_LMC_IGNORE_HARDWARE_HANDSHAKE
== MACH_LPD79520 ==
drivers/net/smc91x.h:253:#elif   defined(CONFIG_MACH_LPD79520) \
arch/arm/mach-lh7a40x/lcd-panel.h:40:#if defined (MACH_LPD79520)\
arch/arm/tools/mach-types:553:lpd79520  MACH_LPD79520   
LPD79520537
== MTD_KeyTechnology ==
drivers/net/fec.c:101:#elif defined (CONFIG_MTD_KeyTechnology)
== NETWINDER_RX_DMA_PROBLEMS ==
drivers/net/irda/w83977af_ir.c:66:#define CONFIG_NETWINDER_RX_DMA_PROBLEMS /* 
Must have this one! */
drivers/net/irda/w83977af_ir.c:741:#ifdef CONFIG_NETWINDER_RX_DMA_PROBLEMS
drivers/net/irda/w83977af_ir.c:766:#ifdef CONFIG_NETWINDER_RX_DMA_PROBLEMS
drivers/net/irda/w83977af_ir.c:789:#ifdef CONFIG_NETWINDER_RX_DMA_PROBLEMS
== NETWINDER_TX_DMA_PROBLEMS ==
drivers/net/irda/w83977af_ir.c:65:#undef  CONFIG_NETWINDER_TX_DMA_PROBLEMS /* 
Not needed */
drivers/net/irda/w83977af_ir.c:593:#ifdef CONFIG_NETWINDER_TX_DMA_PROBLEMS
drivers/net/irda/w83977af_ir.c:609:#ifdef CONFIG_NETWINDER_TX_DMA_PROBLEMS
drivers/net/irda/w83977af_ir.c:625:#ifdef CONFIG_NETWINDER_TX_DMA_PROBLEMS
== SBMAC_COALESCE ==
drivers/net/sb1250-mac.c:58:#define CONFIG_SBMAC_COALESCE
drivers/net/sb1250-mac.c:97:#ifdef CONFIG_SBMAC_COALESCE
drivers/net/sb1250-mac.c:201:#ifdef CONFIG_SBMAC_COALESCE
drivers/net/sb1250-mac.c:696:#ifdef CONFIG_SBMAC_COALESCE
drivers/net/sb1250-mac.c:787:#ifdef CONFIG_SBMAC_COALESCE
drivers/net/sb1250-mac.c:828:#ifdef CONFIG_SBMAC_COALESCE
drivers/net/sb1250-mac.c:975:#ifdef CONFIG_SBMAC_COALESCE
drivers/net/sb1250-mac.c:1070:#ifndef CONFIG_SBMAC_COALESCE
drivers/net/sb1250-mac.c:1164:#ifdef CONFIG_SBMAC_COALESCE
drivers/net/sb1250-mac.c:1706:#ifdef CONFIG_SBMAC_COALESCE

Re: [PATCH 1/5] [NETLINK]: Fix use after free in netlink_recvmsg

2007-05-03 Thread Marcel Holtmann
Hi Dave,

  When the user passes in MSG_TRUNC the skb is used after getting freed.
  
  Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
  Signed-off-by: David Howells [EMAIL PROTECTED]
 
 Ugh, good catch, applied :-)

it seems this could be easily exploited and is at least a local DoS. It
should be a candidate for the -stable kernel.

Regards

Marcel


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [TCP] Highspeed: Limited slow-start is nowadays in tcp_slow_start

2007-05-03 Thread Ilpo Järvinen
Reuse limited slow-start (RFC3742) included into tcp_cong instead
of having another implementation in High Speed TCP.

Compile tested only.

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
---
 net/ipv4/tcp_highspeed.c |   24 +++-
 1 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/net/ipv4/tcp_highspeed.c b/net/ipv4/tcp_highspeed.c
index a291097..43d624e 100644
--- a/net/ipv4/tcp_highspeed.c
+++ b/net/ipv4/tcp_highspeed.c
@@ -97,10 +97,6 @@ struct hstcp {
u32 ai;
 };
 
-static int max_ssthresh = 100;
-module_param(max_ssthresh, int, 0644);
-MODULE_PARM_DESC(max_ssthresh, limited slow start threshold (RFC3742));
-
 static void hstcp_init(struct sock *sk)
 {
struct tcp_sock *tp = tcp_sk(sk);
@@ -122,23 +118,9 @@ static void hstcp_cong_avoid(struct sock
if (!tcp_is_cwnd_limited(sk, in_flight))
return;
 
-   if (tp-snd_cwnd = tp-snd_ssthresh) {
-   /* RFC3742: limited slow start
-* the window is increased by 1/K MSS for each arriving ACK,
-* for K = int(cwnd/(0.5 max_ssthresh))
-*/
-   if (max_ssthresh  0  tp-snd_cwnd  max_ssthresh) {
-   u32 k = max(tp-snd_cwnd / (max_ssthresh  1), 1U);
-   if (++tp-snd_cwnd_cnt = k) {
-   if (tp-snd_cwnd  tp-snd_cwnd_clamp)
-   tp-snd_cwnd++;
-   tp-snd_cwnd_cnt = 0;
-   }
-   } else {
-   if (tp-snd_cwnd  tp-snd_cwnd_clamp)
-   tp-snd_cwnd++;
-   }
-   } else {
+   if (tp-snd_cwnd = tp-snd_ssthresh)
+   tcp_slow_start(tp);
+   else {
/* Update AIMD parameters.
 *
 * We want to guarantee that:
-- 
1.4.2


Re: [PATCH v2 16/16][BNX2]: Update version and reldate.

2007-05-03 Thread Jeff Garzik

Michael Chan wrote:

[BNX2]: Update version and reldate.

Update version to 1.5.10.

Signed-off-by: Michael Chan [EMAIL PROTECTED]


ACK patches 1-16...  including an ACK for the big firmware patch that 
did not make it to the mailing list (due to size).  We cannot 
realistically review the firmware patch for anything beyond the most 
trivial C mistakes anyway.


Thanks,

Jeff



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] [NETLINK]: Fix use after free in netlink_recvmsg

2007-05-03 Thread Patrick McHardy
Marcel Holtmann wrote:
 it seems this could be easily exploited and is at least a local DoS. It
 should be a candidate for the -stable kernel.


The bug got introduced in 2.6.21-git, so -stable is not affected.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH][XFRM] SAD info TLV aggregation

2007-05-03 Thread jamal
On Thu, 2007-03-05 at 02:15 +0200, Patrick McHardy wrote:

 
 I think using attributes here

here as in SAD or SPD as well?

  wasn't a bad idea since this exports
 things that are implementation details and might need to be changed
 or extended at some point.

I think it may be reasonable to group the Hash info in one TLV
and the IPSEC specific info in a separate TLV - is this what you are
saying? Be explicit so i dont have to redo the patch over and over.
The other way to look at it is in the future, a new TLV could be added
that replaces the current one.

 In any case consistent naming here would be nice (SAD_ vs. SADXXX).

yes, i need to make this change on the SPD as well. Dave hold onto both
patches - i will resend.

cheers,
jamal



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH][XFRM] SAD info TLV aggregation

2007-05-03 Thread Patrick McHardy
jamal wrote:
 On Thu, 2007-03-05 at 02:15 +0200, Patrick McHardy wrote:
 
 
I think using attributes here
 
 
 here as in SAD or SPD as well?

Both.

 wasn't a bad idea since this exports
things that are implementation details and might need to be changed
or extended at some point.
 
 
 I think it may be reasonable to group the Hash info in one TLV
 and the IPSEC specific info in a separate TLV - is this what you are
 saying? Be explicit so i dont have to redo the patch over and over.

Yes, thats what I imagined too.

 The other way to look at it is in the future, a new TLV could be added
 that replaces the current one.

It would still make sense to seperate hash related things from the
SA count in my opinion.

In any case consistent naming here would be nice (SAD_ vs. SADXXX).
 
 
 yes, i need to make this change on the SPD as well. Dave hold onto both
 patches - i will resend.

Thanks.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH][XFRM] SAD info TLV aggregation

2007-05-03 Thread jamal
On Thu, 2007-03-05 at 15:15 +0200, Patrick McHardy wrote:

  
  I think it may be reasonable to group the Hash info in one TLV
  and the IPSEC specific info in a separate TLV - is this what you are
  saying? Be explicit so i dont have to redo the patch over and over.
 
 Yes, thats what I imagined too.

Ok, thanks Patrick - indeed it is a wise thing to do to improve
longevity of user space.

I will make those two changes sometime tonight or tommorow morn
and resend.

cheers,
jamal

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: kernel BUG at include/net/tcp.h:739

2007-05-03 Thread Michal Piotrowski
Ilpo Järvinen napisał(a):
 On Wed, 2 May 2007, Michal Piotrowski wrote:
 
 Please take a look at this bug

 [15236.638092] kernel BUG at /mnt/md0/devel/linux-git/include/net/tcp.h:739!
 [15236.644860] invalid opcode:  [#1]
 [15236.648514] PREEMPT SMP 
 [15236.651075] Modules linked in: ipt_MASQUERADE iptable_nat nf_nat autofs4 
 af_packet nf_conntrack_netbios_ns ipt_REJECT nf_conntrack_ipv4 xt_state 
 nf_conntrack nfnetlink iptable_filter ip_tables ip6t_REJECT xt_tcpudp 
 ip6table_filter ip6_tables x_tables ipv6 binfmt_misc thermal processor fan 
 container nvram snd_intel8x0 snd_ac97_codec ac97_bus snd_seq_dummy 
 snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss 
 snd_mixer_oss snd_pcm evdev snd_timer snd intel_agp i2c_i801 soundcore 
 agpgart snd_page_alloc ide_cd cdrom rtc unix
 [15236.698898] CPU:0
 [15236.698899] EIP:0060:[c02f798b]Not tainted VLI
 [15236.698900] EFLAGS: 00010206   (2.6.21-gdc87c398 #169)
 [15236.711580] EIP is at tcp_ack+0xc54/0x16a0
 [15236.715664] eax: 0017   ebx:    ecx: 0003   edx: 010e
 [15236.722433] esi: d5bc1254   edi: 010e   ebp: c0462e18   esp: c0462da8
 [15236.729202] ds: 007b   es: 007b   fs: 00d8  gs:   ss: 0068
 [15236.735019] Process swapper (pid: 0, ti=c0462000 task=c03f14e0 
 task.ti=c0427000)
 [15236.742219] Stack:    0198 0100  
  0018 
 [15236.750698]3b4d5775 0ffef1c0 3b4d79ad 0001 0018 0006 
 3b4d79ad 003f14e0 
 [15236.759178]0006 082a d4b9cde0 00e4059a 000c  
  0130204a 
 [15236.767649] Call Trace:
 [15236.770286]  [c0105039] show_trace_log_lvl+0x1a/0x2f
 [15236.775438]  [c01050eb] show_stack_log_lvl+0x9d/0xa5
 [15236.780590]  [c01052e0] show_registers+0x1ed/0x32c
 [15236.785569]  [c0105537] die+0x118/0x22f
 [15236.789588]  [c01056c7] do_trap+0x79/0x91
 [15236.793781]  [c0105f57] do_invalid_op+0x97/0xa1
 [15236.798501]  [c031f38c] error_code+0x7c/0x84
 [15236.802960]  [c02fafb7] tcp_rcv_established+0x568/0x645
 [15236.808354]  [c03000bd] tcp_v4_do_rcv+0x2b/0x32c
 [15236.813144]  [c030243a] tcp_v4_rcv+0x7f9/0x86b
 [15236.81]  [c02e9dd3] ip_local_deliver+0x170/0x235
 [15236.822928]  [c02e9c2a] ip_rcv+0x4f3/0x52c
 [15236.827199]  [c02d4909] netif_receive_skb+0x1b9/0x252
 [15236.832437]  [c02635c2] skge_poll+0x47a/0x545
 [15236.836967]  [c02d68df] net_rx_action+0x9f/0x192
 [15236.841772]  [c0126408] __do_softirq+0x6d/0xea
 [15236.846407]  [c01069b5] do_softirq+0x64/0xd1
 [15236.850867]  ===
 [15236.854437] Code: 69 42 c0 f7 d0 64 8b 15 04 00 00 00 8b 04 90 ff 80 a4 
 00 00 00 8b 9e 70 05 00 00 89 d8 03 86 74 05 00 00 3b 86 8c 04 00 00 76 04 
 0f 0b eb fe 89 86 90 04 00 00 8a 86 88 03 00 00 84 c0 75 3c 83 
 [15236.874343] EIP: [c02f798b] tcp_ack+0xc54/0x16a0 SS:ESP 0068:c0462da8

 l *0xc02f798b
 0xc02f798b is in tcp_ack (/mnt/md0/devel/linux-git/include/net/tcp.h:739).
 734 (tp-snd_cwnd  2)));
 735 }
 736
 737 static inline void tcp_sync_left_out(struct tcp_sock *tp)
 738 {
 739 BUG_ON(tp-sacked_out + tp-lost_out  tp-packets_out);
 740 tp-left_out = tp-sacked_out + tp-lost_out;
 741 }
 742
 743 extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);

 Caused by commit 34588b4c046c34773e5a1a962da7b78b05c4d1bd 
 
 I think I found the reason:
 
 tcp_clean_rtx_queue without SACK it does not decrement sacked_out but
 tcp_reset_reno_sack/remove_reno_sack is being called later in
 tcp_fastretrans_alert. Before that, tcp_sync_left_out is being called, 
 at least by tcp_fastretrans_alert itself, which sees sacked_out that 
 includes also segments that are no longer in window (this also explains 
 why the original code did not do the reduction in the non-SACK case). Also 
 tcp_process_frto calls tcp_sync_left_out, so it would also lead to the 
 same problem.
 
 Here is a change that ignores this trap without SACK. However, it would be 
 useful to trap this without SACK too as S+L skb causes potentially a 
 negative packets in flight (= large one) disturbing cwnd compares. 
 
 

Thanks Ilpo. I'm testing the patch.


Regards,
Michal

-- 
Michal K. K. Piotrowski
Kernel Monkeys
(http://kernel.wikidot.com/start)
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: netfront for review

2007-05-03 Thread Jeremy Fitzhardinge
Gerd Hoffmann wrote:
 Gerd, in change 11196:b85da7cd9ea5 front: Fix rx buffer leak when
 tearing down an interface. you added a call to
 add_id_to_freelist(np-rx_skbs, id);.  However, rx_skbs doesn't have
 an extra entry for the list head, and there's never any corresponding
 get_id_from_freelist(np-rx_skbs).  What should it be?

 The function has an effect in page flipping mode only.  It walks the
 whole list of rx skbufs (id is the loop variable ...), checks whenever
 they are handed out to the frontend driver to fill in packet data and
 not returned yet, and if so reclaim them ...

Yes, but why use add_id_to_freelist?  rx_skbs are not being used on a
freelist anywhere else.  It just means the rx_skb array gets filled with
small integers, but the rest of the code assumes they're either NULL or
an skb pointer.

J
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: netfront for review

2007-05-03 Thread Gerd Hoffmann

Jeremy Fitzhardinge wrote:

Gerd Hoffmann wrote:

Gerd, in change 11196:b85da7cd9ea5 front: Fix rx buffer leak when
tearing down an interface. you added a call to
add_id_to_freelist(np-rx_skbs, id);.  However, rx_skbs doesn't have
an extra entry for the list head, and there's never any corresponding
get_id_from_freelist(np-rx_skbs).  What should it be?

The function has an effect in page flipping mode only.  It walks the
whole list of rx skbufs (id is the loop variable ...), checks whenever
they are handed out to the frontend driver to fill in packet data and
not returned yet, and if so reclaim them ...


Yes, but why use add_id_to_freelist?  rx_skbs are not being used on a
freelist anywhere else.  It just means the rx_skb array gets filled with
small integers, but the rest of the code assumes they're either NULL or
an skb pointer.


Hmm, good point.  Have to look at the code again, it has been some time 
I've written that, and it took me some time to figure how all the grant 
table stuff works ...


Maybe the add_id_to_freelist() call can simply be dropped.  The whole 
interface is released shortly thereafter, probably thats why filling the 
freelist with yunk never caused any problems ...


cheers,
  Gerd

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Rework dev_base via list_head (v2)

2007-05-03 Thread Pavel Emelianov
Patrick McHardy wrote:
 Pavel Emelianov wrote:
 Cleanup of dev_base list use, with the aim to simplify making
 device list per-namespace. In almost every occasion, use of
 dev_base variable and dev-next pointer could be easily replaced
 by  for_each_netdev loop. A few most complicated places were
 converted to using first_netdev()/next_netdev().

 Changes:
 * David's comment about loop termination;
 * Applies to todays netdev git tree.
 
 
 This seems to be missing fs/afs/netdevices.c.
 

Hm... I've cloned the git repo this morning but there's not such file...

$ ls fs/afs/netdevices.c
/bin/ls: fs/afs/netdevices.c: No such file or directory

Repo was cloned from
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [SCTP] Initialization collision problem

2007-05-03 Thread Isaula Oscar-QOI000
Vlad,

Will these changes make it into the next Kernel release? If so which one
will it be?

Thanks,
Oscar 

-Original Message-
From: Vlad Yasevich [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 01, 2007 3:19 PM
To: Isaula Oscar-QOI000
Cc: netdev@vger.kernel.org
Subject: Re: [SCTP] Initialization collision problem

Isaula Oscar-QOI000 wrote:
 Vlad,
 
 I finally got test results for the changes you suggested. The original

 issue is fixed and I have not detected any side effects.

Thanks.

-vlad

 
 Thanks,
 Oscar
 
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED]
 On Behalf Of Vlad Yasevich
 Sent: Wednesday, April 11, 2007 9:45 AM
 To: Isaula Oscar-QOI000
 Cc: netdev@vger.kernel.org; [EMAIL PROTECTED]
 Subject: Re: [SCTP] Initialization collision problem
 
 Hi Oscar
 
 Isaula Oscar-QOI000 wrote:
 I ran into a problem where LKSCTP is reporting a SCTM_COMM_UP 
 indication to the User application but is giving back a value of zero

 for the assoc_id.

 Attached are the SCTP debugs for the period in question.

 A couple of things that I would like to note about my setup. One is 
 that I'm running Kernel version 2.6.10 (I know is old but I can't 
 move
 
 to a newer version due to custom drivers). The second thing is that 
 the link between the two SCTP node is a very noisy and some messages 
 are getting lost (i.e. the INIT_ACK from the peer in this particular
 case).
 
 Can you give this patch a try and let me know if this fixes your
issue?
 
 Thanks
 -vlad
 

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Rework dev_base via list_head (v2)

2007-05-03 Thread Patrick McHardy
Pavel Emelianov wrote:
 Patrick McHardy wrote:
 
This seems to be missing fs/afs/netdevices.c.

 
 
 Hm... I've cloned the git repo this morning but there's not such file...
 
 $ ls fs/afs/netdevices.c
 /bin/ls: fs/afs/netdevices.c: No such file or directory
 
 Repo was cloned from
 git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git


You need to update, its there in the current tree.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: netfront for review

2007-05-03 Thread Christoph Hellwig
On Thu, May 03, 2007 at 09:33:43AM +0200, Gerd Hoffmann wrote:
 Guess so.  It defaults to flip.  I simplified the rx_copy/flip module
 parameter to a simple rx_mode=0/1, but this is preserved from the
 original.  My guess is that originally there was only flip, and copy was
 added later.
 
 Yep, page flipping is the old (pre xen 3.0.3) way, copy was added (and 
 made the default) later.

So can we please just rip out the obsolete code completely?  There's
no point adding this code anymore.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Rework dev_base via list_head (v3)

2007-05-03 Thread Pavel Emelianov
Netdev tree was updated today soon after I sent a patch for it,
so this version applies to it and the fs/afs/netdevices.c file
is added. Hope I am not late yet again :)

Cleanup of dev_base list use, with the aim to simplify making
device list per-namespace. In almost every occasion, use of
dev_base variable and dev-next pointer could be easily replaced
by  for_each_netdev loop. A few most complicated places were
converted to using first_netdev()/next_netdev().

Signed-off-by: Pavel Emelianov [EMAIL PROTECTED]
Acked-by: Kirill Korotaev [EMAIL PROTECTED]
Cc: Patrick McHardy [EMAIL PROTECTED]

---

diff --git a/arch/s390/appldata/appldata_net_sum.c 
b/arch/s390/appldata/appldata_net_sum.c
index a43f348..2180ac1 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -107,7 +107,7 @@ static void appldata_get_net_sum_data(vo
tx_dropped = 0;
collisions = 0;
read_lock(dev_base_lock);
-   for (dev = dev_base; dev != NULL; dev = dev-next) {
+   for_each_netdev(dev) {
stats = dev-get_stats(dev);
rx_packets += stats-rx_packets;
tx_packets += stats-tx_packets;
diff --git a/arch/sparc64/solaris/ioctl.c b/arch/sparc64/solaris/ioctl.c
index 330743c..18352a4 100644
--- a/arch/sparc64/solaris/ioctl.c
+++ b/arch/sparc64/solaris/ioctl.c
@@ -686,7 +686,8 @@ static inline int solaris_i(unsigned int
int i = 0;

read_lock_bh(dev_base_lock);
-   for (d = dev_base; d; d = d-next) i++;
+   for_each_netdev(d)
+   i++;
read_unlock_bh(dev_base_lock);
 
if (put_user (i, (int __user *)A(arg)))
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 1a6aeac..01fbdd3 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -194,15 +194,15 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigne
sl = sl_tail = NULL;
 
read_lock(dev_base_lock);
-   for (ifp = dev_base; ifp; dev_put(ifp), ifp = ifp-next) {
+   for_each_netdev(ifp) {
dev_hold(ifp);
if (!is_aoe_netif(ifp))
-   continue;
+   goto cont;
 
skb = new_skb(sizeof *h + sizeof *ch);
if (skb == NULL) {
printk(KERN_INFO aoe: skb alloc failure\n);
-   continue;
+   goto cont;
}
skb_put(skb, sizeof *h + sizeof *ch);
skb-dev = ifp;
@@ -221,6 +221,8 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigne
 
skb-next = sl;
sl = skb;
+cont:
+   dev_put(ifp);
}
read_unlock(dev_base_lock);
 
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 2a299a0..ef32a5c 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -1971,8 +1971,7 @@ static struct net_device *get_strip_dev(
  sizeof(zero_address))) {
struct net_device *dev;
read_lock_bh(dev_base_lock);
-   dev = dev_base;
-   while (dev) {
+   for_each_netdev(dev) {
if (dev-type == strip_info-dev-type 
!memcmp(dev-dev_addr,
strip_info-true_dev_addr,
@@ -1983,7 +1982,6 @@ static struct net_device *get_strip_dev(
read_unlock_bh(dev_base_lock);
return (dev);
}
-   dev = dev-next;
}
read_unlock_bh(dev_base_lock);
}
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index 3df82fe..98be288 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -365,7 +365,7 @@ static __inline__ int led_get_net_activi
 * for reading should be OK */
read_lock(dev_base_lock);
rcu_read_lock();
-   for (dev = dev_base; dev; dev = dev-next) {
+   for_each_netdev(dev) {
struct net_device_stats *stats;
struct in_device *in_dev = __in_dev_get_rcu(dev);
if (!in_dev || !in_dev-ifa_list)
diff --git a/fs/afs/netdevices.c b/fs/afs/netdevices.c
index ce08977..fc27d4b 100644
--- a/fs/afs/netdevices.c
+++ b/fs/afs/netdevices.c
@@ -47,7 +47,7 @@ int afs_get_ipv4_interfaces(struct afs_i
ASSERT(maxbufs  0);
 
rtnl_lock();
-   for (dev = dev_base; dev; dev = dev-next) {
+   for_each_netdev(dev) {
if (dev-type == ARPHRD_LOOPBACK  !wantloopback)
continue;
idev = __in_dev_get_rtnl(dev);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4428f1c..3044622 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ 

Re: netfront for review

2007-05-03 Thread Gerd Hoffmann

Christoph Hellwig wrote:

On Thu, May 03, 2007 at 09:33:43AM +0200, Gerd Hoffmann wrote:

Guess so.  It defaults to flip.  I simplified the rx_copy/flip module
parameter to a simple rx_mode=0/1, but this is preserved from the
original.  My guess is that originally there was only flip, and copy was
added later.
Yep, page flipping is the old (pre xen 3.0.3) way, copy was added (and 
made the default) later.


So can we please just rip out the obsolete code completely?  There's
no point adding this code anymore.


Drawback is that the guest kernel wouldn't work with older xen versions 
(dom0 netback driver to be exact) any more.  Probably wouldn't be a 
showstopper though, given that xen 3.0.3 probably is almost one year out 
by the time 2.6.22 will be released ...

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: netfront for review

2007-05-03 Thread Jeremy Fitzhardinge
Gerd Hoffmann wrote:
 Drawback is that the guest kernel wouldn't work with older xen
 versions (dom0 netback driver to be exact) any more.  Probably
 wouldn't be a showstopper though, given that xen 3.0.3 probably is
 almost one year out by the time 2.6.22 will be released ...

I don't think we've decided how backwards-compatible the pv_ops guest
should be.  I've been working on the basis as much as possible, so
long as it isn't a large burden.

J
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] gianfar: Add I/O barriers when touching buffer descriptor ownership.

2007-05-03 Thread Scott Wood

Kumar Gala wrote:

So what about some thing like this where we do the read only once?

- k

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index a06d8d1..9cd7d1e 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1438,31 +1438,35 @@ int gfar_clean_rx_ring(struct net_device *dev, int 
rx_work_limit)
 {
struct rxbd8 *bdp;
struct sk_buff *skb;
-   u16 pkt_len;
+   u16 pkt_len, status;
+   u32 bd_info;



I suggested that on IRC yesterday, and Segher was concerned that the 
compiler might, in theory, optimize it into to two lhz instructions. 
I'm rather skeptical that it would actually do so (even if it needs to 
load twice due to register pressure, why not just use lwz both times?), 
and there's probably many other places that would break if it did, but I 
wasn't up for digging around GCC to prove otherwise.


Plus, that wouldn't synchronize the bd_info read with the buffer data reads.

-Scott
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] IPV6 : Some cleanups in include/net/ipv6.h

2007-05-03 Thread Eric Dumazet
1) struct ip6_flowlabel : moves 'users' field to avoid two 32bits holes for 
64bit arches. Shrinks by 8 bytes sizeof(struct ip6_flowlabel)

2) ipv6_addr_cmp() and ipv6_addr_copy() dont need (void *) casts :
Compiler might take into account natural alignement of in6_addr structs to emit 
better code for memcpy()/memcmp()
Casts to (void *) force byte accesses.

3) ipv6_addr_prefix() optimization :
Better to clear whole struct, as compiler can emit better code for memset(addr, 
0, 16) (2 stores on x86_64), and avoid some conditional branches.

# size vmlinux.after vmlinux.before
   textdata bss dec hex filename
5262262  647612  557432 6467306  62aeea vmlinux.after
5262550  647612  557432 6467594  62b00a vmlinux.before

thats 288 bytes saved.

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]

diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 2ce3941..e4b16b7 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -204,9 +204,9 @@ struct ip6_flowlabel
 {
struct ip6_flowlabel*next;
__be32  label;
+   atomic_tusers;
struct in6_addr dst;
struct ipv6_txoptions   *opt;
-   atomic_tusers;
unsigned long   linger;
u8  share;
u32 owner;
@@ -291,7 +291,7 @@ static inline int ipv6_addr_src_scope(co
 
 static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct 
in6_addr *a2)
 {
-   return memcmp((const void *) a1, (const void *) a2, sizeof(struct 
in6_addr));
+   return memcmp(a1, a2, sizeof(struct in6_addr));
 }
 
 static inline int
@@ -308,7 +308,7 @@ ipv6_masked_addr_cmp(const struct in6_ad
 
 static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr 
*a2)
 {
-   memcpy((void *) a1, (const void *) a2, sizeof(struct in6_addr));
+   memcpy(a1, a2, sizeof(struct in6_addr));
 }
 
 static inline void ipv6_addr_prefix(struct in6_addr *pfx, 
@@ -319,13 +319,10 @@ static inline void ipv6_addr_prefix(stru
int o = plen  3,
b = plen  0x7;
 
+   memset(pfx-s6_addr, 0, sizeof(pfx-s6_addr));
memcpy(pfx-s6_addr, addr, o);
-   if (b != 0) {
+   if (b != 0)
pfx-s6_addr[o] = addr-s6_addr[o]  (0xff00  b);
-   o++;
-   }
-   if (o  16)
-   memset(pfx-s6_addr + o, 0, 16 - o);
 }
 
 static inline void ipv6_addr_set(struct in6_addr *addr, 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] gianfar: Add I/O barriers when touching buffer descriptor ownership.

2007-05-03 Thread Segher Boessenkool

So what about some thing like this where we do the read only once?

- k

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index a06d8d1..9cd7d1e 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1438,31 +1438,35 @@ int gfar_clean_rx_ring(struct net_device 
*dev, int rx_work_limit)

 {
struct rxbd8 *bdp;
struct sk_buff *skb;
-   u16 pkt_len;
+   u16 pkt_len, status;
+   u32 bd_info;



I suggested that on IRC yesterday, and Segher was concerned that the
compiler might, in theory, optimize it into to two lhz instructions.


Yes.  The same is true of the original code btw, but since
you test only one bit there, all is fine.


I'm rather skeptical that it would actually do so (even if it needs to
load twice due to register pressure, why not just use lwz both times?),


Sure.  That doesn't make this code correct though.


and there's probably many other places that would break if it did,


Most other network drivers read from an MMIO reg to see
which RX ring entries are kernel owned AFAICS.


but I wasn't up for digging around GCC to prove otherwise.


It doesn't matter what current GCC does -- simply look
at what it is *allowed* to do instead.

If you want a 32-bit read to be atomic, you should
do the read via a (volatile u32 *).  Doing this with
a cast in the places where you need the atomic access
makes sure you don't get unnecessary rereads.

Plus, that wouldn't synchronize the bd_info read with the buffer data 
reads.


Yes, you still need the rmb().


Segher

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Bugme-new] [Bug 8405] New: pppd does stops compresion with Lost compression sync

2007-05-03 Thread Stefan Wenk
On Thursday 03 May 2007 02:23, Richard Purdie wrote:
 On Wed, 2007-05-02 at 18:59 +0200, Stefan Wenk wrote:
  The situation now is similar as without any modifications. Instead of -5
  (Z_BUF_ERROR)
  we get back -3 (Z_DATA_ERROR) from zlib_inflate. Here is the kernel log
 
  kernel: PPP generic driver version 2.4.2
  pppd[6101]: pppd 2.4.4 started by root, uid 0
  pppd[6101]: Using interface ppp0
  pppd[6101]: Connect: ppp0 -- /dev/pts/8
  pppd[6101]: kernel does not support PPP filtering
  kernel: PPP BSD Compression module registered
  kernel: PPP Deflate Compression module registered
  pppd[6101]: Deflate (15) compression enabled
  pppd[6101]: Cannot determine ethernet address for proxy ARP
  pppd[6101]: local  IP address 192.168.3.2
  pppd[6101]: remote IP address 192.168.3.1
  kernel: z_decompress0: inflate returned -3 (),av in 0, av out 1, t in
  1520, t out 3070, dp 0, of 1, is 644, os 1504
  kernel: z_decompress0: inflate returned -3 ()
  pppd[6101]: Lost compression sync: disabling compression
  pppd[6101]: Terminating on signal 2
  pppd[6101]: Child process pppd (charshunt) (pid 6131) terminated with
  signal 2 pppd[6101]: Modem hangup
  pppd[6101]: Connect time 0.2 minutes.
  pppd[6101]: Sent 2969 bytes, received 2774 bytes.
  pppd[6101]: Connection terminated.
  pppd[6101]: Exit.
 
  Attached you find the corresponding pppdump file.

 Thanks, the interesting bit is that overflow=1. The Z_DATA_ERROR is
 probably coming from zlib_inflateSyncPacket() suggesting a logic error.

 I managed to find a null modem cable, create this setup and occasionally
 reproduce the problem. I think the change I suggested was half way there
 but there is another problem. Could you try this patch and see if it
 fixes your errors?

 I haven't seen the problem occur here on my box with the patch below
 applied. Having said that, I was testing against a box running 2.6.11.2
 and I did see similar looking compression errors appearing on that just
 before I was about to send this after stressing the link for an hour.
 This could mean there is some more subtle problem (not related to the
 inflate patch). It is sending Reset requests rather than Term Requests
 though so perhaps its some other problem. Lets see what you find with
 the patch below...

 Cheers,

 Richard

 Index: linux-2.6.20-rc4/lib/zlib_inflate/inflate.c
 ===
 --- linux-2.6.20-rc4.orig/lib/zlib_inflate/inflate.c
 +++ linux-2.6.20-rc4/lib/zlib_inflate/inflate.c
 @@ -743,12 +745,14 @@ int zlib_inflate(z_streamp strm, int flu

  strm-data_type = state-bits + (state-last ? 64 : 0) +
(state-mode == TYPE ? 128 : 0);
 -if (((in == 0  out == 0) || flush == Z_FINISH)  ret == Z_OK)
 -ret = Z_BUF_ERROR;

  if (flush == Z_PACKET_FLUSH  ret == Z_OK 
 -(strm-avail_out != 0 || strm-avail_in == 0))
 +strm-avail_out != 0  strm-avail_in == 0)
return zlib_inflateSyncPacket(strm);
 +
 +if (((in == 0  out == 0) || flush == Z_FINISH)  ret == Z_OK)
 +ret = Z_BUF_ERROR;
 +
  return ret;
  }
With this modification the reported problem with the lost compression sync is 
fixed indeed. Thank you! I have tried to stress the nullmodem link and on 
application level everthing looks fine now. But I do also sometimes see CCP 
Reset Requests which are sent by the box with the 2.6.21 kernel.  This 
problem seems to be fixed on the TCP layer, so the applications do not 
recognise. I can't tell is this the ordinary behaviour as I have never looked 
at the PPP level in such detail before. I do agree with you that if this is a 
problem it does not look to be related with the issue which you fixed now.

Ciao Stefan
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] TCP: zero out rx_opt in tcp_disconnect()

2007-05-03 Thread Aji_Srinivas
When the server drops its connection, NFS client reconnects using the
same socket after disconnecting. If the new connection's SYN,ACK
doesn't contain the TCP timestamp option and the old connection's did,
tp-tcp_header_len is recomputed assuming no timestamp header but
tp-rx_opt.tstamp_ok remains set. Then tcp_build_and_update_options()
adds in a timestamp option past the end of the allocated TCP header,
overwriting TCP data, or when the data is in skb_shinfo(skb)-frags[],
overwriting skb_shinfo(skb) causing a crash soon after. (The issue was
debugged from such a crash.)

Similarly, wscale_ok and sack_ok also get set based on the SYN,ACK
packet but not reset on disconnect, since they are zeroed out at
initialization. The patch zeroes out the entire tp-rx_opt struct in
tcp_disconnect() to avoid this sort of problem.

Signed-off-by: Srinivas Aji [EMAIL PROTECTED]
---
 net/ipv4/tcp.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index d6e4886..8b124ea 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1760,8 +1760,7 @@ int tcp_disconnect(struct sock *sk, int flags)
tcp_clear_retrans(tp);
inet_csk_delack_init(sk);
tcp_init_send_head(sk);
-   tp-rx_opt.saw_tstamp = 0;
-   tcp_sack_reset(tp-rx_opt);
+   memset(tp-rx_opt, 0, sizeof(tp-rx_opt));
__sk_dst_reset(sk);
 
BUG_TRAP(!inet-num || icsk-icsk_bind_hash);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] sky2: re-enable 88E8056 for most motherboards

2007-05-03 Thread Daniel Drake

Stephen Hemminger wrote:

The PCI info is basically the same between working/non working
Gigabyte boards. Is there any other difference?  Kernel config?
chip revision?


I've never seen any reports of the corruption which you describe, so I 
can't make the comparison myself. Here's the chip info from a working 
Gigabyte DS3:


sky2 :04:00.0: v1.14 addr 0xf800 irq 16 Yukon-EC Ultra (0xb4) rev 2

Daniel
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ehea: fix compilation

2007-05-03 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]
---

 Compile-tested only.

 drivers/net/ehea/ehea_main.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -1799,14 +1799,15 @@ static void ehea_xmit3(struct sk_buff *skb, struct 
net_device *dev,
 
 static inline int ehea_hash_skb(struct sk_buff *skb, int num_qps)
 {
+   struct iphdr *iph = ip_hdr(skb);
struct tcphdr *tcp;
u32 tmp;
 
if ((skb-protocol == htons(ETH_P_IP)) 
-   (skb-nh.iph-protocol == IPPROTO_TCP)) {
-   tcp = (struct tcphdr*)(skb-nh.raw + (skb-nh.iph-ihl * 4));
+   (iph-protocol == IPPROTO_TCP)) {
+   tcp = (struct tcphdr*)(skb_network_header(skb) + iph-ihl * 4);
tmp = (tcp-source + (tcp-dest  16)) % 31;
-   tmp += skb-nh.iph-daddr % 31;
+   tmp += iph-daddr % 31;
return tmp % num_qps;
}
else

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ETHTOOL]: Add 2.5G bit definitions.

2007-05-03 Thread David Miller
From: Jeff Garzik [EMAIL PROTECTED]
Date: Thu, 03 May 2007 07:11:31 -0400

 Michael Chan wrote:
  [ETHTOOL]: Add 2.5G bit definitions.
  
  Add 2.5G supported and advertising bit definitions.  2.5G is supported
  by the bnx2 driver.
  
  Signed-off-by: Michael Chan [EMAIL PROTECTED]
 
 ACK.  If DaveM does not apply this (since it's required for bnx2), I 
 will apply it.

I'll take care of it.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] [NETLINK]: Fix use after free in netlink_recvmsg

2007-05-03 Thread David Miller
From: Marcel Holtmann [EMAIL PROTECTED]
Date: Thu, 03 May 2007 14:27:16 +0200

 Hi Dave,
 
   When the user passes in MSG_TRUNC the skb is used after getting freed.
   
   Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
   Signed-off-by: David Howells [EMAIL PROTECTED]
  
  Ugh, good catch, applied :-)
 
 it seems this could be easily exploited and is at least a local DoS. It
 should be a candidate for the -stable kernel.

The MSG_TRUNC change is in 2.6.22 GIT only.

You might want to check such things before making such statements. :-/

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] phylib: m88e1111: enable SGMII mode

2007-05-03 Thread Kim Phillips
From: Kapil Juneja [EMAIL PROTECTED]

If connected via SGMII, initialize with SGMII mode configured.

Signed-off-by: Kapil Juneja [EMAIL PROTECTED]
Signed-off-by: Andy Fleming [EMAIL PROTECTED]
Signed-off-by: Kim Phillips [EMAIL PROTECTED]
---
please consider for 2.6.22

This patch depends on:

[PATCH v2] phylib: enable RGMII-ID on the Marvell m88e PHY
 - http://marc.info/?l=linux-netdevm=117648831716153w=2
 - submitted 13 apr 2007

I am not sure if initializing for SGMII without clock should be done
unconditionally..the spec doesn't mention under what conditions the
clock data are able to be recovered from the data stream.  I'm assuming
always.

 drivers/net/phy/marvell.c |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index b87f8d2..d4cc952 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -60,6 +60,7 @@
 #define MII_M_PHY_EXT_SR   0x1b
 #define MII_M_HWCFG_MODE_MASK  0xf
 #define MII_M_HWCFG_MODE_RGMII 0xb
+#define MII_M_HWCFG_MODE_SGMII_NO_CLK  0x4
 
 MODULE_DESCRIPTION(Marvell PHY driver);
 MODULE_AUTHOR(Andy Fleming);
@@ -169,6 +170,21 @@ static int m88e_config_init(struct phy_device *phydev)
return err;
}
 
+   if (phydev-interface == PHY_INTERFACE_MODE_SGMII)
+   int temp;
+
+   temp = phy_read(phydev, MII_M_PHY_EXT_SR);
+   if (temp  0)
+   return temp;
+
+   temp = ~(MII_M_HWCFG_MODE_MASK);
+   temp |= MII_M_HWCFG_MODE_SGMII_NO_CLK;
+
+   err = phy_write(phydev, MII_M_PHY_EXT_SR, temp);
+   if (err  0)
+   return err;
+   }
+
err = phy_write(phydev, MII_BMCR, BMCR_RESET);
if (err  0)
return err;
-- 
1.5.0.3

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] gianfar: add support for SGMII

2007-05-03 Thread Kim Phillips
From: Kapil Juneja [EMAIL PROTECTED]

Add code for initialising and configuring TBI interface and
programming it for connecting to on-chip SERDES (Lynx PHY)
in case of SGMII mode selected through HRCW at reset.

also add defines for TBI register configuration. TBI
interface is programmed towards the SERDES.

refactored mdio read/write functions to differentiate
programming local interface MII regs (e.g., for TBI) from
always programming the mdio master (TSEC1, for programming
the PHYs).

Signed-off-by: Kapil Juneja [EMAIL PROTECTED]
Signed-off-by: Andy Fleming [EMAIL PROTECTED]
Signed-off-by: Kim Phillips [EMAIL PROTECTED]
---
please consider for 2.6.22

 drivers/net/gianfar.c |   27 ++
 drivers/net/gianfar.h |6 +
 drivers/net/gianfar_mii.c |   55 -
 3 files changed, 77 insertions(+), 11 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index b666a0c..8e266bb 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -130,6 +130,9 @@ static int gfar_remove(struct platform_device *pdev);
 static void free_skb_resources(struct gfar_private *priv);
 static void gfar_set_multi(struct net_device *dev);
 static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
+static void gfar_configure_serdes(struct net_device *dev);
+extern int gfar_local_mdio_write(struct gfar_mii *regs, int mii_id, int 
regnum, u16 value);
+extern int gfar_local_mdio_read(struct gfar_mii *regs, int mii_id, int regnum);
 #ifdef CONFIG_GFAR_NAPI
 static int gfar_poll(struct net_device *dev, int *budget);
 #endif
@@ -453,6 +456,9 @@ static int init_phy(struct net_device *dev)
 
phydev = phy_connect(dev, phy_id, adjust_link, 0, interface);
 
+   if (interface == PHY_INTERFACE_MODE_SGMII)
+   gfar_configure_serdes(dev);
+
if (IS_ERR(phydev)) {
printk(KERN_ERR %s: Could not attach to PHY\n, dev-name);
return PTR_ERR(phydev);
@@ -467,6 +473,27 @@ static int init_phy(struct net_device *dev)
return 0;
 }
 
+static void gfar_configure_serdes(struct net_device *dev)
+{
+   struct gfar_private *priv = netdev_priv(dev);
+   struct gfar_mii __iomem *regs =
+   (void __iomem *)priv-regs-gfar_mii_regs;
+
+   /* Initialise TBI i/f to communicate with serdes (lynx phy) */
+
+   /* Single clk mode, mii mode off(for aerdes communication) */
+   gfar_local_mdio_write(regs, TBIPA_VALUE, MII_TBICON, TBICON_CLK_SELECT);
+
+   /* Supported pause and full-duplex, no half-duplex */
+   gfar_local_mdio_write(regs, TBIPA_VALUE, MII_ADVERTISE,
+   ADVERTISE_1000XFULL | ADVERTISE_1000XPAUSE |
+   ADVERTISE_1000XPSE_ASYM);
+
+   /* ANEG enable, restart ANEG, full duplex mode, speed[1] set */
+   gfar_local_mdio_write(regs, TBIPA_VALUE, MII_BMCR, BMCR_ANENABLE |
+   BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000);
+}
+
 static void init_registers(struct net_device *dev)
 {
struct gfar_private *priv = netdev_priv(dev);
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 39e9e32..d8e779c 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -136,6 +136,12 @@ extern const char gfar_driver_version[];
 #define MIIMCFG_RESET   0x8000
 #define MIIMIND_BUSY0x0001
 
+/* TBI register addresses */
+#define MII_TBICON 0x11
+
+/* TBICON register bit fields */
+#define TBICON_CLK_SELECT  0x0020
+
 /* MAC register bits */
 #define MACCFG1_SOFT_RESET 0x8000
 #define MACCFG1_RESET_RX_MC0x0008
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index bcc6b82..5dd34a1 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -43,13 +43,18 @@
 #include gianfar.h
 #include gianfar_mii.h
 
-/* Write value to the PHY at mii_id at register regnum,
- * on the bus, waiting until the write is done before returning.
- * All PHY configuration is done through the TSEC1 MIIM regs */
-int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
+/*
+ * Write value to the PHY at mii_id at register regnum,
+ * on the bus attached to the local interface, which may be different from the
+ * generic mdio bus (tied to a single interface), waiting until the write is
+ * done before returning. This is helpful in programming interfaces like
+ * the TBI which control interfaces like onchip SERDES and are always tied to
+ * the local mdio pins, which may not be the same as system mdio bus, used for
+ * controlling the external PHYs, for example.
+ */
+int gfar_local_mdio_write(struct gfar_mii *regs, int mii_id,
+ int regnum, u16 value)
 {
-   struct gfar_mii __iomem *regs = (void __iomem *)bus-priv;
-
/* Set the PHY address and the register address we want to write */
gfar_write(regs-miimadd, (mii_id  8) | regnum);
 
@@ -63,12 

Re: [PATCH][XFRM] SAD info TLV aggregation

2007-05-03 Thread David Miller
From: jamal [EMAIL PROTECTED]
Date: Thu, 03 May 2007 09:01:56 -0400

  In any case consistent naming here would be nice (SAD_ vs. SADXXX).
 
 yes, i need to make this change on the SPD as well. Dave hold onto both
 patches - i will resend.

Okie dokie.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ETHTOOL]: Add 2.5G bit definitions.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:25:51 -0700

 [ETHTOOL]: Add 2.5G bit definitions.
 
 Add 2.5G supported and advertising bit definitions.  2.5G is supported
 by the bnx2 driver.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/16][BNX2]: Block MII access when ifdown.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:28:06 -0700

 [BNX2]: Block MII access when ifdown.
 
 The device may be in D3hot state and should not allow MII register
 access.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/16][BNX2]: Fix register and memory test on 5709.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:28:29 -0700

 [BNX2]: Fix register and memory test on 5709.
 
 Tweak registers and memory test range for 5709.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 3/16][BNX2]: Add 40-bit DMA workaround for 5708.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:28:50 -0700

 [BNX2]: Add 40-bit DMA workaround for 5708.
 
 The internal PCIE-to-PCIX bridge of the 5708 has the same 40-bit DMA
 limitation as some of the tg3 chips.  Set dma_mask and persistent DMA
 mask to 40-bit to workaround.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/16][BNX2]: Fix race conditions when calling register_netdev().

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:29:06 -0700

 [BNX2]: Fix race conditions when calling register_netdev().
 
 Hot-plug scripts can call bnx2_open() as soon as register_netdev() is
 called in bnx2_init_one().  We need to call pci_set_drvdata() and
 setup everything before calling register_netdev(). netif_carrier_off()
 also needs to be moved to bnx2_open() to avoid race conditions with
 the irq.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 5/16][BNX2]: Save PCI state during suspend.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:29:19 -0700

 [BNX2]: Save PCI state during suspend.
 
 This is needed to save the MSI state which will be lost during
 suspend.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 7/16][BNX2]: Update 5709 firmware.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:32:44 -0700

 [BNX2]: Update 5709 firmware.
 
 Add ipv6 TSO support in firmware. 
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 8/16][BNX2]: Add ipv6 TSO and checksum for 5709.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:29:53 -0700

 [BNX2]: Add ipv6 TSO and checksum for 5709.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 9/16][BNX2]: Put MII register offsets in the bnx2 struct.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:30:06 -0700

 [BNX2]: Put MII register offsets in the bnx2 struct.
 
 The 5709 Serdes device uses non-standard MII register offsets.  This
 re-structuring will make it easier to support 5709 Serdes.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 10/16][BNX2]: Re-structure the 2.5G Serdes code.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:30:20 -0700

 [BNX2]: Re-structure the 2.5G Serdes code.
 
 Add some common procedures to handle enabling and disabling 2.5G.
 Add some missing code to resolve flow control.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 11/16][BNX2]: Add support for 5709 Serdes.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:30:37 -0700

 [BNX2]: Add support for 5709 Serdes.
 
 Add PCI ID and code to support the 5709 Serdes PHY.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 12/16][BNX2]: Add indirect spinlock.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:30:48 -0700

 [BNX2]: Add indirect spinlock.
 
 The indirect register access method will be used by more than one
 caller in BH context (NAPI poll and timer), so a spinlock is required.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 13/16][BNX2]: Restructure PHY event handling.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:31:06 -0700

 [BNX2]: Restructure PHY event handling.
 
 Restructure by adding bnx2_phy_event_is_set() to make code cleaner
 and easier to understand.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 14/16][BNX2]: Add 1-shot MSI handler for 5709.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:31:38 -0700

 [BNX2]: Add 1-shot MSI handler for 5709.
 
 The 5709 supports the one-shot MSI handler similar to some of the tg3
 chips.  In this mode, the MSI disables itself automatically until it
 is re-enabled at the end of NAPI poll.
 
 Put the request_irq/free_irq logic in common procedures.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied, thanks.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 15/16][BNX2]: Print bus information for PCIE devices.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:31:49 -0700

 [BNX2]: Print bus information for PCIE devices.
 
 Fix the code to print PCI or PCIE bus information for all devices.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 16/16][BNX2]: Update version and reldate.

2007-05-03 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Thu, 03 May 2007 00:32:02 -0700

 [BNX2]: Update version and reldate.
 
 Update version to 1.5.10.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Applied.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [TCP] Highspeed: Limited slow-start is nowadays in tcp_slow_start

2007-05-03 Thread David Miller
From: Ilpo_Järvinen [EMAIL PROTECTED]
Date: Thu, 3 May 2007 15:34:25 +0300 (EEST)

 Reuse limited slow-start (RFC3742) included into tcp_cong instead
 of having another implementation in High Speed TCP.
 
 Compile tested only.
 
 Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]

Thanks for noticing this code duplication.

I've applied this, but it would be great if someone would
do some sanity tests of highspeed to make sure it's
ok.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   >