Re: [PATCH] Fix buglets in mpc5200 FEC code that are corrupting memory.

2007-11-09 Thread Domen Puncer
On 09/11/07 00:31 -0500, Jon Smirl wrote:
> This is the reason I couldn't get user space started or connect to my
> nfs server. Patch is against current linus git.
> 
> mpc5200 fec driver is corrupting memory. This patch fixes two bugs
> where the wrong skb buffer was being referenced.
> 
> Signed-off-by: Jon Smirl <[EMAIL PROTECTED]>

Acked-by: Domen Puncer <[EMAIL PROTECTED]>

I can't test it at the moment, but the patch is obviously correct,
mapped buffer should be the _same_ as submitted.

> 
> ---
> 
>  drivers/net/fec_mpc52xx.c |4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
> index a8a0ee2..ddfcc0b 100644
> --- a/drivers/net/fec_mpc52xx.c
> +++ b/drivers/net/fec_mpc52xx.c
> @@ -422,7 +422,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int
> irq, void *dev_id)
> 
>   rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status,
>   (struct bcom_bd **)&bd);
> - dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, 
> DMA_FROM_DEVICE);
> + dma_unmap_single(&dev->dev, bd->skb_pa, rskb->len, 
> DMA_FROM_DEVICE);
> 
>   /* Test for errors in received frame */
>   if (status & BCOM_FEC_RX_BD_ERRORS) {
> @@ -467,7 +467,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int
> irq, void *dev_id)
>   bcom_prepare_next_buffer(priv->rx_dmatsk);
> 
>   bd->status = FEC_RX_BUFFER_SIZE;
> - bd->skb_pa = dma_map_single(&dev->dev, rskb->data,
> + bd->skb_pa = dma_map_single(&dev->dev, skb->data,
>   FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);
> 
>   bcom_submit_next_buffer(priv->rx_dmatsk, skb);
> 
> 
> -- 
> Jon Smirl
> [EMAIL PROTECTED]

-- 
Domen Puncer | Research & Development
.
Telargo d.o.o. | Zagrebška cesta 20 | 2000 Maribor | Slovenia
.
www.telargo.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: [RFC] dependencies for platform drivers (was Re: ax88796: add superh to kconfig dependencies)

2007-11-09 Thread Ralf Baechle
On Thu, Nov 08, 2007 at 08:18:54AM +, Al Viro wrote:

> On Thu, Nov 08, 2007 at 04:31:05PM +0900, Magnus Damm wrote:
> >  config AX88796
> > tristate "ASIX AX88796 NE2000 clone support"
> > -   depends on ARM || MIPS
> > +   depends on ARM || MIPS || SUPERH
> 
> You know, that really sucks more and more.  How about doing the following:
>   a) making it depend on PLAT_HAS_AX88796
>   b) adding selects for all subarchitectures that have the corresponding
> platform device
> and setting that as a uniform policy for platform drivers?  For things like
> SM501 we would do
> config MFD_SM501
>   depends on PCI || PLAT_HAS_SM501
> etc.
> 
> Seriously, folks, we are getting shitloads of platform drivers with no
> dependencies whatsoever, needed on a handful of targets and occasionally
> failing to build on unrelated architectures.  Moreover, having a list
> of architectures in dependencies for each of those suckers is a PITA
> from the conflict POV.  Not to mention platform drivers that fall into
> the mainline kernel with not a single platform device for them, etc.
> 
> Comments?

commit def47c5095d53814512bb0c62ec02dfdec769db1
Author: Jeff Garzik <[EMAIL PROTECTED]>
Date:   Tue Jul 10 14:06:48 2007 -0400

[netdrvr] Fix dependencies for ax88796 ne2k clone driver

It needs writesb(), not available on all platforms.

Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index a3bef22..a64c2fb 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -199,6 +199,7 @@ source "drivers/net/arm/Kconfig"
 
 config AX88796
tristate "ASIX AX88796 NE2000 clone support"
+   depends on ARM || MIPS
select CRC32
select MII
help


If writesb() is not an official API then maybe the answer should have been
to either add that API to other architectures or fix the driver.

I guess this incident means I need to go through all Kconfig* files to
see what bogus architecture dependencies on MIPS or !MIPS exist ...

  Ralf
-
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] dependencies for platform drivers (was Re: ax88796: add superh to kconfig dependencies)

2007-11-09 Thread Paul Mundt
On Fri, Nov 09, 2007 at 09:26:52AM +, Ralf Baechle wrote:
> If writesb() is not an official API then maybe the answer should have been
> to either add that API to other architectures or fix the driver.
> 
> I guess this incident means I need to go through all Kconfig* files to
> see what bogus architecture dependencies on MIPS or !MIPS exist ...
> 
While writesb() isn't an official API, the iowriteX_rep() interfaces
theoretically are. Tidying up the driver for iomap is probably a better
option.
-
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/1]: Using ICMP type and code in xfrm selector

2007-11-09 Thread Herbert Xu
On Fri, Nov 02, 2007 at 06:17:40PM -0500, Joy Latten wrote:
>
> While fixing this I wondered why we put icmp message
> type in sport and code in dport?

Where we put the info in the kernel is not specified by the
RFC.  It has to document where you put it in IKE because IKE
is used by two systems which must agree on one format.

Your patch looks OK to me but in general we want to encourage
applications to use the xfrm_user interface as pf_key is not
portable anyway because of the lack of a standard specification
that covers the SPD.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
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] using mii-bitbang on different processor ports - update the booting-without-of.txt-file

2007-11-09 Thread Sergej Stepanov
Am Donnerstag, den 08.11.2007, 14:20 -0600 schrieb Scott Wood: 
> Sergej Stepanov wrote:
> > If both mdio and mdc controlling pins are on the same processor port,
> > one resource should be used.
> > Otherwise, two resources are used: the 1-st - mdio, the 2-nd - mdc.
> 
> How about:
> The first reg resource is the I/O port register block on which MDIO 
> resides.  The second reg resource is the I/O port register block on 
> which MDC resides.  If there is only one reg resource, it is used for 
> both MDIO and MDC.
> 
Ok.

> We also need to change the reference to port C in fsl,mdio-pin and 
> fsl,mdc-pin.
Do you mean this:
   Currently defined compatibles:
   fsl,pq1-fec-mdio (reg is same as first resource of FEC device)
-> fsl,cpm2-mdio-bitbang (reg is port C registers)

   Properties for fsl,cpm2-mdio-bitbang:
-> fsl,mdio-pin : pin of port C controlling mdio data
-> fsl,mdc-pin : pin of port C controlling mdio clock

Right. But i thought it would be related to the example,
and than the reader gets the short comment about I/O ports.

Or the other variant would be:

   iv) MDIO

   Currently defined compatibles:
   fsl,pq1-fec-mdio (reg is same as first resource of FEC device)
   fsl,cpm2-mdio-bitbang (reg is the I/O port register block(s))

   Properties for fsl,cpm2-mdio-bitbang:
   The first reg resource is the I/O port register block on which MDIO
   resides.  The second reg resource is the I/O port register block on
   which MDC resides.  If there is only one reg resource, it is used for
   both MDIO and MDC.
   fsl,mdio-pin : pin of chosen port for controlling mdio data
   fsl,mdc-pin : pin of chosen port for controlling mdio clock

   Example:
[EMAIL PROTECTED] {
device_type = "mdio";
compatible = "fsl,mpc8272ads-mdio-bitbang",
 "fsl,mpc8272-mdio-bitbang",
 "fsl,cpm2-mdio-bitbang";
reg = <10d40 14>;
#address-cells = <1>;
#size-cells = <0>;
fsl,mdio-pin = <12>;
fsl,mdc-pin = <13>;
};
-

Regards
Sergej.

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


Re: [PATCH 1/5] fix send buffer check

2007-11-09 Thread Herbert Xu
On Mon, Oct 29, 2007 at 05:22:53PM -0400, Hideo AOKI wrote:
> This patch introduces sndbuf size check before memory allocation for
> send buffer.

Looks good, what about IPv6?

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/5] accounting unit and variable

2007-11-09 Thread Herbert Xu
On Mon, Oct 29, 2007 at 05:23:10PM -0400, Hideo AOKI wrote:
>  
> +#define SK_DATAGRAM_MEM_QUANTUM ((int)PAGE_SIZE)
> +
> +static inline int sk_datagram_pages(int amt)
> +{
> + return DIV_ROUND_UP(amt, SK_DATAGRAM_MEM_QUANTUM);
> +}

Does this really have to be int? Unsigned would let the compiler
optimise this to a simple shift.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
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] dependencies for platform drivers (was Re: ax88796: add superh to kconfig dependencies)

2007-11-09 Thread Russell King
On Fri, Nov 09, 2007 at 06:40:23PM +0900, Paul Mundt wrote:
> On Fri, Nov 09, 2007 at 09:26:52AM +, Ralf Baechle wrote:
> > If writesb() is not an official API then maybe the answer should have been
> > to either add that API to other architectures or fix the driver.
> > 
> > I guess this incident means I need to go through all Kconfig* files to
> > see what bogus architecture dependencies on MIPS or !MIPS exist ...
> > 
> While writesb() isn't an official API, the iowriteX_rep() interfaces
> theoretically are. Tidying up the driver for iomap is probably a better
> option.

writesb() predates iowriteX_rep() interfaces by quite a number of years,
though if you're using writesb(), converting over to iowriteX_rep() is
really a no-brainer.

writesb() is effectively what mmio_outsb() is, and exists to do what
outsb() does but for peripherals mapped using ioremap on ARM rather
than trying to emulate them via the legacy x86 IO interfaces.

Note that it would've been far better that whoever invented mmio_outsb()
looked around and noticed that some of us already have an implementation
called writesb()... but time has proven that folk seem to be blinkered
to anything not x86.

-- 
Russell King
 Linux kernel2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
-
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] dependencies for platform drivers (was Re: ax88796: add superh to kconfig dependencies)

2007-11-09 Thread Ben Dooks
On Thu, Nov 08, 2007 at 08:18:54AM +, Al Viro wrote:
> On Thu, Nov 08, 2007 at 04:31:05PM +0900, Magnus Damm wrote:
> >  config AX88796
> > tristate "ASIX AX88796 NE2000 clone support"
> > -   depends on ARM || MIPS
> > +   depends on ARM || MIPS || SUPERH
> 
> You know, that really sucks more and more.  How about doing the following:
>   a) making it depend on PLAT_HAS_AX88796
>   b) adding selects for all subarchitectures that have the corresponding
> platform device
> and setting that as a uniform policy for platform drivers?  For things like
> SM501 we would do
> config MFD_SM501
>   depends on PCI || PLAT_HAS_SM501
> etc.

The PLAT_HAS_xxx method is nice, and I would like it applied to other places
in the kernel (see libata arugment below), and would have acked
this patch if it hadn't already been applied by Jeff.

The only reservation is that this doesn't show up the posibilty
of having the driver in the menuconfig, but anyone adding new
board support (should) be bright enough to look through the
Kconfig scripts before deciding they need to write an entirely
new driver.

I would note you may want to do PLAT_HAS_NET_AX88796 as there is
entirely a posibility of confusing this with the simple parallel
port driver which a board may not have support for.

> Seriously, folks, we are getting shitloads of platform drivers with no
> dependencies whatsoever, needed on a handful of targets and occasionally
> failing to build on unrelated architectures.  Moreover, having a list
> of architectures in dependencies for each of those suckers is a PITA
> from the conflict POV.  Not to mention platform drivers that fall into
> the mainline kernel with not a single platform device for them, etc.

There is a general problem with chicken-vs-egg here, how do you submit
support for a machine's platform device without the platform device
being there (and vice-versa) with seperate maintainers for network
and machine support?

One of my colleagues has passed along comments you made about a pair
of the simtec drivers (simtec-i2c and simtec-ide) which have been
added, but have no current users as patches have been stalled either
in submission process, or awaiting for an resolution. In the case
of simtec-ide, I would like to replace it with platform-ata, but
the libata maintainers seem wholy un-interested in
PLAT_HAS_PLATFORM_ATA or similar.

-- 
Ben ([EMAIL PROTECTED], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
-
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] dependencies for platform drivers (was Re: ax88796: add superh to kconfig dependencies)

2007-11-09 Thread Ben Dooks
On Fri, Nov 09, 2007 at 06:40:23PM +0900, Paul Mundt wrote:
> On Fri, Nov 09, 2007 at 09:26:52AM +, Ralf Baechle wrote:
> > If writesb() is not an official API then maybe the answer should have been
> > to either add that API to other architectures or fix the driver.
> > 
> > I guess this incident means I need to go through all Kconfig* files to
> > see what bogus architecture dependencies on MIPS or !MIPS exist ...
> > 
> While writesb() isn't an official API, the iowriteX_rep() interfaces
> theoretically are. Tidying up the driver for iomap is probably a better
> option.

If anyone else isn't interested in doing this, and there are
no objections to having it done, then I would be willing to
look at moving to the iowrite interfaces.

The only other way would be to add an 8/16bit configuration
to drop the use of writesb, as I belive most people connect
these devices in 16bit mode.

-- 
Ben ([EMAIL PROTECTED], http://www.fluff.org/)

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


Re: [PATCH 3/5] memory accounting

2007-11-09 Thread Herbert Xu
On Mon, Oct 29, 2007 at 05:23:21PM -0400, Hideo AOKI wrote:
> This patch adds UDP memory usage accounting in IPv4.
> 
> --
> Hideo Aoki
> Hitachi Computer Products (America) Inc.

> 
> Signed-off-by: Satoshi Oshima <[EMAIL PROTECTED]>
> Signed-off-by: Hideo Aoki <[EMAIL PROTECTED]>

This looks fine for now.  Although in future I'd prefer this
to use the forward alloc model used by stream sockets.  In fact
we should be able to share most of that code too.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
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] Un-define the IPTUNNEL_XMIT() macro

2007-11-09 Thread Pavel Emelyanov
This one is used in all the smth-to-ip tunnels we have and
looks ... not very good. Make this a regular function in the
tunnel4.ko module.

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/include/net/ipip.h b/include/net/ipip.h
index 7cdc914..bc8f4a1 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -25,23 +25,7 @@ struct ip_tunnel
struct ip_tunnel_parm   parms;
 };
 
-#define IPTUNNEL_XMIT() do {   \
-   int err;\
-   int pkt_len = skb->len; \
-   \
-   skb->ip_summed = CHECKSUM_NONE; \
-   iph->tot_len = htons(skb->len); \
-   ip_select_ident(iph, &rt->u.dst, NULL); \
-   ip_send_check(iph); \
-   \
-   err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, rt->u.dst.dev, 
dst_output);\
-   if (net_xmit_eval(err) == 0) {  \
-   stats->tx_bytes += pkt_len; \
-   stats->tx_packets++;\
-   } else {\
-   stats->tx_errors++; \
-   stats->tx_aborted_errors++; \
-   }   \
-} while (0)
+void iptunnel_xmit(struct sk_buff *skb, struct rtable *rt,
+   struct net_device_stats *stats);
 
 #endif
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 02b02a8..4fc19b3 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -882,7 +882,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct 
net_device *dev)
 
nf_reset(skb);
 
-   IPTUNNEL_XMIT();
+   iptunnel_xmit(skb, rt, stats);
tunnel->recursion--;
return 0;
 
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 8c2b2b0..01f6d34 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -638,7 +638,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct 
net_device *dev)
 
nf_reset(skb);
 
-   IPTUNNEL_XMIT();
+   iptunnel_xmit(skb, rt, stats);
tunnel->recursion--;
return 0;
 
diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
index a794a8c..c71617c 100644
--- a/net/ipv4/tunnel4.c
+++ b/net/ipv4/tunnel4.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -71,6 +72,32 @@ int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, 
unsigned short family)
 
 EXPORT_SYMBOL(xfrm4_tunnel_deregister);
 
+void iptunnel_xmit(struct sk_buff *skb, struct rtable *rt,
+   struct net_device_stats *stats)
+{
+   int err;
+   struct iphdr *iph = ip_hdr(skb);
+   int pkt_len = skb->len;
+
+   skb->ip_summed = CHECKSUM_NONE;
+   iph->tot_len = htons(skb->len);
+   ip_select_ident(iph, &rt->u.dst, NULL);
+   ip_send_check(iph);
+
+   err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL,
+   rt->u.dst.dev, dst_output);
+
+   if (net_xmit_eval(err) == 0) {
+   stats->tx_bytes += pkt_len;
+   stats->tx_packets++;
+   } else {
+   stats->tx_errors++;
+   stats->tx_aborted_errors++;
+   }
+}
+
+EXPORT_SYMBOL(iptunnel_xmit);
+
 static int tunnel4_rcv(struct sk_buff *skb)
 {
struct xfrm_tunnel *handler;
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 71433d2..49b30ca 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -579,7 +579,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct 
net_device *dev)
 
nf_reset(skb);
 
-   IPTUNNEL_XMIT();
+   iptunnel_xmit(skb, rt, stats);
tunnel->recursion--;
return 0;
 
-- 
1.5.3.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


[PATCH 2/4] Add missed tunnel64_err handler

2007-11-09 Thread Pavel Emelyanov
The tunnel64_protocol uses the tunnel4_protocol's err_handler and
thus calls the tunnel4_protocol's handlers.

This is not very good, as in case of (icmp) error the wrong error
handlers will be called (e.g. ipip ones instead of sit) and this
won't be noticed at all, because the error is not reported.

Was that made deliberately and I miss something?

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
index c71617c..7938430 100644
--- a/net/ipv4/tunnel4.c
+++ b/net/ipv4/tunnel4.c
@@ -145,6 +145,17 @@ static void tunnel4_err(struct sk_buff *skb, u32 info)
break;
 }
 
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+static void tunnel64_err(struct sk_buff *skb, u32 info)
+{
+   struct xfrm_tunnel *handler;
+
+   for (handler = tunnel64_handlers; handler; handler = handler->next)
+   if (!handler->err_handler(skb, info))
+   break;
+}
+#endif
+
 static struct net_protocol tunnel4_protocol = {
.handler=   tunnel4_rcv,
.err_handler=   tunnel4_err,
@@ -154,7 +165,7 @@ static struct net_protocol tunnel4_protocol = {
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 static struct net_protocol tunnel64_protocol = {
.handler=   tunnel64_rcv,
-   .err_handler=   tunnel4_err,
+   .err_handler=   tunnel64_err,
.no_policy  =   1,
 };
 #endif
-- 
1.5.3.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


[PATCH 3/4] Cleanup the xfrm4_tunnel_(un)register

2007-11-09 Thread Pavel Emelyanov
Both check for the family to select an appropriate tunnel list.
Consolidate this check and make the for() loop more readable.

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
index 7938430..b662a9e 100644
--- a/net/ipv4/tunnel4.c
+++ b/net/ipv4/tunnel4.c
@@ -18,6 +18,11 @@ static struct xfrm_tunnel *tunnel4_handlers;
 static struct xfrm_tunnel *tunnel64_handlers;
 static DEFINE_MUTEX(tunnel4_mutex);
 
+static inline struct xfrm_tunnel **fam_handlers(unsigned short family)
+{
+   return (family == AF_INET) ? &tunnel4_handlers : &tunnel64_handlers;
+}
+
 int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family)
 {
struct xfrm_tunnel **pprev;
@@ -26,8 +31,7 @@ int xfrm4_tunnel_register(struct xfrm_tunnel *handler, 
unsigned short family)
 
mutex_lock(&tunnel4_mutex);
 
-   for (pprev = (family == AF_INET) ? &tunnel4_handlers : 
&tunnel64_handlers;
-*pprev; pprev = &(*pprev)->next) {
+   for (pprev = fam_handlers(family); *pprev; pprev = &(*pprev)->next) {
if ((*pprev)->priority > priority)
break;
if ((*pprev)->priority == priority)
@@ -54,8 +58,7 @@ int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, 
unsigned short family)
 
mutex_lock(&tunnel4_mutex);
 
-   for (pprev = (family == AF_INET) ? &tunnel4_handlers : 
&tunnel64_handlers;
-*pprev; pprev = &(*pprev)->next) {
+   for (pprev = fam_handlers(family); *pprev; pprev = &(*pprev)->next) {
if (*pprev == handler) {
*pprev = handler->next;
ret = 0;
-- 
1.5.3.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


[PATCH 4/4] Consolidate equal handlers in tunnel4.c

2007-11-09 Thread Pavel Emelyanov
Two sets - tunnel[6]4_rcv() and tunnel[6]4_err - do the same
thing, but scan for different lists of tunnels, so this code
is easily consolidated.

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
index b662a9e..c85547d 100644
--- a/net/ipv4/tunnel4.c
+++ b/net/ipv4/tunnel4.c
@@ -101,14 +101,14 @@ void iptunnel_xmit(struct sk_buff *skb, struct rtable *rt,
 
 EXPORT_SYMBOL(iptunnel_xmit);
 
-static int tunnel4_rcv(struct sk_buff *skb)
+static int tunnel_rcv(struct xfrm_tunnel *handlers, struct sk_buff *skb)
 {
struct xfrm_tunnel *handler;
 
if (!pskb_may_pull(skb, sizeof(struct iphdr)))
goto drop;
 
-   for (handler = tunnel4_handlers; handler; handler = handler->next)
+   for (handler = handlers; handler; handler = handler->next)
if (!handler->handler(skb))
return 0;
 
@@ -119,43 +119,36 @@ drop:
return 0;
 }
 
+static int tunnel4_rcv(struct sk_buff *skb)
+{
+   return tunnel_rcv(tunnel4_handlers, skb);
+}
+
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 static int tunnel64_rcv(struct sk_buff *skb)
 {
-   struct xfrm_tunnel *handler;
-
-   if (!pskb_may_pull(skb, sizeof(struct iphdr)))
-   goto drop;
-
-   for (handler = tunnel64_handlers; handler; handler = handler->next)
-   if (!handler->handler(skb))
-   return 0;
-
-   icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
-
-drop:
-   kfree_skb(skb);
-   return 0;
+   return tunnel_rcv(tunnel64_handlers, skb);
 }
 #endif
 
-static void tunnel4_err(struct sk_buff *skb, u32 info)
+static void tunnel_err(struct xfrm_tunnel *handlers, struct sk_buff *skb, u32 
i)
 {
struct xfrm_tunnel *handler;
 
-   for (handler = tunnel4_handlers; handler; handler = handler->next)
-   if (!handler->err_handler(skb, info))
+   for (handler = handlers; handler; handler = handler->next)
+   if (!handler->err_handler(skb, i))
break;
 }
 
+static void tunnel4_err(struct sk_buff *skb, u32 info)
+{
+   tunnel_err(tunnel4_handlers, skb, info);
+}
+
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 static void tunnel64_err(struct sk_buff *skb, u32 info)
 {
-   struct xfrm_tunnel *handler;
-
-   for (handler = tunnel64_handlers; handler; handler = handler->next)
-   if (!handler->err_handler(skb, info))
-   break;
+   tunnel_err(tunnel64_handlers, skb, info);
 }
 #endif
 
-- 
1.5.3.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 0/5] fixups for mpc8360 rev. 2.1 erratum #2 (RGMII Timing)

2007-11-09 Thread Anton Vorontsov
On Thu, Nov 08, 2007 at 01:11:35PM -0600, Kim Phillips wrote:
[...]
> right, but whether it does or not doesn't affect your failure outcome
> either I'm assuming.
> 
> > > If it's something like 0x03, the u-boot patch will probably look like:
> > > 
> > > if ((bcsr[12] == 0x10) &&
> > > (immr->sysconf.spridr == SPR_8360_REV21 ||
> > >  immr->sysconf.spridr == SPR_8360E_REV21))
> > >   /* if phy-connection-type is "rgmii-id", set it to "rgmii-rxid" */
> > > ...
> > > 
> > > but these linux patches would remain the same (the clk and data delay
> > > settings for the UCC's are still valid; it's just the PHY config
> > > that is triggering your problem from what I can tell).
> > 
> > Yup, most likely this is not UCC specific, but PHY. For some reason
> > delays making harm here...

And today I was unable to reproduce yesterday's behaviour. Your
patches works fine, with sixth patch and without it. With -rxid
and with just -id.

Though, after few resets I hit on that:

- - - -
U-Boot 1.3.0-rc3-g281df457-dirty (Nov  6 2007 - 18:19:35) MPC83XX

Reset Status: External/Internal Soft, External/Internal Hard

CPU:   e300c1, MPC8360E, Rev: 21 at 528 MHz, CSB:  264 MHz
Board: Freescale MPC8360EMDS
I2C:   ready
DRAM:  256 MB (DDR2, 64-bit, ECC on)
SDRAM: 64 MB (local bus)
FLASH: 32 MB
In:serial
Out:   serial
Err:   serial
Net:   UEC: PHY is Marvell 88E11x1 (1410cc2)
FSL UEC0: Full Duplex
switching to rgmii 100
FSL UEC0: Speed 100BT
FSL UEC0: Link is up
read wrong value : mii_id 1,mii_reg 2, base e0103120
read wrong value : mii_id 1,mii_reg 3, base e0103120
UEC: PHY is Generic MII ()
read wrong value : mii_id 1,mii_reg 1, base e0103120
read wrong value : mii_id 1,mii_reg 1, base e0103120
read wrong value : mii_id 1,mii_reg 5, base e0103120
FSL UEC1: Full Duplex
switching to rgmii 100
FSL UEC1: Speed 100BT
FSL UEC1: Link is up
FSL UEC0, FSL UEC1
- - - -

And UCC1 does not work at all. After another reset that message
disappears and it does work again.


So, I think hardware is tricking me in various ways, not your
patches fault.

:-(

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ehea: Add kdump support

2007-11-09 Thread Thomas Klein
To support ehea driver reloading in a kdump kernel the driver has to perform
firmware handle deregistrations when the original kernel crashes. As there's
currently no notifier chain for machine crashes this patch enables kdump support
in the ehea driver by bending the ppc_md.machine_crash_shutdown hook to its own
machine crash handler. The original machine_crash_shutdown() fn is called
afterwards. This works fine as long as the ehea driver is the only one which
does so. Problems may occur if other drivers do the same and unload regularly.
This patch enables 2.6.24-rc2 to use kdump with ehea and only puts a very
low risk on base kernel. In 2.6.24 we know ehea is the only user of this
mechanism. The next step for 2.6.25 would be to add a proper notifier chain.
The full solution might be that register_reboot_notifier() provides sth
like a SYS_CRASH action. Please apply.

Signed-off-by: Thomas Klein <[EMAIL PROTECTED]>

---
 drivers/net/ehea/ehea.h  |2 +-
 drivers/net/ehea/ehea_main.c |   28 
 2 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index f78e5bf..5935899 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
 #include 
 
 #define DRV_NAME   "ehea"
-#define DRV_VERSION"EHEA_0080"
+#define DRV_VERSION"EHEA_0081"
 
 /* eHEA capability flags */
 #define DLPAR_PORT_ADD_REM 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index f0319f1..40a732e 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -37,6 +37,7 @@
 #include 
 
 #include 
+#include 
 
 #include "ehea.h"
 #include "ehea_qmr.h"
@@ -98,6 +99,7 @@ static int port_name_cnt = 0;
 static LIST_HEAD(adapter_list);
 u64 ehea_driver_flags = 0;
 struct work_struct ehea_rereg_mr_task;
+static void (*orig_machine_crash_shutdown)(struct pt_regs *regs);
 
 struct semaphore dlpar_mem_lock;
 
@@ -3312,6 +3314,29 @@ static struct notifier_block ehea_reboot_nb = {
 .notifier_call = ehea_reboot_notifier,
 };
 
+void ehea_crash_notifier(struct pt_regs *regs)
+{
+   ehea_info("Machine crash: freeing all eHEA resources");
+   ibmebus_unregister_driver(&ehea_driver);
+   orig_machine_crash_shutdown(regs);
+}
+
+void ehea_register_crash_notifier(void)
+{
+#ifdef CONFIG_KEXEC
+   orig_machine_crash_shutdown =
+   (void*)__xchg_u64((unsigned 
long*)&ppc_md.machine_crash_shutdown,
+(unsigned long)ehea_crash_notifier);
+#endif
+}
+
+void ehea_unregister_crash_notifier(void)
+{
+#ifdef CONFIG_KEXEC
+   ppc_md.machine_crash_shutdown = orig_machine_crash_shutdown;
+#endif
+}
+
 static int check_module_parm(void)
 {
int ret = 0;
@@ -3369,6 +3394,7 @@ int __init ehea_module_init(void)
goto out;
 
register_reboot_notifier(&ehea_reboot_nb);
+   ehea_register_crash_notifier();
 
ret = ibmebus_register_driver(&ehea_driver);
if (ret) {
@@ -3382,6 +3408,7 @@ int __init ehea_module_init(void)
ehea_error("failed to register capabilities attribute, ret=%d",
   ret);
unregister_reboot_notifier(&ehea_reboot_nb);
+   ehea_unregister_crash_notifier();
ibmebus_unregister_driver(&ehea_driver);
goto out;
}
@@ -3396,6 +3423,7 @@ static void __exit ehea_module_exit(void)
driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities);
ibmebus_unregister_driver(&ehea_driver);
unregister_reboot_notifier(&ehea_reboot_nb);
+   ehea_unregister_crash_notifier();
ehea_destroy_busmap();
 }
 
-- 
1.5.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


Re: [PATCH 0/5] fixups for mpc8360 rev. 2.1 erratum #2 (RGMII Timing)

2007-11-09 Thread Anton Vorontsov
On Mon, Nov 05, 2007 at 12:15:30PM -0600, Kim Phillips wrote:
> Hello all,
> 
> the following patches fix RGMII timing for rev. 2.1 of the mpc8360,
> according to erratum #2 (erratum text included below).  Basically the
> most intrusive part is the addition of two new RGMII Internal Delay
> modes; one for TX delay only, and the other for RX delay only (i.e, not
> both at the same time).
> 
> Please review, and since this affects both netdev and powerpc trees,
> one maintainer should ack them for the other to push upstream (i.e,
> Kumar acks them, and Leo picks them up to go through netdev or the
> other way around; either way is fine with me).  I'm hoping they're
> trivial enough to go in 2.6.24.

All five patches are

Tested-by: Anton Vorontsov <[EMAIL PROTECTED]>


Let's hope they'll hit 2.6.24.

Thanks,

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
-
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][PACKET] Use existing sock refcnt debugging infrastructure

2007-11-09 Thread Pavel Emelyanov
The packet_socks_nr variable is used purely for debugging
the number of sockets.

As Arnaldo pointed out, there's already an infrastructure
for this purposes, so switch to using it.

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 4cb2dfb..36331a5 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -139,9 +139,6 @@ dev->hard_header == NULL (ll header is added by device, we 
cannot control it)
 static HLIST_HEAD(packet_sklist);
 static DEFINE_RWLOCK(packet_sklist_lock);
 
-static atomic_t packet_socks_nr;
-
-
 /* Private packet socket structures. */
 
 struct packet_mclist
@@ -236,10 +233,7 @@ static void packet_sock_destruct(struct sock *sk)
return;
}
 
-   atomic_dec(&packet_socks_nr);
-#ifdef PACKET_REFCNT_DEBUG
-   printk(KERN_DEBUG "PACKET socket %p is free, %d are alive\n", sk, 
atomic_read(&packet_socks_nr));
-#endif
+   sk_refcnt_debug_dec(sk);
 }
 
 
@@ -849,6 +843,7 @@ static int packet_release(struct socket *sock)
/* Purge queues */
 
skb_queue_purge(&sk->sk_receive_queue);
+   sk_refcnt_debug_release(sk);
 
sock_put(sk);
return 0;
@@ -1010,7 +1005,7 @@ static int packet_create(struct net *net, struct socket 
*sock, int protocol)
po->num = proto;
 
sk->sk_destruct = packet_sock_destruct;
-   atomic_inc(&packet_socks_nr);
+   sk_refcnt_debug_inc(sk);
 
/*
 *  Attach a protocol block
-- 
1.5.3.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] Fix buglets in mpc5200 FEC code that are corrupting memory.

2007-11-09 Thread Grant Likely
On 11/9/07, Domen Puncer <[EMAIL PROTECTED]> wrote:
> On 09/11/07 00:31 -0500, Jon Smirl wrote:
> > This is the reason I couldn't get user space started or connect to my
> > nfs server. Patch is against current linus git.
> >
> > mpc5200 fec driver is corrupting memory. This patch fixes two bugs
> > where the wrong skb buffer was being referenced.
> >
> > Signed-off-by: Jon Smirl <[EMAIL PROTECTED]>
>
> Acked-by: Domen Puncer <[EMAIL PROTECTED]>

Signed-off-by: Grant Likely <[EMAIL PROTECTED]>

Jeff, can you please pick this up for .24?

Thanks,
g.

>
> I can't test it at the moment, but the patch is obviously correct,
> mapped buffer should be the _same_ as submitted.
>
> >
> > ---
> >
> >  drivers/net/fec_mpc52xx.c |4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >
> >
> > diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
> > index a8a0ee2..ddfcc0b 100644
> > --- a/drivers/net/fec_mpc52xx.c
> > +++ b/drivers/net/fec_mpc52xx.c
> > @@ -422,7 +422,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int
> > irq, void *dev_id)
> >
> >   rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status,
> >   (struct bcom_bd **)&bd);
> > - dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, 
> > DMA_FROM_DEVICE);
> > + dma_unmap_single(&dev->dev, bd->skb_pa, rskb->len, 
> > DMA_FROM_DEVICE);
> >
> >   /* Test for errors in received frame */
> >   if (status & BCOM_FEC_RX_BD_ERRORS) {
> > @@ -467,7 +467,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int
> > irq, void *dev_id)
> >   bcom_prepare_next_buffer(priv->rx_dmatsk);
> >
> >   bd->status = FEC_RX_BUFFER_SIZE;
> > - bd->skb_pa = dma_map_single(&dev->dev, rskb->data,
> > + bd->skb_pa = dma_map_single(&dev->dev, skb->data,
> >   FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);
> >
> >   bcom_submit_next_buffer(priv->rx_dmatsk, skb);
> >
> >
> > --
> > Jon Smirl
> > [EMAIL PROTECTED]
>
> --
> Domen Puncer | Research & Development
> .
> Telargo d.o.o. | Zagrebška cesta 20 | 2000 Maribor | Slovenia
> .
> www.telargo.com
>


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
-
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][IPX] Use existing sock refcnt debugging infrastructure

2007-11-09 Thread Pavel Emelyanov
Just like in the af_packet.c, the ipx_sock_nr variable is used
for debugging purposes.

Switch to using existing infrastructure. Thanks to Arnaldo for
pointing this out.

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index a195a66..c76a952 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -92,11 +92,6 @@ extern int ipxrtr_route_skb(struct sk_buff *skb);
 extern struct ipx_route *ipxrtr_lookup(__be32 net);
 extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg);
 
-#undef IPX_REFCNT_DEBUG
-#ifdef IPX_REFCNT_DEBUG
-atomic_t ipx_sock_nr;
-#endif
-
 struct ipx_interface *ipx_interfaces_head(void)
 {
struct ipx_interface *rc = NULL;
@@ -151,14 +146,7 @@ static void ipx_destroy_socket(struct sock *sk)
 {
ipx_remove_socket(sk);
skb_queue_purge(&sk->sk_receive_queue);
-#ifdef IPX_REFCNT_DEBUG
-   atomic_dec(&ipx_sock_nr);
-   printk(KERN_DEBUG "IPX socket %p released, %d are still alive\n", sk,
-   atomic_read(&ipx_sock_nr));
-   if (atomic_read(&sk->sk_refcnt) != 1)
-   printk(KERN_DEBUG "Destruction sock ipx %p delayed, cnt=%d\n",
-   sk, atomic_read(&sk->sk_refcnt));
-#endif
+   sk_refcnt_debug_dec(sk);
sock_put(sk);
 }
 
@@ -1384,11 +1372,8 @@ static int ipx_create(struct net *net, struct socket 
*sock, int protocol)
sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto);
if (!sk)
goto out;
-#ifdef IPX_REFCNT_DEBUG
-   atomic_inc(&ipx_sock_nr);
-   printk(KERN_DEBUG "IPX socket %p created, now we have %d alive\n", sk,
-   atomic_read(&ipx_sock_nr));
-#endif
+
+   sk_refcnt_debug_inc(sk);
sock_init_data(sock, sk);
sk->sk_no_check = 1;/* Checksum off by default */
sock->ops = &ipx_dgram_ops;
@@ -1409,6 +1394,7 @@ static int ipx_release(struct socket *sock)
 
sock_set_flag(sk, SOCK_DEAD);
sock->sk = NULL;
+   sk_refcnt_debug_release(sk);
ipx_destroy_socket(sk);
 out:
return 0;
-- 
1.5.3.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][PACKET] Use existing sock refcnt debugging infrastructure

2007-11-09 Thread Arnaldo Carvalho de Melo
Em Fri, Nov 09, 2007 at 04:39:41PM +0300, Pavel Emelyanov escreveu:
> The packet_socks_nr variable is used purely for debugging
> the number of sockets.
> 
> As Arnaldo pointed out, there's already an infrastructure
> for this purposes, so switch to using it.
> 
> Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

Acked-by: Arnaldo Carvalho de Melo <[EMAIL PROTECTED]>
 
> ---
> 
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 4cb2dfb..36331a5 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -139,9 +139,6 @@ dev->hard_header == NULL (ll header is added by device, 
> we cannot control it)
>  static HLIST_HEAD(packet_sklist);
>  static DEFINE_RWLOCK(packet_sklist_lock);
>  
> -static atomic_t packet_socks_nr;
> -
> -
>  /* Private packet socket structures. */
>  
>  struct packet_mclist
> @@ -236,10 +233,7 @@ static void packet_sock_destruct(struct sock *sk)
>   return;
>   }
>  
> - atomic_dec(&packet_socks_nr);
> -#ifdef PACKET_REFCNT_DEBUG
> - printk(KERN_DEBUG "PACKET socket %p is free, %d are alive\n", sk, 
> atomic_read(&packet_socks_nr));
> -#endif
> + sk_refcnt_debug_dec(sk);
>  }
>  
>  
> @@ -849,6 +843,7 @@ static int packet_release(struct socket *sock)
>   /* Purge queues */
>  
>   skb_queue_purge(&sk->sk_receive_queue);
> + sk_refcnt_debug_release(sk);
>  
>   sock_put(sk);
>   return 0;
> @@ -1010,7 +1005,7 @@ static int packet_create(struct net *net, struct socket 
> *sock, int protocol)
>   po->num = proto;
>  
>   sk->sk_destruct = packet_sock_destruct;
> - atomic_inc(&packet_socks_nr);
> + sk_refcnt_debug_inc(sk);
>  
>   /*
>*  Attach a protocol block
> -- 
> 1.5.3.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
-
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][IPX] Use existing sock refcnt debugging infrastructure

2007-11-09 Thread Arnaldo Carvalho de Melo
Em Fri, Nov 09, 2007 at 04:42:05PM +0300, Pavel Emelyanov escreveu:
> Just like in the af_packet.c, the ipx_sock_nr variable is used
> for debugging purposes.
> 
> Switch to using existing infrastructure. Thanks to Arnaldo for
> pointing this out.
> 
> Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

Acked-by: Arnaldo Carvalho de Melo <[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


[RFC][PATCH][LLC] Use existing sock refcnt debugging

2007-11-09 Thread Pavel Emelyanov
Hi, Arnaldo.

I've grep-ed through the code and found one more place, where
the sk refcnt debugging is required, but is still performed in
an old fashion - this is the LLC2.

The problem in using the sk_refcnt_debug_xxx here is that these
socks do not provide the sk_destruct callback to catch the 
moment of the sock destruction.

Making this callback mandatory is not a good solution, as most 
often it will be empty and thus useless. Making this callback 
be set under the #ifdef SOCK_REFCNT_DEBUG is even more ugly 
than the previous one.

So, I propose to extend the sk_refcnt_debug_xxx set of helperf 
for those socks not having the sk_destruct callback by default,
like the LLC2 ones.

The new helper is sk_refcnt_debug_inc_undo(sk) sets the 
sk_destruct callback into the sk_refcnt_debug_dec() in case the
SOCK_REFCNT_DEBUG is on.

What do you think about it?

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/include/net/sock.h b/include/net/sock.h
index 5504fb9..1404ab9 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -654,10 +654,21 @@ static inline void sk_refcnt_debug_release(const struct 
sock *sk)
printk(KERN_DEBUG "Destruction of the %s socket %p delayed, 
refcnt=%d\n",
   sk->sk_prot->name, sk, atomic_read(&sk->sk_refcnt));
 }
+
+/*
+ * this one is to be used *only* for thouse socks, that
+ * do not have their own sk_destruct callback
+ */
+static inline void sk_refcnt_debug_inc_undo(struct sock *sk)
+{
+   sk_refcnt_debug_inc(sk);
+   sk->sk_destruct = sk_refcnt_debug_dec;
+}
 #else /* SOCK_REFCNT_DEBUG */
 #define sk_refcnt_debug_inc(sk) do { } while (0)
 #define sk_refcnt_debug_dec(sk) do { } while (0)
 #define sk_refcnt_debug_release(sk) do { } while (0)
+#define sk_refcnt_debug_inc_undo(sk) do { } while (0)
 #endif /* SOCK_REFCNT_DEBUG */
 
 /* Called with local bh disabled */
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 5c0b484..6ee8778 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -775,11 +775,6 @@ drop_unlock:
goto out;
 }
 
-#undef LLC_REFCNT_DEBUG
-#ifdef LLC_REFCNT_DEBUG
-static atomic_t llc_sock_nr;
-#endif
-
 /**
  * llc_backlog_rcv - Processes rx frames and expired timers.
  * @sk: LLC sock (p8022 connection)
@@ -875,11 +870,7 @@ struct sock *llc_sk_alloc(struct net *net, int family, 
gfp_t priority, struct pr
goto out;
llc_sk_init(sk);
sock_init_data(NULL, sk);
-#ifdef LLC_REFCNT_DEBUG
-   atomic_inc(&llc_sock_nr);
-   printk(KERN_DEBUG "LLC socket %p created in %s, now we have %d 
alive\n", sk,
-   __FUNCTION__, atomic_read(&llc_sock_nr));
-#endif
+   sk_refcnt_debug_inc_undo(sk);
 out:
return sk;
 }
@@ -905,18 +896,7 @@ void llc_sk_free(struct sock *sk)
skb_queue_purge(&sk->sk_receive_queue);
skb_queue_purge(&sk->sk_write_queue);
skb_queue_purge(&llc->pdu_unack_q);
-#ifdef LLC_REFCNT_DEBUG
-   if (atomic_read(&sk->sk_refcnt) != 1) {
-   printk(KERN_DEBUG "Destruction of LLC sock %p delayed in %s, 
cnt=%d\n",
-   sk, __FUNCTION__, atomic_read(&sk->sk_refcnt));
-   printk(KERN_DEBUG "%d LLC sockets are still alive\n",
-   atomic_read(&llc_sock_nr));
-   } else {
-   atomic_dec(&llc_sock_nr);
-   printk(KERN_DEBUG "LLC socket %p released in %s, %d are still 
alive\n", sk,
-   __FUNCTION__, atomic_read(&llc_sock_nr));
-   }
-#endif
+   sk_refcnt_debug_release(sk);
sock_put(sk);
 }
 
-
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] Fix infinite loop on dev_mc_unsync()

2007-11-09 Thread Luis R. Rodriguez
While reviewing net/core/dev_mcast.c I found what I think is an 
infinite loop on dev_mc_unsync(). This fixes it. We make use of
this guy on mac80211 in ieee80211_stop(). This is untested.

Signed-off-by: Luis R. Rodriguez <[EMAIL PROTECTED]>

diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index 15241cf..5373c03 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -168,8 +168,10 @@ void dev_mc_unsync(struct net_device *to, struct 
net_device *from)
da = from->mc_list;
while (da != NULL) {
next = da->next;
-   if (!da->da_synced)
+   if (!da->da_synced) {
+   da = next;
continue;
+   }
__dev_addr_delete(&to->mc_list, &to->mc_count,
  da->da_addr, da->da_addrlen, 0);
da->da_synced = 0;
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2.6.24] RDMA/cxgb3: Set the max_qp_init_rd_atom attribute.

2007-11-09 Thread Steve Wise

RDMA/cxgb3: Set the max_qp_init_rd_atom attribute.

Attribute max_qp_init_rd_atom is not getting set.  Version 1.0.4 of
librdmacm now validates the user's requested initiator and responder
resources vs the max supported by the device.  Since iw_cxgb3 wasn't
setting this attribute (and it defaulted to 0), all rdma_connect()s fail
if there are initiator resources requested by the app.

Signed-off-by: Steve Wise <[EMAIL PROTECTED]>
---

 drivers/infiniband/hw/cxgb3/iwch_provider.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c 
b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index f0c7775..b5436ca 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -1000,6 +1000,7 @@ static int iwch_query_device(struct ib_device *ibdev,
props->max_sge = dev->attr.max_sge_per_wr;
props->max_sge_rd = 1;
props->max_qp_rd_atom = dev->attr.max_rdma_reads_per_qp;
+   props->max_qp_init_rd_atom = dev->attr.max_rdma_reads_per_qp;
props->max_cq = dev->attr.max_cqs;
props->max_cqe = dev->attr.max_cqes_per_cq;
props->max_mr = dev->attr.max_mem_regs;
-
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] using mii-bitbang on different processor ports - update the booting-without-of.txt-file

2007-11-09 Thread Scott Wood

Sergej Stepanov wrote:
We also need to change the reference to port C in fsl,mdio-pin and 
fsl,mdc-pin.

Do you mean this:
   Currently defined compatibles:
   fsl,pq1-fec-mdio (reg is same as first resource of FEC device)
-> fsl,cpm2-mdio-bitbang (reg is port C registers)

   Properties for fsl,cpm2-mdio-bitbang:
-> fsl,mdio-pin : pin of port C controlling mdio data
-> fsl,mdc-pin : pin of port C controlling mdio clock


Yes.


Right. But i thought it would be related to the example,
and than the reader gets the short comment about I/O ports.


No, the example is the example, and the spec is the spec. :-)


Or the other variant would be:

   iv) MDIO

   Currently defined compatibles:
   fsl,pq1-fec-mdio (reg is same as first resource of FEC device)
   fsl,cpm2-mdio-bitbang (reg is the I/O port register block(s))

   Properties for fsl,cpm2-mdio-bitbang:
   The first reg resource is the I/O port register block on which MDIO
   resides.  The second reg resource is the I/O port register block on
   which MDC resides.  If there is only one reg resource, it is used for
   both MDIO and MDC.
   fsl,mdio-pin : pin of chosen port for controlling mdio data
   fsl,mdc-pin : pin of chosen port for controlling mdio clock


Looks good.  We can eliminate the parenthetical for 
fsl,cpm2-mdio-bitbang because reg is now explained below.


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


Re: [PATCH 02/05] ipv6: RFC4214 Support (2)

2007-11-09 Thread osprey67

YOSHIFUJI Hideaki / 吉藤英明 wrote:

In article <[EMAIL PROTECTED]> (at Thu, 08 Nov 2007 12:41:39 -0800), osprey67 
<[EMAIL PROTECTED]> says:


From: Fred L. Templin <[EMAIL PROTECTED]>

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
"ip" utility with device names beginning with: "isatap".

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin <[EMAIL PROTECTED]>


Hmm...tabs are still mangled, and it's better to have your
official address.  Anyway...


I have switched over to Thunderbird and POP mail. I submitted
the patches by cutting and pasting from a text file into the
mail message. Is there a way to stop it from clobbering tabs?


--- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08 
12:06:17.0 -0800
+++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-08 08:27:24.0 
-0800
@@ -241,6 +241,37 @@ static inline int ipv6_addr_is_ll_all_ro
 addr->s6_addr32[3] == htonl(0x0002));
  }

+#if defined(CONFIG_IPV6_ISATAP)
+static inline int ipv6_isatap_eui64(u8 *eui, __be32 addr)
+{
+
+   /* RFC3330 Special-Use IPv4 Addresses */
+   eui[0] = (((addr & htonl(0xFF00)) == htonl(0x)) ||
+ ((addr & htonl(0xFF00)) == htonl(0x0A00)) ||
+ ((addr & htonl(0xFF00)) == htonl(0x0D00)) ||
+ ((addr & htonl(0xFF00)) == htonl(0x1800)) ||
+ ((addr & htonl(0xFF00)) == htonl(0x7F00)) ||
+ ((addr & htonl(0x)) == htonl(0xA9FE)) ||
+ ((addr & htonl(0xFFF0)) == htonl(0xAC10)) ||
+ ((addr & htonl(0xFF00)) == htonl(0xC200)) ||
+ ((addr & htonl(0xFF00)) == htonl(0xC0586300)) ||
+ ((addr & htonl(0x)) == htonl(0xC0A8)) ||
+ ((addr & htonl(0xFFFE)) == htonl(0xC612)) ||
+ ((addr & htonl(0xF000)) == htonl(0xE000)) ||
+ ((addr & htonl(0xF000)) == htonl(0xF000))) ?
+   0x00 : 0x02;
+
+   eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
+   memcpy (eui+4, &addr, 4);
+   return 0;
+}
+


Please put this function in net/ipv6/addrconf.c as addrconf_ifid_isatap().

Please use MULTICAST, LOCALNET etc. (and probaly introduce new macro
for others).  IMHO, it's better to add a comment for each entry, e.g.,
MULTICAST(addr) ||  /* 224.0.0.0/4 */
instead of
((addr & htonl(0xF000)) == htonl(0xE000)) ||


OK - will do.


+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
+{
+   return ((addr->s6_addr32[2] | htonl(0x0200)) == htonl(0x02005EFE));
+}
+#endif
+


ipv6_addr_isatap(), maybe (to align with ipv6_addr_any() etc.).


Well, if you look in addrconf.h immediately above this the convention
seems to be to call it as "*_is_*" if it is testing an address and
to omit the "*_is_*" if it is setting an address. Since this is an
address test, maybe more consistent to keep the "*_is_*"?

Thanks - Fred
[EMAIL PROTECTED]



--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: [PATCH] PCI: export pci_restore_msi_state()

2007-11-09 Thread Linas Vepstas
On Thu, Nov 08, 2007 at 07:21:01PM -0600, Wen Xiong wrote:
> Hi Linas,
> 
> I saw you have submitted several patches to support pci-express network 
> adapters EEH. But looks only this patch fixed something in linux kernel 
> code.

And its an old patch, submitted long ago ... I've resubmitted, because
it seems that its the best/most correct thing to do.

> Do you mean I can test EEH callback functions in device driver after I 
> apply  this patch in the kernel?

Yes, please.  Note, however, I was never able to make the pci-e 
version of the e1000 work. It comes up, generates interrupts, and
registeres are readable and writeable. But it behvaes as if the PHY 
is turned off -- no network traffic goes thorugh. (I tried turning
PHY on explicitly; that didn't help). So there is still something 
wrong somewhere, probably in the e1000 deice driver. I'm guessing
the pci-e to pci-x bridge chip on that card is not quite resetting
the card completely.

> Do you do "pci_save_msi_state" somewhere in the kernel? Or you suggest to 
> do "pci_save_msi_state" and "pci_restore_msi_state" in each device driver?

There is no "save state", the msi state can't be saved. The MSI regs
are write-only, and they are controlled by firmware. The restore_state
function is the only one you need.

--linas
-
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 08/13] SCTP: Use hashed lookup when looking for an association.

2007-11-09 Thread Vlad Yasevich
Vlad Yasevich wrote:
> A SCTP endpoint may have a lot of associations on them and walking
> the list is fairly inefficient.  Instead, use a hashed lookup,
> and filter out the hash list based on the endopoint we already have.

This one is missing an unlock.  Will send an update shortly.

-vlad

> 
> Signed-off-by: Vlad Yasevich <[EMAIL PROTECTED]>
> ---
>  net/sctp/endpointola.c |   33 +
>  1 files changed, 21 insertions(+), 12 deletions(-)
> 
> diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
> index 2d2d81e..f38fa0f 100644
> --- a/net/sctp/endpointola.c
> +++ b/net/sctp/endpointola.c
> @@ -328,24 +328,33 @@ static struct sctp_association 
> *__sctp_endpoint_lookup_assoc(
>   const union sctp_addr *paddr,
>   struct sctp_transport **transport)
>  {
> + struct sctp_association *asoc = NULL;
> + struct sctp_transport *t = NULL;
> + struct sctp_hashbucket *head;
> + struct sctp_ep_common *epb;
> + int hash;
>   int rport;
> - struct sctp_association *asoc;
> - struct list_head *pos;
>  
> + *transport = NULL;
>   rport = ntohs(paddr->v4.sin_port);
>  
> - list_for_each(pos, &ep->asocs) {
> - asoc = list_entry(pos, struct sctp_association, asocs);
> - if (rport == asoc->peer.port) {
> - *transport = sctp_assoc_lookup_paddr(asoc, paddr);
> -
> - if (*transport)
> - return asoc;
> + hash = sctp_assoc_hashfn(ep->base.bind_addr.port, rport);
> + head = &sctp_assoc_hashtable[hash];
> + read_lock(&head->lock);
> + for (epb = head->chain; epb; epb = epb->next) {
> + asoc = sctp_assoc(epb);
> + if (asoc->ep != ep || rport != asoc->peer.port)
> + goto next;
> +
> + t = sctp_assoc_lookup_paddr(asoc, paddr);
> + if (t) {
> + *transport = t;
> + break;
>   }
> +next:
> + asoc = NULL;
>   }
> -
> - *transport = NULL;
> - return NULL;
> + return asoc;
>  }
>  
>  /* Lookup association on an endpoint based on a peer address.  BH-safe.  */

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


Re: [PATCH 2/2]: e1000: avoid lockup durig error recovery

2007-11-09 Thread Ingo Oeser
Hi Linas,

Linas Vepstas schrieb:
> Index: linux-2.6.23-rc8-mm1/include/linux/netdevice.h
> ===
> --- linux-2.6.23-rc8-mm1.orig/include/linux/netdevice.h   2007-09-26 
> 15:07:05.0 -0500
> +++ linux-2.6.23-rc8-mm1/include/linux/netdevice.h2007-11-07 
> 17:14:50.0 -0600
> @@ -384,6 +384,18 @@ static inline void napi_enable(struct na
>   clear_bit(NAPI_STATE_SCHED, &n->state);
>  }
>  
> +/**
> + *   napi_enabled_p - return non-zero if napi enabled
> + *   @n: napi context
> + * 
> + * Mnemonic: _p stands for "predicate", returning a yes/no
> + * answer to the question.

Call it "is_napi_enabled()" an nobody will ask :-)

> + */
> +static inline int napi_enabled_p(struct napi_struct *n)

And please make it return "bool" instead of "int".


Best Regards

Ingo Oeser
-
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 02/05] ipv6: RFC4214 Support

2007-11-09 Thread Ingo Oeser
YOSHIFUJI Hideaki / 吉藤英明 schrieb:
> In article <[EMAIL PROTECTED]> (at Wed, 7 Nov 2007 10:52:47 -0800), "Templin, 
> Fred L" <[EMAIL PROTECTED]> says:
> 
> > > > > > > + if (((ipv4 >= 0x0100) && (ipv4 < 0x0a00)) ||
> > > > > > > + ((ipv4 >= 0x0b00) && (ipv4 < 0x7f00)) ||
> > > > > > > + ((ipv4 >= 0x8000) && (ipv4 < 0xa9fe)) ||
> > > > > > > + ((ipv4 >= 0xa9ff) && (ipv4 < 0xac10)) ||
> > > > > > > + ((ipv4 >= 0xac20) && (ipv4 < 0xc0a8)) ||
> > > > > > > + ((ipv4 >= 0xc0a9) && (ipv4 < 0xc612)) ||
> > > > > > > + ((ipv4 >= 0xc614) && (ipv4 < 
> > > 0xe000))) eui[0] |=
> > > > > > > 0x2;
> 
> > Maybe it is I who did not understand. Can you suggest a clean solution?
> 
> You could write each element as LOOPBACK(), MULTICAST()
> etc.
>   eui[0] = (!ZERONETO(a) &&
> !PRIVATE_10(a) &&
> !LINKLOCAL(a) &&
> !PRIVATE_172(a) &&
> !PRIVATE_192(a) &&
> !NETICDEVBENCH(a) &&
> !MULTICAST(a)) ? 2 : 0;

Oh, yes that's great! Now even *I* can read what this is all about 
without reading any RFC :-)

Please Fred, try to do it that way.


Best Regards

Ingo Oeser
-
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] Fix infinite loop on dev_mc_unsync()

2007-11-09 Thread Luis R. Rodriguez
Sorry, forgot to CC David.

On Fri, Nov 09, 2007 at 10:11:35AM -0500, Luis R. Rodriguez wrote:

While reviewing net/core/dev_mcast.c I found what I think is an 
infinite loop on dev_mc_unsync(). This fixes it. We make use of
this guy on mac80211 in ieee80211_stop(). This is untested.

Signed-off-by: Luis R. Rodriguez <[EMAIL PROTECTED]>

diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index 15241cf..5373c03 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -168,8 +168,10 @@ void dev_mc_unsync(struct net_device *to, struct 
net_device *from)
da = from->mc_list;
while (da != NULL) {
next = da->next;
-   if (!da->da_synced)
+   if (!da->da_synced) {
+   da = next;
continue;
+   }
__dev_addr_delete(&to->mc_list, &to->mc_count,
  da->da_addr, da->da_addrlen, 0);
da->da_synced = 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] Fix infinite loop on dev_mc_unsync()

2007-11-09 Thread Joe Perches
On Fri, 2007-11-09 at 13:51 -0500, Luis R. Rodriguez wrote:
> While reviewing net/core/dev_mcast.c I found what I think is an 
> infinite loop on dev_mc_unsync(). This fixes it. We make use of
> this guy on mac80211 in ieee80211_stop(). This is untested.
> 
> Signed-off-by: Luis R. Rodriguez <[EMAIL PROTECTED]>
> 
> diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
> index 15241cf..5373c03 100644
> --- a/net/core/dev_mcast.c
> +++ b/net/core/dev_mcast.c
> @@ -168,8 +168,10 @@ void dev_mc_unsync(struct net_device *to, struct 
> net_device *from)
>   da = from->mc_list;
>   while (da != NULL) {
>   next = da->next;
> - if (!da->da_synced)
> + if (!da->da_synced) {
> + da = next;
>   continue;
> + }
>   __dev_addr_delete(&to->mc_list, &to->mc_count,
> da->da_addr, da->da_addrlen, 0);
>   da->da_synced = 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

Perhaps this is clearer as:

void dev_mc_unsync(struct net_device *to, struct net_device *from)
{
struct dev_addr_list *da;

netif_tx_lock_bh(from);
netif_tx_lock_bh(to);

da = from->mc_list;
while (da) {
if (da->da_synced) {
__dev_addr_delete(&to->mc_list, &to->mc_count,
  da->da_addr, da->da_addrlen, 0);
__dev_addr_delete(&from->mc_list, &from->mc_count,
  da->da_addr, da->da_addrlen, 0);
da->da_synced = 0;
}
da = da->next;
}

__dev_set_rx_mode(to);

netif_tx_unlock_bh(to);
netif_tx_unlock_bh(from);
}
EXPORT_SYMBOL(dev_mc_unsync);


-
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] Fix infinite loop on dev_mc_unsync()

2007-11-09 Thread Luis R. Rodriguez
On Fri, Nov 09, 2007 at 11:07:16AM -0800, Joe Perches wrote:
> On Fri, 2007-11-09 at 13:51 -0500, Luis R. Rodriguez wrote:
> > While reviewing net/core/dev_mcast.c I found what I think is an 
> > infinite loop on dev_mc_unsync(). This fixes it. We make use of
> > this guy on mac80211 in ieee80211_stop(). This is untested.
> > 
> > Signed-off-by: Luis R. Rodriguez <[EMAIL PROTECTED]>
> > 
> > diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
> > index 15241cf..5373c03 100644
> > --- a/net/core/dev_mcast.c
> > +++ b/net/core/dev_mcast.c
> > @@ -168,8 +168,10 @@ void dev_mc_unsync(struct net_device *to, struct 
> > net_device *from)
> > da = from->mc_list;
> > while (da != NULL) {
> > next = da->next;
> > -   if (!da->da_synced)
> > +   if (!da->da_synced) {
> > +   da = next;
> > continue;
> > +   }
> > __dev_addr_delete(&to->mc_list, &to->mc_count,
> >   da->da_addr, da->da_addrlen, 0);
> > da->da_synced = 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
> 
> Perhaps this is clearer as:
> 
> void dev_mc_unsync(struct net_device *to, struct net_device *from)
> {
>   struct dev_addr_list *da;
> 
>   netif_tx_lock_bh(from);
>   netif_tx_lock_bh(to);
> 
>   da = from->mc_list;
>   while (da) {
>   if (da->da_synced) {
>   __dev_addr_delete(&to->mc_list, &to->mc_count,
> da->da_addr, da->da_addrlen, 0);
>   __dev_addr_delete(&from->mc_list, &from->mc_count,
> da->da_addr, da->da_addrlen, 0);
>   da->da_synced = 0;
>   }
>   da = da->next;
>   }
> 
>   __dev_set_rx_mode(to);
> 
>   netif_tx_unlock_bh(to);
>   netif_tx_unlock_bh(from);
> }
> EXPORT_SYMBOL(dev_mc_unsync);

Sure, or better with a for loop and do away with next pointer then:

void dev_mc_unsync(struct net_device *to, struct net_device *from)
{
struct dev_addr_list *da;

netif_tx_lock_bh(from);
netif_tx_lock_bh(to);

for (da = from->mc_list; da; da = da->next) {
if (!da->da_synced)
continue;
__dev_addr_delete(&to->mc_list, &to->mc_count,
  da->da_addr, da->da_addrlen, 0);
da->da_synced = 0;
__dev_addr_delete(&from->mc_list, &from->mc_count,
  da->da_addr, da->da_addrlen, 0);
}
__dev_set_rx_mode(to);

netif_tx_unlock_bh(to);
netif_tx_unlock_bh(from);
}
EXPORT_SYMBOL(dev_mc_unsync);

Patch below.

Signed-off-by: Luis R. Rodriguez <[EMAIL PROTECTED]>

diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index 15241cf..2aea8e1 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -160,14 +160,12 @@ EXPORT_SYMBOL(dev_mc_sync);
  */
 void dev_mc_unsync(struct net_device *to, struct net_device *from)
 {
-   struct dev_addr_list *da, *next;
+   struct dev_addr_list *da;
 
netif_tx_lock_bh(from);
netif_tx_lock_bh(to);
 
-   da = from->mc_list;
-   while (da != NULL) {
-   next = da->next;
+   for (da = from->mc_list; da; da = da->next) {
if (!da->da_synced)
continue;
__dev_addr_delete(&to->mc_list, &to->mc_count,
@@ -175,7 +173,6 @@ void dev_mc_unsync(struct net_device *to, struct net_device 
*from)
da->da_synced = 0;
__dev_addr_delete(&from->mc_list, &from->mc_count,
  da->da_addr, da->da_addrlen, 0);
-   da = next;
}
__dev_set_rx_mode(to);
 
-
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/5] fixups for mpc8360 rev. 2.1 erratum #2 (RGMII Timing)

2007-11-09 Thread Kim Phillips
On Fri, 9 Nov 2007 16:25:07 +0300
Anton Vorontsov <[EMAIL PROTECTED]> wrote:

> On Thu, Nov 08, 2007 at 01:11:35PM -0600, Kim Phillips wrote:
> [...]
> > right, but whether it does or not doesn't affect your failure outcome
> > either I'm assuming.
> > 
> > > > If it's something like 0x03, the u-boot patch will probably look like:
> > > > 
> > > > if ((bcsr[12] == 0x10) &&
> > > > (immr->sysconf.spridr == SPR_8360_REV21 ||
> > > >  immr->sysconf.spridr == SPR_8360E_REV21))
> > > > /* if phy-connection-type is "rgmii-id", set it to "rgmii-rxid" 
> > > > */
> > > > ...
> > > > 
> > > > but these linux patches would remain the same (the clk and data delay
> > > > settings for the UCC's are still valid; it's just the PHY config
> > > > that is triggering your problem from what I can tell).
> > > 
> > > Yup, most likely this is not UCC specific, but PHY. For some reason
> > > delays making harm here...
> 
> And today I was unable to reproduce yesterday's behaviour. Your
> patches works fine, with sixth patch and without it. With -rxid
> and with just -id.

excellent.  btw, you should be paying a 50% packet loss price by not
going with the -rxid.  ping your board with '-q -s 1400 -i 0.01 -c 100'
to notice the difference.

> 
> Though, after few resets I hit on that:
> 
> - - - -
> U-Boot 1.3.0-rc3-g281df457-dirty (Nov  6 2007 - 18:19:35) MPC83XX
> 
> Reset Status: External/Internal Soft, External/Internal Hard
> 
> CPU:   e300c1, MPC8360E, Rev: 21 at 528 MHz, CSB:  264 MHz
> Board: Freescale MPC8360EMDS
> I2C:   ready
> DRAM:  256 MB (DDR2, 64-bit, ECC on)
> SDRAM: 64 MB (local bus)
> FLASH: 32 MB
> In:serial
> Out:   serial
> Err:   serial
> Net:   UEC: PHY is Marvell 88E11x1 (1410cc2)
> FSL UEC0: Full Duplex
> switching to rgmii 100
> FSL UEC0: Speed 100BT
> FSL UEC0: Link is up
> read wrong value : mii_id 1,mii_reg 2, base e0103120
> read wrong value : mii_id 1,mii_reg 3, base e0103120
> UEC: PHY is Generic MII ()
> read wrong value : mii_id 1,mii_reg 1, base e0103120
> read wrong value : mii_id 1,mii_reg 1, base e0103120
> read wrong value : mii_id 1,mii_reg 5, base e0103120
> FSL UEC1: Full Duplex
> switching to rgmii 100
> FSL UEC1: Speed 100BT
> FSL UEC1: Link is up
> FSL UEC0, FSL UEC1
> - - - -
> 
> And UCC1 does not work at all. After another reset that message
> disappears and it does work again.
> 
the RGMII bcsr settings survive soft-resets, which confuse u-boot since
it uses GMII mode.

Kim
-
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: stateless 1:1 NAT

2007-11-09 Thread Florin Andrei

Herbert Xu wrote:

Florin Andrei <[EMAIL PROTECTED]> wrote:

OK, if I download 2.6.24-rc1, will it have this feature already?


Yes.


OK, I want to test this feature with 2.6.24-rc2. I compiled 
iproute2-2.6.23 with your patch applied.
The problem is, I have no experience with tc (and very little experience 
with iproute2 in general). Can you give me an example on how to setup 
1:1 NAT for one system?


Let's say, the firewall has the addresses 10.123.0.10 (eth0 outside) and 
10.123.1.10 (eth1 inside), the server behind it is 10.123.1.253 and I 
want to map the server's address to 10.123.0.253 on the outside interface.

What are the parameters for tc to setup 1:1 NAT like that?

--
Florin Andrei

http://florin.myip.org/
-
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.24] RDMA/cxgb3: Set the max_qp_init_rd_atom attribute.

2007-11-09 Thread Roland Dreier
thanks, 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 2/2]: e1000: avoid lockup durig error recovery

2007-11-09 Thread Linas Vepstas
On Fri, Nov 09, 2007 at 06:02:34PM +0100, Ingo Oeser wrote:
> Linas Vepstas schrieb:
> > + * napi_enabled_p - return non-zero if napi enabled
> > + * 
> > + * Mnemonic: _p stands for "predicate", returning a yes/no
> > + * answer to the question.
> 
> Call it "is_napi_enabled()" an nobody will ask :-)

Heh. The suffix _p is standard coding style for lisp/scheme
and first-order logic interpreters.  This was my lame attempt
to introduce it to the kernel. I guess that lame duck won't fly.

--linas

-
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] Fix infinite loop on dev_mc_unsync()

2007-11-09 Thread Patrick McHardy

Luis R. Rodriguez wrote:

diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index 15241cf..2aea8e1 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -160,14 +160,12 @@ EXPORT_SYMBOL(dev_mc_sync);
  */
 void dev_mc_unsync(struct net_device *to, struct net_device *from)
 {
-   struct dev_addr_list *da, *next;
+   struct dev_addr_list *da;
 
 	netif_tx_lock_bh(from);

netif_tx_lock_bh(to);
 
-	da = from->mc_list;

-   while (da != NULL) {
-   next = da->next;
+   for (da = from->mc_list; da; da = da->next) {
  


This may cause a use-after-free since __dev_addr_delete frees the address
when all references are gone.


if (!da->da_synced)
continue;
__dev_addr_delete(&to->mc_list, &to->mc_count,
@@ -175,7 +173,6 @@ void dev_mc_unsync(struct net_device *to, struct net_device 
*from)
da->da_synced = 0;
__dev_addr_delete(&from->mc_list, &from->mc_count,
  da->da_addr, da->da_addrlen, 0);
-   da = next;
}
  



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


[PATCH 1/5] Net: ibm_newemac, remove SPIN_LOCK_UNLOCKED

2007-11-09 Thread Jiri Slaby
ibm_newemac, remove SPIN_LOCK_UNLOCKED

SPIN_LOCK_UNLOCKED is deprecated, use DEFINE_SPINLOCK instead

Signed-off-by: Jiri Slaby <[EMAIL PROTECTED]>
Cc: Jeff Garzik <[EMAIL PROTECTED]>

---
commit aefcf0f6b6ab925184e7cebff8b609e4da1f5c0d
tree 9e1e6240f26c759826959e8812885726c520019d
parent f87566db6dd9613dde8de59380cd2f423166511e
author Jiri Slaby <[EMAIL PROTECTED]> Thu, 25 Oct 2007 11:54:41 +0200
committer Jiri Slaby <[EMAIL PROTECTED]> Thu, 25 Oct 2007 11:54:41 +0200

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

diff --git a/drivers/net/ibm_newemac/debug.c b/drivers/net/ibm_newemac/debug.c
index 170524e..ada13cd 100644
--- a/drivers/net/ibm_newemac/debug.c
+++ b/drivers/net/ibm_newemac/debug.c
@@ -21,7 +21,7 @@
 
 #include "core.h"
 
-static spinlock_t emac_dbg_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(emac_dbg_lock);
 
 static void emac_desc_dump(struct emac_instance *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


[PATCH 5/5] Net: sunrpc, remove SPIN_LOCK_UNLOCKED

2007-11-09 Thread Jiri Slaby
sunrpc, remove SPIN_LOCK_UNLOCKED

SPIN_LOCK_UNLOCKED is deprecated, use DEFINE_SPINLOCK instead

Signed-off-by: Jiri Slaby <[EMAIL PROTECTED]>

---
commit d5e782e62a4fe2663a012571c345d9887b02
tree b993038b020d8c619f6ffdad412fbb992c073513
parent 828042d12cc0aa515e049889aa76d4066df100c0
author Jiri Slaby <[EMAIL PROTECTED]> Thu, 25 Oct 2007 12:00:13 +0200
committer Jiri Slaby <[EMAIL PROTECTED]> Thu, 25 Oct 2007 12:00:13 +0200

 net/sunrpc/xprt.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 282a9a2..cd641c8 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -62,7 +62,7 @@ static inline voiddo_xprt_reserve(struct rpc_task *);
 static voidxprt_connect_status(struct rpc_task *task);
 static int  __xprt_get_cong(struct rpc_xprt *, struct rpc_task *);
 
-static spinlock_t xprt_list_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(xprt_list_lock);
 static LIST_HEAD(xprt_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: SIS190.c

2007-11-09 Thread Francois Romieu
j gleacher <[EMAIL PROTECTED]> :
[sorry for the delay, I was busy]
> I'm not sure how to properly send you this information about subject,
> but with a new Acer Desktop I needed to add 0x0968 to the below to
> get the eth0 recognized.

Ok. Can you check the patch below against 2.6.24-rc2 ?

diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 7200883..51bbb60 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -1549,28 +1549,31 @@ static int __devinit 
sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev,
 }
 
 /**
- * sis190_get_mac_addr_from_apc - Get MAC address for SiS965 model
+ * sis190_get_mac_addr_from_apc - Get MAC address for SiS96x model
  * @pdev: PCI device
  * @dev:  network device to get address for
  *
- * SiS965 model, use APC CMOS RAM to store MAC address.
+ * SiS96x model, use APC CMOS RAM to store MAC address.
  * APC CMOS RAM is accessed through ISA bridge.
  * MAC address is read into @net_dev->dev_addr.
  */
 static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev,
  struct net_device *dev)
 {
+   static const u16 __devinitdata ids[] = { 0x0965, 0x0966, 0x0968 };
struct sis190_private *tp = netdev_priv(dev);
struct pci_dev *isa_bridge;
u8 reg, tmp8;
-   int i;
+   unsigned int i;
 
net_probe(tp, KERN_INFO "%s: Read MAC address from APC.\n",
  pci_name(pdev));
 
-   isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0965, NULL);
-   if (!isa_bridge)
-   isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0966, NULL);
+   for (i = 0; i < ARRAY_SIZE(ids); i++) {
+   isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, ids[i], NULL);
+   if (isa_bridge)
+   break;
+   }
 
if (!isa_bridge) {
net_probe(tp, KERN_INFO "%s: Can not find ISA bridge.\n",

> While this enables the interface, the performance is horrible as my
> wlan0 if much faster and eth0 frequently hangs.  I'm learning about
> drivers, so I could help if there is a need to troubleshoot this type
> of issue. 

"hangs" == no network or no computer ?

Please send:
- a complete dmesg (from boot to poor behavior)
- the output of lspci -vvv
- the output of mii-diag -v ethX
- the content of /proc/interrupts

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


Re: [PATCH] Fix infinite loop on dev_mc_unsync()

2007-11-09 Thread Joe Perches
On Sat, 2007-11-10 at 00:12 +0100, Patrick McHardy wrote:
> This may cause a use-after-free since __dev_addr_delete frees the address
> when all references are gone.

How about a comment then?  Perhaps:

diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index ae35405..63576aa 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -165,16 +165,23 @@ void dev_mc_unsync(struct net_device *to, struct 
net_device *from)
netif_tx_lock_bh(from);
netif_tx_lock_bh(to);
 
+   /*
+ This while loop can't be written as
+   for (da = from->mc_list; da; da = da->next)
+ da = from->mc_list and __dev_addr_delete can kfree(from->mc_list)
+ which could cause a use-after-free of da->next
+   */
+
da = from->mc_list;
while (da != NULL) {
next = da->next;
-   if (!da->da_synced)
-   continue;
-   __dev_addr_delete(&to->mc_list, &to->mc_count,
- da->da_addr, da->da_addrlen, 0);
-   da->da_synced = 0;
-   __dev_addr_delete(&from->mc_list, &from->mc_count,
- da->da_addr, da->da_addrlen, 0);
+   if (da->da_synced) {
+   __dev_addr_delete(&to->mc_list, &to->mc_count,
+ da->da_addr, da->da_addrlen, 0);
+   da->da_synced = 0;
+   __dev_addr_delete(&from->mc_list, &from->mc_count,
+ da->da_addr, da->da_addrlen, 0);
+   }
da = next;
}
__dev_set_rx_mode(to);


-
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] Fix infinite loop on dev_mc_unsync()

2007-11-09 Thread Patrick McHardy

Joe Perches wrote:

On Sat, 2007-11-10 at 00:12 +0100, Patrick McHardy wrote:
  

This may cause a use-after-free since __dev_addr_delete frees the address
when all references are gone.



How about a comment then?  Perhaps:

diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index ae35405..63576aa 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -165,16 +165,23 @@ void dev_mc_unsync(struct net_device *to, struct 
net_device *from)
netif_tx_lock_bh(from);
netif_tx_lock_bh(to);
 
+	/*

+ This while loop can't be written as
+   for (da = from->mc_list; da; da = da->next)
+ da = from->mc_list and __dev_addr_delete can kfree(from->mc_list)
+ which could cause a use-after-free of da->next
+   */
  


Seems unnecessary to me, we also don't comment each list_for_each_entry_safe
iteration. I consider the use of a seperate next variable self-explanatory.


-
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] ehea: Add kdump support

2007-11-09 Thread Michael Neuling
> To support ehea driver reloading in a kdump kernel the driver has to
> perform firmware handle deregistrations when the original kernel
> crashes. As there's currently no notifier chain for machine crashes
> this patch enables kdump support in the ehea driver by bending the
> ppc_md.machine_crash_shutdown hook to its own machine crash
> handler. The original machine_crash_shutdown() fn is called
> afterwards. This works fine as long as the ehea driver is the only one
> which does so. Problems may occur if other drivers do the same and
> unload regularly .  This patch enables 2.6.24-rc2 to use kdump with
> ehea and only puts a very low risk on base kernel. In 2.6.24 we know
> ehea is the only user of this mechanism. The next step for 2.6.25
> would be to add a proper notifier chain.  The full solution might be
> that register_reboot_notifier() provides sth like a SYS_CRASH
> action. Please apply.

If we are going to do this workaround, I'd prefer the notifier chain be
done correctly now.  The way it's hacked in here, it's more likely to
cause even more issues.  

Either way, if this is going to go in, it at least needs to be acked by
Paulus.

> 
> Signed-off-by: Thomas Klein <[EMAIL PROTECTED]>
> 
> ---
>  drivers/net/ehea/ehea.h  |2 +-
>  drivers/net/ehea/ehea_main.c |   28 
>  2 files changed, 29 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
> index f78e5bf..5935899 100644
> --- a/drivers/net/ehea/ehea.h
> +++ b/drivers/net/ehea/ehea.h
> @@ -40,7 +40,7 @@
>  #include 
>  
>  #define DRV_NAME "ehea"
> -#define DRV_VERSION  "EHEA_0080"
> +#define DRV_VERSION  "EHEA_0081"
>  
>  /* eHEA capability flags */
>  #define DLPAR_PORT_ADD_REM 1
> diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
> index f0319f1..40a732e 100644
> --- a/drivers/net/ehea/ehea_main.c
> +++ b/drivers/net/ehea/ehea_main.c
> @@ -37,6 +37,7 @@
>  #include 
>  
>  #include 
> +#include 
>  
>  #include "ehea.h"
>  #include "ehea_qmr.h"
> @@ -98,6 +99,7 @@ static int port_name_cnt = 0;
>  static LIST_HEAD(adapter_list);
>  u64 ehea_driver_flags = 0;
>  struct work_struct ehea_rereg_mr_task;
> +static void (*orig_machine_crash_shutdown)(struct pt_regs *regs);
>  
>  struct semaphore dlpar_mem_lock;
>  
> @@ -3312,6 +3314,29 @@ static struct notifier_block ehea_reboot_nb = {
>  .notifier_call = ehea_reboot_notifier,
>  };
>  
> +void ehea_crash_notifier(struct pt_regs *regs)
> +{
> + ehea_info("Machine crash: freeing all eHEA resources");
> + ibmebus_unregister_driver(&ehea_driver);
> + orig_machine_crash_shutdown(regs);
> +}
> +
> +void ehea_register_crash_notifier(void)
> +{
> +#ifdef CONFIG_KEXEC
> + orig_machine_crash_shutdown =
> +   (void*)__xchg_u64((unsigned long*)&ppc_md.machine_crash_shutd
own,
> +  (unsigned long)ehea_crash_notifier);
> +#endif
> +}
> +
> +void ehea_unregister_crash_notifier(void)
> +{
> +#ifdef CONFIG_KEXEC
> + ppc_md.machine_crash_shutdown = orig_machine_crash_shutdown;
> +#endif
> +}
> +
>  static int check_module_parm(void)
>  {
>   int ret = 0;
> @@ -3369,6 +3394,7 @@ int __init ehea_module_init(void)
>   goto out;
>  
>   register_reboot_notifier(&ehea_reboot_nb);
> + ehea_register_crash_notifier();
>  
>   ret = ibmebus_register_driver(&ehea_driver);
>   if (ret) {
> @@ -3382,6 +3408,7 @@ int __init ehea_module_init(void)
>   ehea_error("failed to register capabilities attribute, ret=%d",
>  ret);
>   unregister_reboot_notifier(&ehea_reboot_nb);
> + ehea_unregister_crash_notifier();
>   ibmebus_unregister_driver(&ehea_driver);
>   goto out;
>   }
> @@ -3396,6 +3423,7 @@ static void __exit ehea_module_exit(void)
>   driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities);
>   ibmebus_unregister_driver(&ehea_driver);
>   unregister_reboot_notifier(&ehea_reboot_nb);
> + ehea_unregister_crash_notifier();
>   ehea_destroy_busmap();
>  }
>  
> -- 
> 1.5.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


[PATCH 8/13] tg3: Limit 5784 / 5764 to MAC LED mode

2007-11-09 Thread Matt Carlson
Most 5784 / 5764 LED modes do not work as expected because of a hardware
bug.  This patch forces the LED mode to be in MAC LED mode.

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index b5c4799..bb3b734 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -10610,6 +10610,9 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 
*tp)
tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL)
tp->led_ctrl = LED_CTRL_MODE_PHY_2;
 
+   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0)
+   tp->led_ctrl = LED_CTRL_MODE_MAC;
+
if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) {
tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
if ((tp->pdev->subsystem_vendor ==


-
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/13] tg3: APE flag fix

2007-11-09 Thread Matt Carlson
This patch corrects a bug where the ENABLE_APE flag was tested against
the wrong flag variable.

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 82b1cf0..833cb9b 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -10881,7 +10881,7 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
}
 
if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) ||
-(tp->tg3_flags & TG3_FLG3_ENABLE_APE))
+(tp->tg3_flags3 & TG3_FLG3_ENABLE_APE))
return;
 
for (offset = TG3_NVM_DIR_START;


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


[PATCH 11/13] tg3: Add A1 revs

2007-11-09 Thread Matt Carlson
This patch adds the A1 revision of 5784, 5764, and 5761, and applies all
previous bugfixes.  In places where the list of devices gets too long,
the patch uses a new TG3_FLG3_5761_5784_AX_FIXES flag instead.

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 72db78b..8e76092 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -1106,8 +1106,7 @@ static int tg3_phy_reset(struct tg3 *tp)
if (err)
return err;
 
-   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
-   tp->pci_chip_rev_id == CHIPREV_ID_5761_A0) {
+   if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
u32 val;
 
val = tr32(TG3_CPMU_LSPD_1000MB_CLK);
@@ -1352,8 +1351,7 @@ static void tg3_power_down_phy(struct tg3 *tp)
 (tp->tg3_flags2 & TG3_FLG2_MII_SERDES)))
return;
 
-   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
-   tp->pci_chip_rev_id == CHIPREV_ID_5761_A0) {
+   if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
val = tr32(TG3_CPMU_LSPD_1000MB_CLK);
val &= ~CPMU_LSPD_1000MB_MACCLK_MASK;
val |= CPMU_LSPD_1000MB_MACCLK_12_5;
@@ -3154,7 +3152,8 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
err = tg3_setup_copper_phy(tp, force_reset);
}
 
-   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0) {
+   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
+   tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) {
u32 val, scale;
 
val = tr32(TG3_CPMU_CLCK_STAT) & CPMU_CLCK_STAT_MAC_CLCK_MASK;
@@ -6390,7 +6389,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 
tg3_write_sig_legacy(tp, RESET_KIND_INIT);
 
-   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0) {
+   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
+   tp->pci_chip_rev_id == CHIPREV_ID_5784_A1) {
val = tr32(TG3_CPMU_CTRL);
val &= ~(CPMU_CTRL_LINK_AWARE_MODE | CPMU_CTRL_LINK_IDLE_MODE);
tw32(TG3_CPMU_CTRL, val);
@@ -9379,8 +9379,7 @@ static int tg3_test_loopback(struct tg3 *tp)
if (err)
return TG3_LOOPBACK_FAILED;
 
-   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
-   tp->pci_chip_rev_id == CHIPREV_ID_5761_A0) {
+   if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
int i;
u32 status;
 
@@ -9407,8 +9406,7 @@ static int tg3_test_loopback(struct tg3 *tp)
if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK))
err |= TG3_MAC_LOOPBACK_FAILED;
 
-   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
-   tp->pci_chip_rev_id == CHIPREV_ID_5761_A0) {
+   if (tp->tg3_flags3 & TG3_FLG3_5761_5784_AX_FIXES) {
tw32(TG3_CPMU_CTRL, cpmuctrl);
 
/* Release the mutex */
@@ -10629,7 +10627,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 
*tp)
tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL)
tp->led_ctrl = LED_CTRL_MODE_PHY_2;
 
-   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0)
+   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
+   tp->pci_chip_rev_id == CHIPREV_ID_5784_A1)
tp->led_ctrl = LED_CTRL_MODE_MAC;
 
if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) {
@@ -11401,9 +11400,16 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
}
 
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
-   GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761)
+   GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) {
tp->tg3_flags |= TG3_FLAG_CPMU_PRESENT;
 
+   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
+   tp->pci_chip_rev_id == CHIPREV_ID_5784_A1 ||
+   tp->pci_chip_rev_id == CHIPREV_ID_5761_A0 ||
+   tp->pci_chip_rev_id == CHIPREV_ID_5761_A1)
+   tp->tg3_flags3 |= TG3_FLG3_5761_5784_AX_FIXES;
+   }
+
/* Set up tp->grc_local_ctrl before calling tg3_set_power_state().
 * GPIO1 driven high will bring 5700's external PHY out of reset.
 * It is also used as eeprom write protect on LOMs.
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index d325ab5..da18fb2 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -109,7 +109,9 @@
 #define  CHIPREV_ID_5714_A2 0x9002
 #define  CHIPREV_ID_5906_A1 0xc001
 #define  CHIPREV_ID_5784_A0 0x5784000
+#define  CHIPREV_ID_5784_A1 0x5784001
 #define  CHIPREV_ID_5761_A0 0x5761000
+#define  CHIPREV_ID_5761_A1 0x5761001
 #define  GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12)
 #define   ASIC_REV_5700 0x07
 #define   ASIC_REV_5701   

[PATCH 12/13] tg3: MII => TP

2007-11-09 Thread Matt Carlson
This patch changes the PHY type reported through ethtool for copper
devices from MII to TP.  The latter is more accurate.

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 8e76092..8d518cc 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -8329,7 +8329,7 @@ static int tg3_get_settings(struct net_device *dev, 
struct ethtool_cmd *cmd)
  SUPPORTED_100baseT_Full |
  SUPPORTED_10baseT_Half |
  SUPPORTED_10baseT_Full |
- SUPPORTED_MII);
+ SUPPORTED_TP);
cmd->port = PORT_TP;
} else {
cmd->supported |= SUPPORTED_FIBRE;


-
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 13/13] tg3: Update version to 3.86

2007-11-09 Thread Matt Carlson
This patch updates the version number to 3.86

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 8d518cc..4942f7d 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
 
 #define DRV_MODULE_NAME"tg3"
 #define PFX DRV_MODULE_NAME": "
-#define DRV_MODULE_VERSION "3.85"
-#define DRV_MODULE_RELDATE "October 18, 2007"
+#define DRV_MODULE_VERSION "3.86"
+#define DRV_MODULE_RELDATE "November 9, 2007"
 
 #define TG3_DEF_MAC_MODE   0
 #define TG3_DEF_RX_MODE0


-
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 10/13] tg3: Increase the PCI MRRS

2007-11-09 Thread Matt Carlson
Previous devices hardcoded the PCI Maximum Read Request Size to 4K.  To
better comply with the PCI spec, the hardware now defaults the MRRS to
512 bytes.  This will yield poor driver performance if left untouched.
This patch increases the MRRS to 4K on driver initialization.

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index ecd64a2..72db78b 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -5098,12 +5098,15 @@ static void tg3_restore_pci_state(struct tg3 *tp)
 
pci_write_config_word(tp->pdev, PCI_COMMAND, tp->pci_cmd);
 
-   if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) {
+   if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)
+   pcie_set_readrq(tp->pdev, 4096);
+   else {
pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE,
  tp->pci_cacheline_sz);
pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER,
  tp->pci_lat_timer);
}
+
/* Make sure PCI-X relaxed ordering bit is clear. */
if (tp->pcix_cap) {
u16 pcix_cmd;
@@ -11215,6 +11218,9 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
pcie_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_EXP);
if (pcie_cap != 0) {
tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS;
+
+   pcie_set_readrq(tp->pdev, 4096);
+
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
u16 lnkctl;
 


-
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 7/13] tg3: Disable GPHY autopowerdown

2007-11-09 Thread Matt Carlson
New CPMU devices contend with the GPHY for power management.  The GPHY
autopowerdown feature is enabled by default in the PHY and thus needs to
be disabled after every PHY reset.

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 25e57d8..b5c4799 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -1117,6 +1117,12 @@ static int tg3_phy_reset(struct tg3 *tp)
udelay(40);
tw32_f(TG3_CPMU_LSPD_1000MB_CLK, val);
}
+
+   /* Disable GPHY autopowerdown. */
+   tg3_writephy(tp, MII_TG3_MISC_SHDW,
+MII_TG3_MISC_SHDW_WREN |
+MII_TG3_MISC_SHDW_APD_SEL |
+MII_TG3_MISC_SHDW_APD_WKTM_84MS);
}
 
 out:
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index f715b35..5b799ff 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -1715,6 +1715,12 @@
 #define MII_TG3_ISTAT  0x1a /* IRQ status register */
 #define MII_TG3_IMASK  0x1b /* IRQ mask register */
 
+#define MII_TG3_MISC_SHDW  0x1c
+#define MII_TG3_MISC_SHDW_WREN 0x8000
+#define MII_TG3_MISC_SHDW_APD_SEL  0x2800
+
+#define MII_TG3_MISC_SHDW_APD_WKTM_84MS0x0001
+
 /* ISTAT/IMASK event bits */
 #define MII_TG3_INT_LINKCHG0x0002
 #define MII_TG3_INT_SPEEDCHG   0x0004


-
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/13] tg3: 5784 / 5764 DMA engine lockup fix

2007-11-09 Thread Matt Carlson
5784 and 5764 devices lock up when the link speed is 10Mbps, the CPMU
link speed mode is enabled, and the MAC clock is running at 1.5Mhz.  The
fix is to run the MAC clock at faster speeds.

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 833cb9b..b865c5d 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -6369,6 +6369,21 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
val = tr32(TG3_CPMU_CTRL);
val &= ~(CPMU_CTRL_LINK_AWARE_MODE | CPMU_CTRL_LINK_IDLE_MODE);
tw32(TG3_CPMU_CTRL, val);
+
+   val = tr32(TG3_CPMU_LSPD_10MB_CLK);
+   val &= ~CPMU_LSPD_10MB_MACCLK_MASK;
+   val |= CPMU_LSPD_10MB_MACCLK_6_25;
+   tw32(TG3_CPMU_LSPD_10MB_CLK, val);
+
+   val = tr32(TG3_CPMU_LNK_AWARE_PWRMD);
+   val &= ~CPMU_LNK_AWARE_MACCLK_MASK;
+   val |= CPMU_LNK_AWARE_MACCLK_6_25;
+   tw32(TG3_CPMU_LNK_AWARE_PWRMD, val);
+
+   val = tr32(TG3_CPMU_HST_ACC);
+   val &= ~CPMU_HST_ACC_MACCLK_MASK;
+   val |= CPMU_HST_ACC_MACCLK_6_25;
+   tw32(TG3_CPMU_HST_ACC, val);
}
 
/* This works around an issue with Athlon chipsets on
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 4659697..c6aad49 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -857,13 +857,24 @@
 #define  CPMU_CTRL_LINK_IDLE_MODE   0x0200
 #define  CPMU_CTRL_LINK_AWARE_MODE  0x0400
 #define  CPMU_CTRL_LINK_SPEED_MODE  0x4000
-/* 0x3604 --> 0x360c unused */
+#define TG3_CPMU_LSPD_10MB_CLK 0x3604
+#define  CPMU_LSPD_10MB_MACCLK_MASK 0x001f
+#define  CPMU_LSPD_10MB_MACCLK_6_25 0x0013
+/* 0x3608 --> 0x360c unused */
 
 #define TG3_CPMU_LSPD_1000MB_CLK   0x360c
 #define  CPMU_LSPD_1000MB_MACCLK_62_5   0x
 #define  CPMU_LSPD_1000MB_MACCLK_12_5   0x0011
 #define  CPMU_LSPD_1000MB_MACCLK_MASK   0x001f
-/* 0x3610 --> 0x365c unused */
+#define TG3_CPMU_LNK_AWARE_PWRMD   0x3610
+#define  CPMU_LNK_AWARE_MACCLK_MASK 0x001f
+#define  CPMU_LNK_AWARE_MACCLK_6_25 0x0013
+/* 0x3614 --> 0x361c unused */
+
+#define TG3_CPMU_HST_ACC   0x361c
+#define  CPMU_HST_ACC_MACCLK_MASK   0x001f
+#define  CPMU_HST_ACC_MACCLK_6_25   0x0013
+/* 0x3620 --> 0x365c unused */
 
 #define TG3_CPMU_MUTEX_REQ 0x365c
 #define  CPMU_MUTEX_REQ_DRIVER  0x1000


-
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/13] tg3: Fix 5761 PXEboot crash

2007-11-09 Thread Matt Carlson
When 5761 devices boot the machine using PXEboot, PXE leaves the device
active when it terminates.  The tg3 driver has code to detect this
condition and resets the device during initialization.  On 5761 devices,
device resets involve sending a driver state update message to the APE
on the 5761.  However, during this initialization stage, communications
to the APE registers have not yet been set up.  The driver then
dereferences a NULL pointer and crashes the machine.  The fix is to move
the APE register access setup earlier in the initialization code to
cover this condition.

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index cad5199..ddeaa0c 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -12464,6 +12464,28 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
goto err_out_iounmap;
}
 
+   if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
+   if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
+   printk(KERN_ERR PFX "Cannot find proper PCI device "
+  "base address for APE, aborting.\n");
+   err = -ENODEV;
+   goto err_out_iounmap;
+   }
+
+   tg3reg_base = pci_resource_start(pdev, 2);
+   tg3reg_len = pci_resource_len(pdev, 2);
+
+   tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len);
+   if (tp->aperegs == 0UL) {
+   printk(KERN_ERR PFX "Cannot map APE registers, "
+  "aborting.\n");
+   err = -ENOMEM;
+   goto err_out_iounmap;
+   }
+
+   tg3_ape_lock_init(tp);
+   }
+
/*
 * Reset chip in case UNDI or EFI driver did not shutdown
 * DMA self test will enable WDMAC and we'll see (spurious)
@@ -12478,7 +12500,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
err = tg3_test_dma(tp);
if (err) {
printk(KERN_ERR PFX "DMA engine test failed, aborting.\n");
-   goto err_out_iounmap;
+   goto err_out_apeunmap;
}
 
/* Tigon3 can do ipv4 only... and some chips have buggy
@@ -12501,28 +12523,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
 
tg3_init_coal(tp);
 
-   if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
-   if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
-   printk(KERN_ERR PFX "Cannot find proper PCI device "
-  "base address for APE, aborting.\n");
-   err = -ENODEV;
-   goto err_out_iounmap;
-   }
-
-   tg3reg_base = pci_resource_start(pdev, 2);
-   tg3reg_len = pci_resource_len(pdev, 2);
-
-   tp->aperegs = ioremap_nocache(tg3reg_base, tg3reg_len);
-   if (tp->aperegs == 0UL) {
-   printk(KERN_ERR PFX "Cannot map APE registers, "
-  "aborting.\n");
-   err = -ENOMEM;
-   goto err_out_iounmap;
-   }
-
-   tg3_ape_lock_init(tp);
-   }
-
pci_set_drvdata(pdev, dev);
 
err = register_netdev(dev);


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


[PATCH 6/13] tg3: CPMU adjustments for loopback tests

2007-11-09 Thread Matt Carlson
This patch adds the LINK_SPEED mode to the list of CPMU modes that can
cause the loopback tests to fail.  These bugs are planned to be fixed in
future revisions of the chip, so the patch qualifies the fixes as such.

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index ef849b1..25e57d8 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -9354,7 +9354,8 @@ static int tg3_test_loopback(struct tg3 *tp)
if (err)
return TG3_LOOPBACK_FAILED;
 
-   if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) {
+   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
+   tp->pci_chip_rev_id == CHIPREV_ID_5761_A0) {
int i;
u32 status;
 
@@ -9371,17 +9372,18 @@ static int tg3_test_loopback(struct tg3 *tp)
if (status != CPMU_MUTEX_GNT_DRIVER)
return TG3_LOOPBACK_FAILED;
 
-   cpmuctrl = tr32(TG3_CPMU_CTRL);
-
/* Turn off power management based on link speed. */
+   cpmuctrl = tr32(TG3_CPMU_CTRL);
tw32(TG3_CPMU_CTRL,
-cpmuctrl & ~CPMU_CTRL_LINK_SPEED_MODE);
+cpmuctrl & ~(CPMU_CTRL_LINK_SPEED_MODE |
+ CPMU_CTRL_LINK_AWARE_MODE));
}
 
if (tg3_run_loopback(tp, TG3_MAC_LOOPBACK))
err |= TG3_MAC_LOOPBACK_FAILED;
 
-   if (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) {
+   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
+   tp->pci_chip_rev_id == CHIPREV_ID_5761_A0) {
tw32(TG3_CPMU_CTRL, cpmuctrl);
 
/* Release the mutex */


-
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/13] tg3: 5784 / 5764 GPHY power down fix

2007-11-09 Thread Matt Carlson
5784 and 5764 devices fail to link / pass traffic after one load /
unload cycle.  This happens because of a hardware bug in the new CPMU.
During normal operation, the MAC depends on the PHY clock being
available.  When the PHY is powered down, the clock the MAC depends on
is disabled.  The fix is to switch the MAC clock to an alternate source
before powering down the PHY, and to restore the MAC clock to the PHY
source upon device resume.

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index ddeaa0c..82b1cf0 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -1106,6 +1106,19 @@ static int tg3_phy_reset(struct tg3 *tp)
if (err)
return err;
 
+   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
+   tp->pci_chip_rev_id == CHIPREV_ID_5761_A0) {
+   u32 val;
+
+   val = tr32(TG3_CPMU_LSPD_1000MB_CLK);
+   if ((val & CPMU_LSPD_1000MB_MACCLK_MASK) ==
+   CPMU_LSPD_1000MB_MACCLK_12_5) {
+   val &= ~CPMU_LSPD_1000MB_MACCLK_MASK;
+   udelay(40);
+   tw32_f(TG3_CPMU_LSPD_1000MB_CLK, val);
+   }
+   }
+
 out:
if (tp->tg3_flags2 & TG3_FLG2_PHY_ADC_BUG) {
tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
@@ -1297,6 +1310,8 @@ static void tg3_nvram_unlock(struct tg3 *);
 
 static void tg3_power_down_phy(struct tg3 *tp)
 {
+   u32 val;
+
if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) {
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
u32 sg_dig_ctrl = tr32(SG_DIG_CTRL);
@@ -1311,8 +1326,6 @@ static void tg3_power_down_phy(struct tg3 *tp)
}
 
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
-   u32 val;
-
tg3_bmcr_reset(tp);
val = tr32(GRC_MISC_CFG);
tw32_f(GRC_MISC_CFG, val | GRC_MISC_CFG_EPHY_IDDQ);
@@ -1332,6 +1345,15 @@ static void tg3_power_down_phy(struct tg3 *tp)
(GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 &&
 (tp->tg3_flags2 & TG3_FLG2_MII_SERDES)))
return;
+
+   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0 ||
+   tp->pci_chip_rev_id == CHIPREV_ID_5761_A0) {
+   val = tr32(TG3_CPMU_LSPD_1000MB_CLK);
+   val &= ~CPMU_LSPD_1000MB_MACCLK_MASK;
+   val |= CPMU_LSPD_1000MB_MACCLK_12_5;
+   tw32_f(TG3_CPMU_LSPD_1000MB_CLK, val);
+   }
+
tg3_writephy(tp, MII_BMCR, BMCR_PDOWN);
 }
 
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 1d5b2a3..4659697 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -109,6 +109,7 @@
 #define  CHIPREV_ID_5714_A2 0x9002
 #define  CHIPREV_ID_5906_A1 0xc001
 #define  CHIPREV_ID_5784_A0 0x5784000
+#define  CHIPREV_ID_5761_A0 0x5761000
 #define  GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12)
 #define   ASIC_REV_5700 0x07
 #define   ASIC_REV_5701 0x00
@@ -856,7 +857,13 @@
 #define  CPMU_CTRL_LINK_IDLE_MODE   0x0200
 #define  CPMU_CTRL_LINK_AWARE_MODE  0x0400
 #define  CPMU_CTRL_LINK_SPEED_MODE  0x4000
-/* 0x3604 --> 0x365c unused */
+/* 0x3604 --> 0x360c unused */
+
+#define TG3_CPMU_LSPD_1000MB_CLK   0x360c
+#define  CPMU_LSPD_1000MB_MACCLK_62_5   0x
+#define  CPMU_LSPD_1000MB_MACCLK_12_5   0x0011
+#define  CPMU_LSPD_1000MB_MACCLK_MASK   0x001f
+/* 0x3610 --> 0x365c unused */
 
 #define TG3_CPMU_MUTEX_REQ 0x365c
 #define  CPMU_MUTEX_REQ_DRIVER  0x1000


-
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/13] tg3: Fix nvram selftest failures

2007-11-09 Thread Matt Carlson
Newer devices contain bootcode in the chip's private ROM area.  This
bootcode is called selfboot.  Selfboot can be patched in the device's
NVRAM and the patches can have several formats.  In one particular
format, the checksum calculation needs to be slightly modified.  This
patch adjusts the NVRAM test code for that case, and add support for the
missing formats.

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index b865c5d..ef849b1 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -8701,7 +8701,9 @@ static void tg3_get_ethtool_stats (struct net_device *dev,
 }
 
 #define NVRAM_TEST_SIZE 0x100
-#define NVRAM_SELFBOOT_FORMAT1_SIZE 0x14
+#define NVRAM_SELFBOOT_FORMAT1_0_SIZE  0x14
+#define NVRAM_SELFBOOT_FORMAT1_2_SIZE  0x18
+#define NVRAM_SELFBOOT_FORMAT1_3_SIZE  0x1c
 #define NVRAM_SELFBOOT_HW_SIZE 0x20
 #define NVRAM_SELFBOOT_DATA_SIZE 0x1c
 
@@ -8716,9 +8718,22 @@ static int tg3_test_nvram(struct tg3 *tp)
if (magic == TG3_EEPROM_MAGIC)
size = NVRAM_TEST_SIZE;
else if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == TG3_EEPROM_MAGIC_FW) {
-   if ((magic & 0xe0) == 0x20)
-   size = NVRAM_SELFBOOT_FORMAT1_SIZE;
-   else
+   if ((magic & TG3_EEPROM_SB_FORMAT_MASK) ==
+   TG3_EEPROM_SB_FORMAT_1) {
+   switch (magic & TG3_EEPROM_SB_REVISION_MASK) {
+   case TG3_EEPROM_SB_REVISION_0:
+   size = NVRAM_SELFBOOT_FORMAT1_0_SIZE;
+   break;
+   case TG3_EEPROM_SB_REVISION_2:
+   size = NVRAM_SELFBOOT_FORMAT1_2_SIZE;
+   break;
+   case TG3_EEPROM_SB_REVISION_3:
+   size = NVRAM_SELFBOOT_FORMAT1_3_SIZE;
+   break;
+   default:
+   return 0;
+   }
+   } else
return 0;
} else if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW)
size = NVRAM_SELFBOOT_HW_SIZE;
@@ -8745,8 +8760,17 @@ static int tg3_test_nvram(struct tg3 *tp)
TG3_EEPROM_MAGIC_FW) {
u8 *buf8 = (u8 *) buf, csum8 = 0;
 
-   for (i = 0; i < size; i++)
-   csum8 += buf8[i];
+   if ((cpu_to_be32(buf[0]) & TG3_EEPROM_SB_REVISION_MASK) ==
+   TG3_EEPROM_SB_REVISION_2) {
+   /* For rev 2, the csum doesn't include the MBA. */
+   for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++)
+   csum8 += buf8[i];
+   for (i = TG3_EEPROM_SB_F1R2_MBA_OFF + 4; i < size; i++)
+   csum8 += buf8[i];
+   } else {
+   for (i = 0; i < size; i++)
+   csum8 += buf8[i];
+   }
 
if (csum8 == 0) {
err = 0;
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index c6aad49..f715b35 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -1555,6 +1555,12 @@
 #define TG3_EEPROM_MAGIC   0x669955aa
 #define TG3_EEPROM_MAGIC_FW0xa500
 #define TG3_EEPROM_MAGIC_FW_MSK0xff00
+#define TG3_EEPROM_SB_FORMAT_MASK  0x00e0
+#define TG3_EEPROM_SB_FORMAT_1 0x0020
+#define TG3_EEPROM_SB_REVISION_MASK0x001f
+#define TG3_EEPROM_SB_REVISION_0   0x
+#define TG3_EEPROM_SB_REVISION_2   0x0002
+#define TG3_EEPROM_SB_REVISION_3   0x0003
 #define TG3_EEPROM_MAGIC_HW0xabcd
 #define TG3_EEPROM_MAGIC_HW_MSK0x
 
@@ -1765,6 +1771,8 @@
 /* APE convenience enumerations. */
 #define TG3_APE_LOCK_MEM4
 
+#define TG3_EEPROM_SB_F1R2_MBA_OFF 0x10
+
 
 /* There are two ways to manage the TX descriptors on the tigon3.
  * Either the descriptors are in host DMA'able memory, or they


-
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 9/13] tg3: Prescaler fix

2007-11-09 Thread Matt Carlson
Internal hardware timers become inaccurate after link events.  Clock
frequency switches performed by the CPMU fail to adjust timer
prescalers.  The fix is to detect core clock frequency changes during
link events and adjust the timer prescalers accordingly.

Signed-off-by: Matt Carlson <[EMAIL PROTECTED]>
Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index bb3b734..ecd64a2 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -3154,6 +3154,22 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
err = tg3_setup_copper_phy(tp, force_reset);
}
 
+   if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0) {
+   u32 val, scale;
+
+   val = tr32(TG3_CPMU_CLCK_STAT) & CPMU_CLCK_STAT_MAC_CLCK_MASK;
+   if (val == CPMU_CLCK_STAT_MAC_CLCK_62_5)
+   scale = 65;
+   else if (val == CPMU_CLCK_STAT_MAC_CLCK_6_25)
+   scale = 6;
+   else
+   scale = 12;
+
+   val = tr32(GRC_MISC_CFG) & ~GRC_MISC_CFG_PRESCALAR_MASK;
+   val |= (scale << GRC_MISC_CFG_PRESCALAR_SHIFT);
+   tw32(GRC_MISC_CFG, val);
+   }
+
if (tp->link_config.active_speed == SPEED_1000 &&
tp->link_config.active_duplex == DUPLEX_HALF)
tw32(MAC_TX_LENGTHS,
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 5b799ff..d325ab5 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -874,7 +874,14 @@
 #define TG3_CPMU_HST_ACC   0x361c
 #define  CPMU_HST_ACC_MACCLK_MASK   0x001f
 #define  CPMU_HST_ACC_MACCLK_6_25   0x0013
-/* 0x3620 --> 0x365c unused */
+/* 0x3620 --> 0x3630 unused */
+
+#define TG3_CPMU_CLCK_STAT 0x3630
+#define  CPMU_CLCK_STAT_MAC_CLCK_MASK   0x001f
+#define  CPMU_CLCK_STAT_MAC_CLCK_62_5   0x
+#define  CPMU_CLCK_STAT_MAC_CLCK_12_5   0x0011
+#define  CPMU_CLCK_STAT_MAC_CLCK_6_25   0x0013
+/* 0x3634 --> 0x365c unused */
 
 #define TG3_CPMU_MUTEX_REQ 0x365c
 #define  CPMU_MUTEX_REQ_DRIVER  0x1000




-
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/13] tg3: 5761, 5784, and 5764 support fixes

2007-11-09 Thread Matt Carlson
The following patches round out support for 5784, 5764, and 5761
devices, fixing bugs in the process.

-
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 01/05] ipv6: RFC4214 Support (3)

2007-11-09 Thread osprey67

From: Fred L. Templin <[EMAIL PROTECTED]>

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
"ip" utility with device names beginning with: "isatap".

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin <[EMAIL PROTECTED]>

- linux-2.6.24-rc2/include/linux/if.h.orig2007-11-08 12:05:47.0 
-0800
+++ linux-2.6.24-rc2/include/linux/if.h 2007-11-08 08:26:44.0 -0800
@@ -61,6 +61,7 @@
 #define IFF_MASTER_ALB 0x10/* bonding master, balance-alb. */
 #define IFF_BONDING0x20/* bonding master or slave  */
 #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
+#define IFF_ISATAP 0x80/* ISATAP interface (RFC4214)   */

 #define IF_GET_IFACE   0x0001  /* for querying only */
 #define IF_GET_PROTO   0x0002
--- linux-2.6.24-rc2/include/linux/if_tunnel.h.orig 2007-11-09 
09:06:16.0 -0800
+++ linux-2.6.24-rc2/include/linux/if_tunnel.h  2007-11-09 15:49:54.0 
-0800
@@ -25,6 +25,8 @@ struct ip_tunnel_parm
__be16  o_flags;
__be32  i_key;
__be32  o_key;
+   __be32  router;
+   __be32  lifetime;
struct iphdriph;
 };

--- linux-2.6.24-rc2/include/linux/in.h.orig2007-11-09 08:00:32.0 
-0800
+++ linux-2.6.24-rc2/include/linux/in.h 2007-11-09 08:56:09.0 -0800
@@ -252,7 +252,15 @@ struct sockaddr_in {
 #define BADCLASS(x)(((x) & htonl(0xf000)) == htonl(0xf000))
 #define ZERONET(x) (((x) & htonl(0xff00)) == htonl(0x))
 #define LOCAL_MCAST(x) (((x) & htonl(0xFF00)) == htonl(0xE000))
-
+
+/* Special-Use IPv4 Addresses (RFC3330) */
+#define PRIVATE_10(x)  (((x) & htonl(0xff00)) == htonl(0x0A00))
+#define LINK_169(x)(((x) & htonl(0x)) == htonl(0xA9FE))
+#define PRIVATE_172(x) (((x) & htonl(0xfff0)) == htonl(0xAC10))
+#define TEST_192(x)(((x) & htonl(0xff00)) == htonl(0xC200))
+#define ANYCAST_6TO4(x)(((x) & htonl(0xff00)) == htonl(0xC0586300))
+#define PRIVATE_192(x) (((x) & htonl(0x)) == htonl(0xC0A8))
+#define TEST_198(x)(((x) & htonl(0xfffe)) == htonl(0xC612))
 #endif

 #endif /* _LINUX_IN_H */
--- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08 
12:06:17.0 -0800
+++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-09 08:12:29.0 
-0800
@@ -241,6 +241,14 @@ static inline int ipv6_addr_is_ll_all_ro
addr->s6_addr32[3] == htonl(0x0002));
 }

+#if defined(CONFIG_IPV6_ISATAP)
+/* only for IFF_ISATAP interfaces */
+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
+{
+   return ((addr->s6_addr32[2] | htonl(0x0200)) == htonl(0x02005EFE));
+}
+#endif
+
 #ifdef CONFIG_PROC_FS
 extern int if6_proc_init(void);
 extern void if6_proc_exit(void);-


-
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 02/05] ipv6: RFC4214 Support (3)

2007-11-09 Thread osprey67

From: Fred L. Templin <[EMAIL PROTECTED]>

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
"ip" utility with device names beginning with: "isatap".

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin <[EMAIL PROTECTED]>

---

--- linux-2.6.24-rc2/net/ipv6/Kconfig.orig  2007-11-08 12:07:17.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/Kconfig   2007-11-08 08:27:48.0 -0800
@@ -57,6 +57,17 @@ config IPV6_ROUTE_INFO

  If unsure, say N.

+config IPV6_ISATAP
+   bool "IPv6: ISATAP (RFC 4214) support (EXPERIMENTAL)"
+   depends on IPV6 && EXPERIMENTAL
+   ---help---
+ This is experimental support for the Intra-Site Automatic
+ Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
+ the SIT module, and is configured using the "ip" utility
+ with device names beginning with: "isatap".
+
+ If unsure, say N.
+
 config IPV6_OPTIMISTIC_DAD
bool "IPv6: Enable RFC 4429 Optimistic DAD (EXPERIMENTAL)"
depends on IPV6 && EXPERIMENTAL


-
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 03/05] ipv6: RFC4214 Support (3)

2007-11-09 Thread osprey67

From: Fred L. Templin <[EMAIL PROTECTED]>

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
"ip" utility with device names beginning with: "isatap".

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin <[EMAIL PROTECTED]>

---

--- linux-2.6.24-rc2/net/ipv6/addrconf.c.orig   2007-11-08 11:59:35.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/addrconf.c2007-11-09 14:19:19.0 
-0800
@@ -75,7 +75,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 

 #ifdef CONFIG_IPV6_PRIVACY
@@ -1424,6 +1424,24 @@ static int addrconf_ifid_infiniband(u8 *
return 0;
 }

+#if defined(CONFIG_IPV6_ISATAP)
+static int addrconf_ifid_isatap(u8 *eui, __be32 addr)
+{
+
+   eui[0] = 0x02; eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
+   memcpy (eui+4, &addr, 4);
+
+   /* Special-Use IPv4 Addresses (RFC3330)
+   if (ZERONET(addr) || PRIVATE_10(addr) || LOOPBACK(addr) ||
+   LINK_169(addr) || PRIVATE_172(addr) || TEST_192(addr) ||
+   ANYCAST_6TO4(addr) || PRIVATE_192(addr) || TEST_198(addr) ||
+   MULTICAST(addr) || BADCLASS(addr)) eui[0] &= ~0x02;
+*/ eui[0] = 0;
+
+   return 0;
+}
+#endif
+
 static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
 {
switch (dev->type) {
@@ -1435,6 +1453,11 @@ static int ipv6_generate_eui64(u8 *eui,
return addrconf_ifid_arcnet(eui, dev);
case ARPHRD_INFINIBAND:
return addrconf_ifid_infiniband(eui, dev);
+#if defined(CONFIG_IPV6_ISATAP)
+   case ARPHRD_SIT:
+   if (dev->priv_flags & IFF_ISATAP)
+   return addrconf_ifid_isatap(eui, *(__be32 
*)dev->dev_addr);
+#endif
}
return -1;
 }
@@ -1470,8 +1493,7 @@ regen:
 *
 *  - Reserved subnet anycast (RFC 2526)
 *  1101 1111 1xxx
-*  - ISATAP (draft-ietf-ngtrans-isatap-13.txt) 5.1
-*  00-00-5E-FE-xx-xx-xx-xx
+*  - ISATAP (RFC4214) 00-00-5E-FE-xx-xx-xx-xx - remove??
 *  - value 0
 *  - XXX: already assigned to an address on the device
 */
@@ -2201,6 +2223,31 @@ static void addrconf_sit_config(struct n
return;
}

+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - NBMA link */
+   if (dev->priv_flags & IFF_ISATAP) {
+   struct in6_addr addr;
+
+   addrconf_add_lroute(dev);
+
+   ipv6_addr_set(&addr,  htonl(0xFE80), 0, 0, 0);
+
+   if (ipv6_generate_eui64(addr.s6_addr + 8, dev) == 0) {
+   struct inet6_ifaddr *ifp;
+
+   ifp = ipv6_add_addr(idev, &addr, 64,
+   IFA_LINK, IFA_F_PERMANENT);
+   if (!IS_ERR(ifp)) {
+   addrconf_prefix_route(&ifp->addr,
+   ifp->prefix_len, idev->dev, 0, 0);
+   addrconf_dad_start(ifp, 0);
+   in6_ifa_put(ifp);
+   }
+   }
+   return;
+   }
+#endif
+
sit_add_v4_addrs(idev);

if (dev->flags&IFF_POINTOPOINT) {
@@ -2531,6 +2578,19 @@ static void addrconf_rs_timer(unsigned l
 *  Announcement received after solicitation
 *  was sent
 */
+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - Re-DAD to trigger new RS/RA */
+   if (ifp->idev->dev->priv_flags & IFF_ISATAP) {
+   struct ip_tunnel *t  = netdev_priv(ifp->idev->dev);
+   if (t->parms.router != INADDR_NONE) {
+   spin_lock(&ifp->lock);
+   ifp->probes = 0;
+   ifp->idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD);
+   addrconf_mod_timer(ifp, AC_DAD, 
t->parms.lifetime*HZ);
+   spin_unlock(&ifp->lock);
+   }
+   }
+#endif
goto out;
}

@@ -2545,10 +2605,32 @@ static void addrconf_rs_timer(unsigned l
   ifp->idev->cnf.rtr_solicit_interval);
spin_unlock(&ifp->lock);

+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - unicast RS */
+   if (ifp->idev->dev->priv_flags & IFF_ISATAP) {
+   struct ip_tunnel *t = netdev_priv(ifp->idev->dev);
+
+   if (t->parms.router == INADDR_NONE) goto out;
+
+   ipv6_addr_set(&all_routers, htonl(0xFE80), 0, 0, 0);
+   addrconf_ifid_isatap(all_routers.s6_addr + 8, 
t->parms.router);
+   } else
+#endif
ipv6_addr_all_routers(&all_routers);

 

[PATCH 04/05] ipv6: RFC4214 Support (3)

2007-11-09 Thread osprey67

From: Fred L. Templin <[EMAIL PROTECTED]>

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
"ip" utility with device names beginning with: "isatap".

The following diffs are specific to the Linux 2.6.24-rc2
kernel distribution.

Signed-off-by: Fred L. Templin <[EMAIL PROTECTED]>

---

--- linux-2.6.24-rc2/net/ipv6/sit.c.orig2007-11-08 12:03:41.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/sit.c 2007-11-09 15:50:41.0 -0800
@@ -16,6 +16,7 @@
  * Changes:
  * Roger Venning <[EMAIL PROTECTED]>:  6to4 support
  * Nate Thompson <[EMAIL PROTECTED]>:6to4 support
+ * Fred L. Templin <[EMAIL PROTECTED]>:isatap support
  */

 #include 
@@ -182,6 +183,14 @@ static struct ip_tunnel * ipip6_tunnel_l
dev->init = ipip6_tunnel_init;
nt->parms = *parms;

+#if defined(CONFIG_IPV6_ISATAP)
+   if (parms->router) {
+   dev->priv_flags |= IFF_ISATAP;
+   if (!nt->parms.lifetime)
+   nt->parms.lifetime = 120; /* RFC4214 Default */
+   }
+#endif
+
if (register_netdevice(dev) < 0) {
free_netdev(dev);
goto failed;
@@ -382,6 +391,48 @@ static int ipip6_rcv(struct sk_buff *skb
IPCB(skb)->flags = 0;
skb->protocol = htons(ETH_P_IPV6);
skb->pkt_type = PACKET_HOST;
+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - check source address */
+   if (tunnel->dev->priv_flags & IFF_ISATAP) {
+   struct neighbour *neigh;
+   struct dst_entry *dst;
+   struct flowi fl;
+   struct in6_addr *addr6;
+   struct ipv6hdr *iph6;
+
+   /* from ISATAP router */
+   if ((tunnel->parms.router != INADDR_NONE) &&
+   (iph->saddr == tunnel->parms.router)) goto accept;
+
+   iph6 = ipv6_hdr(skb);
+   addr6 = &iph6->saddr;
+
+   /* from legitimate previous hop */
+   memset(&fl, 0, sizeof(fl));
+   fl.proto = iph6->nexthdr;
+   ipv6_addr_copy(&fl.fl6_dst, addr6);
+   fl.oif = tunnel->dev->ifindex;
+   security_skb_classify_flow(skb, &fl);
+
+   if (!(dst = ip6_route_output(NULL, &fl)) ||
+(dst->dev != tunnel->dev) ||
+((neigh = dst->neighbour) == NULL)) goto drop;
+
+   addr6 = (struct in6_addr*)&neigh->primary_key;
+
+   if (!(ipv6_addr_is_isatap(addr6)) ||
+(addr6->s6_addr32[3] != iph->saddr)) {
+drop:
+   tunnel->stat.rx_errors++;
+   read_unlock(&ipip6_lock);
+   dst_release(dst);
+   kfree_skb(skb);
+   return 0;
+   }
+   dst_release(dst);
+   }
+accept:
+#endif
tunnel->stat.rx_packets++;
tunnel->stat.rx_bytes += skb->len;
skb->dev = tunnel->dev;
@@ -444,6 +495,31 @@ static int ipip6_tunnel_xmit(struct sk_b
if (skb->protocol != htons(ETH_P_IPV6))
goto tx_error;

+#if defined(CONFIG_IPV6_ISATAP)
+   /* ISATAP (RFC4214) - must come before 6to4 */
+   if (dev->priv_flags & IFF_ISATAP) {
+   struct neighbour *neigh = NULL;
+
+   if (skb->dst)
+   neigh = skb->dst->neighbour;
+
+   if (neigh == NULL) {
+   if (net_ratelimit())
+   printk(KERN_DEBUG "sit: nexthop == NULL\n");
+   goto tx_error;
+   }
+
+   addr6 = (struct in6_addr*)&neigh->primary_key;
+   addr_type = ipv6_addr_type(addr6);
+
+   if ((addr_type & IPV6_ADDR_UNICAST) &&
+ipv6_addr_is_isatap(addr6))
+   dst = addr6->s6_addr32[3];
+   else
+   goto tx_error;
+   }
+#endif /* CONFIG_IPV6_ISATAP */
+
if (!dst)
dst = try_6to4(&iph6->daddr);

@@ -651,6 +727,10 @@ ipip6_tunnel_ioctl (struct net_device *d
ipip6_tunnel_unlink(t);
t->parms.iph.saddr = p.iph.saddr;
t->parms.iph.daddr = p.iph.daddr;
+#if defined(CONFIG_IPV6_ISATAP)
+   if (p.router) t->parms.router = p.router;
+   if (p.lifetime) t->parms.lifetime = p.lifetime;
+#endif
memcpy(dev->dev_addr, &p.iph.saddr, 4);
 

[PATCH 05/05] ipv6: RFC4214 Support (3)

2007-11-09 Thread osprey67

From: Fred L. Templin <[EMAIL PROTECTED]>

This message attaches the combined diffs from
messages 01/05 through 04/05. This file should be
suitable for use with the patch utility.

Signed-off-by: Fred L. Templin <[EMAIL PROTECTED]>

--- linux-2.6.24-rc2/include/linux/if.h.orig2007-11-08 12:05:47.0 
-0800
+++ linux-2.6.24-rc2/include/linux/if.h 2007-11-08 08:26:44.0 -0800
@@ -61,6 +61,7 @@
 #define IFF_MASTER_ALB 0x10/* bonding master, balance-alb. */
 #define IFF_BONDING0x20/* bonding master or slave  */
 #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
+#define IFF_ISATAP 0x80/* ISATAP interface (RFC4214)   */
 
 #define IF_GET_IFACE   0x0001  /* for querying only */
 #define IF_GET_PROTO   0x0002
--- linux-2.6.24-rc2/include/linux/if_tunnel.h.orig 2007-11-09 
09:06:16.0 -0800
+++ linux-2.6.24-rc2/include/linux/if_tunnel.h  2007-11-09 15:49:54.0 
-0800
@@ -25,6 +25,8 @@ struct ip_tunnel_parm
__be16  o_flags;
__be32  i_key;
__be32  o_key;
+   __be32  router;
+   __be32  lifetime;
struct iphdriph;
 };
 
--- linux-2.6.24-rc2/include/linux/in.h.orig2007-11-09 08:00:32.0 
-0800
+++ linux-2.6.24-rc2/include/linux/in.h 2007-11-09 08:56:09.0 -0800
@@ -252,7 +252,15 @@ struct sockaddr_in {
 #define BADCLASS(x)(((x) & htonl(0xf000)) == htonl(0xf000))
 #define ZERONET(x) (((x) & htonl(0xff00)) == htonl(0x))
 #define LOCAL_MCAST(x) (((x) & htonl(0xFF00)) == htonl(0xE000))
-
+ 
+/* Special-Use IPv4 Addresses (RFC3330) */
+#define PRIVATE_10(x)  (((x) & htonl(0xff00)) == htonl(0x0A00))
+#define LINK_169(x)(((x) & htonl(0x)) == htonl(0xA9FE))
+#define PRIVATE_172(x) (((x) & htonl(0xfff0)) == htonl(0xAC10))
+#define TEST_192(x)(((x) & htonl(0xff00)) == htonl(0xC200))
+#define ANYCAST_6TO4(x)(((x) & htonl(0xff00)) == htonl(0xC0586300))
+#define PRIVATE_192(x) (((x) & htonl(0x)) == htonl(0xC0A8))
+#define TEST_198(x)(((x) & htonl(0xfffe)) == htonl(0xC612))
 #endif
 
 #endif /* _LINUX_IN_H */
--- linux-2.6.24-rc2/include/net/addrconf.h.orig2007-11-08 
12:06:17.0 -0800
+++ linux-2.6.24-rc2/include/net/addrconf.h 2007-11-09 08:12:29.0 
-0800
@@ -241,6 +241,14 @@ static inline int ipv6_addr_is_ll_all_ro
addr->s6_addr32[3] == htonl(0x0002));
 }
 
+#if defined(CONFIG_IPV6_ISATAP)
+/* only for IFF_ISATAP interfaces */
+static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
+{
+   return ((addr->s6_addr32[2] | htonl(0x0200)) == htonl(0x02005EFE));
+}
+#endif
+
 #ifdef CONFIG_PROC_FS
 extern int if6_proc_init(void);
 extern void if6_proc_exit(void);
--- linux-2.6.24-rc2/net/ipv6/Kconfig.orig  2007-11-08 12:07:17.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/Kconfig   2007-11-08 08:27:48.0 -0800
@@ -57,6 +57,17 @@ config IPV6_ROUTE_INFO
 
  If unsure, say N.
 
+config IPV6_ISATAP
+   bool "IPv6: ISATAP (RFC 4214) support (EXPERIMENTAL)"
+   depends on IPV6 && EXPERIMENTAL
+   ---help---
+ This is experimental support for the Intra-Site Automatic
+ Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
+ the SIT module, and is configured using the "ip" utility
+ with device names beginning with: "isatap".
+
+ If unsure, say N.
+
 config IPV6_OPTIMISTIC_DAD
bool "IPv6: Enable RFC 4429 Optimistic DAD (EXPERIMENTAL)"
depends on IPV6 && EXPERIMENTAL
--- linux-2.6.24-rc2/net/ipv6/addrconf.c.orig   2007-11-08 11:59:35.0 
-0800
+++ linux-2.6.24-rc2/net/ipv6/addrconf.c2007-11-09 14:19:19.0 
-0800
@@ -75,7 +75,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #ifdef CONFIG_IPV6_PRIVACY
@@ -1424,6 +1424,24 @@ static int addrconf_ifid_infiniband(u8 *
return 0;
 }
 
+#if defined(CONFIG_IPV6_ISATAP)
+static int addrconf_ifid_isatap(u8 *eui, __be32 addr)
+{
+
+   eui[0] = 0x02; eui[1] = 0; eui[2] = 0x5E; eui[3] = 0xFE;
+   memcpy (eui+4, &addr, 4);
+
+   /* Special-Use IPv4 Addresses (RFC3330)
+   if (ZERONET(addr) || PRIVATE_10(addr) || LOOPBACK(addr) ||
+   LINK_169(addr) || PRIVATE_172(addr) || TEST_192(addr) ||
+   ANYCAST_6TO4(addr) || PRIVATE_192(addr) || TEST_198(addr) ||
+   MULTICAST(addr) || BADCLASS(addr)) eui[0] &= ~0x02;
+*/ eui[0] = 0;
+
+   return 0;
+}
+#endif
+
 static int ipv6_generate_eui64(u8 *eui, struct net_device *dev)
 {
switch (dev->type) {
@@ -1435,6 +1453,11 @@ static int ipv6_generate_eui64(u8 *eui, 
return addrconf_ifid_arcnet(eui, dev);
case ARPHRD_INFINIBAND:
return addrconf_ifid_infiniband(eui, dev);
+#if defined(CONFIG_IPV6_ISATAP)

[PATCH 01/01] iproute2-2.6.23: RFC4214 Support (3)

2007-11-09 Thread osprey67

From: Fred L. Templin <[EMAIL PROTECTED]>

This is experimental support for the Intra-Site Automatic
Tunnel Addressing Protocol (ISATAP) per RFC4214. It uses
the SIT module, and is configured using the unmodified
"ip" utility with device names beginning with: "isatap".

The following diffs are specific to the iproute2-2.6.23
software distribution. The diff text file itself is also
attached and should be suitable for use with the patch
utility.

Signed-off-by: Fred L. Templin <[EMAIL PROTECTED]>

---

--- iproute2-2.6.23/ip/iptunnel.c.orig  2007-11-08 16:27:24.0 -0800
+++ iproute2-2.6.23/ip/iptunnel.c   2007-11-09 15:47:06.0 -0800
@@ -1,3 +1,5 @@
+#define ISATAP
+
 /*
  * iptunnel.c "ip tunnel"
  *
@@ -39,7 +41,12 @@ static void usage(void) __attribute__((n
 static void usage(void)
 {
fprintf(stderr, "Usage: ip tunnel { add | change | del | show } [ NAME 
]\n");
+#if defined(ISATAP)
+   fprintf(stderr, "  [ mode { ipip | gre | sit | isatap } ]\n");
+   fprintf(stderr, "  [ remote ADDR ] [ local ADDR ] [ router ADDR ] [ 
lifetime NUMBER ]\n");
+#else
fprintf(stderr, "  [ mode { ipip | gre | sit } ] [ remote ADDR ] [ 
local ADDR ]\n");
+#endif
fprintf(stderr, "  [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum 
]\n");
fprintf(stderr, "  [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ dev 
PHYS_DEV ]\n");
fprintf(stderr, "\n");
@@ -55,6 +62,9 @@ static int parse_args(int argc, char **a
 {
int count = 0;
char medium[IFNAMSIZ];
+#if defined(ISATAP)
+   int isatap = 0;
+#endif

memset(p, 0, sizeof(*p));
memset(&medium, 0, sizeof(medium));
@@ -90,6 +100,15 @@ static int parse_args(int argc, char **a
exit(-1);
}
p->iph.protocol = IPPROTO_IPV6;
+#if defined(ISATAP)
+   } else if (strcmp(*argv, "isatap") == 0) {
+   if (p->iph.protocol && p->iph.protocol != 
IPPROTO_IPV6) {
+   fprintf(stderr,"You managed to ask for more 
than one tunnel mode.\n");
+   exit(-1);
+   }
+   p->iph.protocol = IPPROTO_IPV6;
+   isatap++;
+#endif
} else {
fprintf(stderr,"Cannot guess tunnel mode.\n");
exit(-1);
@@ -160,6 +179,20 @@ static int parse_args(int argc, char **a
NEXT_ARG();
if (strcmp(*argv, "any"))
p->iph.saddr = get_addr32(*argv);
+#if defined(ISATAP)
+   } else if (strcmp(*argv, "router") == 0) {
+   NEXT_ARG();
+   if (strcmp(*argv, "any"))
+   p->router = get_addr32(*argv);
+   } else if (strcmp(*argv, "lifetime") == 0) {
+   unsigned uval;
+   NEXT_ARG();
+   if (get_unsigned(&uval, *argv, 0)) {
+   invarg("invalid lifetime\n", *argv);
+   exit(-1);
+   }
+   p->lifetime = uval;
+#endif
} else if (strcmp(*argv, "dev") == 0) {
NEXT_ARG();
strncpy(medium, *argv, IFNAMSIZ-1);
@@ -212,6 +245,12 @@ static int parse_args(int argc, char **a
p->iph.protocol = IPPROTO_IPIP;
else if (memcmp(p->name, "sit", 3) == 0)
p->iph.protocol = IPPROTO_IPV6;
+#if defined(ISATAP)
+   else if (memcmp(p->name, "isatap", 6) == 0) {
+   p->iph.protocol = IPPROTO_IPV6;
+   isatap++;
+   }
+#endif
}

if (p->iph.protocol == IPPROTO_IPIP || p->iph.protocol == IPPROTO_IPV6) 
{
@@ -239,6 +278,22 @@ static int parse_args(int argc, char **a
fprintf(stderr, "Broadcast tunnel requires a source 
address.\n");
return -1;
}
+#if defined(ISATAP)
+   if (isatap) {
+   if (p->iph.daddr) {
+   fprintf(stderr, "no remote with isatap.\n");
+   return -1;
+   }
+   if (!p->router) p->router = INADDR_NONE;
+   if (!p->lifetime) p->lifetime = 120;
+   } else {
+   if (p->router || p->lifetime) {
+   fprintf(stderr, "router/lifetime only for isatap.\n");
+   return -1;
+   }
+   }
+#endif
+
return 0;
 }

--- iproute2-2.6.23/ip/iptunnel.c.orig  2007-11-08 16:27:24.0 -0800
+++ iproute2-2.6.23/ip/iptunnel.c   2007-11-09 15:47:06.0 -0800
@@ -1,3 +1,5 @@
+#define ISATAP
+
 /*
  * iptunnel.c   

Re: [PATCH 01/01] iproute2-2.6.23: RFC4214 Support (3)

2007-11-09 Thread Patrick McHardy

osprey67 wrote:


--- iproute2-2.6.23/ip/iptunnel.c.orig  2007-11-08 16:27:24.0 
-0800
+++ iproute2-2.6.23/ip/iptunnel.c   2007-11-09 15:47:06.0 
-0800

@@ -1,3 +1,5 @@
+#define ISATAP
+
 /*
  * iptunnel.c "ip tunnel"
  *
@@ -39,7 +41,12 @@ static void usage(void) __attribute__((n
 static void usage(void)
 {
fprintf(stderr, "Usage: ip tunnel { add | change | del | show 
} [ NAME ]\n");

+#if defined(ISATAP)
+   fprintf(stderr, "  [ mode { ipip | gre | sit | isatap 
} ]\n");
+   fprintf(stderr, "  [ remote ADDR ] [ local ADDR ] [ 
router ADDR ] [ lifetime NUMBER ]\n");

+#else
fprintf(stderr, "  [ mode { ipip | gre | sit } ] [ 
remote ADDR ] [ local ADDR ]\n");
+#endif 



Why all the #ifdefs if you define it in the same file anyway?

-
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/05] ipv6: RFC4214 Support (3)

2007-11-09 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Fri, 09 Nov 2007 16:35:59 -0800), osprey67 
<[EMAIL PROTECTED]> says:

> --- linux-2.6.24-rc2/include/linux/if_tunnel.h.orig   2007-11-09 
> 09:06:16.0 -0800
> +++ linux-2.6.24-rc2/include/linux/if_tunnel.h2007-11-09 
> 15:49:54.0 -0800
> @@ -25,6 +25,8 @@ struct ip_tunnel_parm
>   __be16  o_flags;
>   __be32  i_key;
>   __be32  o_key;
> + __be32  router;
> + __be32  lifetime;
>   struct iphdriph;
>  };
>  

No, you cannot simply change this.
If you change ioctl structure, you need to change
constants for SIOC{GET,ADD,CHG,DEL}TUNNEL.
Rename ole ones to OSIOxxx and assign new values.

If possible, new iproute2 should work with old kernels, and
old iproute2 should work with new kernels (without new features).

--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: [RFC] dependencies for platform drivers (was Re: ax88796: add superh to kconfig dependencies)

2007-11-09 Thread Jeff Garzik

Ben Dooks wrote:

in submission process, or awaiting for an resolution. In the case
of simtec-ide, I would like to replace it with platform-ata, but
the libata maintainers seem wholy un-interested in
PLAT_HAS_PLATFORM_ATA or similar.



I've either missed or forgotten your patch/proposal, want to repost to 
linux-ide?


I want to spread libata to the far corner of the globe, and am quite 
interested in supporting all architectures.


Jeff


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


Re: [PATCH 00/05] pull request for 'upstream-jeff' branch

2007-11-09 Thread Jeff Garzik

Francois Romieu wrote:

Please pull from branch 'upstream-jeff' in repository

git://git.kernel.org/pub/scm/linux/kernel/git/romieu/netdev-2.6.git 
upstream-jeff

to get the changes below.

They should make things better for people who have experienced the 8168b
regression since 2.6.24-rc1.

Distance from 'master' (f2511f13daaf00fdd206bee7b108f75923a613c6)
-

407b35429151dd1d7a64cbef9f4bc59dac2efe5d
d981c1de3b81edf50fe59f0e1298668919117b14
9d891d0bb0a14bc8184eee45323cb010db4d0db4
69b4d070ea49bd7f589776ea471a69883455
db1470271c581050dcacc6ed681b9166d30bdba0

Diffstat


 drivers/net/r8169.c |   26 +++---
 1 files changed, 7 insertions(+), 19 deletions(-)

Shortlog


Ciaran McCreesh (1):
  r8169: add PCI ID for the 8168 in the Abit Fatal1ty F-190HD motherboard

Francois Romieu (2):
  r8169: do not enable the TBI for the 8168 and the 81x0
  r8169: prevent bit sign expansion error in mdio_write

Mark Lord (2):
  r8169: revert 7da97ec96a0934319c7fbedd3d38baf533e20640 (partly)
  r8169: revert 7da97ec96a0934319c7fbedd3d38baf533e20640 (bis repetita)



pulled


-
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: 2.6.24-rc2: Network commit causes SLUB performance regression with tbench

2007-11-09 Thread Nick Piggin
On Saturday 10 November 2007 12:29, Nick Piggin wrote:
> cc'ed linux-netdev

Err, make that 'netdev' :P

> On Saturday 10 November 2007 10:46, Christoph Lameter wrote:
> > commit deea84b0ae3d26b41502ae0a39fe7fe134e703d0 seems to cause a drop
> > in SLUB tbench performance:
> >
> > 8p x86_64 system:
> >
> > 2.6.24-rc2:
> > 1260.80 MB/sec
> >
> > After reverting the patch:
> > 2350.04 MB/sec
> >
> > SLAB performance (which is at 2435.58 MB/sec, ~3% better than SLUB) is
> > not affected by the patch.
>
> Ah, I didn't realise this was a regression. Thanks for bisecting it.
>
> > Since this is an alignment change it seems that tbench performance is
> > sensitive to the data layout? SLUB packs data more tightly than SLAB. So
> > 8 byte allocations could result in cacheline contention if adjacent
> > objects are allocated from different cpus. SLABs minimum size is 32
> > bytes so the cacheline contention is likely more limited.
> >
> > Maybe we need to allocate a mininum of one cacheline to the skb head? Or
> > padd it out to a full cacheline?
>
> The data should already be cacheline aligned. It is kmalloced, and
> with a minimum size of somewhere around 200 bytes on a 64-bit machine.
> So it will hit a cacheline aligned kmalloc slab AFAIKS  -- cacheline
> interference is probably not the problem. (To verify, I built slub with
> minimum kmalloc size set to 32 like slab and it's no real difference)
>
> But I can't see why restricting the allocation to PAGE_SIZE would help
> either. Maybe the macros are used in some other areas.
>
> BTW. your size-2048 kmalloc cache is order-1 in the default setup,
> wheras kmalloc(1024) or kmalloc(4096) will be order-0 allocations. And
> SLAB also uses order-0 for size-2048. It would be nice if SLUB did the
> same...
>
> > commit deea84b0ae3d26b41502ae0a39fe7fe134e703d0
> > Author: Herbert Xu <[EMAIL PROTECTED]>
> > Date:   Sun Oct 21 16:27:46 2007 -0700
> >
> > [NET]: Fix SKB_WITH_OVERHEAD calculation
> >
> > The calculation in SKB_WITH_OVERHEAD is incorrect in that it can
> > cause an overflow across a page boundary which is what it's meant to
> > prevent. In particular, the header length (X) should not be lumped
> > together with skb_shared_info.  The latter needs to be aligned properly
> > while the header has no choice but to sit in front of wherever the
> > payload is.
> >
> > Therefore the correct calculation is to take away the aligned size of
> > skb_shared_info, and then subtract the header length.  The resulting
> > quantity L satisfies the following inequality:
> >
> > SKB_DATA_ALIGN(L + X) + sizeof(struct skb_shared_info) <=
> > PAGE_SIZE
> >
> > This is the quantity used by alloc_skb to do the actual allocation.
> > Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>
> > Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
> >
> > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> > index f93f22b..369f60a 100644
> > --- a/include/linux/skbuff.h
> > +++ b/include/linux/skbuff.h
> > @@ -41,8 +41,7 @@
> >  #define SKB_DATA_ALIGN(X)  (((X) + (SMP_CACHE_BYTES - 1)) & \
> >  ~(SMP_CACHE_BYTES - 1))
> >  #define SKB_WITH_OVERHEAD(X)   \
> > -   (((X) - sizeof(struct skb_shared_info)) & \
> > -~(SMP_CACHE_BYTES - 1))
> > +   ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
> >  #define SKB_MAX_ORDER(X, ORDER) \
> > SKB_WITH_OVERHEAD((PAGE_SIZE << (ORDER)) - (X))
> >  #define SKB_MAX_HEAD(X)(SKB_MAX_ORDER((X), 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