Re: [PATCH] HTB O(1) class lookup

2007-02-06 Thread Jarek Poplawski
On Mon, Feb 05, 2007 at 06:14:13PM +0100, Simon Lodal wrote:
 On Monday 05 February 2007 11:16, Jarek Poplawski wrote:
  On 01-02-2007 12:30, Andi Kleen wrote:
   Simon Lodal [EMAIL PROTECTED] writes:
   Memory is generally not an issue, but CPU is, and you can not beat the
   CPU efficiency of plain array lookup (always faster, and constant time).
 
  Probably for some old (or embedded) lean boxes used for
  small network routers, with memory hungry iptables -
  memory could be an issue.
 
 Sure, but if they are that constrained they probably do not run HTB in the 
 first place.
 
 We are talking about 4k initially, up to 256k worst case (or 512k if your 
 router is 64bit, unlikely if small is a priority).
 
   And the worst memory consumption case considered by Patrick should
   be relatively unlikely.
 
  Anyway, such approach, that most users do something
  this (reasonable) way, doesn't look like good
  programming practice.
 
 The current hash algorithm also assumes certain usage patterns, namely that 
 you choose classids that generate different hash keys (= distribute uniformly 
 across the buckets), or scalability will suffer very quickly. Even at 64 
 classes you would probably see htb_find() near the top of a profiling 
 analysis.
 
 But I would say that it is just as unlikely as choosing 64 classids that 
 cause 
 my patch to allocate all 256k.
 
 In these unlikely cases, my patch only wastes passive memory, while the 
 current htb wastes cpu to a point where it can severely limit routing 
 performance.
 
 
  I wonder, why not try, at least for a while, to do this
  a compile (menuconfig) option with a comment:
  recommended for a large number of classes. After hash
  optimization and some testing, final decisions could be
  made.
 
 I decided not to do it because it would mean too many ifdefs 
 (ugly+unmaintanable code).

As a matter of fact Andi's recommentation is enough
for me. In his first message he wrote probably the
right data structure for this, so I thought: why
not test and make sure. It should be easier without
removing current solution. But his second message
convinced me.

Generally I think 512k (or even 256k) should matter
and don't agree HTB is not for constrained ones. It
could be dangerous attitude if every module in the
kernel were so generous. And it could be contagious:
others don't care - why should I?

Some time ago low memory requirements and possibility
to run on older boxes were strong arguments for linux.
Did we give it up to BSDs?

So I only wanted to make sure there would be a real
gain, because, for consistency, probably the same
model should be used with others (CBQ, HFSC).

Cheers,
Jarek P.
-
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: [RESEND PATCH 0/7] [S390]: Introduction of AF_IUCV sockets support

2007-02-06 Thread Heiko Carstens
On Mon, Feb 05, 2007 at 03:00:50PM +0100, Frank Pavlic wrote:
 Hello,
 seems that Patch 1/7 is lost and did not make its way to the mailing list :-(
 That's the reason why I resend the whole patch set again.
 Here we go ...
 [...]
 [1/7] [S390]: Rewrite of the IUCV base code, part 1

Patch 1 has more than 100.000 characters. That's why it didn't reach any
list.
-
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: [Lksctp-developers] Fw: Intermittent SCTP multihoming breakage

2007-02-06 Thread Steve Hill
Vlad Yasevich wrote on 05 February 2007 20:35:

 would you mind terribly, changing the -d $net to the
 -i $net, and run the script with the interface name instead?

I seem to get the same failure when dropping traffic based on interface
as I do when dropping based on address.

 When I block at the ip address, I see the path failover
 in an odd state.  It looks like it happened, but the flow is
 not resumed.  Receive still doesn't get traffic. I think I might

This sounds like it might be the same problem I'm seeing.

My sender is running the 2.6.16.1 kernel with your patch applied, the
receiver is running Fedora Core 6's 2.6.18-1.2798.fc6 kernel.  The
iptables rules are being set on the receiver (so there should be no odd
interactions between the sender's SCTP stack and iptables - as far as
the sender knows the packets have been transmitted and lost in transit).

Thanks.

 - Steve Hill
   Software Engineer
   Dialogic
   Fordingbridge, Hampshire, UK
   +44-1425-651392
   [EMAIL PROTECTED]
-
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 7/7] [S390]: Add AF_IUCV socket support

2007-02-06 Thread Christoph Hellwig
 -#define NPROTO   32  /* should be enough for now..   
 */
 +#define NPROTO   33  /* should be enough for now..   
 */

You can't simply increase NPROTO, but there should be holes left.
Ask DaveM for a proper allocation.

-
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 11/11] netfilter warning fix

2007-02-06 Thread Martin Josefsson
On Mon, 5 Feb 2007, David Miller wrote:

 Let's audit NF_CT_STAT_INC() usage to make sure :-)

 net/netfilter/nf_conntrack_core.c:

   destroy_conntrack: Inside write_{lock,unlock}_bh().
   death_by_timeout: Ditto.
   __nf_conntrack_find: Inside read_{lock,unlock}_bh() via callers.
   __nf_conntrack_confirm: Inside write_{lock,unlock}_bh().
   early_drop: This one looks like it could be unprotected.
   init_conntrack: Inside of write_{lock,unlock}_bh().
   nf_conntrack_in: Packet receive path, softints disabled.

early_drop() is called from __nf_conntrack_alloc() which is called from
init_conntrack() and these days from ctnetlink_create_conntrack() as well.

init_conntrack() is called from nf_conntrack_in() which is packet receive
path. But ctnetlink_create_conntrack() is unprotected.

 So that leaves early_drop() as the only suspicious case that might
 not run inside of disabled BH's.

Looks that way.

 And in fact that case is a bug regardless of the preemptible rcu
 changes because this allows the counter bump to be corrupted by
 software interrupt context.

Yes, it's a bug, although not a very critical one.

 And OK, I see in the lockdep trace that it's the packet transmit
 path...   In fact, this assumption of preemption being disabled
 by the netfilter top-level dispatch is very deep.

Yes it is, and I have some future changes that wants to take this
assumption even further in order to possibly avoid the per packet
conntrack refcounts as far as possible, but this might not be possible and
there's still a long way to go before we are there. Currently it's just a
wet dream of mine.

 For example, several bits besides the NF_CT_STATIC_INC of
 nf_conntrack_in() (where the lockdep trigger backtrace hits) assume
 that preemption is enabled by that rcu_read_lock() in the top-level
 netfilter dispatch.

s/enabled/disabled/

 The __nf_ct_l{3,4}proto_find() calls there are just two examples.

 I imagine this assumption is quite pervasive throughout the
 netfilter code, so just patching up this NF_CT_STAT_INC() case
 will merely shut up lockdep and paper over the issue.

 I bet this rcu_read_lock()-implies-preempt_disable() assumption has
 spread into other areas of the tree as well.

I think so too.

/Martin
-
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: spidernet: dynamic phy setup code

2007-02-06 Thread Ishizaki Kou
Ben-san, Jens-san

Thanks for your comments and advices.
First, we should apologize to you that some troubles which we informed
about spidernet auto-negotiation are caused by our mistake.
We used wrong MACRO for advertise variable to
phy-def-ops-setup_aneg(). 

We will post the revised patch for spider_net.
Following are the current status of troubles we informed.

(1)
- if (card-aneg_count  10) {
-  /* timeout */
-  card-aneg_count = 0;
-  is1000 = !is1000;
-  goto re_setup;
- if (phy-speed == 1000  !is1000) {
-  is1000 = 1;
-  goto re_setup;
- } else if(phy-speed != 1000  is1000) {
-  is1000 = 0;
-  goto re_setup;
- }
 We need to use different auto-neg initial settings between
 for 10/100Mbps ethernet switches and for Gbps ethernet switches.
 Driver don't know which type of network switch is connected to
 network card, so we try both settings alternately in auto negtiation
 sequences by using a variable is1000.
 Furthermore, we have a problem that poll_link() may succeed even when
 the auto-neg initial setting is for different network switch type,
 and the network card does not work on this case. We retry auto-neg
 with the another initial setting on this case.
Solved.

We are now able to use Gbps switches and 10/100Mbps switches with 
the same advertise setting and we don't need to use is1000.
The re_setup is not necessary and they are removed in the revised patch.

2.
 - spider_net_write_reg(card, SPIDER_NET_GMACST,
 -spider_net_read_reg(card, SPIDER_NET_GMACST));
 - spider_net_write_reg(card, SPIDER_NET_GMACINTEN, 0x4);

 These codes are enabling LINK status interrupt which is disabled
 at the beginning of auto-neg.
 Without this operation, auto negotiation works only when a connection
 detected for the first time, and auto negotiation will not work 
 when an ethernet cable is unpluged or pluged.
Pending(No problem, if they don't cause any trouble on Cell Blades).

By the way, why do you suggest to use polling for auto-neg, Ben-san? 
Is there a merit to use polling, or is there a problem to use interrupt?
Sorry, we couldn't find the reason why sungem use polling for auto-neg. 

They might not be necessary, if we use polling to handle LINK status as
Ben-san said.

3
 - mii_phy_probe(phy, phy-mii_id);
 It seems that PHY reset is necessary before auto negotiation,
 in the case that ethernet card is disconnected from an ethernet switch
 then connected to another ethernet switch.
 We can't call directly reset routine from driver, so we call
mii_phy_probe().
Pending.

After all, we need phy reset.
 If you really need to reset it, then change sungem_phy.c to export the
 reset function. But I'm surprised you need that. Another option is to
 reset the PHY in your PHY's setup_aneg() function.
We still wonder which is the best way, and mii_phy_probe() still remains
so far.

Best regards,
Kou Ishizaki
-
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.6.20] wavelan: Use ARRAY_SIZE macro when appropriate

2007-02-06 Thread Ahmed S. Darwish
On Mon, Feb 05, 2007 at 11:17:09PM +0300, Alexey Dobriyan wrote:
 On Mon, Feb 05, 2007 at 07:00:44PM +0200, Ahmed S. Darwish wrote:
  A trivial patch to use ARRAY_SIZE macro.
 
 You're supposed to remove it ans use ARRAY_SIZE where old macro is used.
 
  --- a/drivers/net/wireless/wavelan.p.h
  +++ b/drivers/net/wireless/wavelan.p.h
  @@ -450,7 +450,7 @@ static const char   *version= wavelan.c : 
  v24 (SMP + wireless extensions) 11/12/
   #defineWATCHDOG_JIFFIES(512*HZ/100)
 
   /* Macro to get the number of elements in an array */
  -#defineNELS(a) (sizeof(a) / sizeof(a[0]))
  +#defineNELS(a) ARRAY_SIZE(a)

Ooh, how dumb the original patch is :). Thanks, here's the modified patch.

A patch to use ARRAY_SIZE macro when appropriate.

Signed-off-by: Ahmed S. Darwish [EMAIL PROTECTED]
---
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c
index 24221e4..2aa3c76 100644
--- a/drivers/net/wireless/wavelan.c
+++ b/drivers/net/wireless/wavelan.c
@@ -28,7 +28,7 @@
  */
 static u8 wv_irq_to_psa(int irq)
 {
-   if (irq  0 || irq = NELS(irqvals))
+   if (irq  0 || irq = ARRAY_SIZE(irqvals))
return 0;
 
return irqvals[irq];
@@ -42,7 +42,7 @@ static int __init wv_psa_to_irq(u8 irqval)
 {
int irq;
 
-   for (irq = 0; irq  NELS(irqvals); irq++)
+   for (irq = 0; irq  ARRAY_SIZE(irqvals); irq++)
if (irqvals[irq] == irqval)
return irq;
 
@@ -1695,7 +1695,7 @@ static int wv_frequency_list(unsigned long ioaddr,
/* I/O port of the card */
/* Look in the table if the frequency is allowed */
if (table[9 - (freq / 16)]  (1  (freq % 16))) {
/* Compute approximate channel number */
-   while ((c  NELS(channel_bands)) 
+   while ((c  ARRAY_SIZE(channel_bands)) 
(((channel_bands[c]  1) - 24)  freq)) 
c++;
list[i].i = c;  /* Set the list index */
@@ -4269,7 +4269,7 @@ struct net_device * __init wavelan_probe(int unit)
printk(KERN_DEBUG %s: -wavelan_probe()\n, dev-name);
 #endif
} else { /* Scan all possible addresses of the WaveLAN hardware. */
-   for (i = 0; i  NELS(iobase); i++) {
+   for (i = 0; i  ARRAY_SIZE(iobase); i++) {
dev-irq = def_irq;
if (wavelan_config(dev, iobase[i]) == 0) {
 #ifdef DEBUG_CALLBACK_TRACE
@@ -4280,7 +4280,7 @@ struct net_device * __init wavelan_probe(int unit)
break;
}
}
-   if (i == NELS(iobase))
+   if (i == ARRAY_SIZE(iobase))
r = -ENODEV;
}
if (r) 
@@ -4327,14 +4327,14 @@ int __init init_module(void)
 #endif
 
/* Copy the basic set of address to be probed. */
-   for (i = 0; i  NELS(iobase); i++)
+   for (i = 0; i  ARRAY_SIZE(iobase); i++)
io[i] = iobase[i];
}
 
 
/* Loop on all possible base addresses. */
i = -1;
-   while ((io[++i] != 0)  (i  NELS(io))) {
+   while ((io[++i] != 0)  (i  ARRAY_SIZE(io))) {
struct net_device *dev = alloc_etherdev(sizeof(net_local));
if (!dev)
break;
diff --git a/drivers/net/wireless/wavelan.p.h b/drivers/net/wireless/wavelan.p.h
index 72b646c..fe24281 100644
--- a/drivers/net/wireless/wavelan.p.h
+++ b/drivers/net/wireless/wavelan.p.h
@@ -449,9 +449,6 @@ static const char   *version= wavelan.c : v24 (SMP 
+ wireless extensions) 11/12/
 /* Watchdog temporisation */
 #defineWATCHDOG_JIFFIES(512*HZ/100)
 
-/* Macro to get the number of elements in an array */
-#defineNELS(a) (sizeof(a) / sizeof(a[0]))
-
 /*  PRIVATE IOCTL  */
 
 #define SIOCSIPQTHRSIOCIWFIRSTPRIV /* Set quality threshold */

-- 
Ahmed S. Darwish
http://darwish-07.blogspot.com
-
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.6.20] ixgb: Use ARRAY_SIZE macro when appropriate

2007-02-06 Thread Ahmed S. Darwish
On Mon, Feb 05, 2007 at 12:31:26PM -0800, Auke Kok wrote:
 Alexey Dobriyan wrote:
 On Mon, Feb 05, 2007 at 06:59:33PM +0200, Ahmed S. Darwish wrote:
 A patch to use ARRAY_SIZE macro already defined in kernel.h.
 
 Remove it and use ARRAY_SIZE instead.
 
 --- a/drivers/net/ixgb/ixgb_param.c
 +++ b/drivers/net/ixgb/ixgb_param.c
 @@ -245,7 +245,7 @@ ixgb_validate_option(int *value, struct ixgb_option 
 *opt)
 return -1;
  }
  
 -#define LIST_LEN(l) (sizeof(l) / sizeof(l[0]))
 +#define LIST_LEN(l) ARRAY_SIZE(l)
 
 yes, well spotted. Please change line 338 in this file to read:
 
  .arg  = { .l = { .nr = ARRAY_SIZE(fc_list),
 
 instead, so you can remove the LIST_LEN macro completely.
 
Thanks, Here's the new patch.

Use ARRAY_SIZE macro when appropriate.

Signed-off-by: Ahmed S. Darwish [EMAIL PROTECTED]
---
diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
index b27442a..c38ce73 100644
--- a/drivers/net/ixgb/ixgb_param.c
+++ b/drivers/net/ixgb/ixgb_param.c
@@ -245,8 +245,6 @@ ixgb_validate_option(int *value, struct ixgb_option *opt)
return -1;
 }
 
-#define LIST_LEN(l) (sizeof(l) / sizeof(l[0]))
-
 /**
  * ixgb_check_options - Range Checking for Command Line Parameters
  * @adapter: board private structure
@@ -335,7 +333,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
.name = Flow Control,
.err  = reading default settings from EEPROM,
.def  = ixgb_fc_tx_pause,
-   .arg  = { .l = { .nr = LIST_LEN(fc_list),
+   .arg  = { .l = { .nr = ARRAY_SIZE(fc_list),
 .p = fc_list }}
};


-- 
Ahmed S. Darwish
http://darwish-07.blogspot.com
-
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.4 0/3] e1000: update to 7.3.20

2007-02-06 Thread Willy Tarreau
Hi Auke,

On Mon, Feb 05, 2007 at 05:01:02PM -0800, Kok, Auke wrote:
 Willy,
 
 Please pull:
 
 git-pull git://lost.foo-projects.org/~ahkok/git/linux-2.4 e1000
 
 to receive an update for the e1000 driver. This updates the e1000
 driver in the 2.4 kernel to version 7.3.20-k4, roughly the equivalent
 of what is in 2.6.20 and the latest of our out-of-tree driver.
 
 This adds new hardware support and many fixes. Many customers are
 asking us for these updates and the current 2.4 kernel ships a very
 outdated version of the e1000 adapter.
 
 This patch includes small compatibility headers and code to minimize
 the changes we need to make to our driver and keep it in sync easier
 with the 2.6 kernel version so we can possibly continue to ship
 updates and fixes to this driver with more ease.

Pulled, thanks very much. I'll produce -pre1 shortly so that we can
ensure there's no regression.

 Cheers,
 
 Auke

Best Regards,
Willy

-
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/4] ucc_geth: Change private immrbar_virt_to_phys to generic iopa

2007-02-06 Thread Li Yang

Get rid of private immrbar_virt_to_phys() routine and
use generic iopa().

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |   29 ++---
1 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 7e4b23c..722a89f 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3065,21 +3065,11 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
endOfRing =
ugeth-p_tx_bd_ring[i] + (ug_info-bdRingLenTx[i] -
  1) * sizeof(struct qe_bd);
-   if (ugeth-ug_info-uf_info.bd_mem_part == MEM_PART_SYSTEM) {
-   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
-(u32) virt_to_phys(ugeth-p_tx_bd_ring[i]));
-   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].
+   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
+   iopa((unsigned long)ugeth-p_tx_bd_ring[i]));
+   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].
 last_bd_completed_address,
-(u32) virt_to_phys(endOfRing));
-   } else if (ugeth-ug_info-uf_info.bd_mem_part ==
-  MEM_PART_MURAM) {
-   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
-(u32) immrbar_virt_to_phys(ugeth-
-   p_tx_bd_ring[i]));
-   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].
-last_bd_completed_address,
-(u32) immrbar_virt_to_phys(endOfRing));
-   }
+   iopa((unsigned long)endOfRing));
}

/* schedulerbasepointer */
@@ -3331,15 +3321,8 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
/* Setup the table */
/* Assume BD rings are already established */
for (i = 0; i  ug_info-numQueuesRx; i++) {
-   if (ugeth-ug_info-uf_info.bd_mem_part == MEM_PART_SYSTEM) {
-   out_be32(ugeth-p_rx_bd_qs_tbl[i].externalbdbaseptr,
-(u32) virt_to_phys(ugeth-p_rx_bd_ring[i]));
-   } else if (ugeth-ug_info-uf_info.bd_mem_part ==
-  MEM_PART_MURAM) {
-   out_be32(ugeth-p_rx_bd_qs_tbl[i].externalbdbaseptr,
-(u32) immrbar_virt_to_phys(ugeth-
-   p_rx_bd_ring[i]));
-   }
+   out_be32(ugeth-p_rx_bd_qs_tbl[i].externalbdbaseptr,
+iopa((unsigned long)ugeth-p_rx_bd_ring[i]));
/* rest of fields handled by QE */
}

-
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/4] ucc_geth: Switch kmalloc to kzalloc and clean some redundant kmalloc casts

2007-02-06 Thread Li Yang

From: Ahmed S. Darwish [EMAIL PROTECTED]

Switch kmalloc to kzalloc and clean some redundant kmalloc
casts.

Signed-off-by: Ahmed S. Darwish [EMAIL PROTECTED]
Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |   21 -
1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 722a89f..50b1fe9 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2927,10 +2927,9 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
/* Init Tx bds */
for (j = 0; j  ug_info-numQueuesTx; j++) {
/* Setup the skbuff rings */
-   ugeth-tx_skbuff[j] =
-   (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) *
-  ugeth-ug_info-bdRingLenTx[j],
-  GFP_KERNEL);
+   ugeth-tx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
+ ugeth-ug_info-bdRingLenTx[j],
+ GFP_KERNEL);

if (ugeth-tx_skbuff[j] == NULL) {
ugeth_err(%s: Could not allocate tx_skbuff,
@@ -2959,10 +2958,9 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
/* Init Rx bds */
for (j = 0; j  ug_info-numQueuesRx; j++) {
/* Setup the skbuff rings */
-   ugeth-rx_skbuff[j] =
-   (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) *
-  ugeth-ug_info-bdRingLenRx[j],
-  GFP_KERNEL);
+   ugeth-rx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
+ ugeth-ug_info-bdRingLenRx[j],
+ GFP_KERNEL);

if (ugeth-rx_skbuff[j] == NULL) {
ugeth_err(%s: Could not allocate rx_skbuff,
@@ -3434,19 +3432,16 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
 * resource.
 * This shadow structure keeps a copy of what was done so that the
 * allocated resources can be released when the channel is freed.
+* *p_init_enet_param_shadow is zeroed by kzalloc
 */
if (!(ugeth-p_init_enet_param_shadow =
-(struct ucc_geth_init_pram *) kmalloc(sizeof(struct 
ucc_geth_init_pram),
- GFP_KERNEL))) {
+ kzalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) {
ugeth_err
(%s: Can not allocate memory for
 p_UccInitEnetParamShadows., __FUNCTION__);
ucc_geth_memclean(ugeth);
return -ENOMEM;
}
-   /* Zero out *p_init_enet_param_shadow */
-   memset((char *)ugeth-p_init_enet_param_shadow,
-  0, sizeof(struct ucc_geth_init_pram));

/* Fill shadow InitEnet command parameter structure */


-
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/4] ucc_geth: Remove obsolete workaround of link speed change

2007-02-06 Thread Li Yang

The workaround used a long delay of 4s which caused problem
when two link-changes happens at the same time.

Signed-off-by: Li Yang [EMAIL PROTECTED]
Signed-off-by: Wu Xiaochuan [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |   71 +++
drivers/net/ucc_geth_phy.c |2 +
2 files changed, 7 insertions(+), 66 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 50b1fe9..dcec66d 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1709,75 +1709,13 @@ static void adjust_link(struct net_device *dev)
if (mii_info-speed != ugeth-oldspeed) {
switch (mii_info-speed) {
case 1000:
-#ifdef CONFIG_PPC_MPC836x
-/* FIXME: This code is for 100Mbs BUG fixing,
-remove this when it is fixed!!! */
-   if (ugeth-ug_info-enet_interface ==
-   ENET_1000_GMII)
-   /* Run the commands which initialize the PHY */
-   {
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-
-   dev, mii_info-mii_id, 0x1b);
-   tempval |= 0x000f;
-   mii_info-mdio_write(ugeth-dev,
-   mii_info-mii_id, 0x1b,
-   (u16) tempval);
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-
-   dev, mii_info-mii_id,
-   MII_BMCR);
-   mii_info-mdio_write(ugeth-dev,
-   mii_info-mii_id, MII_BMCR,
-   (u16) (tempval | BMCR_RESET));
-   } else if (ugeth-ug_info-enet_interface ==
-  ENET_1000_RGMII)
-   /* Run the commands which initialize the PHY */
-   {
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-
-   dev, mii_info-mii_id, 0x1b);
-   tempval = (tempval  ~0x000f) | 0x000b;
-   mii_info-mdio_write(ugeth-dev,
-   mii_info-mii_id, 0x1b,
-   (u16) tempval);
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-
-   dev, mii_info-mii_id,
-   MII_BMCR);
-   mii_info-mdio_write(ugeth-dev,
-   mii_info-mii_id, MII_BMCR,
-   (u16) (tempval | BMCR_RESET));
-   }
-   msleep(4000);
-#endif /* CONFIG_MPC8360 */
-   adjust_enet_interface(ugeth);
+   ugeth-ug_info-enet_interface = 
ENET_1000_RGMII;
break;
case 100:
-   case 10:
-#ifdef CONFIG_PPC_MPC836x
-/* FIXME: This code is for 100Mbs BUG fixing,
-remove this lines when it will be fixed!!! */
ugeth-ug_info-enet_interface = ENET_100_RGMII;
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-dev,
- mii_info-mii_id,
- 0x1b);
-   tempval = (tempval  ~0x000f) | 0x000b;
-   mii_info-mdio_write(ugeth-dev,
-mii_info-mii_id, 0x1b,
-(u16) tempval);
-   tempval =
-   (u32) mii_info-mdio_read(ugeth-dev,
- mii_info-mii_id,
- MII_BMCR);
-   mii_info-mdio_write(ugeth-dev,
-mii_info-mii_id, MII_BMCR,
-(u16) (tempval |
-   BMCR_RESET));
-   msleep(4000);
-#endif /* 

[PATCH 4/4] ucc_geth: Add support to local-mac-address property

2007-02-06 Thread Li Yang

IEEE-1275 defines “local-mac-address” to be a standard
property name to specify preassigned network address.
This patch adds support for it.

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |8 +++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index dcec66d..62512fc 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -4053,6 +4053,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma
static int mii_mng_configured = 0;
const phandle *ph;
const unsigned int *prop;
+   const void *mac_addr;

ugeth_vdbg(%s: IN, __FUNCTION__);

@@ -4178,7 +4179,12 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma

ugeth-ug_info = ug_info;
ugeth-dev = dev;
-   memcpy(dev-dev_addr, get_property(np, mac-address, NULL), 6);
+
+   mac_addr = get_property(np, mac-address, NULL);
+   if (mac_addr == NULL)
+   mac_addr = get_property(np, local-mac-address, NULL);
+   if (mac_addr)
+   memcpy(dev-dev_addr, mac_addr, 6);

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


Re: [patch 11/11] netfilter warning fix

2007-02-06 Thread Ingo Molnar

* Andrew Morton [EMAIL PROTECTED] wrote:

 On Mon, 05 Feb 2007 18:44:08 -0800 (PST) David Miller 
 [EMAIL PROTECTED] wrote:
 
  I bet this rcu_read_lock()-implies-preempt_disable() assumption has 
  spread into other areas of the tree as well.
 
 Me too.  Although one expects that other holes will cause might_sleep 
 or lockdep warnings pretty easily.
 
 Still, life is hard enough as it is.  I think I'll shelve rcu-preempt 
 pending resolution of this.

that was pretty much the only place in the whole kernel that got hit by 
some rcu-preempt side-effect - and even this appears to show that it's a 
real bug that was in hiding. So please dont shelve RCU-preempt for this 
reason :-)

Ingo
-
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: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-02-06 Thread Neil Horman
On Tue, Feb 06, 2007 at 10:24:05AM +0900, YOSHIFUJI Hideaki / 吉藤英明 wrote:
 Hello.
 
snip
Thank you Yoshifuji.  To be honest, I've been focused on functionality rather
than pretty so far, figuring I'd clean up the tabbing from my various patch
inclusions/reversions when we had agreed that the functionality looked good.
I'll fix up my tabbing/spacing, as well as your other comments in my next post.

Regards
Neil

-
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/4] ucc_geth: Change private immrbar_virt_to_phys to generic iopa

2007-02-06 Thread Kumar Gala


On Feb 6, 2007, at 5:31 AM, Li Yang wrote:


Get rid of private immrbar_virt_to_phys() routine and
use generic iopa().


Nack. iopa() isn't that generic, shouldn't we really be using the dma  
mapping API here?


- k



Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |   29 ++---
1 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 7e4b23c..722a89f 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3065,21 +3065,11 @@ static int ucc_geth_startup(struct  
ucc_geth_private *ugeth)

endOfRing =
ugeth-p_tx_bd_ring[i] + (ug_info-bdRingLenTx[i] -
  1) * sizeof(struct qe_bd);
-   if (ugeth-ug_info-uf_info.bd_mem_part == MEM_PART_SYSTEM) {
-   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
-(u32) virt_to_phys(ugeth-p_tx_bd_ring[i]));
-   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].
+   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
+   iopa((unsigned long)ugeth-p_tx_bd_ring[i]));
+   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].
 last_bd_completed_address,
-(u32) virt_to_phys(endOfRing));
-   } else if (ugeth-ug_info-uf_info.bd_mem_part ==
-  MEM_PART_MURAM) {
-   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].bd_ring_base,
-(u32) immrbar_virt_to_phys(ugeth-
-   p_tx_bd_ring[i]));
-   out_be32(ugeth-p_send_q_mem_reg-sqqd[i].
-last_bd_completed_address,
-(u32) immrbar_virt_to_phys(endOfRing));
-   }
+   iopa((unsigned long)endOfRing));
}
/* schedulerbasepointer */
@@ -3331,15 +3321,8 @@ static int ucc_geth_startup(struct  
ucc_geth_private *ugeth)

/* Setup the table */
/* Assume BD rings are already established */
for (i = 0; i  ug_info-numQueuesRx; i++) {
-   if (ugeth-ug_info-uf_info.bd_mem_part == MEM_PART_SYSTEM) {
-   out_be32(ugeth-p_rx_bd_qs_tbl[i].externalbdbaseptr,
-(u32) virt_to_phys(ugeth-p_rx_bd_ring[i]));
-   } else if (ugeth-ug_info-uf_info.bd_mem_part ==
-  MEM_PART_MURAM) {
-   out_be32(ugeth-p_rx_bd_qs_tbl[i].externalbdbaseptr,
-(u32) immrbar_virt_to_phys(ugeth-
-   p_rx_bd_ring[i]));
-   }
+   out_be32(ugeth-p_rx_bd_qs_tbl[i].externalbdbaseptr,
+iopa((unsigned long)ugeth-p_rx_bd_ring[i]));
/* rest of fields handled by QE */
}

-
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


-
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


IP_FREEBIND and CAP_NET_ADMIN (was: Re: [PATCH/RFC 05/10] Remove local address check on IP output)

2007-02-06 Thread KOVACS Krisztian
On Wednesday 10 January 2007 07:47, Patrick McHardy wrote:
 KOVACS Krisztian wrote:
  ip_route_output() contains a check to make sure that no flows with
  non-local source IP addresses are routed. Unfortunately this check
  makes it completely impossible to use non-local bound sockets as no
  outbound packets will make through the stack.
 
  This patch moves the interface lookup to the multicast-specific code
  path as that is the only real user of the interface data looked up.
 
  Signed-off-by: KOVACS Krisztian [EMAIL PROTECTED]
 
  ---
 
   net/ipv4/route.c |   13 +
   1 files changed, 5 insertions(+), 8 deletions(-)
 
  diff --git a/net/ipv4/route.c b/net/ipv4/route.c
  index 537b976..bb1158a 100644
  --- a/net/ipv4/route.c
  +++ b/net/ipv4/route.c
  @@ -2498,11 +2498,6 @@ #endif
  ZERONET(oldflp-fl4_src))
  goto out;
 
  -   /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
  -   dev_out = ip_dev_find(oldflp-fl4_src);
  -   if (dev_out == NULL)
  -   goto out;
  -

 I'm not sure how exactly this is used by applications, but couldn't you
 restrict this to sockets without freebind?

As it turned out since I've submitted this patch simply removing the 
branch in the quoted patch above is not good, as that'd allow all local 
users to generate connections from a non-local IP address. (Since setting 
IP_FREEBIND does not require CAP_NET_ADMIN.)

I've attempted to restrict the removal of the check to certain sockets, 
but it is more difficult than expected. It'd require touching a lot of 
areas of the kernel code, as the socket is not available at times where 
an output routing lookup is requested.

In fact the only thing available when making the decision in 
ip_route_output_slow() is a struct flowi. I've tried to stuff a flag bit 
into struct flowi, but that solution seems to be very risky, as the 
value for struct flowi-flags is not consulted at a lot of places. IMHO 
the result would be far from pretty... (And I have to admit that I don't 
really know what flowi-flags is used for. I've found no in-tree user of 
that field. The only defined flag bit, FLOWI_FLAG_MULTIPATHOLDROUTE, has 
no in-tree user either.)

And even if we have this flag in place, it's not enough to set it for 
certain sockets in ip_route_connect(): this would not handle SYN+ACK or 
ACK packets sent in response for redirected TCP connection attempts. And 
who knows what else is still hiding there: ip_route_output_*() calls are 
pretty much everywhere in the whole net/ipv4 directory.

So I think the cleanest solution would be to require CAP_NET_ADMIN for 
IP_FREEBIND. This way, a non-root process would not be allowed to bind to 
a non-local socket, thus it would not be possible to initiate connections 
from a non-local IP.

As this would be a change in the kernel ABI, me and Balazs have tried to 
search for applications using the IP_FREEBIND option using Google 
codesearch (www.google.com/codesearch).

Outside libc and kernel, we've found only three applications that mention
this option:
* socat: which allows setting all socket options by the user (I doubt 
using IP_FREEBIND with socat has any meaningful use)
* strace: to be able to dump IP_FREEBIND
* qemu: for emulating Linux system calls

Neither of these require IP_FREEBIND as core functionality, and will 
probably work if IP_FREEBIND would be bound to CAP_NET_ADMIN.

So the question is: shall we take the IP_FREEBIND approach, this would 
change a hardly ever used interface by requiring CAP_NET_ADMIN 
capabilities, or we should try finding all the scattered places in the 
Linux IP stack which does a route lookup?

-- 
 Regards,
  Krisztian Kovacs
-
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 v3] d80211: Add control structure for beacontemplates

2007-02-06 Thread Ivo van Doorn
Previous send v2 had a null pointer error in it.

When rt2500usb and rt73usb will start using beacontemplates,
they would also need a control structure to be passed along to
correctly set the tx parameters.
This patch will add a ieee80211_tx_control pointer to the
ieee80211_if_init_conf structure. This pointer is only a reference
to a local variable so drivers will not need to call kfree() on it.

Signed-off-by Ivo van Doorn [EMAIL PROTECTED]

---

diff -rpU3 dscape/include/net/d80211.h dscape.control/include/net/d80211.h
--- dscape/include/net/d80211.h 2007-02-06 00:19:37.0 +0100
+++ dscape.control/include/net/d80211.h 2007-02-06 16:57:35.0 +0100
@@ -374,6 +374,8 @@ struct ieee80211_if_init_conf {
  * @beacon: beacon template. Valid only if @host_gen_beacon_template in
  * struct ieee80211_hw is set. The driver is responsible of freeing
  * the sk_buff.
+ * @beacon_control: tx_control for the beacon template, this field is only
+ * valid when the @beacon field was set.
  *
  * This structure is passed to the config_interface() callback of
  * struct ieee80211_hw.
@@ -386,6 +388,7 @@ struct ieee80211_if_conf {
u8 *generic_elem;
size_t generic_elem_len;
struct sk_buff *beacon;
+   struct ieee80211_tx_control *beacon_control;
 };
 
 typedef enum { ALG_NONE, ALG_WEP, ALG_TKIP, ALG_CCMP, ALG_NULL }
diff -rpU3 dscape/net/d80211/ieee80211.c dscape.control/net/d80211/ieee80211.c
--- dscape/net/d80211/ieee80211.c   2007-02-06 00:19:38.0 +0100
+++ dscape.control/net/d80211/ieee80211.c   2007-02-06 16:58:04.0 
+0100
@@ -1857,7 +1857,8 @@ ieee80211_get_buffered_bc(struct ieee802
 EXPORT_SYMBOL(ieee80211_get_buffered_bc);
 
 static int __ieee80211_if_config(struct net_device *dev,
-struct sk_buff *beacon)
+struct sk_buff *beacon,
+struct ieee80211_tx_control *control)
 {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = dev-ieee80211_ptr;
@@ -1881,6 +1882,7 @@ static int __ieee80211_if_config(struct 
conf.generic_elem = sdata-u.ap.generic_elem;
conf.generic_elem_len = sdata-u.ap.generic_elem_len;
conf.beacon = beacon;
+   conf.beacon_control = control;
}
return local-ops-config_interface(local_to_hw(local),
   dev-ifindex, conf);
@@ -1888,20 +1890,21 @@ static int __ieee80211_if_config(struct 
 
 int ieee80211_if_config(struct net_device *dev)
 {
-   return __ieee80211_if_config(dev, NULL);
+   return __ieee80211_if_config(dev, NULL, NULL);
 }
 
 int ieee80211_if_config_beacon(struct net_device *dev)
 {
struct ieee80211_local *local = dev-ieee80211_ptr;
+   struct ieee80211_tx_control control;
struct sk_buff *skb;
 
if (!(local-hw.flags  IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE))
return 0;
-   skb = ieee80211_beacon_get(local_to_hw(local), dev-ifindex, NULL);
+   skb = ieee80211_beacon_get(local_to_hw(local), dev-ifindex, control);
if (!skb)
return -ENOMEM;
-   return __ieee80211_if_config(dev, skb);
+   return __ieee80211_if_config(dev, skb, control);
 }
 
 int ieee80211_hw_config(struct ieee80211_local *local)
-
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 01/11] user of the jiffies rounding code: Networking

2007-02-06 Thread Auke Kok

David Miller wrote:

From: [EMAIL PROTECTED]
Date: Mon, 05 Feb 2007 16:30:52 -0800


From: Arjan van de Ven [EMAIL PROTECTED]

This patch introduces users of the round_jiffies() function in the networking
code.

These timers all were of the about once a second or about once every X
seconds variety and several showed up in the what wakes the cpu up profiles
that the tickless patches provide.  Some timers are highly dynamic based on
network load; but even on low activity systems they still show up so the
rounding is done only in cases of low activity, allowing higher frequency
timers in the high activity case.

The various hardware watchdogs are an obvious case; they run every 2 seconds
but aren't otherwise specific of exactly when they need to run.

Signed-off-by: Arjan van de Ven [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]


I pulled in everything except the e1000 driver change, Jeff please
suck that in, thanks.


Jeff,

And add my:

Acked-by: Auke Kok [EMAIL PROTECTED]


Thanks

Auke



Arjan, btw:


+   if (dst_gc_timer_expires  4*HZ)
+   mod_timer(dst_gc_timer,
+   round_jiffies(jiffies + dst_gc_timer_expires));
+   else
+   mod_timer(dst_gc_timer, jiffies + dst_gc_timer_expires);

   ^

That line begins TAB SPACE TAB, and lo' and behold GIT
catch this when I applied it :-)  I fixed it up by hand
and reapplied, so don't worry about this instance.

-
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

-
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 0/7] sky2 v1.12 patches

2007-02-06 Thread Stephen Hemminger
New driver version for 2.6.21 inclusion:
* WOL
* TSO support for 88E8055
* more PCI id's
* experimental support for Yukon Extreme

Patches are against current netdev-2.6#upstream

--
Stephen Hemminger [EMAIL PROTECTED]

-
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/7] sky2: use dev_err for error reports

2007-02-06 Thread Stephen Hemminger
Use the standard dev_xxx functions instead of printk directly for
error reports. Fix a bug where the initialization would return 0
if allocation of network device failed.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

---
 drivers/net/sky2.c |   75 +
 1 file changed, 31 insertions(+), 44 deletions(-)

--- sky2-dev.orig/drivers/net/sky2.c2007-02-06 10:44:15.0 -0800
+++ sky2-dev/drivers/net/sky2.c 2007-02-06 10:44:19.0 -0800
@@ -2266,8 +2266,8 @@
 
pci_err = sky2_pci_read16(hw, PCI_STATUS);
if (net_ratelimit())
-   printk(KERN_ERR PFX %s: pci hw error (0x%x)\n,
-  pci_name(hw-pdev), pci_err);
+   dev_err(hw-pdev-dev, PCI hardware error (0x%x)\n,
+   pci_err);
 
sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
sky2_pci_write16(hw, PCI_STATUS,
@@ -2282,8 +2282,8 @@
pex_err = sky2_pci_read32(hw, PEX_UNC_ERR_STAT);
 
if (net_ratelimit())
-   printk(KERN_ERR PFX %s: pci express error (0x%x)\n,
-  pci_name(hw-pdev), pex_err);
+   dev_err(hw-pdev-dev, PCI Express error (0x%x)\n,
+   pex_err);
 
/* clear the interrupt */
sky2_write32(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
@@ -2479,8 +2479,8 @@
 
hw-chip_id = sky2_read8(hw, B2_CHIP_ID);
if (hw-chip_id  CHIP_ID_YUKON_XL || hw-chip_id  CHIP_ID_YUKON_FE) {
-   printk(KERN_ERR PFX %s: unsupported chip type 0x%x\n,
-  pci_name(hw-pdev), hw-chip_id);
+   dev_err(hw-pdev-dev, unsupported chip type 0x%x\n,
+   hw-chip_id);
return -EOPNOTSUPP;
}
 
@@ -2488,9 +2488,9 @@
 
/* This rev is really old, and requires untested workarounds */
if (hw-chip_id == CHIP_ID_YUKON_EC  hw-chip_rev == 
CHIP_REV_YU_EC_A1) {
-   printk(KERN_ERR PFX %s: unsupported revision Yukon-%s (0x%x) 
rev %d\n,
-  pci_name(hw-pdev), yukon2_name[hw-chip_id - 
CHIP_ID_YUKON_XL],
-  hw-chip_id, hw-chip_rev);
+   dev_err(hw-pdev-dev, unsupported revision Yukon-%s (0x%x) 
rev %d\n,
+   yukon2_name[hw-chip_id - CHIP_ID_YUKON_XL],
+   hw-chip_id, hw-chip_rev);
return -EOPNOTSUPP;
}
 
@@ -3298,7 +3298,7 @@
struct net_device *dev = alloc_etherdev(sizeof(*sky2));
 
if (!dev) {
-   printk(KERN_ERR sky2 etherdev alloc failed);
+   dev_err(hw-pdev-dev, etherdev alloc failed);
return NULL;
}
 
@@ -3415,8 +3415,7 @@
 
err = request_irq(pdev-irq, sky2_test_intr, 0, DRV_NAME, hw);
if (err) {
-   printk(KERN_ERR PFX %s: cannot assign irq %d\n,
-  pci_name(pdev), pdev-irq);
+   dev_err(pdev-dev, cannot assign irq %d\n, pdev-irq);
return err;
}
 
@@ -3427,9 +3426,8 @@
 
if (!hw-msi) {
/* MSI test failed, go back to INTx mode */
-   printk(KERN_INFO PFX %s: No interrupt generated using MSI, 
-  switching to INTx mode.\n,
-  pci_name(pdev));
+   dev_info(pdev-dev, No interrupt generated using MSI, 
+switching to INTx mode.\n);
 
err = -EOPNOTSUPP;
sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ);
@@ -3464,15 +3462,13 @@
 
err = pci_enable_device(pdev);
if (err) {
-   printk(KERN_ERR PFX %s cannot enable PCI device\n,
-  pci_name(pdev));
+   dev_err(pdev-dev, cannot enable PCI device\n);
goto err_out;
}
 
err = pci_request_regions(pdev, DRV_NAME);
if (err) {
-   printk(KERN_ERR PFX %s cannot obtain PCI resources\n,
-  pci_name(pdev));
+   dev_err(pdev-dev, cannot obtain PCI resources\n);
goto err_out;
}
 
@@ -3483,16 +3479,14 @@
using_dac = 1;
err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
if (err  0) {
-   printk(KERN_ERR PFX %s unable to obtain 64 bit DMA 
-  for consistent allocations\n, pci_name(pdev));
+   dev_err(pdev-dev, unable to obtain 64 bit DMA 
+   for consistent allocations\n);
goto err_out_free_regions;
}
-
} else {
err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
if (err) {
-   printk(KERN_ERR PFX %s no usable DMA configuration\n,
-  pci_name(pdev));
+

[PATCH 7/7] sky2: version 1.12

2007-02-06 Thread Stephen Hemminger
Updated version for WOL and new id's

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
---
 drivers/net/sky2.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- sky2-dev.orig/drivers/net/sky2.c2007-02-06 10:44:29.0 -0800
+++ sky2-dev/drivers/net/sky2.c 2007-02-06 10:44:31.0 -0800
@@ -49,7 +49,7 @@
 #include sky2.h
 
 #define DRV_NAME   sky2
-#define DRV_VERSION1.11.1
+#define DRV_VERSION1.12
 #define PFXDRV_NAME  
 
 /*

--
Stephen Hemminger [EMAIL PROTECTED]

-
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 5/7] sky2: Yukon Extreme support

2007-02-06 Thread Stephen Hemminger
This is basic support for the new Yukon Extreme
chip, extracted from the new vendor driver 10.0.4.3.

Since this is untested hardware, it has a big fat warning for now.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

---
 drivers/net/sky2.c |   49 +++---
 drivers/net/sky2.h |   56 +
 2 files changed, 89 insertions(+), 16 deletions(-)

--- sky2-dev.orig/drivers/net/sky2.c2007-02-06 10:44:23.0 -0800
+++ sky2-dev/drivers/net/sky2.c 2007-02-06 10:44:26.0 -0800
@@ -140,7 +140,7 @@
 static const char *yukon2_name[] = {
XL,   /* 0xb3 */
EC Ultra, /* 0xb4 */
-   UNKNOWN,  /* 0xb5 */
+   Extreme,  /* 0xb5 */
EC,   /* 0xb6 */
FE,   /* 0xb7 */
 };
@@ -211,7 +211,7 @@
else
sky2_write8(hw, B2_Y2_CLK_GATE, 0);
 
-   if (hw-chip_id == CHIP_ID_YUKON_EC_U) {
+   if (hw-chip_id == CHIP_ID_YUKON_EC_U || hw-chip_id == 
CHIP_ID_YUKON_EX) {
u32 reg1;
 
sky2_pci_write32(hw, PCI_DEV_REG3, 0);
@@ -289,8 +289,10 @@
struct sky2_port *sky2 = netdev_priv(hw-dev[port]);
u16 ctrl, ct1000, adv, pg, ledctrl, ledover, reg;
 
-   if (sky2-autoneg == AUTONEG_ENABLE 
-   !(hw-chip_id == CHIP_ID_YUKON_XL || hw-chip_id == 
CHIP_ID_YUKON_EC_U)) {
+   if (sky2-autoneg == AUTONEG_ENABLE
+!(hw-chip_id == CHIP_ID_YUKON_XL
+|| hw-chip_id == CHIP_ID_YUKON_EC_U
+|| hw-chip_id == CHIP_ID_YUKON_EX)) {
u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL);
 
ectrl = ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK |
@@ -317,8 +319,10 @@
/* enable automatic crossover */
ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO);
 
-   if (sky2-autoneg == AUTONEG_ENABLE 
-   (hw-chip_id == CHIP_ID_YUKON_XL || hw-chip_id == 
CHIP_ID_YUKON_EC_U)) {
+   if (sky2-autoneg == AUTONEG_ENABLE
+(hw-chip_id == CHIP_ID_YUKON_XL
+   || hw-chip_id == CHIP_ID_YUKON_EC_U
+   || hw-chip_id == CHIP_ID_YUKON_EX)) {
ctrl = ~PHY_M_PC_DSC_MSK;
ctrl |= PHY_M_PC_DSC(2) | PHY_M_PC_DOWN_S_ENA;
}
@@ -473,7 +477,9 @@
/* restore page register */
gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
break;
+
case CHIP_ID_YUKON_EC_U:
+   case CHIP_ID_YUKON_EX:
pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
 
/* select page 3 to access LED control register */
@@ -515,7 +521,7 @@
 
/* set page register to 0 */
gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
-   } else {
+   } else if (hw-chip_id != CHIP_ID_YUKON_EX) {
gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl);
 
if (sky2-autoneg == AUTONEG_DISABLE || sky2-speed == 
SPEED_100) {
@@ -727,7 +733,7 @@
sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR);
sky2_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON);
 
-   if (hw-chip_id == CHIP_ID_YUKON_EC_U) {
+   if (hw-chip_id == CHIP_ID_YUKON_EC_U || hw-chip_id == 
CHIP_ID_YUKON_EX) {
sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8);
sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8);
if (hw-dev[port]-mtu  ETH_DATA_LEN) {
@@ -1687,7 +1693,9 @@
sky2_write8(hw, SK_REG(port, LNK_LED_REG),
LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF);
 
-   if (hw-chip_id == CHIP_ID_YUKON_XL || hw-chip_id == 
CHIP_ID_YUKON_EC_U) {
+   if (hw-chip_id == CHIP_ID_YUKON_XL
+   || hw-chip_id == CHIP_ID_YUKON_EC_U
+   || hw-chip_id == CHIP_ID_YUKON_EX) {
u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
u16 led = PHY_M_LEDC_LOS_CTRL(1);   /* link active */
 
@@ -1780,14 +1788,16 @@
sky2-duplex = (aux  PHY_M_PS_FULL_DUP) ? DUPLEX_FULL : DUPLEX_HALF;
 
/* Pause bits are offset (9..8) */
-   if (hw-chip_id == CHIP_ID_YUKON_XL || hw-chip_id == 
CHIP_ID_YUKON_EC_U)
+   if (hw-chip_id == CHIP_ID_YUKON_XL
+   || hw-chip_id == CHIP_ID_YUKON_EC_U
+   || hw-chip_id == CHIP_ID_YUKON_EX)
aux = 6;
 
sky2-flow_status = sky2_flow(aux  PHY_M_PS_RX_P_EN,
  aux  PHY_M_PS_TX_P_EN);
 
if (sky2-duplex == DUPLEX_HALF  sky2-speed  SPEED_1000
-hw-chip_id != CHIP_ID_YUKON_EC_U)
+!(hw-chip_id == CHIP_ID_YUKON_EC_U || hw-chip_id == 
CHIP_ID_YUKON_EX))
sky2-flow_status = FC_NONE;
 
if (aux  PHY_M_PS_RX_P_EN)
@@ -2442,6 +2452,7 @@

[PATCH 3/7] sky2: TSO support for EC_U

2007-02-06 Thread Stephen Hemminger
The Yukon EC_U chipset apparently supports TSO but only for non-Jumbo
frame sizes because it lacks a Ram buffer.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

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

--- sky2-dev.orig/drivers/net/sky2.c2007-02-06 10:44:19.0 -0800
+++ sky2-dev/drivers/net/sky2.c 2007-02-06 10:44:21.0 -0800
@@ -1895,8 +1895,9 @@
if (new_mtu  ETH_ZLEN || new_mtu  ETH_JUMBO_MTU)
return -EINVAL;
 
+   /* TSO on Yukon Ultra and MTU  1500 not supported */
if (hw-chip_id == CHIP_ID_YUKON_EC_U  new_mtu  ETH_DATA_LEN)
-   return -EINVAL;
+   dev-features = ~NETIF_F_TSO;
 
if (!netif_running(dev)) {
dev-mtu = new_mtu;
@@ -3350,11 +3351,9 @@
 
sky2-port = port;
 
-   if (hw-chip_id != CHIP_ID_YUKON_EC_U)
-   dev-features |= NETIF_F_TSO;
+   dev-features |= NETIF_F_TSO | NETIF_F_IP_CSUM | NETIF_F_SG;
if (highmem)
dev-features |= NETIF_F_HIGHDMA;
-   dev-features |= NETIF_F_IP_CSUM | NETIF_F_SG;
 
 #ifdef SKY2_VLAN_TAG_USED
dev-features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;

--
Stephen Hemminger [EMAIL PROTECTED]

-
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/7] sky2: safer transmit timeout

2007-02-06 Thread Stephen Hemminger
Rather than trying to be smart about possible transmit timeout
causes. Just clear all pending frames and reset the PHY.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

---
 drivers/net/sky2.c |   41 +++--
 1 file changed, 15 insertions(+), 26 deletions(-)

--- sky2-dev.orig/drivers/net/sky2.c2007-02-06 10:44:21.0 -0800
+++ sky2-dev/drivers/net/sky2.c 2007-02-06 10:44:23.0 -0800
@@ -1840,48 +1840,37 @@
 }
 
 
-/* Transmit timeout is only called if we are running, carries is up
+/* Transmit timeout is only called if we are running, carrier is up
  * and tx queue is full (stopped).
+ * Called with netif_tx_lock held.
  */
 static void sky2_tx_timeout(struct net_device *dev)
 {
struct sky2_port *sky2 = netdev_priv(dev);
struct sky2_hw *hw = sky2-hw;
-   unsigned txq = txqaddr[sky2-port];
-   u16 report, done;
+   u32 imask;
 
if (netif_msg_timer(sky2))
printk(KERN_ERR PFX %s: tx timeout\n, dev-name);
 
-   report = sky2_read16(hw, sky2-port == 0 ? STAT_TXA1_RIDX : 
STAT_TXA2_RIDX);
-   done = sky2_read16(hw, Q_ADDR(txq, Q_DONE));
-
printk(KERN_DEBUG PFX %s: transmit ring %u .. %u report=%u done=%u\n,
-  dev-name,
-  sky2-tx_cons, sky2-tx_prod, report, done);
-
-   if (report != done) {
-   printk(KERN_INFO PFX status burst pending (irq 
moderation?)\n);
+  dev-name, sky2-tx_cons, sky2-tx_prod,
+  sky2_read16(hw, sky2-port == 0 ? STAT_TXA1_RIDX : 
STAT_TXA2_RIDX),
+  sky2_read16(hw, Q_ADDR(txqaddr[sky2-port], Q_DONE)));
 
-   sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_STOP);
-   sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_START);
-   } else if (report != sky2-tx_cons) {
-   printk(KERN_INFO PFX status report lost?\n);
+   imask = sky2_read32(hw, B0_IMSK);   /* block IRQ in hw */
+   sky2_write32(hw, B0_IMSK, 0);
+   sky2_read32(hw, B0_IMSK);
 
-   netif_tx_lock_bh(dev);
-   sky2_tx_complete(sky2, report);
-   netif_tx_unlock_bh(dev);
-   } else {
-   printk(KERN_INFO PFX hardware hung? flushing\n);
+   netif_poll_disable(hw-dev[0]); /* stop NAPI poll */
+   synchronize_irq(hw-pdev-irq);
 
-   sky2_write32(hw, Q_ADDR(txq, Q_CSR), BMU_STOP);
-   sky2_write32(hw, Y2_QADDR(txq, PREF_UNIT_CTRL), 
PREF_UNIT_RST_SET);
+   netif_start_queue(dev); /* don't wakeup during flush */
+   sky2_tx_complete(sky2, sky2-tx_prod);  /* Flush transmit queue */
 
-   sky2_tx_clean(dev);
+   sky2_write32(hw, B0_IMSK, imask);
 
-   sky2_qset(hw, txq);
-   sky2_prefetch_init(hw, txq, sky2-tx_le_map, TX_RING_SIZE - 1);
-   }
+   sky2_phy_reinit(sky2);  /* this clears flow control etc 
*/
 }
 
 static int sky2_change_mtu(struct net_device *dev, int new_mtu)

--
Stephen Hemminger [EMAIL PROTECTED]

-
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/7] sky2: add Wake On Lan support

2007-02-06 Thread Stephen Hemminger
Adds basic magic packet wake on lan support to the sky2 driver.
Note: initial WOL value is based on BIOS settings.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
---
 drivers/net/sky2.c |  208 ++---
 drivers/net/sky2.h |   28 ++-
 2 files changed, 189 insertions(+), 47 deletions(-)

--- sky2-dev.orig/drivers/net/sky2.c2007-02-06 10:44:10.0 -0800
+++ sky2-dev/drivers/net/sky2.c 2007-02-06 10:44:15.0 -0800
@@ -567,6 +567,73 @@
spin_unlock_bh(sky2-phy_lock);
 }
 
+/* Put device in state to listen for Wake On Lan */
+static void sky2_wol_init(struct sky2_port *sky2)
+{
+   struct sky2_hw *hw = sky2-hw;
+   unsigned port = sky2-port;
+   enum flow_control save_mode;
+   u16 ctrl;
+   u32 reg1;
+
+   /* Bring hardware out of reset */
+   sky2_write16(hw, B0_CTST, CS_RST_CLR);
+   sky2_write16(hw, SK_REG(port, GMAC_LINK_CTRL), GMLC_RST_CLR);
+
+   sky2_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_CLR);
+   sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR);
+
+   /* Force to 10/100
+* sky2_reset will re-enable on resume
+*/
+   save_mode = sky2-flow_mode;
+   ctrl = sky2-advertising;
+
+   sky2-advertising = 
~(ADVERTISED_1000baseT_Half|ADVERTISED_1000baseT_Full);
+   sky2-flow_mode = FC_NONE;
+   sky2_phy_power(hw, port, 1);
+   sky2_phy_reinit(sky2);
+
+   sky2-flow_mode = save_mode;
+   sky2-advertising = ctrl;
+
+   /* Set GMAC to no flow control and auto update for speed/duplex */
+   gma_write16(hw, port, GM_GP_CTRL,
+   GM_GPCR_FC_TX_DIS|GM_GPCR_TX_ENA|GM_GPCR_RX_ENA|
+   GM_GPCR_DUP_FULL|GM_GPCR_FC_RX_DIS|GM_GPCR_AU_FCT_DIS);
+
+   /* Set WOL address */
+   memcpy_toio(hw-regs + WOL_REGS(port, WOL_MAC_ADDR),
+   sky2-netdev-dev_addr, ETH_ALEN);
+
+   /* Turn on appropriate WOL control bits */
+   sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), WOL_CTL_CLEAR_RESULT);
+   ctrl = 0;
+   if (sky2-wol  WAKE_PHY)
+   ctrl |= WOL_CTL_ENA_PME_ON_LINK_CHG|WOL_CTL_ENA_LINK_CHG_UNIT;
+   else
+   ctrl |= WOL_CTL_DIS_PME_ON_LINK_CHG|WOL_CTL_DIS_LINK_CHG_UNIT;
+
+   if (sky2-wol  WAKE_MAGIC)
+   ctrl |= WOL_CTL_ENA_PME_ON_MAGIC_PKT|WOL_CTL_ENA_MAGIC_PKT_UNIT;
+   else
+   ctrl |= 
WOL_CTL_DIS_PME_ON_MAGIC_PKT|WOL_CTL_DIS_MAGIC_PKT_UNIT;;
+
+   ctrl |= WOL_CTL_DIS_PME_ON_PATTERN|WOL_CTL_DIS_PATTERN_UNIT;
+   sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl);
+
+   /* Turn on legacy PCI-Express PME mode */
+   sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
+   reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
+   reg1 |= PCI_Y2_PME_LEGACY;
+   sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
+   sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
+
+   /* block receiver */
+   sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
+
+}
+
 static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
 {
struct sky2_port *sky2 = netdev_priv(hw-dev[port]);
@@ -2404,11 +2471,9 @@
 }
 
 
-static int sky2_reset(struct sky2_hw *hw)
+static int __devinit sky2_init(struct sky2_hw *hw)
 {
-   u16 status;
u8 t8;
-   int i;
 
sky2_write8(hw, B0_CTST, CS_RST_CLR);
 
@@ -2429,6 +2494,22 @@
return -EOPNOTSUPP;
}
 
+   hw-pmd_type = sky2_read8(hw, B2_PMD_TYP);
+   hw-ports = 1;
+   t8 = sky2_read8(hw, B2_Y2_HW_RES);
+   if ((t8  CFG_DUAL_MAC_MSK) == CFG_DUAL_MAC_MSK) {
+   if (!(sky2_read8(hw, B2_Y2_CLK_GATE)  Y2_STATUS_LNK2_INAC))
+   ++hw-ports;
+   }
+
+   return 0;
+}
+
+static void sky2_reset(struct sky2_hw *hw)
+{
+   u16 status;
+   int i;
+
/* disable ASF */
if (hw-chip_id = CHIP_ID_YUKON_EC) {
sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
@@ -2453,14 +2534,6 @@
sky2_pci_write32(hw, PEX_UNC_ERR_STAT, 0xUL);
 
 
-   hw-pmd_type = sky2_read8(hw, B2_PMD_TYP);
-   hw-ports = 1;
-   t8 = sky2_read8(hw, B2_Y2_HW_RES);
-   if ((t8  CFG_DUAL_MAC_MSK) == CFG_DUAL_MAC_MSK) {
-   if (!(sky2_read8(hw, B2_Y2_CLK_GATE)  Y2_STATUS_LNK2_INAC))
-   ++hw-ports;
-   }
-
sky2_power_on(hw);
 
for (i = 0; i  hw-ports; i++) {
@@ -2544,7 +2617,37 @@
sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_START);
sky2_write8(hw, STAT_LEV_TIMER_CTRL, TIM_START);
sky2_write8(hw, STAT_ISR_TIMER_CTRL, TIM_START);
+}
 
+static inline u8 sky2_wol_supported(const struct sky2_hw *hw)
+{
+   return sky2_is_copper(hw) ? (WAKE_PHY | WAKE_MAGIC) : 0;
+}
+
+static void sky2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+{
+   const struct sky2_port *sky2 = netdev_priv(dev);
+
+   wol-supported = sky2_wol_supported(sky2-hw);
+   

[PATCH 6/7] sky2: add new chip ids

2007-02-06 Thread Stephen Hemminger
More new chip id's from vendor driver version 10.0.4.3

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

---
 drivers/net/sky2.c |4 
 1 file changed, 4 insertions(+)

--- sky2-dev.orig/drivers/net/sky2.c2007-02-06 10:44:26.0 -0800
+++ sky2-dev/drivers/net/sky2.c 2007-02-06 10:44:29.0 -0800
@@ -105,6 +105,7 @@
{ PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) },/* DGE-560T */
{ PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4001) },/* DGE-550SX */
{ PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4B02) },/* DGE-560SX */
+   { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4B03) },/* DGE-550T */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, /* 88E8021 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) }, /* 88E8022 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) }, /* 88E8061 */
@@ -126,6 +127,9 @@
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */
+   { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4369) }, /* 88EC042 */
+   { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436A) }, /* 88E8058 */
+   { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x436B) }, /* 88E8071 */
{ 0 }
 };
 

--
Stephen Hemminger [EMAIL PROTECTED]

-
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: [RFC/TOY]Extensible hashing and RCU

2007-02-06 Thread linux
 For purposes of discussion, I've attached a toy implementation
 for doing dynamic resizing of a hashtable. It is useless, except
 as a proof of concept.
 
 I think this is very similar to what you are describing, no?

Er... not quite; that has a lot more overhead than what I was
thinking about.

I have used the trick of distinguishable sentinel values in a
doubly-linked list to maintain read cursors while it's being updated,
but I don't think that's necessary here.

(You can also encode the nh_type flag in the lsbit of the pointer
if you're being sneaky.  That will attract curses from the
memleak detector, though.)

In particular, I was imagining a singly linked list.  To delete
an item, use the hash to find the head pointer and walk it
to find the pointer to be fixed up.  Since the chains are short
anyway, this is entirely reasonable.

Less fundamental comments include:

1) Is the seqlock in get_nh() and nh_replace() really required?
   Is there any architecture that doesn't have atomic pointer stores?
   If you wanted to store the table size in a fixed location as
   well, I could see the need...

2) I think the whole __nh_sort_chain business will royally confuse
   anyone walking the chain while it happens.  This is exactly
   what I was working to avoid.  The partial sorting in __nh_insert
   isn't good enough.

   Instead, try:

/* Return true if bitrev(x)  bitrev(y) */
static bool bitrev_gt(unsigned long x, unsinged long y)
{
/* Identify the bits that differ between x and y */
unsigned long mask = x ^ y; /* Find the bits that differ */
mask ^= mask-1; /* Find lsbit of difference (and all lower bits) */
return (x  mask)  (y  mask);
}

static void __nh_insert(struct nh_entry *entry, struct nh_head *head)
{
struct list_head *p, *n;
unsigned long const hashval = nh_hashval(entry-data);

/*
 * Insert the new entry just before the first element of the list
 * that its hash value is not greater than (bit-reversed).
 */
p = head-list;
list_for_each_rcu(n, head-list) {
struct nh_entry *t = container_of(n, struct nh_entry, nh_list);
if (t-nh_type == NH_ENTRY 
!bitrev_gt(hashval, nh_hashval(t-data)))
break;
p = n;
}
__list_add_rcu(entry-nh_list, p, n);
}

static int nh_add(unsigned long data)
{
struct nh_entry *entry = kmalloc(sizeof *entry, GFP_KERNEL);
struct nh *nh;

if (!entry) return -ENOMEM;

entry-nh_type = NH_ENTRY;
entry-data = data;

rcu_read_lock();

nh = get_nh();  /* or nh = __nh */

if (nh) {
struct nh_head *h = \
nh-hash[ nh_bucket(nh_hashval(data), nh-nentries) ];

spin_lock(h-lock);
__nh_insert(entry, h);
spin_unlock(h-lock);
}
rcu_read_unlock();


}

   Then there's no need for __nh_sort_chain at all.  Alternatively, if the
   upper bits of nh_hashval are as good as the lower bits, just index the
   hash table on them.

3) Code inside a mutex like nh_resize() can use plain list_for_each();
   the _rcu variant is only required if there can be simultaneous
   mutation.

That's a nice module framework.  I'll see if I can write some code
of the sort I was thinking about.

FWIW, I figured out a way around the need to delay deletion for two
RCU intervals.

Suppose that an expansion is pending, and we have just stretched the
table from 16 entries to 32, and the following hash values are
stored.  (Note the bit-reversed order.)

old[3] --\   
new[3] ---+- 0x03 - 0x43 - 0x23 - 0x63 - 0x13 - 0x53 - 0x33 - 0x73
 /
new[3+16]---/

After an RCU period, you can throw away the old[] array and NUL-terminate
the new[i] list after 0x63.  But until then, you need to leave the list alone
to accomodate people who are looking for 0x53 via the old head.

The tricky case comes when you delete 0x13.  If you only delete it from the
new[3+16] list, you can't discard it until the RCU quiescent period
after the one which dicsonnects the 0x63-0x13 link.

The solution is actually very simple: notice when you're
- Deleting the first entry in a list
- While an expension is pending
- And the list is in the second half of the expanded table
then unlink the entry from BOTH the new head and the old list.
It's a bit more work, and requires some lock-ordering care, but
it lets you queue the node for RCU cleanup the normal way.
-
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 11/11] netfilter warning fix

2007-02-06 Thread David Miller
From: Ingo Molnar [EMAIL PROTECTED]
Date: Tue, 6 Feb 2007 13:34:01 +0100

 
 * Andrew Morton [EMAIL PROTECTED] wrote:
 
  On Mon, 05 Feb 2007 18:44:08 -0800 (PST) David Miller 
  [EMAIL PROTECTED] wrote:
  
   I bet this rcu_read_lock()-implies-preempt_disable() assumption has 
   spread into other areas of the tree as well.
  
  Me too.  Although one expects that other holes will cause might_sleep 
  or lockdep warnings pretty easily.
  
  Still, life is hard enough as it is.  I think I'll shelve rcu-preempt 
  pending resolution of this.
 
 that was pretty much the only place in the whole kernel that got hit by 
 some rcu-preempt side-effect - and even this appears to show that it's a 
 real bug that was in hiding.

No, rather, it's the only location that triggered an automated
debugging check.  The very first set of code paths we checked, in
response to the bug trigger, showed beyond a shadow of a doubt that
this assumption is pervasive and in many locations that none of the
automated debugging checks live.

The tree should be fully audited before such a huge semantic change
gets added into the 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: IP_FREEBIND and CAP_NET_ADMIN

2007-02-06 Thread David Miller
From: KOVACS Krisztian [EMAIL PROTECTED]
Date: Tue, 6 Feb 2007 15:36:18 +0100

 Neither of these require IP_FREEBIND as core functionality, and will 
 probably work if IP_FREEBIND would be bound to CAP_NET_ADMIN.
 
 So the question is: shall we take the IP_FREEBIND approach, this would 
 change a hardly ever used interface by requiring CAP_NET_ADMIN 
 capabilities, or we should try finding all the scattered places in the 
 Linux IP stack which does a route lookup?

We're not going to remove functionality from the user for the
sake of convenience of something you are trying to write.

If it was some security hole, then fine, but it's not so it
can stay and it does have legitimate uses.

This freebind behavior should actually be the default, but we had to
put the socket option and sysctl there because allowing freebind by
default makes several test suites fail that try to purposely bind to a
non-local address and expect an error return.

It allows servers to bind when your on-demand connection is down.
-
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: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-02-06 Thread Neil Horman
On Tue, Feb 06, 2007 at 07:51:44AM -0500, Neil Horman wrote:
 On Tue, Feb 06, 2007 at 10:24:05AM +0900, YOSHIFUJI Hideaki / 吉藤英明 wrote:
  Hello.
  
 snip
 Thank you Yoshifuji.  To be honest, I've been focused on functionality rather

Ok, New patch attached, taking Vlad and Yoshifujis latest comments into account.
Vlad, as you mentioned, I too looked and saw that we already join the all nodes
multicast address in ipv6_add_dev, so the additional anycast join is incorrect,
and has been removed.  Whitespace/tabs have been cleaned up, code has been
consolidated/beautified as per suggestions.  I'm testing now, and early results
are good.

Thanks  Regards
Neil

Signed-off-by: Neil Horman [EMAIL PROTECTED]


 include/linux/if_addr.h |1 
 include/linux/ipv6.h|4 ++
 include/linux/sysctl.h  |1 
 include/net/addrconf.h  |4 +-
 net/ipv6/Kconfig|   10 +
 net/ipv6/addrconf.c |   93 
 net/ipv6/ip6_output.c   |   28 ++
 net/ipv6/mcast.c|4 +-
 net/ipv6/ndisc.c|   84 ++-
 9 files changed, 187 insertions(+), 42 deletions(-)


diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h
index d557e4c..43f3bed 100644
--- a/include/linux/if_addr.h
+++ b/include/linux/if_addr.h
@@ -39,6 +39,7 @@ enum
 #define IFA_F_TEMPORARYIFA_F_SECONDARY
 
 #defineIFA_F_NODAD 0x02
+#define IFA_F_OPTIMISTIC   0x04
 #defineIFA_F_HOMEADDRESS   0x10
 #define IFA_F_DEPRECATED   0x20
 #define IFA_F_TENTATIVE0x40
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index f824113..bf93c1b 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -177,6 +177,9 @@ struct ipv6_devconf {
 #endif
 #endif
__s32   proxy_ndp;
+#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
+   __s32   optimistic_dad;
+#endif
void*sysctl;
 };
 
@@ -205,6 +208,7 @@ enum {
DEVCONF_RTR_PROBE_INTERVAL,
DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
DEVCONF_PROXY_NDP,
+   DEVCONF_OPTIMISTIC_DAD,
DEVCONF_MAX
 };
 
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 81480e6..972a33a 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -570,6 +570,7 @@ enum {
NET_IPV6_RTR_PROBE_INTERVAL=21,
NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
NET_IPV6_PROXY_NDP=23,
+   NET_IPV6_OPTIMISTIC_DAD=24,
__NET_IPV6_MAX
 };
 
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 88df8fc..d248a19 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -73,7 +73,9 @@ extern intipv6_get_saddr(struct dst_entry 
*dst,
 extern int ipv6_dev_get_saddr(struct net_device *dev, 
   struct in6_addr *daddr,
   struct in6_addr *saddr);
-extern int ipv6_get_lladdr(struct net_device *dev, struct 
in6_addr *);
+extern int ipv6_get_lladdr(struct net_device *dev, 
+   struct in6_addr *,
+   unsigned char banned_flags);
 extern int ipv6_rcv_saddr_equal(const struct sock *sk, 
  const struct sock *sk2);
 extern voidaddrconf_join_solict(struct net_device *dev,
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index deb4101..822d3eb 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -57,6 +57,16 @@ config IPV6_ROUTE_INFO
 
  If unsure, say N.
 
+config IPV6_OPTIMISTIC_DAD
+   bool IPv6: Enable RFC 4429 Optimistic DAD (EXPERIMENTAL)
+   depends on IPV6  EXPERIMENTAL
+   ---help---
+ This is experimental support for optimistic Duplicate
+ Address Detection.  It allows for autoconfigured addresses
+ to be used more quickly.
+
+ If unsure, say N.
+
 config INET6_AH
tristate IPv6: AH transformation
depends on IPV6
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e385469..f2bf7da 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -594,6 +594,16 @@ ipv6_add_addr(struct inet6_dev *idev, const struct 
in6_addr *addr, int pfxlen,
 
ifa-rt = rt;
 
+   /*
+* part one of RFC 4429, section 3.3
+* We should not configure an address as 
+* optimistic if we do not yet know the link
+* layer address of out nexhop router
+*/
+
+   if (rt-rt6i_nexthop == NULL)
+   ifa-flags = ~IFA_F_OPTIMISTIC;
+
ifa-idev = idev;
in6_dev_hold(idev);
/* For caller */
@@ -770,6 +780,7 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, 
struct inet6_ifaddr *i
int tmp_plen;
int ret = 0;
int max_addresses;
+   u32 

[PATCH] tg3 : avoid an expensive divide

2007-02-06 Thread Eric Dumazet

Hi David

During an oprofile session of linux-2.6.20 on a dual opteron system, I noticed 
an expensive divide was done in tg3_poll().


I am using gcc-4.1.1, so the following comment from drivers/net/tg3.c seems 
over-optimistic :


/* Do not place this n-ring entries value into the tp struct itself,
 * we really want to expose these constants to GCC so that modulo et
 * al.  operations are done with shifts and masks instead of with
 * hw multiply/modulo instructions.  Another solution would be to
 * replace things like '% foo' with ' (foo - 1)'.
 */
#define TG3_RX_RCB_RING_SIZE(tp)\
((tp-tg3_flags2  TG3_FLG2_5705_PLUS) ?  512 : 1024)

Assembly code before patch :
(oprofile results included)
  6434  0.0088 :803684b9:   mov0x6f0(%r15),%eax
   587 8.0e-04 :803684c0:   and$0x4,%eax
  2170  0.0030 :803684c5:   cmp$0x1,%eax
   :803684c8:   lea0x1(%r13),%eax
   :803684cc:   sbb%ecx,%ecx
  2051  0.0028 :803684ce:   xor%edx,%edx
   :803684d0:   and$0x200,%ecx
20 2.7e-05 :803684d6:   add$0x200,%ecx
  1986  0.0027 :803684dc:   div%ecx
103427  0.1410 :803684de:   cmp%edx,0xff7c(%rbp)


Assembly code after the suggested patch :


803684b9:   mov0x6f0(%r15),%eax
803684c0:   and$0x4,%eax
803684c5:   cmp$0x1,%eax
803684c8:   sbb%eax,%eax
803684ca:   inc%r13d
803684cd:   and$0x200,%eax
803684d2:   add$0x1ff,%eax
803684d7:   and%eax,%r13d
803684da:   cmp%r13d,0xff7c(%rbp)

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
--- linux-2.6.20/drivers/net/tg3.c.orig 2007-02-06 22:30:39.0 +0100
+++ linux-2.6.20-ed/drivers/net/tg3.c   2007-02-06 22:32:42.0 +0100
@@ -3384,7 +3384,7 @@
}
 next_pkt_nopost:
sw_idx++;
-   sw_idx %= TG3_RX_RCB_RING_SIZE(tp);
+   sw_idx = (TG3_RX_RCB_RING_SIZE(tp) - 1);
 
/* Refresh hw_idx to see if there is new work */
if (sw_idx == hw_idx) {


Re: [patch 11/11] netfilter warning fix

2007-02-06 Thread Ingo Molnar

* David Miller [EMAIL PROTECTED] wrote:

  that was pretty much the only place in the whole kernel that got hit 
  by some rcu-preempt side-effect - and even this appears to show that 
  it's a real bug that was in hiding.
 
 No, rather, it's the only location that triggered an automated 
 debugging check.  The very first set of code paths we checked, in 
 response to the bug trigger, showed beyond a shadow of a doubt that 
 this assumption is pervasive and in many locations that none of the 
 automated debugging checks live.
 
 The tree should be fully audited before such a huge semantic change 
 gets added into the tree.

i'd like to add more automated checks to the tree. 'naked' 
smp_processor_id() use is one telltale sign of such a problem - what 
other instances could you suggest me to check? The thing is, in 99% of 
the cases the smp_processor_id() check caught such assumptions in other 
code because 'preempt off' is inextricably connected to /some/ use of 
smp_processor_id() - be it get_cpu_var() or any other derivative 
interface. So i'm wondering what other assumptions there are (or can be) 
about rcu_read_lock() also being a preempt-off point. Thanks!

(btw., i always argued that neither preempt_disable() nor 
rcu_read_lock() is an ideal interface for locking because both hide 
critical assumptions and dependencies - and they both are able to create 
little versions of the 'big BKL mess' that we had to fight a few years 
ago. (and that we still have to fight today, in certain areas of code.))

Ingo
-
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] tg3 : avoid an expensive divide

2007-02-06 Thread David Miller
From: Eric Dumazet [EMAIL PROTECTED]
Date: Tue, 06 Feb 2007 21:53:24 +0100

 I am using gcc-4.1.1, so the following comment from drivers/net/tg3.c seems 
 over-optimistic :
 
 /* Do not place this n-ring entries value into the tp struct itself,
   * we really want to expose these constants to GCC so that modulo et
   * al.  operations are done with shifts and masks instead of with
   * hw multiply/modulo instructions.  Another solution would be to
   * replace things like '% foo' with ' (foo - 1)'.
   */
 #define TG3_RX_RCB_RING_SIZE(tp)\
  ((tp-tg3_flags2  TG3_FLG2_5705_PLUS) ?  512 : 1024)

Because I've seen gcc optimize this properly before (at least on
sparc64), it means that either:

1) There is a GCC bug where the properties of the constants
   do not propagate.

2) GCC really thinks the divide is cheaper (code density vs.
   cycle count tradeoffs etc.)

Anyways, we should probably apply your patch in any event.

Michael, any objections?
-
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] tg3 : avoid an expensive divide

2007-02-06 Thread Michael Chan
On Tue, 2007-02-06 at 21:53 +0100, Eric Dumazet wrote:

 Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
 plain text document attachment (tg3_avoid_divide.patch)
 --- linux-2.6.20/drivers/net/tg3.c.orig   2007-02-06 22:30:39.0 
 +0100
 +++ linux-2.6.20-ed/drivers/net/tg3.c 2007-02-06 22:32:42.0 +0100
 @@ -3384,7 +3384,7 @@
   }
  next_pkt_nopost:
   sw_idx++;
 - sw_idx %= TG3_RX_RCB_RING_SIZE(tp);
 + sw_idx = (TG3_RX_RCB_RING_SIZE(tp) - 1);
  
   /* Refresh hw_idx to see if there is new work */
   if (sw_idx == hw_idx) {

There are other places doing similar divide (e.g. tg3_recycle_rx(),
tg3_alloc_rx_skb()).  I think we should change them all.

-
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 11/11] netfilter warning fix

2007-02-06 Thread David Miller
From: Ingo Molnar [EMAIL PROTECTED]
Date: Tue, 6 Feb 2007 22:02:51 +0100

 So i'm wondering what other assumptions there are (or can be) 
 about rcu_read_lock() also being a preempt-off point. Thanks!

I showed the examples in my detailed analysis yesterday.

Beause I love hearing myself say the same thing over and over so much
I'll restate it for you.

net/netfilter/nf_conntrack_core.c, calls:

l4proto = __nf_ct_l4proto_find((u_int16_t)pf, protonum);

whichs assumes that preemption is disabled.
-
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] tg3 : avoid an expensive divide

2007-02-06 Thread Michael Chan
On Tue, 2007-02-06 at 13:19 -0800, David Miller wrote:

 
 Because I've seen gcc optimize this properly before (at least on
 sparc64), it means that either:
 
 1) There is a GCC bug where the properties of the constants
do not propagate.
 
 2) GCC really thinks the divide is cheaper (code density vs.
cycle count tradeoffs etc.)
 
 Anyways, we should probably apply your patch in any event.
 
 Michael, any objections?
 
No objections.  I will create another patch to convert similar divisions
in other spots.

-
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] tg3 : avoid an expensive divide

2007-02-06 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Tue, 06 Feb 2007 14:05:41 -0800

 On Tue, 2007-02-06 at 21:53 +0100, Eric Dumazet wrote:
 
  Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
  plain text document attachment (tg3_avoid_divide.patch)
  --- linux-2.6.20/drivers/net/tg3.c.orig 2007-02-06 22:30:39.0 
  +0100
  +++ linux-2.6.20-ed/drivers/net/tg3.c   2007-02-06 22:32:42.0 
  +0100
  @@ -3384,7 +3384,7 @@
  }
   next_pkt_nopost:
  sw_idx++;
  -   sw_idx %= TG3_RX_RCB_RING_SIZE(tp);
  +   sw_idx = (TG3_RX_RCB_RING_SIZE(tp) - 1);
   
  /* Refresh hw_idx to see if there is new work */
  if (sw_idx == hw_idx) {
 
 There are other places doing similar divide (e.g. tg3_recycle_rx(),
 tg3_alloc_rx_skb()).  I think we should change them all.

Ok, I'll take care of this.
-
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] tg3 : avoid an expensive divide

2007-02-06 Thread David Miller
From: Michael Chan [EMAIL PROTECTED]
Date: Tue, 06 Feb 2007 14:09:16 -0800

 No objections.  I will create another patch to convert similar divisions
 in other spots.

I actually checked and those cases work on true constants so do not
generate the divide instructions.
-
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: [Ipw2100-devel] [RFC] Runtime power management on ipw2100

2007-02-06 Thread Matthew Garrett
On Thu, Feb 01, 2007 at 09:47:05AM +0800, Zhu Yi wrote:
 On Wed, 2007-01-31 at 07:52 +, Matthew Garrett wrote:

 From my understanding, the intention of this patch is to defer the
 device self-initialization work (including firmware loading) from netdev
 initialization time to netdev open time (ifconfig up) and de-initialize
 the device when it is not being used (ifconfig down). This saves power
 during the time the driver is loaded but the interface is not open.

That's correct.

 You should remove ipw2100_up() from ipw2100_net_init() which is
 netdev-init() since it will be called in -open() in your patch. I'd
 also suggest you to request_irq()/free_irq() in the netdev -open() and
 -close() in case the device shares IRQ with other devices, the
 interrupt handler should not be invoked anyway.

I've removed net_init() entirely, since all it did was call 
ipw2100_up(). I'm reluctant to drop the IRQ because PCMCIA seems to have 
a nasty habit of grabbing free looking IRQs and setting them to be edge 
triggered, which would obviously be bad.

How's this patch?

Signed-off-by: Matthew Garrett [EMAIL PROTECTED]

diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index 24ef52a..679946e 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -1809,13 +1809,6 @@ static int ipw2100_up(struct ipw2100_priv *priv, int 
deferred)
return rc;
 }
 
-/* Called by register_netdev() */
-static int ipw2100_net_init(struct net_device *dev)
-{
-   struct ipw2100_priv *priv = ieee80211_priv(dev);
-   return ipw2100_up(priv, 1);
-}
-
 static void ipw2100_down(struct ipw2100_priv *priv)
 {
unsigned long flags;
@@ -5771,8 +5764,38 @@ static int ipw2100_open(struct net_device *dev)
 {
struct ipw2100_priv *priv = ieee80211_priv(dev);
unsigned long flags;
+   int err, val;
IPW_DEBUG_INFO(dev-open\n);
 
+   mutex_lock(priv-action_mutex);
+
+   pci_set_power_state(priv-pci_dev, PCI_D0);
+   err = pci_enable_device (priv-pci_dev);
+
+   if (err) {
+   printk(KERN_WARNING DRV_NAME
+  Error calling pci_enable_device.\n);
+   mutex_unlock(priv-action_mutex);
+   return err;
+}
+
+   pci_restore_state(priv-pci_dev);
+
+   pci_read_config_dword(priv-pci_dev, 0x40, val);
+   if ((val  0xff00) != 0)
+   pci_write_config_dword(priv-pci_dev, 0x40, val  0x00ff);
+
+   err = ipw2100_up(priv, 0);
+
+   if (err) {
+   printk(KERN_WARNING DRV_NAME
+   Error bringing card up.\n);
+   pci_disable_device(priv-pci_dev);
+   pci_set_power_state(priv-pci_dev, PCI_D3hot);  
+   mutex_unlock(priv-action_mutex);
+   return err;
+} 
+
spin_lock_irqsave(priv-low_lock, flags);
if (priv-status  STATUS_ASSOCIATED) {
netif_carrier_on(dev);
@@ -5780,6 +5803,8 @@ static int ipw2100_open(struct net_device *dev)
}
spin_unlock_irqrestore(priv-low_lock, flags);
 
+   mutex_unlock(priv-action_mutex);
+
return 0;
 }
 
@@ -5814,6 +5839,19 @@ static int ipw2100_close(struct net_device *dev)
}
spin_unlock_irqrestore(priv-low_lock, flags);
 
+   ipw2100_down(priv);
+
+#ifdef ACPI_CSTATE_LIMIT_DEFINED
+   if (priv-config  CFG_C3_DISABLED) {
+   IPW_DEBUG_INFO(: Resetting C3 transitions.\n);
+   acpi_set_cstate_limit(priv-cstate_limit);
+   priv-config = ~CFG_C3_DISABLED;
+   }
+#endif
+
+   pci_disable_device(priv-pci_dev);
+   pci_set_power_state(priv-pci_dev, PCI_D3hot);
+
IPW_DEBUG_INFO(exit\n);
 
return 0;
@@ -6021,7 +6059,6 @@ static struct net_device *ipw2100_alloc_device(struct 
pci_dev *pci_dev,
 
dev-open = ipw2100_open;
dev-stop = ipw2100_close;
-   dev-init = ipw2100_net_init;
dev-ethtool_ops = ipw2100_ethtool_ops;
dev-tx_timeout = ipw2100_tx_timeout;
dev-wireless_handlers = ipw2100_wx_handler_def;
@@ -6208,6 +6245,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
pci_write_config_dword(pci_dev, 0x40, val  0x00ff);
 
pci_set_power_state(pci_dev, PCI_D0);
+   pci_save_state(pci_dev);
 
if (!ipw2100_hw_is_adapter_in_system(dev)) {
printk(KERN_WARNING DRV_NAME
@@ -6274,23 +6312,9 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
if (err)
goto fail_unlock;
 
-   /* If the RF Kill switch is disabled, go ahead and complete the
-* startup sequence */
-   if (!(priv-status  STATUS_RF_KILL_MASK)) {
-   /* Enable the adapter - sends HOST_COMPLETE */
-   if (ipw2100_enable_adapter(priv)) {
-   printk(KERN_WARNING DRV_NAME
-  : %s: failed in call to enable adapter.\n,
-

Re: [PATCH] tg3 : avoid an expensive divide

2007-02-06 Thread Eric Dumazet

Michael Chan a écrit :

On Tue, 2007-02-06 at 21:53 +0100, Eric Dumazet wrote:


Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
plain text document attachment (tg3_avoid_divide.patch)
--- linux-2.6.20/drivers/net/tg3.c.orig 2007-02-06 22:30:39.0 +0100
+++ linux-2.6.20-ed/drivers/net/tg3.c   2007-02-06 22:32:42.0 +0100
@@ -3384,7 +3384,7 @@
}
 next_pkt_nopost:
sw_idx++;
-   sw_idx %= TG3_RX_RCB_RING_SIZE(tp);
+   sw_idx = (TG3_RX_RCB_RING_SIZE(tp) - 1);
 
 		/* Refresh hw_idx to see if there is new work */

if (sw_idx == hw_idx) {


There are other places doing similar divide (e.g. tg3_recycle_rx(),
tg3_alloc_rx_skb()).  I think we should change them all.


Well, I checked whole tg3.o with objdump --disassemble and there are only 
three points using a div : tg3_nvram_phys_addr()/tg3_set_eeprom() 

tg3_open(), wich are seldom used :)

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: [Lksctp-developers] Fw: Intermittent SCTP multihoming breakage

2007-02-06 Thread Vlad Yasevich
Steve Hill wrote:
 Vlad Yasevich wrote on 05 February 2007 20:35:
 
 would you mind terribly, changing the -d $net to the
 -i $net, and run the script with the interface name instead?
 
 I seem to get the same failure when dropping traffic based on interface
 as I do when dropping based on address.

Hmm... can you try with a more recent sender please.  Running 2.6.19 or
2.6.20 with my patch, I don't see this problem when a single interface fails.

I see a full path failover withing the 5 second timeout of the table rule.
Once failover happens, the traffic is using the second interface.

I haven't tried forcing the failover back to the first one, but I can
try flip-flopping them and see what happens.

 
 When I block at the ip address, I see the path failover
 in an odd state.  It looks like it happened, but the flow is
 not resumed.  Receive still doesn't get traffic. I think I might
 
 This sounds like it might be the same problem I'm seeing.
 
 My sender is running the 2.6.16.1 kernel with your patch applied, the
 receiver is running Fedora Core 6's 2.6.18-1.2798.fc6 kernel.  The
 iptables rules are being set on the receiver (so there should be no odd
 interactions between the sender's SCTP stack and iptables - as far as
 the sender knows the packets have been transmitted and lost in transit).

Yes, that's what I am doing as well.  I'll see if I can run a more recent
receiver.

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 5/7] sky2: Yukon Extreme support

2007-02-06 Thread Francois Romieu
Stephen Hemminger [EMAIL PROTECTED] :
[...]
 @@ -289,8 +289,10 @@
   struct sky2_port *sky2 = netdev_priv(hw-dev[port]);
   u16 ctrl, ct1000, adv, pg, ledctrl, ledover, reg;
  
 - if (sky2-autoneg == AUTONEG_ENABLE 
 - !(hw-chip_id == CHIP_ID_YUKON_XL || hw-chip_id == 
 CHIP_ID_YUKON_EC_U)) {
 + if (sky2-autoneg == AUTONEG_ENABLE
 +  !(hw-chip_id == CHIP_ID_YUKON_XL
 +  || hw-chip_id == CHIP_ID_YUKON_EC_U
 +  || hw-chip_id == CHIP_ID_YUKON_EX)) {
[...]
 + if (sky2-autoneg == AUTONEG_ENABLE
 +  (hw-chip_id == CHIP_ID_YUKON_XL
 + || hw-chip_id == CHIP_ID_YUKON_EC_U
 + || hw-chip_id == CHIP_ID_YUKON_EX)) {
[...]
 + if (hw-chip_id == CHIP_ID_YUKON_XL
 + || hw-chip_id == CHIP_ID_YUKON_EC_U
 + || hw-chip_id == CHIP_ID_YUKON_EX) {
[...]
 + if (hw-chip_id == CHIP_ID_YUKON_XL
 + || hw-chip_id == CHIP_ID_YUKON_EC_U
 + || hw-chip_id == CHIP_ID_YUKON_EX)

Any objection against the use of :

static bool is_yukon_extreme(struct sky2_hw *hw)
{
return hw-chip_id == CHIP_ID_YUKON_XL ||
hw-chip_id == CHIP_ID_YUKON_EC_U ||
hw-chip_id == CHIP_ID_YUKON_EX;
}

?

-- 
Ueimor
-
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


Fw: [Bugme-new] [Bug 7952] New: slattach only works every other time

2007-02-06 Thread Andrew Morton


Begin forwarded message:

Date: Tue, 6 Feb 2007 13:01:55 -0800
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [Bugme-new] [Bug 7952] New: slattach only works every other time


http://bugzilla.kernel.org/show_bug.cgi?id=7952

   Summary: slattach only works every other time
Kernel Version: 2.6.18
Status: NEW
  Severity: normal
 Owner: [EMAIL PROTECTED]
 Submitter: [EMAIL PROTECTED]


Most recent kernel where this bug did *NOT* occur:2.6.16
Distribution:Debian Etch
Hardware Environment: x86 with serial port (including qemu)
Software Environment: slattach
Problem Description:

First time slattach is run to set up a SLIP line all is ok.
If slattach process is then killed and restarted it fails with message:
SLIP_set_disc(1): File exists
Problem still occurs in 2.6.20rc6 kernel

dmesg shows:
object_add failed for sl0 with -EEXIST, don't try to register things 
with the same name in the same directory.
 [c01b7b54] kobject_add+0x147/0x16d
 [c0211209] class_device_add+0x9d/0x3b3
 [c022829d] register_netdevice+0x21a/0x2d0
 [c8903213] slip_open+0x3a1/0x4e2 [slip]
 [c01fc709] tty_ioctl+0x922/0xbac
 [c0117778] default_wake_function+0x0/0xc
 [c01fd4bd] n_tty_open+0x0/0x88
 [c01fd498] n_tty_close+0x0/0x25
 [c01fd3ae] n_tty_flush_buffer+0x0/0x3b
 [c01fd2ab] n_tty_chars_in_buffer+0x0/0x5b
 [c01fe5eb] read_chan+0x0/0x551
 [c01fd545] write_chan+0x0/0x294
 [c01fef41] n_tty_ioctl+0x0/0x40d
 [c01fd082] n_tty_set_termios+0x0/0x1cc
 [c01fe4d2] normal_poll+0x0/0x119
 [c01fd7d9] n_tty_receive_buf+0x0/0xcf9
 [c01fd24e] n_tty_write_wakeup+0x0/0x27
 [c88b2474] parport_pc_interrupt+0x1a/0x42 [parport_pc]
 [c013fb83] handle_IRQ_event+0x23/0x49
 [c013fc5c] __do_IRQ+0xb3/0xe8
 [c013fc80] __do_IRQ+0xd7/0xe8
 [c0130170] hrtimer_run_queues+0xcf/0x157
 [c016937b] do_ioctl+0x47/0x5d
 [c01695db] vfs_ioctl+0x24a/0x25c
 [c0121c58] tasklet_action+0x55/0xaf
 [c0169635] sys_ioctl+0x48/0x5f
 [c0102c11] sysenter_past_esp+0x56/0x79


Steps to reproduce:
(requires a serial port but nothing needs to be attached to it):
# slattach -L -vd -p slip -s 115200 /dev/ttyS0
slattach: tty_open: looking for lock
slattach: tty_open: trying to open /dev/ttyS0
slattach: tty_open: /dev/ttyS0 (fd=3) slattach: tty_set_speed: 115200
slattach: tty_set_databits: 8
slattach: tty_set_stopbits: 1
slattach: tty_set_parity: N
slip started on /dev/ttyS0 interface sl0

Above is OK, now kill process with CTRL-C

slattach: tty_set_speed: 0
# slattach -L -vd -p slip -s 115200 /dev/ttyS0
slattach: tty_open: looking for lock
slattach: tty_open: trying to open /dev/ttyS0
slattach: tty_open: /dev/ttyS0 (fd=3) slattach: tty_set_speed: 115200
slattach: tty_set_databits: 8
slattach: tty_set_stopbits: 1
slattach: tty_set_parity: N
SLIP_set_disc(1): File exists

# dmesg
Gives trace shown above

I believe this is called by this changeset :
http://www2.kernel.org/git/?p=linux/kernel/git/stable/linux-2.6.17.y.git;a=commit;h=b17a7c179dd3ce7d04373fddf660eda21efc9db9

Regards,

Martin

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.
-
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 11/11] netfilter warning fix

2007-02-06 Thread Ingo Molnar

* David Miller [EMAIL PROTECTED] wrote:

 From: Ingo Molnar [EMAIL PROTECTED]
 Date: Tue, 6 Feb 2007 22:02:51 +0100
 
  So i'm wondering what other assumptions there are (or can be) about 
  rcu_read_lock() also being a preempt-off point. Thanks!
 
 I showed the examples in my detailed analysis yesterday.
 
 Beause I love hearing myself say the same thing over and over so much 
 I'll restate it for you.
 
 net/netfilter/nf_conntrack_core.c, calls:
 
   l4proto = __nf_ct_l4proto_find((u_int16_t)pf, protonum);
 
 whichs assumes that preemption is disabled.

you are right - i mistakenly read that mail only up to the point where 
you point out the (slightly) buggy NF_CT_STATIC_INC use and missed your 
final point about other coding having implicit preempt_disable() 
assumptions.

I've looked at __nf_ct_l4proto_find() and it's not obvious to me what 
the hidden preempt_disable() assumption is. Its main use seems to be of 
nf_ct_protos[] array, which is protected by nf_conntrack_lock. I'm 
wondering whether what you say suggests that it's safe to call 
__nf_ct_l4proto_find() without the nf_conntrack_lock locked (as read or 
as write), and if it's safe, how it protects against simultaneous 
modifications to the nf_ct_protos[] array. 

Ahh ... unregister does a synchronize_net(), right? That means that 
removal of the pointer only happens if all CPUs have gone through a 
quiescent state.

this means that this particular use could be fixed by converting the 
preempt_disable()/enable() pair in nf_ct_l4proto_find_get() to 
rcu_read_lock()/unlock(), correct? Furthermore, every user of 
synchronize_net() [and synchronize_rcu() in general] needs to be 
reviewed.

Ingo
-
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/7] sky2: Yukon Extreme support

2007-02-06 Thread Stephen Hemminger

 static bool is_yukon_extreme(struct sky2_hw *hw)
 {
   return hw-chip_id == CHIP_ID_YUKON_XL ||
   hw-chip_id == CHIP_ID_YUKON_EC_U ||
   hw-chip_id == CHIP_ID_YUKON_EX;

These chips aren't extreme, it might be easier to turn the
test around and test for the chips that aren't that way.
-
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 05/11] bonding: Replace kmalloc() + memset() pairs with the appropriate kzalloc() calls

2007-02-06 Thread David Miller
From: [EMAIL PROTECTED]
Date: Mon, 05 Feb 2007 16:31:04 -0800

 From: Joe Jin [EMAIL PROTECTED]
 
 Replace kmalloc() + memset() pairs with the appropriate kzalloc() calls in
 the bonding driver.
 
 Signed-off-by: Joe Jin [EMAIL PROTECTED]
 Signed-off-by: Andrew Morton [EMAIL PROTECTED]

Jeff asked me to take this so I have, 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] tg3 : avoid an expensive divide

2007-02-06 Thread David Miller

Eric, I've applied your patch as-is to net-2.6.21, 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: [RFC][PATCH][IPSEC][0/3]inter address family ipsec tunnel

2007-02-06 Thread David Miller
From: Kazunori MIYAZAWA [EMAIL PROTECTED]
Date: Fri, 29 Dec 2006 14:47:02 +0900

 I fixed the compile issue when we configure IPv6 as a module.
 
 [1/3] exporting xfrm_state_afinfo
 [2/3] supporting IPv6 over IPv4 IPsec
 [3/3] supporting IPv4 over IPv6 IPsec
 
 These patches can be applied to linux-2.6.20-rc2.

Thank you.  This is not a bad solution to the symbol
export problem, for now.

I noticed that there is no need for the module symbol
export of xfrm6_output() you added, because xfrm6_output.o
and xfrm6_state.o always get linked together.

So I will remove that:

+EXPORT_SYMBOL(xfrm6_output);

part of the first patch.

We see so many issues with ipv6 symbols dependencies in various
subsystems (netfilter, xfrm, etc.).  It is a sign that we need
some kind of long range plan to deal with this problem.  Since
the ipv6 module can't be unloaded anyways, and it's been broken
like that forever, it might make sense to make ipv6 only available
non-modular.  I know people would dislike this, but the current
situation isn't good either.

Thanks again.

-
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: Implement RFC 4429 Optimistic Duplicate Address Detection

2007-02-06 Thread Vlad Yasevich
Hi Neil

a few comments.  sorry, just can't resist... :)


 @@ -2627,6 +2673,9 @@ static void addrconf_dad_completed(struct inet6_ifaddr 
 *ifp)
*  Configure the address for reception. Now it is valid.
*/
  
 + if (ifp-flags  IFA_F_OPTIMISTIC)
 + addrconf_leave_anycast(ifp);
 +
   ipv6_ifa_notify(RTM_NEWADDR, ifp);

Since we are no longer doing anycast, remove the above.

 diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
 index 7b7bd44..b8a5261 100644
 --- a/net/ipv6/ip6_output.c
 +++ b/net/ipv6/ip6_output.c
 @@ -857,6 +857,34 @@ static int ip6_dst_lookup_tail(struct sock *sk,
  
   if (ipv6_addr_any(fl-fl6_src)) {
   err = ipv6_get_saddr(*dst, fl-fl6_dst, fl-fl6_src);
 +#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
 + /*
 +  * Here if the dst entry we've looked up 
 +  * has a neighbour entry that is in the INCOMPLETE
 +  * state and the src address from the flow is 
 +  * marked as OPTIMISTIC, we release the found 
 +  * dst entry and replace it instead with the 
 +  * dst entry of the nexthop router
 +  */
 + if (!((*dst)-neighbour-nud_state  NUD_VALID)) {
 + struct inet6_ifaddr *ifp;
 + struct flowi fl_gw;
 + ifp = ipv6_get_ifaddr(fl-fl6_src, (*dst)-dev, 1);
 +
 + if (ifp  ifp-flags  IFA_F_OPTIMISTIC) {
 + /*
 +  * We need to get the dst entry for the 
 +  * default router instead
 +  */
 + dst_release(*dst);
 + memcpy(fl_gw, fl, sizeof(struct flowi));
 + memset(fl_gw.fl6_dst, 0, sizeof(struct 
 in6_addr));
 + *dst = ip6_route_output(sk, fl_gw);
 + if ((err = (*dst)-error))
 + goto out_err_release;   
 
 + }
 + }
 +#endif
   if (err)
   goto out_err_release;

This actually doesn't look right  What if ipv6_get_saddr returned an error?
I think the new code should go after the 'goto out_err_release;'...
That way, we do optimistic checks if we have a valid source address.

   }
 diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
 index 882cde4..9c5273c 100644
 --- a/net/ipv6/mcast.c
 +++ b/net/ipv6/mcast.c
 @@ -1411,7 +1411,7 @@ static struct sk_buff *mld_newpack(struct net_device 
 *dev, int size)
  
   skb_reserve(skb, LL_RESERVED_SPACE(dev));
  
 - if (ipv6_get_lladdr(dev, addr_buf)) {
 + if (ipv6_get_lladdr(dev, addr_buf, IFA_F_TENTATIVE)) {
   /* draft-ietf-magma-mld-source-05.txt:
* use unspecified address as the source address 
* when a valid link-local address is not available.
 @@ -1789,7 +1789,7 @@ static void igmp6_send(struct in6_addr *addr, struct 
 net_device *dev, int type)
  
   skb_reserve(skb, LL_RESERVED_SPACE(dev));
  
 - if (ipv6_get_lladdr(dev, addr_buf)) {
 + if (ipv6_get_lladdr(dev, addr_buf, IFA_F_TENTATIVE)) {
   /* draft-ietf-magma-mld-source-05.txt:
* use unspecified address as the source address 
* when a valid link-local address is not available.
 diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
 index 39bb658..7400805 100644
 --- a/net/ipv6/ndisc.c
 +++ b/net/ipv6/ndisc.c
 @@ -447,6 +447,8 @@ static void ndisc_send_na(struct net_device *dev, struct 
 neighbour *neigh,
   ifp = ipv6_get_ifaddr(solicited_addr, dev, 1);
   if (ifp) {
   src_addr = solicited_addr;
 + if (ifp-flags  IFA_F_OPTIMISTIC)
 + override = 0;
   in6_ifa_put(ifp);
   } else {
   if (ipv6_dev_get_saddr(dev, daddr, tmpaddr))
 @@ -500,6 +502,7 @@ static void ndisc_send_na(struct net_device *dev, struct 
 neighbour *neigh,
  msg-icmph.icmp6_solicited = solicited;
  msg-icmph.icmp6_override  = override;
  
 +

Empty line...

  /* Set the target address. */
   ipv6_addr_copy(msg-target, solicited_addr);
  
 @@ -542,7 +545,8 @@ void ndisc_send_ns(struct net_device *dev, struct 
 neighbour *neigh,
   int send_llinfo;
  
   if (saddr == NULL) {
 - if (ipv6_get_lladdr(dev, addr_buf))
 + if (ipv6_get_lladdr(dev, addr_buf, 
 +(IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)))
   return;
   saddr = addr_buf;
   }
 @@ -559,7 +563,7 @@ void ndisc_send_ns(struct net_device *dev, struct 
 neighbour *neigh,
   return;
  
   len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr);
 - send_llinfo = dev-addr_len  !ipv6_addr_any(saddr);
 + send_llinfo = dev-addr_len  !ipv6_addr_any(saddr); 


Re: [PATCH] igmp: check add_grhead() return value

2007-02-06 Thread David Miller
From: Alexey Dobriyan [EMAIL PROTECTED]
Date: Mon, 5 Feb 2007 18:04:33 +0300

 OK, now that we aren't seeing crashes which can be attributed to these
 NULL dereferences any longer.
 --
 add_grhead() allocates memory with GFP_ATOMIC and in at least two places skb
 from it passed to skb_put() without checking.
 
 Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]

Thanks for the patch and for testing Alexey.

Applied, and I'll push this to -stable too.

Thanks again.
-
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 0/7] [S390]: Introduction of AF_IUCV sockets support

2007-02-06 Thread David Miller
From: Frank Pavlic [EMAIL PROTECTED]
Date: Fri, 2 Feb 2007 13:05:28 +0100

 The patch set consists of following patches:
 
 [1/7] [S390]: Rewrite of the IUCV base code, part 1
 [2/7] [S390]: Rewrite of the IUCV base code, part 2
 [3/7] [S390]: Adapt monreader driver to new IUCV API
 [4/7] [S390]: Adapt vmlogrdr driver to new IUCV API
 [5/7] [S390]: Adapt netiucv driver to new IUCV API
 [6/7] [S390]: Adapt special message interface to new IUCV API
 [7/7] [S390]: Add AF_IUCV socket support

I have no fundamental objections to this, although I think
I'll end up needing something similar on Niagara at some
point :-)

The list ate the first patch due to it's size.  Could you
email me a copy privately so can integrate all of your work
into my net-2.6.21 tree?

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


depending on IPv6 symbols (was: [RFC][PATCH][IPSEC][0/3]inter address family ipsec tunnel)

2007-02-06 Thread Roland Dreier
David We see so many issues with ipv6 symbols dependencies in
David various subsystems (netfilter, xfrm, etc.).  It is a sign
David that we need some kind of long range plan to deal with this
David problem.  Since the ipv6 module can't be unloaded anyways,
David and it's been broken like that forever, it might make sense
David to make ipv6 only available non-modular.  I know people
David would dislike this, but the current situation isn't good
David either.

Yes, coincidentally I just ran into this problem.  In the context of
reviewing a patch (IPoIB connected mode, which has to deal with
getting too-big packets for a given path) that basically wants to do

#ifdef CONFIG_IPV6
if (...)
icmpv6_send(...TOOBIG...)
#endif

I noticed that this exact problem already appears in
net/ipv4/ip_gre.c, which has exactly the same type of code:

#ifdef CONFIG_IPV6
else if (skb-protocol == htons(ETH_P_IPV6)) {
struct rt6_info *rt6 = (struct rt6_info*)skb-dst;

if (rt6  mtu  dst_mtu(skb-dst)  mtu = IPV6_MIN_MTU) {
if ((tunnel-parms.iph.daddr  
!MULTICAST(tunnel-parms.iph.daddr)) ||
rt6-rt6i_dst.plen == 128) {
rt6-rt6i_flags |= RTF_MODIFIED;
skb-dst-metrics[RTAX_MTU-1] = mtu;
}
}

if (mtu = IPV6_MIN_MTU  mtu  skb-len - tunnel-hlen + 
gre_hlen) {
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, dev);
ip_rt_put(rt);
goto tx_error;
}
}
#endif

now obviously this means that if ipv6 is built modular, then the
correct handling for too-big packets will never be used.  But on the
other hand, if we convert the test to

#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)

then building with CONFIG_NET_IPGRE=y and CONFIG_IPV6=m will break,
because icmpv6_send() is no longer built in.  And obviously making
NET_IPGRE depend on IPV6 doesn't make sense.

So I hope we can come up with a short-range plan to deal with the
possibility of built-in code calling icmpv6_send() at least...  As you
said, should we just convert IPV6 to a bool instead of a tristate?

Thanks,
  Roland
-
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] Marvell Libertas 8388 802.11b/g USB driver (v2)

2007-02-06 Thread Marcelo Tosatti
On Sat, Feb 03, 2007 at 08:43:49PM -0200, Marcelo Tosatti wrote:
 Hi Arnd,

  Most of these are unused as well, I guess it would be good
  to go through the whole list and see what can be removed.
 
 Done. Will go through the entire file list before posting the next
 patch.

Done.

  Did you run the file through a recent sparse successfully?
 
 Spits a bunch of warnings, looking at them.

Fixed sparse warnings.

  The printk and dprintk statements should probably be converted
  to dev_info/dev_dbg/... standard macros, or something derived
  from that.

Done.

  
   +void if_usb_free(struct usb_card_rec *cardp)
   +{
   + ENTER();
  
  Do you find the ENTER() and LEAVE() macros really useful?
  usually, you're better off taking them out...
 
 Yes, for instance the bug reported at http://dev.laptop.org/ticket/841
 could be verified by checking the log file (by confirming that certain
 states were true/false).
 
 However, only a few such macros, on key functions, are required. I'll go
 over and remove the unneeded ones.

Removed a bunch of ENTER/LEAVE macro calls.

-
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: depending on IPv6 symbols

2007-02-06 Thread Roland Dreier
  config FOO
   depends on (IPV6 || IPV6=n)

OK, I'll add the same hack for INFINIBAND_IPOIB too.  I doubt there's
anyone that really cares about IPoIB built-in with modular IPv6.

Would you like a patch to do the same thing for INET_IPGRE (and fix
the #ifdefs in ip_gre.c)?

 - R.
-
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: depending on IPv6 symbols

2007-02-06 Thread David Miller
From: Roland Dreier [EMAIL PROTECTED]
Date: Tue, 06 Feb 2007 14:53:58 -0800

 Would you like a patch to do the same thing for INET_IPGRE (and fix
 the #ifdefs in ip_gre.c)?

Sure, although I'm surprised nobody noticed that build failure
before :-)
-
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: Please pull upstream-fixes branch of wireless-2.6

2007-02-06 Thread Jeff Garzik

Would you mind rebasing  resending, kind sir?

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: depending on IPv6 symbols

2007-02-06 Thread Roland Dreier
David Sure, although I'm surprised nobody noticed that build
David failure before :-)

OK, coming up.  (It's not a build failure though, it's wrong code: if
CONFIG_IPV6=m then the code inside #ifdef CONFIG_IPV6 in ip_gre.c
just doesn't get built, even though it should)

 - R.
-
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/4] skge: handle zero address at open

2007-02-06 Thread Jeff Garzik

Stephen Hemminger wrote:
Some motherboards are broken and have no address set. Failing at probe time 
prevents the device from ever being used (like to download a fixed BIOS). Instead

warn on probe and check again when device is brought up. That way the address
can be set.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]


applied 1-4


-
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/3] NetXen: Fixes for ppc architecture.

2007-02-06 Thread Jeff Garzik

Amit S. Kale wrote:

NetXen: Fixes for ppc architecture.

Signed-off-by: Amit S. Kale [EMAIL PROTECTED]


applied 2-3.  patch #1 failed to apply.


-
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 09/11] Remove unused kernel config option DLCI_COUNT

2007-02-06 Thread Jeff Garzik

[EMAIL PROTECTED] wrote:

From: Robert P. J. Day [EMAIL PROTECTED]

Remove the unused kernel config option DLCI_COUNT.

Signed-off-by: Robert P. J. Day [EMAIL PROTECTED]
Cc: David S. Miller [EMAIL PROTECTED]
Cc: Jeff Garzik [EMAIL PROTECTED]
Cc: Krzysztof Halasa [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/net/wan/Kconfig |   11 ---
 1 file changed, 11 deletions(-)


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] Marvell Libertas 8388 802.11b/g USB driver

2007-02-06 Thread David Young
On Mon, Dec 18, 2006 at 05:57:23PM -0200, Marcelo Tosatti wrote:
 
/* Channel flags. */
   Did you send this part to netbsd also? We really don't want to fork 
   radiotap. ;) Also, this should be in a separate patch, but I'm guessing 
   it's 
   all rolled together for convenience.
  
  No, especially since NetBSD is where I keep the authoritative definitions.
  
  How have you defined RX_FLAGS and TX_FLAGS?
 
 Oh yes, missed that part of the patch. Sorry.

Sorry for the delayed response, it's been a busy couple of months.

There is now a mailing list for discussing radiotap.  Subscribe at
http://mail.ojctech.com/mailman/listinfo/radiotap.  I ask that you
send proposals for new fields to the mailing list for discussion.  I am
interested to see proposals for 802.11n.  A couple of people have already
promised me proposals, but they never sent them.

A couple words about the fields you mention:

 --- a/include/net/ieee80211_radiotap.h
 +++ b/include/net/ieee80211_radiotap.h
 @@ -168,6 +168,23 @@ struct ieee80211_radiotap_header {
   *  Unitless indication of the Rx/Tx antenna for this packet.
   *  The first antenna is antenna 0.
   *
 + * IEEE80211_RADIOTAP_RX_FLAGS  u_int16_t   bitmap
 + *
 + * Properties of received frames. See flags defined below.
 + *
 + * IEEE80211_RADIOTAP_TX_FLAGS  u_int16_t   bitmap
 + *
 + * Properties of transmitted frames. See flags defined below.
 + *
 + * IEEE80211_RADIOTAP_RTS_RETRIES   u_int8_tdata
 + *
 + * Number of rts retries a transmitted frame used.
 + *
 + * IEEE80211_RADIOTAP_DATA_RETRIES  u_int8_tdata
 + *
 + * Number of unicast retries a transmitted frame used.
 + *
 + *
   * IEEE80211_RADIOTAP_FCSu32   data
   *
   *   FCS from frame in network byte order.
 @@ -187,7 +204,11 @@ enum ieee80211_radiotap_type {
   IEEE80211_RADIOTAP_ANTENNA = 11,
   IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
   IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
 - IEEE80211_RADIOTAP_EXT = 31,
 + IEEE80211_RADIOTAP_RX_FLAGS = 14,
 + IEEE80211_RADIOTAP_TX_FLAGS = 15,
 + IEEE80211_RADIOTAP_RTS_RETRIES = 16,
 + IEEE80211_RADIOTAP_DATA_RETRIES = 17,
 + IEEE80211_RADIOTAP_EXT = 31
  };

I remember discussing these fields, but they were for somebody's
experimental use.  All of the fields are acceptable to me, but this flag
is questionable; it duplicates the function of another flag:

 +#define IEEE80211_RADIOTAP_F_RX_BADFCS   0x0001  /* frame failed crc 
 check */

If it is important to people that I add this flag, let's discuss on the
mailing list.

Dave

-- 
David Young OJC Technologies
[EMAIL PROTECTED]  Urbana, IL * (217) 278-3933
-
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/4] ucc_geth: Change private immrbar_virt_to_phys to generic iopa

2007-02-06 Thread Jeff Garzik

Li Yang wrote:

Get rid of private immrbar_virt_to_phys() routine and
use generic iopa().

Signed-off-by: Li Yang [EMAIL PROTECTED]
---
drivers/net/ucc_geth.c |   29 ++---
1 files changed, 6 insertions(+), 23 deletions(-)


I'll await resend pending resolution of comments


-
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/7] sky2: add Wake On Lan support

2007-02-06 Thread Jeff Garzik

Stephen Hemminger wrote:

Adds basic magic packet wake on lan support to the sky2 driver.
Note: initial WOL value is based on BIOS settings.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
---
 drivers/net/sky2.c |  208 ++---
 drivers/net/sky2.h |   28 ++-
 2 files changed, 189 insertions(+), 47 deletions(-)


applied 1-7


-
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.6.20] ixgb: Use ARRAY_SIZE macro when appropriate

2007-02-06 Thread Auke Kok

Ahmed S. Darwish wrote:

On Mon, Feb 05, 2007 at 12:31:26PM -0800, Auke Kok wrote:

Alexey Dobriyan wrote:

On Mon, Feb 05, 2007 at 06:59:33PM +0200, Ahmed S. Darwish wrote:

A patch to use ARRAY_SIZE macro already defined in kernel.h.

Remove it and use ARRAY_SIZE instead.


--- a/drivers/net/ixgb/ixgb_param.c
+++ b/drivers/net/ixgb/ixgb_param.c
@@ -245,7 +245,7 @@ ixgb_validate_option(int *value, struct ixgb_option 
*opt)

return -1;
}

-#define LIST_LEN(l) (sizeof(l) / sizeof(l[0]))
+#define LIST_LEN(l) ARRAY_SIZE(l)

yes, well spotted. Please change line 338 in this file to read:

 .arg  = { .l = { .nr = ARRAY_SIZE(fc_list),

instead, so you can remove the LIST_LEN macro completely.
 
Thanks, Here's the new patch.


Use ARRAY_SIZE macro when appropriate.

Signed-off-by: Ahmed S. Darwish [EMAIL PROTECTED]


Acked-by: Auke Kok [EMAIL PROTECTED]

Cheers,

Auke


---
diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
index b27442a..c38ce73 100644
--- a/drivers/net/ixgb/ixgb_param.c
+++ b/drivers/net/ixgb/ixgb_param.c
@@ -245,8 +245,6 @@ ixgb_validate_option(int *value, struct ixgb_option *opt)
return -1;
 }
 
-#define LIST_LEN(l) (sizeof(l) / sizeof(l[0]))

-
 /**
  * ixgb_check_options - Range Checking for Command Line Parameters
  * @adapter: board private structure
@@ -335,7 +333,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
.name = Flow Control,
.err  = reading default settings from EEPROM,
.def  = ixgb_fc_tx_pause,
-   .arg  = { .l = { .nr = LIST_LEN(fc_list),
+   .arg  = { .l = { .nr = ARRAY_SIZE(fc_list),
 .p = fc_list }}
};



-
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: dynticks + iptables almost stops the boot process [was: Re: 2.6.20-rc6-mm3]

2007-02-06 Thread Ingo Molnar

Mattia,

* Mattia Dongili [EMAIL PROTECTED] wrote:

  I have it halfways reproducible now and I'm working to find the root 
  cause. Thanks for providing the info.
 
 Great, I'm obviously available to test any patch :)

Could you try the patch below? The RCU serialization code (a rare call 
but can be common in some types of setups) has a nasty implicit 
dependency on the HZ tick - which until now was a hidden wart but became 
an explicit bug under dynticks. Maybe this is what is slowing down your 
box.

Ingo

-
Subject: [patch] dynticks: make sure synchronize_rcu() completes
From: Ingo Molnar [EMAIL PROTECTED]

synchronize_rcu() has a nasty implicit dependency on the HZ tick: it 
relies on another CPU finishing all RCU work so that this CPU can finish 
its RCU work too - in IRQ context. But wait_for_completion() goes to 
sleep indefinitely on dynticks and there might be no other IRQs to this 
CPU for a long time.

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
---
 kernel/rcupdate.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux/kernel/rcupdate.c
===
--- linux.orig/kernel/rcupdate.c
+++ linux/kernel/rcupdate.c
@@ -85,8 +85,13 @@ void synchronize_rcu(void)
/* Will wake me after RCU finished */
call_rcu(rcu.head, wakeme_after_rcu);
 
-   /* Wait for it */
-   wait_for_completion(rcu.completion);
+   /*
+* Wait for it. Note: on dynticks RCU completion needs to be
+* polled frequently, to make sure we finish work. If this CPU
+* goes idle then another CPU cannot finish this CPU's work.
+*/
+   while (wait_for_completion_timeout(rcu.completion, HZ/100 ? : 1) == 0)
+   /* nothing */;
 }
 
 static void rcu_barrier_callback(struct rcu_head *notused)
-
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.6.20] e1000: Use ARRAY_SIZE macro when appropriate

2007-02-06 Thread Auke Kok

Ahmed S. Darwish wrote:

Hi,

A patch to use ARRAY_SIZE macro already defined in kernel.h.

Signed-off-by: Ahmed S. Darwish [EMAIL PROTECTED]


Acked-by: Auke Kok [EMAIL PROTECTED]

Cheers,

Auke


---
Patch is compile tested.

diff --git a/drivers/net/e1000/e1000_ethtool.c 
b/drivers/net/e1000/e1000_ethtool.c
index fb96c87..d21706e 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -746,7 +746,7 @@ err_setup:
uint32_t pat, value;   \
uint32_t test[] =  \
{0x5A5A5A5A, 0xA5A5A5A5, 0x, 0x};  \
-   for (pat = 0; pat  sizeof(test)/sizeof(test[0]); pat++) {  
\
+   for (pat = 0; pat  ARRAY_SIZE(test); pat++) {  \
E1000_WRITE_REG(adapter-hw, R, (test[pat]  W)); \
value = E1000_READ_REG(adapter-hw, R);   \
if (value != (test[pat]  W  M)) { 
\


-
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.6.20] ibm_emac: Use ARRAY_SIZE macro when appropriate

2007-02-06 Thread Ahmed S. Darwish
On Mon, Feb 05, 2007 at 11:22:06PM +0300, Alexey Dobriyan wrote:
 On Mon, Feb 05, 2007 at 06:59:16PM +0200, Ahmed S. Darwish wrote:
  A patch to use ARRAY_SIZE macro already defined in kernel.h.
 
 OK, but checks you're changing are strange. idx there is signed so
 
   BUG_ON(idx  0 || idx  ARRAY_SIZE());
 
 should be more appropriate.

It's just a janitor patch. I don't like to mess with code logic in such
kind of patches (to minimize errors and because I can't find time to
understand all affected files since they are scattered allover the tree).

Thanks,
-- 
Ahmed S. Darwish
http://darwish-07.blogspot.com
-
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: dynticks + iptables almost stops the boot process [was: Re: 2.6.20-rc6-mm3]

2007-02-06 Thread Mattia Dongili
On Tue, Feb 06, 2007 at 05:48:26PM +0100, Ingo Molnar wrote:
 
 Mattia,
 
 * Mattia Dongili [EMAIL PROTECTED] wrote:
 
   I have it halfways reproducible now and I'm working to find the root 
   cause. Thanks for providing the info.
  
  Great, I'm obviously available to test any patch :)
 
 Could you try the patch below? The RCU serialization code (a rare call 
 but can be common in some types of setups) has a nasty implicit 
 dependency on the HZ tick - which until now was a hidden wart but became 
 an explicit bug under dynticks. Maybe this is what is slowing down your 
 box.

No, not this. Anyway the last patch Thomas forwarded does fix the
problem.

By the way, I have all the patches I received stacked up, if you want me
to test some different combination, just ask.

Thanks
-- 
mattia
:wq!
-
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


[RFC: -mm patch] drivers/net/atl1/: possible cleanups

2007-02-06 Thread Adrian Bunk
On Mon, Jan 29, 2007 at 08:45:28PM -0800, Andrew Morton wrote:
...
 Changes since 2.6.20-rc6-mm2:
...
  git-netdev-all.patch
...
  git trees
...


This patch contains the following possible cleanups:
- move extern declarations to atl1.h
- make needlessly global code static

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

BTW: Can we get a MAINTAINERS entry for this driver?

 drivers/net/atl1/atl1.h |6 --
 drivers/net/atl1/atl1_ethtool.c |3 ---
 drivers/net/atl1/atl1_hw.c  |6 ++
 drivers/net/atl1/atl1_main.c|8 +++-
 drivers/net/atl1/atl1_param.c   |4 +---
 5 files changed, 10 insertions(+), 17 deletions(-)

--- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1.h.old2007-02-06 
07:55:58.0 +0100
+++ linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1.h2007-02-06 
08:19:50.0 +0100
@@ -34,8 +34,10 @@
 s32 atl1_up(struct atl1_adapter *adapter);
 void atl1_down(struct atl1_adapter *adapter);
 int atl1_reset(struct atl1_adapter *adapter);
-s32 atl1_setup_ring_resources(struct atl1_adapter *adapter);
-void atl1_free_ring_resources(struct atl1_adapter *adapter);
+
+extern char atl1_driver_name[];
+extern char atl1_driver_version[];
+extern const struct ethtool_ops atl1_ethtool_ops;
 
 struct atl1_adapter;
 
--- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_hw.c.old 2007-02-06 
07:52:20.0 +0100
+++ linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_hw.c 2007-02-06 
07:56:22.0 +0100
@@ -31,8 +31,6 @@
 #include atl1.h
 
 
-extern char atl1_driver_name[];
-
 /**
  * Reset the transmit and receive units; mask and clear all interrupts.
  * hw - Struct containing variables accessed by shared code
@@ -209,7 +207,7 @@
  * get_permanent_address
  * return 0 if get valid mac address, 
  **/
-int atl1_get_permanent_address(struct atl1_hw *hw)
+static int atl1_get_permanent_address(struct atl1_hw *hw)
 {
u32 addr[2];
u32 i, control;
@@ -602,7 +600,7 @@
return ret_val;
 }
 
-struct atl1_spi_flash_dev flash_table[] = {
+static struct atl1_spi_flash_dev flash_table[] = {
 /* MFR_NAME  WRSR  READ  PRGM  WREN  WRDI  RDSR  RDID  SECTOR_ERASE 
CHIP_ERASE */
{Atmel, 0x00, 0x03, 0x02, 0x06, 0x04, 0x05, 0x15, 0x52,0x62},
{SST,   0x01, 0x03, 0x02, 0x06, 0x04, 0x05, 0x90, 0x20,0x60},
--- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_ethtool.c.old2007-02-06 
07:57:04.0 +0100
+++ linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_ethtool.c2007-02-06 
07:57:10.0 +0100
@@ -31,9 +31,6 @@
 #include atl1.h
 
 
-extern char atl1_driver_name[];
-extern char atl1_driver_version[];
-
 struct atl1_stats {
char stat_string[ETH_GSTRING_LEN];
int sizeof_stat;
--- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_param.c.old  2007-02-06 
07:57:18.0 +0100
+++ linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_param.c  2007-02-06 
08:16:39.0 +0100
@@ -26,8 +26,6 @@
 #include linux/moduleparam.h
 #include atl1.h
 
-extern char atl1_driver_name[];
-
 /**
  * This is the only thing that needs to be changed to adjust the
  * maximum number of ports that the driver can manage.
@@ -68,7 +66,7 @@
 module_param_array_named(flash_vendor, flash_vendor, int, num_flash_vendor, 
0);
 MODULE_PARM_DESC(flash_vendor, SPI flash vendor);
 
-int enable_msi;
+static int enable_msi;
 module_param(enable_msi, int, 0444);
 MODULE_PARM_DESC(enable_msi, Enable PCI MSI);
 
--- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_main.c.old   2007-02-06 
07:58:37.0 +0100
+++ linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_main.c   2007-02-06 
08:15:51.0 +0100
@@ -95,8 +95,6 @@
 MODULE_LICENSE(GPL);
 MODULE_VERSION(DRIVER_VERSION);
 
-extern struct ethtool_ops atl1_ethtool_ops;
-
 /**
  * atl1_pci_tbl - PCI Device ID Table
  **/
@@ -178,7 +176,7 @@
  *
  * Return 0 on success, negative on failure
  **/
-s32 atl1_setup_ring_resources(struct atl1_adapter * adapter)
+static s32 atl1_setup_ring_resources(struct atl1_adapter * adapter)
 {
struct atl1_tpd_ring *tpd_ring = adapter-tpd_ring;
struct atl1_rfd_ring *rfd_ring = adapter-rfd_ring;
@@ -1221,7 +1219,7 @@
  * atl1_irq_disable - Mask off interrupt generation on the NIC
  * @adapter: board private structure
  **/
-void atl1_irq_disable(struct atl1_adapter *adapter)
+static void atl1_irq_disable(struct atl1_adapter *adapter)
 {
atomic_inc(adapter-irq_sem);
iowrite32(0, adapter-hw.hw_addr + REG_IMR);
@@ -1749,7 +1747,7 @@
  *
  * Free all transmit software resources
  **/
-void atl1_free_ring_resources(struct atl1_adapter *adapter)
+static void atl1_free_ring_resources(struct atl1_adapter *adapter)
 {
struct pci_dev *pdev = adapter-pdev;
struct atl1_tpd_ring *tpd_ring = adapter-tpd_ring;

-
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: dynticks + iptables almost stops the boot process [was: Re: 2.6.20-rc6-mm3]

2007-02-06 Thread Tilman Schmidt
Am 06.02.2007 20:28 schrieb Mattia Dongili:
 On Tue, Feb 06, 2007 at 05:48:26PM +0100, Ingo Molnar wrote:
 Could you try the patch below? The RCU serialization code (a rare call 
 but can be common in some types of setups) has a nasty implicit 
 dependency on the HZ tick - which until now was a hidden wart but became 
 an explicit bug under dynticks. Maybe this is what is slowing down your 
 box.

I have the same problem (huge delay when loading iptables) with
2.6.20-rc6-mm3, and for me this patch did fix it.

 No, not this. Anyway the last patch Thomas forwarded does fix the
 problem.

Which one would that be? I might try it for comparison.

Thanks,
Tilman

-- 
Tilman Schmidt  E-Mail: [EMAIL PROTECTED]
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)



signature.asc
Description: OpenPGP digital signature


Re: dynticks + iptables almost stops the boot process [was: Re: 2.6.20-rc6-mm3]

2007-02-06 Thread Thomas Gleixner
On Wed, 2007-02-07 at 00:12 +0100, Tilman Schmidt wrote:
  No, not this. Anyway the last patch Thomas forwarded does fix the
  problem.
 
 Which one would that be? I might try it for comparison.

Find the combined patch of all fixlets on top of -mm3 below.

tglx

Index: linux-2.6.20/kernel/timer.c
===
--- linux-2.6.20.orig/kernel/timer.c
+++ linux-2.6.20/kernel/timer.c
@@ -985,8 +985,9 @@ static int timekeeping_resume(struct sys
 
if (now  (now  timekeeping_suspend_time)) {
unsigned long sleep_length = now - timekeeping_suspend_time;
+
xtime.tv_sec += sleep_length;
-   jiffies_64 += (u64)sleep_length * HZ;
+   wall_to_monotonic.tv_sec -= sleep_length;
}
/* re-base the last cycle value */
clock-cycle_last = clocksource_read(clock);
@@ -994,7 +995,7 @@ static int timekeeping_resume(struct sys
timekeeping_suspended = 0;
write_sequnlock_irqrestore(xtime_lock, flags);
 
-   clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL);
+   touch_softlockup_watchdog();
/* Resume hrtimers */
clock_was_set();
 
Index: linux-2.6.20/kernel/time/clockevents.c
===
--- linux-2.6.20.orig/kernel/time/clockevents.c
+++ linux-2.6.20/kernel/time/clockevents.c
@@ -42,8 +42,8 @@ unsigned long clockevent_delta2ns(unsign
u64 clc = ((u64) latch  evt-shift);
 
do_div(clc, evt-mult);
-   if (clc  KTIME_MONOTONIC_RES.tv64)
-   clc = KTIME_MONOTONIC_RES.tv64;
+   if (clc  1000)
+   clc = 1000;
if (clc  LONG_MAX)
clc = LONG_MAX;
 
@@ -72,18 +72,22 @@ void clockevents_set_mode(struct clock_e
  *
  * Returns 0 on success, -ETIME when the event is in the past.
  */
-int clockevents_program_event(struct clock_event_device *dev, ktime_t expires)
+int clockevents_program_event(struct clock_event_device *dev, ktime_t expires,
+ ktime_t now)
 {
unsigned long long clc;
int64_t delta;
 
-   delta = ktime_to_ns(ktime_sub(expires, ktime_get()));
+   delta = ktime_to_ns(ktime_sub(expires, now));
 
if (delta = 0)
return -ETIME;
 
dev-next_event = expires;
 
+   if (dev-mode == CLOCK_EVT_MODE_SHUTDOWN)
+   return 0;
+
if (delta  dev-max_delta_ns)
delta = dev-max_delta_ns;
if (delta  dev-min_delta_ns)
Index: linux-2.6.20/kernel/time/tick-broadcast.c
===
--- linux-2.6.20.orig/kernel/time/tick-broadcast.c
+++ linux-2.6.20/kernel/time/tick-broadcast.c
@@ -159,6 +159,8 @@ static void tick_do_periodic_broadcast(v
  */
 static void tick_handle_periodic_broadcast(struct clock_event_device *dev)
 {
+   dev-next_event.tv64 = KTIME_MAX;
+
tick_do_periodic_broadcast();
 
/*
@@ -174,7 +176,7 @@ static void tick_handle_periodic_broadca
for (;;) {
ktime_t next = ktime_add(dev-next_event, tick_period);
 
-   if (!clockevents_program_event(dev, next))
+   if (!clockevents_program_event(dev, next, ktime_get()))
return;
tick_do_periodic_broadcast();
}
@@ -294,17 +296,31 @@ cpumask_t *tick_get_broadcast_oneshot_ma
return tick_broadcast_oneshot_mask;
 }
 
+static int tick_broadcast_set_event(ktime_t expires, int force)
+{
+   struct clock_event_device *bc = tick_broadcast_device.evtdev;
+   ktime_t now = ktime_get();
+   int res;
+
+   for(;;) {
+   res = clockevents_program_event(bc, expires, now);
+   if (!res || !force)
+   return res;
+   now = ktime_get();
+   expires = ktime_add(now, ktime_set(0, bc-min_delta_ns));
+   }
+}
+
 /*
  * Reprogram the broadcast device:
  *
  * Called with tick_broadcast_lock held and interrupts disabled.
  */
-static int tick_broadcast_reprogram(int force)
+static int tick_broadcast_reprogram(void)
 {
-   struct clock_event_device *bc = tick_broadcast_device.evtdev;
-   ktime_t tmp, expires = { .tv64 = KTIME_MAX };
+   ktime_t expires = { .tv64 = KTIME_MAX };
struct tick_device *td;
-   int cpu, res;
+   int cpu;
 
/*
 * Find the event which expires next:
@@ -319,13 +335,7 @@ static int tick_broadcast_reprogram(int 
if (expires.tv64 == KTIME_MAX)
return 0;
 
-   for(;;) {
-   res = clockevents_program_event(bc, expires);
-   if (!res || !force)
-   return res;
-   tmp = ktime_set(0, bc-min_delta_ns  1);
-   expires = ktime_add(ktime_get(), tmp);
-   }
+   return tick_broadcast_set_event(expires, 0);
 }
 
 /*
@@ -333,14 +343,15 @@ static int tick_broadcast_reprogram(int 

Re: [PATCH netdev#atl1 1/3] atl1: remove whitespace damage

2007-02-06 Thread Jeff Garzik

Jay Cliburn wrote:

From: Jay Cliburn [EMAIL PROTECTED]

atl1: fix whitespace damage

Remove trailing whitespace and spaces preceding tabs.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]


applied 1-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


Re: [PATCH] sky2: flow control off

2007-02-06 Thread Jeff Garzik

Stephen Hemminger wrote:

Turn flow control off for sky2. When flow control is on, the transmitter
may get randomly stuck. Perhaps there is hardware problem, but until
Marvell provides errata information for workaround, it should default to off.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
---
 drivers/net/sky2.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 822dd0b..a31dea5 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3263,7 +3263,7 @@ #endif
 
 	/* Auto speed and flow control */

sky2-autoneg = AUTONEG_ENABLE;
-   sky2-flow_mode = FC_BOTH;
+   sky2-flow_mode = FC_NONE;


I ACK the patch... conditional on some -mm style testing and user ACKs.

Logic:  if there were no downsides to disabling flow control globally, 
the world's networks would have already done so.  Flow control can be 
quite helpful, so I while I understand the errata argument, I also want 
to understand the full effect of this tiny patch.


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: [RFC: -mm patch] drivers/net/atl1/: possible cleanups

2007-02-06 Thread Jay Cliburn
On Tue, 6 Feb 2007 23:12:29 +0100
Adrian Bunk [EMAIL PROTECTED] wrote:

 On Mon, Jan 29, 2007 at 08:45:28PM -0800, Andrew Morton wrote:
 ...
  Changes since 2.6.20-rc6-mm2:
 ...
   git-netdev-all.patch
 ...
   git trees
 ...
 
 
 This patch contains the following possible cleanups:
 - move extern declarations to atl1.h
 - make needlessly global code static

Adrian,

The atl1 driver currently follows this development pathway:

developer - netdev#atl1 - netdev#ALL - -mm

Your patch is just a little bit out ahead of us.  Some of your suggested
changes are already in the pipeline; we're just waiting for Jeff to
merge netdev#atl1 into netdev#ALL.  Should be soon.

 
 Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
 
 ---
 
 BTW: Can we get a MAINTAINERS entry for this driver?

Already submitted to netdev#atl1.

http://lkml.org/lkml/2007/2/3/174

 
  drivers/net/atl1/atl1.h |6 --
  drivers/net/atl1/atl1_ethtool.c |3 ---
  drivers/net/atl1/atl1_hw.c  |6 ++
  drivers/net/atl1/atl1_main.c|8 +++-
  drivers/net/atl1/atl1_param.c   |4 +---
  5 files changed, 10 insertions(+), 17 deletions(-)
 
 --- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1.h.old
 2007-02-06 07:55:58.0 +0100 +++
 linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1.h  2007-02-06
 08:19:50.0 +0100 @@ -34,8 +34,10 @@ s32 atl1_up(struct
 atl1_adapter *adapter); void atl1_down(struct atl1_adapter *adapter);
  int atl1_reset(struct atl1_adapter *adapter);
 -s32 atl1_setup_ring_resources(struct atl1_adapter *adapter);
 -void atl1_free_ring_resources(struct atl1_adapter *adapter);
 +
 +extern char atl1_driver_name[];
 +extern char atl1_driver_version[];

netdev#atl1 already has this change.

The rest of these I'll bundle up and submit to netdev#atl1, too.  Will
that work for you?

 +extern const struct ethtool_ops atl1_ethtool_ops;
  
  struct atl1_adapter;
  
 --- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_hw.c.old
 2007-02-06 07:52:20.0 +0100 +++
 linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_hw.c   2007-02-06
 07:56:22.0 +0100 @@ -31,8 +31,6 @@ #include atl1.h
  
  
 -extern char atl1_driver_name[];
 -
  /**
   * Reset the transmit and receive units; mask and clear all
 interrupts.
   * hw - Struct containing variables accessed by shared code
 @@ -209,7 +207,7 @@
   * get_permanent_address
   * return 0 if get valid mac address, 
   **/
 -int atl1_get_permanent_address(struct atl1_hw *hw)
 +static int atl1_get_permanent_address(struct atl1_hw *hw)
  {
   u32 addr[2];
   u32 i, control;
 @@ -602,7 +600,7 @@
   return ret_val;
  }
  
 -struct atl1_spi_flash_dev flash_table[] = {
 +static struct atl1_spi_flash_dev flash_table[] = {
  /*   MFR_NAME  WRSR  READ  PRGM  WREN  WRDI  RDSR  RDID
 SECTOR_ERASE CHIP_ERASE */ {Atmel, 0x00, 0x03, 0x02, 0x06, 0x04,
 0x05, 0x15, 0x52,0x62}, {SST,   0x01, 0x03, 0x02, 0x06,
 0x04, 0x05, 0x90, 0x20,0x60}, ---
 linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_ethtool.c.old
 2007-02-06 07:57:04.0 +0100 +++
 linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_ethtool.c
 2007-02-06 07:57:10.0 +0100 @@ -31,9 +31,6 @@ #include
 atl1.h 
 -extern char atl1_driver_name[];
 -extern char atl1_driver_version[];
 -
  struct atl1_stats {
   char stat_string[ETH_GSTRING_LEN];
   int sizeof_stat;
 --- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_param.c.old
 2007-02-06 07:57:18.0 +0100 +++
 linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_param.c2007-02-06
 08:16:39.0 +0100 @@ -26,8 +26,6 @@ #include
 linux/moduleparam.h #include atl1.h
  
 -extern char atl1_driver_name[];
 -
  /**
   * This is the only thing that needs to be changed to adjust the
   * maximum number of ports that the driver can manage.
 @@ -68,7 +66,7 @@
  module_param_array_named(flash_vendor, flash_vendor, int,
 num_flash_vendor, 0); MODULE_PARM_DESC(flash_vendor, SPI flash
 vendor); 
 -int enable_msi;
 +static int enable_msi;
  module_param(enable_msi, int, 0444);
  MODULE_PARM_DESC(enable_msi, Enable PCI MSI);
  
 --- linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_main.c.old
 2007-02-06 07:58:37.0 +0100 +++
 linux-2.6.20-rc6-mm3/drivers/net/atl1/atl1_main.c 2007-02-06
 08:15:51.0 +0100 @@ -95,8 +95,6 @@ MODULE_LICENSE(GPL);
  MODULE_VERSION(DRIVER_VERSION);
  
 -extern struct ethtool_ops atl1_ethtool_ops;
 -
  /**
   * atl1_pci_tbl - PCI Device ID Table
   **/
 @@ -178,7 +176,7 @@
   *
   * Return 0 on success, negative on failure
   **/
 -s32 atl1_setup_ring_resources(struct atl1_adapter * adapter)
 +static s32 atl1_setup_ring_resources(struct atl1_adapter * adapter)
  {
   struct atl1_tpd_ring *tpd_ring = adapter-tpd_ring;
   struct atl1_rfd_ring *rfd_ring = adapter-rfd_ring;
 @@ -1221,7 +1219,7 @@
   * atl1_irq_disable - Mask off interrupt generation on the NIC
   * @adapter: board private structure
   **/
 -void atl1_irq_disable(struct atl1_adapter *adapter)
 +static void atl1_irq_disable(struct atl1_adapter *adapter)
  {
   

Re: [RFC: -mm patch] drivers/net/atl1/: possible cleanups

2007-02-06 Thread Jeff Garzik

Jay Cliburn wrote:

Your patch is just a little bit out ahead of us.  Some of your suggested
changes are already in the pipeline; we're just waiting for Jeff to
merge netdev#atl1 into netdev#ALL.  Should be soon.



Technical note:  merging #atl1 into #ALL happens each time 
netdev-2.6.git is flushed out from my local machine.


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: [RFC: -mm patch] drivers/net/atl1/: possible cleanups

2007-02-06 Thread Adrian Bunk
On Tue, Feb 06, 2007 at 06:19:10PM -0600, Jay Cliburn wrote:
 On Tue, 6 Feb 2007 23:12:29 +0100
 Adrian Bunk [EMAIL PROTECTED] wrote:
...
  This patch contains the following possible cleanups:
  - move extern declarations to atl1.h
  - make needlessly global code static
 
 Adrian,
 
 The atl1 driver currently follows this development pathway:
 
 developer - netdev#atl1 - netdev#ALL - -mm
 
 Your patch is just a little bit out ahead of us.  Some of your suggested
 changes are already in the pipeline; we're just waiting for Jeff to
 merge netdev#atl1 into netdev#ALL.  Should be soon.
 
  
  Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
  
  ---
  
  BTW: Can we get a MAINTAINERS entry for this driver?
 
 Already submitted to netdev#atl1.
 
 http://lkml.org/lkml/2007/2/3/174

:-)

  -s32 atl1_setup_ring_resources(struct atl1_adapter *adapter);
  -void atl1_free_ring_resources(struct atl1_adapter *adapter);
  +
  +extern char atl1_driver_name[];
  +extern char atl1_driver_version[];
 
 netdev#atl1 already has this change.
 
 The rest of these I'll bundle up and submit to netdev#atl1, too.  Will
 that work for you?
...

Do what you consider the right thing - I don't care how it gets into the 
various trees.

cu
Adrian

-- 

   Is there not promise of rain? Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   Only a promise, Lao Er said.
   Pearl S. Buck - Dragon Seed

-
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: [RFC: -mm patch] drivers/net/atl1/: possible cleanups

2007-02-06 Thread J. K. Cliburn

On 2/6/07, Jeff Garzik [EMAIL PROTECTED] wrote:

Jay Cliburn wrote:
 Your patch is just a little bit out ahead of us.  Some of your suggested
 changes are already in the pipeline; we're just waiting for Jeff to
 merge netdev#atl1 into netdev#ALL.  Should be soon.


Technical note:  merging #atl1 into #ALL happens each time
netdev-2.6.git is flushed out from my local machine.


Noted.  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: dynticks + iptables almost stops the boot process [was: Re: 2.6.20-rc6-mm3]

2007-02-06 Thread Andrew Morton
On Wed, 07 Feb 2007 00:17:33 +0100
Thomas Gleixner [EMAIL PROTECTED] wrote:

 On Wed, 2007-02-07 at 00:12 +0100, Tilman Schmidt wrote:
   No, not this. Anyway the last patch Thomas forwarded does fix the
   problem.
  
  Which one would that be? I might try it for comparison.
 
 Find the combined patch of all fixlets on top of -mm3 below.

err, I don't have most of this.

I just uploaded the crappile-of-the-moment to
   
ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/mm/broken-out-2007-02-06-16-59.tar.gz
-
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


hostap_cs_{resume,suspend}(): inconsequent NULL checking

2007-02-06 Thread Adrian Bunk
The Coverity checker spotted the following in 
drivers/net/wireless/hostap/hostap_cs.c:

--  snip  --

...
static int hostap_cs_suspend(struct pcmcia_device *link)
{
struct net_device *dev = (struct net_device *) link-priv;
int dev_open = 0;
struct hostap_interface *iface = NULL;

if (dev)
iface = netdev_priv(dev);

PDEBUG(DEBUG_EXTRA, %s: CS_EVENT_PM_SUSPEND\n, dev_info);
if (iface  iface-local)
dev_open = iface-local-num_dev_open  0;
if (dev_open) {
netif_stop_queue(dev);
netif_device_detach(dev);
}
prism2_suspend(dev);

return 0;
}

static int hostap_cs_resume(struct pcmcia_device *link)
{
struct net_device *dev = (struct net_device *) link-priv;
int dev_open = 0;
struct hostap_interface *iface = NULL;

if (dev)
iface = netdev_priv(dev);

PDEBUG(DEBUG_EXTRA, %s: CS_EVENT_PM_RESUME\n, dev_info);

if (iface  iface-local)
dev_open = iface-local-num_dev_open  0;

prism2_hw_shutdown(dev, 1);
prism2_hw_config(dev, dev_open ? 0 : 1);
if (dev_open) {
netif_device_attach(dev);
netif_start_queue(dev);
}

return 0;
}
...

--  snip  --

The problem is that if the if (dev) is false, there's a guaranteed 
NULL dereference later in the prism2_suspend(dev) resp.
prism2_hw_config(dev, dev_open ? 0 : 1).

cu
Adrian

-- 

   Is there not promise of rain? Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   Only a promise, Lao Er said.
   Pearl S. Buck - Dragon Seed


-
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 netdev#atl1 1/1] atl1: clean up extern, global scope declarations

2007-02-06 Thread Jay Cliburn
From: Jay Cliburn [EMAIL PROTECTED]

atl1: move extern to header file; make some global code static

Move an extern declaration to a header file.  Make needlessly global
functions static.  Noticed by Adrian Bunk.

Signed-off-by: Jay Cliburn [EMAIL PROTECTED]
---

 drivers/net/atl1/atl1.h |1 +
 drivers/net/atl1/atl1_ethtool.c |2 +-
 drivers/net/atl1/atl1_hw.c  |4 ++--
 drivers/net/atl1/atl1_main.c|4 +---
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h
index 3ff978b..b1c6034 100644
--- a/drivers/net/atl1/atl1.h
+++ b/drivers/net/atl1/atl1.h
@@ -38,6 +38,7 @@ void atl1_free_ring_resources(struct atl1_adapter *adapter);
 
 extern char atl1_driver_name[];
 extern char atl1_driver_version[];
+extern const struct ethtool_ops atl1_ethtool_ops;
 
 struct atl1_adapter;
 
diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atl1/atl1_ethtool.c
index 01c2348..c11c277 100644
--- a/drivers/net/atl1/atl1_ethtool.c
+++ b/drivers/net/atl1/atl1_ethtool.c
@@ -318,7 +318,7 @@ static void atl1_get_ringparam(struct net_device *netdev,
ring-rx_jumbo_pending = 0;
 }
 
-static int atl1_set_ringparam (struct net_device *netdev,
+static int atl1_set_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring)
 {
struct atl1_adapter *adapter = netdev_priv(netdev);
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index a5e92e7..08b2d78 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -206,7 +206,7 @@ static bool atl1_spi_read(struct atl1_hw *hw, u32 addr, u32 
*buf)
  * get_permanent_address
  * return 0 if get valid mac address, 
  */
-int atl1_get_permanent_address(struct atl1_hw *hw)
+static int atl1_get_permanent_address(struct atl1_hw *hw)
 {
u32 addr[2];
u32 i, control;
@@ -592,7 +592,7 @@ static s32 atl1_setup_link(struct atl1_hw *hw)
return ret_val;
 }
 
-struct atl1_spi_flash_dev flash_table[] = {
+static struct atl1_spi_flash_dev flash_table[] = {
 /* MFR_NAME  WRSR  READ  PRGM  WREN  WRDI  RDSR  RDID  SECTOR_ERASE 
CHIP_ERASE */
{Atmel, 0x00, 0x03, 0x02, 0x06, 0x04, 0x05, 0x15, 0x52,0x62},
{SST,   0x01, 0x03, 0x02, 0x06, 0x04, 0x05, 0x90, 0x20,0x60},
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 9a3fb86..6655640 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -96,8 +96,6 @@ MODULE_DESCRIPTION(Attansic 1000M Ethernet Network Driver);
 MODULE_LICENSE(GPL);
 MODULE_VERSION(DRIVER_VERSION);
 
-extern struct ethtool_ops atl1_ethtool_ops;
-
 /*
  * atl1_pci_tbl - PCI Device ID Table
  */
@@ -1205,7 +1203,7 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
  * atl1_irq_disable - Mask off interrupt generation on the NIC
  * @adapter: board private structure
  */
-void atl1_irq_disable(struct atl1_adapter *adapter)
+static void atl1_irq_disable(struct atl1_adapter *adapter)
 {
atomic_inc(adapter-irq_sem);
iowrite32(0, adapter-hw.hw_addr + REG_IMR);
-
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] bcm43xx: Fix for oops on resume

2007-02-06 Thread Larry Finger
There is a kernel oops on bcm43xx when resuming due to an overly tight timeout 
loop.

Signed-off-by: Larry Finger[EMAIL PROTECTED]
---

Index: linux-2.6/drivers/net/wireless/bcm43xx/bcm43xx.h
===
--- linux-2.6.orig/drivers/net/wireless/bcm43xx/bcm43xx.h
+++ linux-2.6/drivers/net/wireless/bcm43xx/bcm43xx.h
@@ -21,7 +21,7 @@
 #define PFXKBUILD_MODNAME : 
 
 #define BCM43xx_SWITCH_CORE_MAX_RETRIES50
-#define BCM43xx_IRQWAIT_MAX_RETRIES50
+#define BCM43xx_IRQWAIT_MAX_RETRIES100
 
 #define BCM43xx_IO_SIZE8192
 
-
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] bcm43xx: Fix incorrect definition of PHY revision

2007-02-06 Thread Larry Finger
There is a typographical error in the spefications that interchange the PHY 
version
and revision. Fixing this error makes all BCM43xx varieties work at full CCCK 
rates.

Signed-off-by: Larry Finger[EMAIL PROTECTED]
---

John,

This patch should be put into wireless-2.6 and into 'upstream' as soon as 
possible.
I will be sending it to stable for inclusion in 2.6.20.1, and whatever other 
kernels
are still being maintained by -stable.

Larry
---
 
Index: wireless-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c
===
--- wireless-2.6.orig/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ wireless-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -3704,9 +3704,9 @@ static int bcm43xx_read_phyinfo(struct b
 
value = bcm43xx_read16(bcm, BCM43xx_MMIO_PHY_VER);
 
-   phy_version = (value  0xF000)  12;
+   phy_rev = (value  0xF000)  12;
phy_type = (value  0x0F00)  8;
-   phy_rev = (value  0x000F);
+   phy_version = (value  0x000F);
 
dprintk(KERN_INFO PFX Detected PHY: Version: %x, Type %x, Revision 
%x\n,
phy_version, phy_type, phy_rev);

===

-
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: flow control off

2007-02-06 Thread Stephen Hemminger
On Tue, 06 Feb 2007 19:18:07 -0500
Jeff Garzik [EMAIL PROTECTED] wrote:

 Stephen Hemminger wrote:
  Turn flow control off for sky2. When flow control is on, the transmitter
  may get randomly stuck. Perhaps there is hardware problem, but until
  Marvell provides errata information for workaround, it should default to 
  off.
  
  Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
  ---
   drivers/net/sky2.c |2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)
  
  diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
  index 822dd0b..a31dea5 100644
  --- a/drivers/net/sky2.c
  +++ b/drivers/net/sky2.c
  @@ -3263,7 +3263,7 @@ #endif
   
  /* Auto speed and flow control */
  sky2-autoneg = AUTONEG_ENABLE;
  -   sky2-flow_mode = FC_BOTH;
  +   sky2-flow_mode = FC_NONE;
 
 I ACK the patch... conditional on some -mm style testing and user ACKs.
 
 Logic:  if there were no downsides to disabling flow control globally, 
 the world's networks would have already done so.  Flow control can be 
 quite helpful, so I while I understand the errata argument, I also want 
 to understand the full effect of this tiny patch.
 

Actually, the E1000 had it off until recently. The downside is that if 
a system is connected on a switch with a gigabit to 100mbit port
and using a stupid protocol like NFS over UDP, then the packet
burst is sure to get truncated so the 8K fragmented UDP
never gets through.
-
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: [IPV6] RAW: Add checksum default defines for MH.

2007-02-06 Thread YOSHIFUJI Hideaki / 吉藤英明
Dave,

AFAIK, we have not heard objectsions and I finally agree on this.
Please apply.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

--yoshfuji

In article [EMAIL PROTECTED] (at Wed,  3 Jan 2007 18:57:48 +0900), Masahide 
NAKAMURA [EMAIL PROTECTED] says:

 Add checksum default defines for mobility header(MH) which
 goes through raw socket. As the result kernel's behavior is
 to handle MH checksum as default.
 
 This patch also removes verifying inbound MH checksum at
 mip6_mh_filter() since it did not consider user specified
 checksum offset and was redundant check with raw socket code.
 
 Signed-off-by: Masahide NAKAMURA [EMAIL PROTECTED]
 ---
  net/ipv6/mip6.c |   26 --
  net/ipv6/raw.c  |   13 +++--
  2 files changed, 11 insertions(+), 28 deletions(-)
 
 diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
 index be7dd7d..681bb07 100644
 --- a/net/ipv6/mip6.c
 +++ b/net/ipv6/mip6.c
 @@ -89,7 +89,6 @@ static int mip6_mh_len(int type)
  int mip6_mh_filter(struct sock *sk, struct sk_buff *skb)
  {
   struct ip6_mh *mh;
 - int mhlen;
  
   if (!pskb_may_pull(skb, (skb-h.raw - skb-data) + 8) ||
   !pskb_may_pull(skb, (skb-h.raw - skb-data) + ((skb-h.raw[1] + 1) 
  3)))
 @@ -103,31 +102,6 @@ int mip6_mh_filter(struct sock *sk, stru
   mip6_param_prob(skb, 0, (mh-ip6mh_hdrlen) - skb-nh.raw);
   return -1;
   }
 - mhlen = (mh-ip6mh_hdrlen + 1)  3;
 -
 - if (skb-ip_summed == CHECKSUM_COMPLETE) {
 - skb-ip_summed = CHECKSUM_UNNECESSARY;
 - if (csum_ipv6_magic(skb-nh.ipv6h-saddr,
 - skb-nh.ipv6h-daddr,
 - mhlen, IPPROTO_MH,
 - skb-csum)) {
 - LIMIT_NETDEBUG(KERN_DEBUG mip6: MH hw checksum 
 failed\n);
 - skb-ip_summed = CHECKSUM_NONE;
 - }
 - }
 - if (skb-ip_summed == CHECKSUM_NONE) {
 - if (csum_ipv6_magic(skb-nh.ipv6h-saddr,
 - skb-nh.ipv6h-daddr,
 - mhlen, IPPROTO_MH,
 - skb_checksum(skb, 0, mhlen, 0))) {
 - LIMIT_NETDEBUG(KERN_DEBUG mip6: MH checksum failed 
 -[ NIP6_FMTNIP6_FMT ]\n,
 -NIP6(skb-nh.ipv6h-saddr),
 -NIP6(skb-nh.ipv6h-daddr));
 - return -1;
 - }
 - skb-ip_summed = CHECKSUM_UNNECESSARY;
 - }
  
   if (mh-ip6mh_proto != IPPROTO_NONE) {
   LIMIT_NETDEBUG(KERN_DEBUG mip6: MH invalid payload proto = 
 %d\n,
 diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
 index 4ae1b19..4b83e69 100644
 --- a/net/ipv6/raw.c
 +++ b/net/ipv6/raw.c
 @@ -1094,10 +1094,19 @@ static void rawv6_close(struct sock *sk,
  
  static int rawv6_init_sk(struct sock *sk)
  {
 - if (inet_sk(sk)-num == IPPROTO_ICMPV6) {
 - struct raw6_sock *rp = raw6_sk(sk);
 + struct raw6_sock *rp = raw6_sk(sk);
 +
 + switch (inet_sk(sk)-num) {
 + case IPPROTO_ICMPV6:
   rp-checksum = 1;
   rp-offset   = 2;
 + break;
 + case IPPROTO_MH:
 + rp-checksum = 1;
 + rp-offset   = 4;
 + break;
 + default:
 + break;
   }
   return(0);
  }
 -- 
 1.4.2
 
 -
 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
-
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 11/11] netfilter warning fix

2007-02-06 Thread Patrick McHardy
Ingo Molnar wrote:
 * David Miller [EMAIL PROTECTED] wrote:
 
net/netfilter/nf_conntrack_core.c, calls:

  l4proto = __nf_ct_l4proto_find((u_int16_t)pf, protonum);

whichs assumes that preemption is disabled.

Yes, that is certainly broken.

 you are right - i mistakenly read that mail only up to the point where 
 you point out the (slightly) buggy NF_CT_STATIC_INC use and missed your 
 final point about other coding having implicit preempt_disable() 
 assumptions.
 
 I've looked at __nf_ct_l4proto_find() and it's not obvious to me what 
 the hidden preempt_disable() assumption is. Its main use seems to be of 
 nf_ct_protos[] array, which is protected by nf_conntrack_lock. I'm 
 wondering whether what you say suggests that it's safe to call 
 __nf_ct_l4proto_find() without the nf_conntrack_lock locked (as read or 
 as write), and if it's safe, how it protects against simultaneous 
 modifications to the nf_ct_protos[] array. 
 
 Ahh ... unregister does a synchronize_net(), right? That means that 
 removal of the pointer only happens if all CPUs have gone through a 
 quiescent state.
 
 this means that this particular use could be fixed by converting the 
 preempt_disable()/enable() pair in nf_ct_l4proto_find_get() to 
 rcu_read_lock()/unlock(), correct? 

That is another bug (all uses of preempt_disable in netfilter
actually), but calling __nf_ct_l[34]proto_find without
rcu_read_lock is broken as well.

 Furthermore, every user of 
 synchronize_net() [and synchronize_rcu() in general] needs to be 
 reviewed.

I'll take care of netfilter.
-
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


[IPROUTE2] tc build failure and netfilter headers.

2007-02-06 Thread YOSHIFUJI Hideaki / 吉藤英明
Stephen,

I think we should include include/linux/netfilter/{x_tables.h,xt_tcpudp.h}
in iproute2 distribution to avoid compilation failure of tc.

Regards,

--yoshfuji
-
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: [IPROUTE2] tc build failure and netfilter headers.

2007-02-06 Thread Stephen Hemminger
On Wed, 07 Feb 2007 16:33:53 +0900 (JST)
YOSHIFUJI Hideaki / 吉藤英明 [EMAIL PROTECTED] wrote:

 Stephen,
 
 I think we should include include/linux/netfilter/{x_tables.h,xt_tcpudp.h}
 in iproute2 distribution to avoid compilation failure of tc.
 
 Regards,
 
 --yoshfuji

Okay, but but we are suffering from header creep
-
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