[PATCH] net: 32 bit (socket layer) ioctl emulation for 64 bit kernels

2006-01-08 Thread Shaun Pereira
Hi all,
The attached patch is a follow up to a post made earlier to this site
with regard to 32 bit (socket layer) ioctl emulation for 64 bit kernels.

I needed to implement 32 bit userland ioctl support for modular (x.25)
socket ioctls in a 64 bit kernel. With the removal of the
register_ioctl32_conversion() function from the kernel, one of the
suggestions made by Andi was "to just extend the socket code to add a
compat_ioctl vector to the socket options"

With Arnd's help (see previous mails with subject = 32 bit (socket
layer) ioctl emulation for 64 bit kernels) I have prepared the following
patchand tested with with x25 over tcp on a x26_64 kernel. 

Since we are interested in ioctl's from userspace I have not added the 
.compat_ioctl function pointer to struct net_device. The assumption
being once the userspace data has reached the kernel via the socket api,
if the socket layer protocol knows how to handle the data, it will
prepare it for the device. 

Am not too sure whether struct proto requires modification. Since it is 
allocated dynamically in the protocol layer I have left it alone;no
compat_ioctl. Also it seems like the socket layer would know how to
"ioctl" the transport layer, userspace does not need to know about
this? 

But if any of this is incorrect and needs to be changed please advise 
and I will make the changes accordingly. If this patch is accepted I 
would be in a position to submit a patch for x25 (32 bit userspace 
for 64 bit kernel). 

Many thanks for your help
Regards
Shaun


diff -uprN -X dontdiff linux-2.6.15-vanilla/include/linux/net.h
linux-2.6.15/include/linux/net.h
--- linux-2.6.15-vanilla/include/linux/net.h2006-01-03
14:21:10.0 +1100
+++ linux-2.6.15/include/linux/net.h2006-01-09 15:59:49.0 +1100
@@ -143,6 +143,10 @@ struct proto_ops {
  struct poll_table_struct *wait);
int (*ioctl) (struct socket *sock, unsigned int cmd,
  unsigned long arg);
+#ifdef CONFIG_COMPAT
+   int (*compat_ioctl) (struct socket *sock, unsigned int cmd,
+ unsigned long arg);
+#endif
int (*listen)(struct socket *sock, int len);
int (*shutdown)  (struct socket *sock, int flags);
int (*setsockopt)(struct socket *sock, int level,
@@ -205,6 +209,7 @@ extern int   kernel_recvmsg(struct
 #ifndef CONFIG_SMP
 #define SOCKOPS_WRAPPED(name) name
 #define SOCKOPS_WRAP(name, fam)
+#define SOCKOPS_COMPAT_WRAP(name, fam)
 #else
 
 #define SOCKOPS_WRAPPED(name) __unlocked_##name
@@ -279,6 +284,60 @@ static struct proto_ops name##_ops = { 
.recvmsg= __lock_##name##_recvmsg,  \
.mmap   = __lock_##name##_mmap, \
 };
+
+#define SOCKOPS_COMPAT_WRAP(name, fam) \
+SOCKCALL_WRAP(name, release, (struct socket *sock), (sock))\
+SOCKCALL_WRAP(name, bind, (struct socket *sock, struct sockaddr *uaddr,
int addr_len), \
+ (sock, uaddr, addr_len))  \
+SOCKCALL_WRAP(name, connect, (struct socket *sock, struct sockaddr *
uaddr, \
+ int addr_len, int flags), \
+ (sock, uaddr, addr_len, flags))   \
+SOCKCALL_WRAP(name, socketpair, (struct socket *sock1, struct socket
*sock2), \
+ (sock1, sock2))   \
+SOCKCALL_WRAP(name, accept, (struct socket *sock, struct socket
*newsock, \
+int flags), (sock, newsock, flags)) \
+SOCKCALL_WRAP(name, getname, (struct socket *sock, struct sockaddr
*uaddr, \
+int *addr_len, int peer), (sock, uaddr, addr_len, 
peer)) \
+SOCKCALL_UWRAP(name, poll, (struct file *file, struct socket *sock,
struct poll_table_struct *wait), \
+ (file, sock, wait)) \
+SOCKCALL_WRAP(name, ioctl, (struct socket *sock, unsigned int cmd, \
+unsigned long arg), (sock, cmd, arg)) \
+SOCKCALL_WRAP(name, compat_ioctl, (struct socket *sock, unsigned int
cmd, \
+unsigned long arg), (sock, cmd, arg)) \
+SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock,
len)) \
+SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock,
flags)) \
+SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int
optname, \
+char __user *optval, int optlen), (sock, level, 
optname, optval,
optlen)) \
+SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int
optname, \
+char __user *optval, int __user *optlen), (sock, 
level, optname,
optval, optlen)) \
+SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock,
struct msghdr *m, size_t len), \
+ (iocb, sock, m, len)) \
+SOCKCALL_WRAP(name, recvmsg, (struct kiocb *iocb, struct socket *sock,
struct msghdr *m, s

Re: [IPV6]: Set skb->priority in ip6_output.c

2006-01-08 Thread David S. Miller
From: Patrick McHardy <[EMAIL PROTECTED]>
Date: Mon, 09 Jan 2006 01:01:27 +0100

> I noticed IPv6 only sets skb->priority in raw.c but not in
> ip6_output.c, which seems to be a mistake.

Applied, thanks Patrick.
-
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: [IPV4]: ip_output.c needs xfrm.h

2006-01-08 Thread David S. Miller
From: Patrick McHardy <[EMAIL PROTECTED]>
Date: Sun, 08 Jan 2006 22:56:35 +0100

> This patch fixes a warning from my IPsec patches:
> 
>CC  net/ipv4/ip_output.o
> net/ipv4/ip_output.c: In function 'ip_finish_output':
> net/ipv4/ip_output.c:208: warning: implicit declaration of function 
> 'xfrm4_output_finish'
> 
> Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

Applied, thanks Patrick.
-
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: Resubmit: PATCH: fix qdisc return code

2006-01-08 Thread David S. Miller
From: Jamal Hadi Salim <[EMAIL PROTECTED]>
Date: Sun, 08 Jan 2006 14:34:03 -0500

> Ok, heres a resubmit after discussion with Patrick.

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


Re: Resubmit: PATCH: IFB as IMQ replacement

2006-01-08 Thread David S. Miller
From: Jamal Hadi Salim <[EMAIL PROTECTED]>
Date: Sun, 08 Jan 2006 12:43:20 -0500

> Heres a resubmit of the IFB device. Updates from latest comments (much
> much thanks Patrick). 
> Dave please apply this one. Any further comments that come up after this
> go in as separate patches.

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


Re: ax25/mkiss: unbalanced spinlock_bh in ax_encaps()

2006-01-08 Thread David S. Miller
From: Ralf Baechle <[EMAIL PROTECTED]>
Date: Sun, 8 Jan 2006 10:43:19 +0100

> No, with your patch the spinlock is dropped only after the
> tty->driver->write() call which might sleep.
> 
> Signed-off-by: Ralf Baechle <[EMAIL PROTECTED]>

Applied, thanks 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: [PATCH] Change some "if (x) BUG();" to "BUG_ON(x);"

2006-01-08 Thread David S. Miller
From: "Kris Katterjohn" <[EMAIL PROTECTED]>
Date: Sat, 7 Jan 2006 18:49:17 -0800

> This changes some simple "if (x) BUG();" statements to "BUG_ON(x);"
> 
> Signed-off-by: Kris Katterjohn <[EMAIL PROTECTED]>

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


Re: [PATCH 6/6][PKT_SCHED]: Prefix tc actions with act_

2006-01-08 Thread David S. Miller
From: Patrick McHardy <[EMAIL PROTECTED]>
Date: Sun, 08 Jan 2006 00:38:03 +0100

> [PKT_SCHED]: Prefix tc actions with act_
> 
> Clean up the net/sched directory a bit by prefix all actions with act_.
> 
> Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

Applied, with the appropriate rename commands.

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


Re: [PATCH 5/6][PKT_SCHED]: Fix memory leak when dumping in pedit action

2006-01-08 Thread David S. Miller
From: Patrick McHardy <[EMAIL PROTECTED]>
Date: Sun, 08 Jan 2006 00:37:56 +0100

> [PKT_SCHED]: Fix memory leak when dumping in pedit action
> 
> Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

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


Re: [PATCH 4/6][PKT_SCHED]: Remove some obsolete policer exports

2006-01-08 Thread David S. Miller
From: Patrick McHardy <[EMAIL PROTECTED]>
Date: Sun, 08 Jan 2006 00:37:51 +0100

> [PKT_SCHED]: Remove some obsolete policer exports
> 
> Also make sure the legacy code is only built when CONFIG_NET_CLS_ACT
> is not set.
> 
> Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

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


Re: [PATCH 3/6][PKT_SCHED]: Convert tc action functions to single skb pointers

2006-01-08 Thread David S. Miller

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


Re: [PATCH 1/6][NET]: Convert net/{ipv4,ipv6,sched} to netdev_priv

2006-01-08 Thread David S. Miller
From: Patrick McHardy <[EMAIL PROTECTED]>
Date: Sun, 08 Jan 2006 00:37:28 +0100

> following are a couple of assorted patches I found while
> cleaning out old trees. Please apply, thanks.
 ...
> [NET]: Convert net/{ipv4,ipv6,sched} to netdev_priv
>
> Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

Applied, although personally I would have split out this
particular hunk:

@@ -286,9 +286,6 @@ static struct ip_tunnel * ipgre_tunnel_l
goto failed;
}
 
-   nt = dev->priv;
-   nt->parms = *parms;
-
dev_hold(dev);
ipgre_tunnel_link(nt);
return nt;

Yes, if you read the code you'll see that the ->init() function
change any releavant state to this stuff so the assignment is
superfluous.  But a changeset comment stating that would have
made this easier to review :-)

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


[PATCH] Re: mv643xx_eth_start_xmit: calls skb_linearize with interrupts off

2006-01-08 Thread Paul Janzen
Paul Janzen <[EMAIL PROTECTED]> writes:

> In mv643xx_eth_start_xmit:
> [...]
>   spin_lock_irqsave(&mp->lock, flags);
> [...]
>   /* Since hardware can't handle unaligned fragments smaller
>* than 9 bytes, if we find any, we linearize the skb
>* and start again. */
> [...]
>   skb_linearize(skb, GFP_ATOMIC);
> [...]
>
> which ends up calling kunmap_skb_frag(vaddr), which, when
> CONFIG_HIGHMEM=y, calls local_bh_enable with interrupts off.

A patch for this problem is enclosed.  I believe it also solves a
potential deadlock if skb_linearize() returns -ENOMEM. 

Signed-off-by: Paul Janzen <[EMAIL PROTECTED]>

--- a/drivers/net/mv643xx_eth.c 2005-12-24 15:47:48.0 -0800
+++ b/drivers/net/mv643xx_eth.c 2006-01-08 20:30:25.0 -0800
@@ -1093,6 +1093,27 @@ static int mv643xx_poll(struct net_devic
 }
 #endif
 
+/* Hardware can't handle unaligned fragments smaller than 9 bytes.
+ * This helper function detects that case.  When I've seen it, it's
+ * always been the first frag (probably near the end of the page), but
+ * we check all frags to be safe.
+ */
+
+static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb)
+{
+unsigned int frag;
+skb_frag_t *fragp;
+
+for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) {
+fragp = &skb_shinfo(skb)->frags[frag];
+if (fragp->size <= 8 && fragp->page_offset & 0x7) 
+return 1;
+
+}
+return 0;
+}
+
+
 /*
  * mv643xx_eth_start_xmit
  *
@@ -1136,12 +1157,22 @@ static int mv643xx_eth_start_xmit(struct
return 1;
}
 
+if (has_tiny_unaligned_frags(skb)) {
+if ((skb_linearize(skb, GFP_ATOMIC) != 0) 
+|| has_tiny_unaligned_frags(skb)) { 
+stats->tx_dropped++;
+printk(KERN_ERR 
+   "%s: failed to linearize tiny unaligned 
fragment\n",
+dev->name);
+return 1;
+}
+}
+
spin_lock_irqsave(&mp->lock, flags);
 
/* Update packet info data structure -- DMA owned, first last */
 #ifdef MV643XX_CHECKSUM_OFFLOAD_TX
if (!skb_shinfo(skb)->nr_frags) {
-linear:
if (skb->ip_summed != CHECKSUM_HW) {
/* Errata BTS #50, IHL must be 5 if no HW checksum */
pkt_info.cmd_sts = ETH_TX_ENABLE_INTERRUPT |
@@ -1183,26 +1214,6 @@ linear:
} else {
unsigned int frag;
 
-   /* Since hardware can't handle unaligned fragments smaller
-* than 9 bytes, if we find any, we linearize the skb
-* and start again.  When I've seen it, it's always been
-* the first frag (probably near the end of the page),
-* but we check all frags to be safe.
-*/
-   for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) {
-   skb_frag_t *fragp;
-
-   fragp = &skb_shinfo(skb)->frags[frag];
-   if (fragp->size <= 8 && fragp->page_offset & 0x7) {
-   skb_linearize(skb, GFP_ATOMIC);
-   printk(KERN_DEBUG "%s: unaligned tiny fragment"
-   "%d of %d, fixed\n",
-   dev->name, frag,
-   skb_shinfo(skb)->nr_frags);
-   goto linear;
-   }
-   }
-
/* first frag which is skb header */
pkt_info.byte_cnt = skb_headlen(skb);
pkt_info.buf_ptr = dma_map_single(NULL, skb->data,


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


[IPV6]: Set skb->priority in ip6_output.c

2006-01-08 Thread Patrick McHardy

I noticed IPv6 only sets skb->priority in raw.c but not in
ip6_output.c, which seems to be a mistake.

[IPV6]: Set skb->priority in ip6_output.c

Set skb->priority = sk->sk_priority as in raw.c and IPv4.

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

---
commit 6c35e681553b3faf9c98d0b983c3e9f51d17fcaf
tree 6793ee9dcc8b7a71b17e3faa4d0e63d3adc3cd4b
parent 663f377ad5eeac785bb490e1274fd9bab000995b
author Patrick McHardy <[EMAIL PROTECTED]> Mon, 09 Jan 2006 00:59:02 +0100
committer Patrick McHardy <[EMAIL PROTECTED]> Mon, 09 Jan 2006 00:59:02 +0100

 net/ipv6/ip6_output.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index b4c4beb..efa3e72 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -226,6 +226,8 @@ int ip6_xmit(struct sock *sk, struct sk_
ipv6_addr_copy(&hdr->saddr, &fl->fl6_src);
ipv6_addr_copy(&hdr->daddr, first_hop);
 
+   skb->priority = sk->sk_priority;
+
mtu = dst_mtu(dst);
if ((skb->len <= mtu) || ipfragok) {
IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
@@ -1182,6 +1184,8 @@ int ip6_push_pending_frames(struct sock 
ipv6_addr_copy(&hdr->saddr, &fl->fl6_src);
ipv6_addr_copy(&hdr->daddr, final_dst);
 
+   skb->priority = sk->sk_priority;
+
skb->dst = dst_clone(&rt->u.dst);
IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS); 
err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dst->dev, 
dst_output);


Re: SiS190 on ASUS. monodirectional traffic

2006-01-08 Thread Francois Romieu
Marco Atzeri <[EMAIL PROTECTED]> :
[...]
> In both the two directions I noted that from 1469 and over the loss is 100%

4 bytes too soon. Sh*t.

Can you try the patch below and send the dump of a simple
for i in $(seq 1467 1473); do ping -c 1 -s $i 192.168.1.2; done

Not that it should need a lot of space but you can use something like
"-F libpcap -w frob.nitz" to save to a more space-savy format.

Any chance you could do the test with a tethereal/linux on both side ?

diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 478791e..bf6f188 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -602,7 +602,7 @@ static int sis190_rx_interrupt(struct ne
sis190_give_to_asic(desc, tp->rx_buf_sz);
else {
struct sk_buff *skb = tp->Rx_skbuff[entry];
-   int pkt_size = (status & RxSizeMask) - 4;
+   int pkt_size = status & RxSizeMask;
void (*pci_action)(struct pci_dev *, dma_addr_t,
size_t, int) = pci_dma_sync_single_for_device;
 
-
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


[IPV4]: ip_output.c needs xfrm.h

2006-01-08 Thread Patrick McHardy

This patch fixes a warning from my IPsec patches:

  CC  net/ipv4/ip_output.o
net/ipv4/ip_output.c: In function 'ip_finish_output':
net/ipv4/ip_output.c:208: warning: implicit declaration of function 
'xfrm4_output_finish'


Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 59fdac3..e8569b9 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -69,6 +69,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 


[PATCH] smc91x: allow for dynamic bus access configs

2006-01-08 Thread Nicolas Pitre
All accessor's different methods are now selected with C code and unused 
ones statically optimized away at compile time instead of being selected 
with #if's and #ifdef's.  This has many advantages such as allowing the 
compiler to validate the syntax of the whole code, making it cleaner and 
easier to understand, and ultimately allowing people to define 
configuration symbols in terms of variables if they really want to 
dynamically support multiple bus configurations at the same time (with 
the unavoidable performance cost).

Signed-off-by: Nicolas Pitre <[EMAIL PROTECTED]>

---

Index: linux-2.6/drivers/net/smc91x.c
===
--- linux-2.6.orig/drivers/net/smc91x.c
+++ linux-2.6/drivers/net/smc91x.c
@@ -216,15 +216,12 @@ struct smc_local {
 
spinlock_t lock;
 
-#ifdef SMC_CAN_USE_DATACS
-   u32 __iomem *datacs;
-#endif
-
 #ifdef SMC_USE_PXA_DMA
/* DMA needs the physical address of the chip */
u_long physaddr;
 #endif
void __iomem *base;
+   void __iomem *datacs;
 };
 
 #if SMC_DEBUG > 0
@@ -2107,9 +2104,8 @@ static int smc_enable_device(struct plat
 * Set the appropriate byte/word mode.
 */
ecsr = readb(addr + (ECSR << SMC_IO_SHIFT)) & ~ECSR_IOIS8;
-#ifndef SMC_CAN_USE_16BIT
-   ecsr |= ECSR_IOIS8;
-#endif
+   if (SMC_CAN_USE_16BIT)
+   ecsr |= ECSR_IOIS8;
writeb(ecsr, addr + (ECSR << SMC_IO_SHIFT));
local_irq_restore(flags);
 
@@ -2146,40 +2142,39 @@ static void smc_release_attrib(struct pl
release_mem_region(res->start, ATTRIB_SIZE);
 }
 
-#ifdef SMC_CAN_USE_DATACS
-static void smc_request_datacs(struct platform_device *pdev, struct net_device 
*ndev)
+static inline void smc_request_datacs(struct platform_device *pdev, struct 
net_device *ndev)
 {
-   struct resource * res = platform_get_resource_byname(pdev, 
IORESOURCE_MEM, "smc91x-data32");
-   struct smc_local *lp = netdev_priv(ndev);
+   if (SMC_CAN_USE_DATACS) {
+   struct resource * res = platform_get_resource_byname(pdev, 
IORESOURCE_MEM, "smc91x-data32");
+   struct smc_local *lp = netdev_priv(ndev);
 
-   if (!res)
-   return;
+   if (!res)
+   return;
 
-   if(!request_mem_region(res->start, SMC_DATA_EXTENT, CARDNAME)) {
-   printk(KERN_INFO "%s: failed to request datacs memory 
region.\n", CARDNAME);
-   return;
-   }
+   if(!request_mem_region(res->start, SMC_DATA_EXTENT, CARDNAME)) {
+   printk(KERN_INFO "%s: failed to request datacs memory 
region.\n", CARDNAME);
+   return;
+   }
 
-   lp->datacs = ioremap(res->start, SMC_DATA_EXTENT);
+   lp->datacs = ioremap(res->start, SMC_DATA_EXTENT);
+   }
 }
 
 static void smc_release_datacs(struct platform_device *pdev, struct net_device 
*ndev)
 {
-   struct smc_local *lp = netdev_priv(ndev);
-   struct resource * res = platform_get_resource_byname(pdev, 
IORESOURCE_MEM, "smc91x-data32");
+   if (SMC_CAN_USE_DATACS) {
+   struct smc_local *lp = netdev_priv(ndev);
+   struct resource * res = platform_get_resource_byname(pdev, 
IORESOURCE_MEM, "smc91x-data32");
 
-   if (lp->datacs)
-   iounmap(lp->datacs);
+   if (lp->datacs)
+   iounmap(lp->datacs);
 
-   lp->datacs = NULL;
+   lp->datacs = NULL;
 
-   if (res)
-   release_mem_region(res->start, SMC_DATA_EXTENT);
+   if (res)
+   release_mem_region(res->start, SMC_DATA_EXTENT);
+   }
 }
-#else
-static void smc_request_datacs(struct platform_device *pdev, struct net_device 
*ndev) {}
-static void smc_release_datacs(struct platform_device *pdev, struct net_device 
*ndev) {}
-#endif
 
 /*
  * smc_init(void)
Index: linux-2.6/drivers/net/smc91x.h
===
--- linux-2.6.orig/drivers/net/smc91x.h
+++ linux-2.6/drivers/net/smc91x.h
@@ -275,7 +275,10 @@ SMC_outw(u16 val, void __iomem *ioaddr, 
 #define SMC_insw(a,r,p,l)  readsw ((void*) ((a) + (r)), p, l)
 #define SMC_outw(v,a,r) ({ writew ((v), (a) + (r)); 
LPD7A40X_IOBARRIER; })
 
-static inline void SMC_outsw (unsigned long a, int r, unsigned char* p, int l)
+#define SMC_outsw  LPD7A40X_SMC_outsw
+
+static inline void LPD7A40X_SMC_outsw(unsigned long a, int r,
+unsigned char* p, int l)
 {
unsigned short* ps = (unsigned short*) p;
while (l-- > 0) {
@@ -342,10 +345,6 @@ static inline void SMC_outsw (unsigned l
 
 #endif
 
-#ifndefSMC_IRQ_TRIGGER_TYPE
-#defineSMC_IRQ_TRIGGER_TYPEIRQT_RISING
-#endif
-
 #ifdef SMC_USE_PXA_DMA
 /*
  * Let's use the DMA engine on the XScale PXA2xx for RX packets. This is
@@ -441,10 +440,85 @@ smc

[RFC] cs89x0: ALLOW_DMA

2006-01-08 Thread Lennert Buytenhek
There's an ifdef in cs89x0.c that seems to have been the wrong way round
since it was merged (and noone seems to have noticed) -- the IXDP2x01
doesn't support ISA-style DMA, but when building for IXDP2x01, cs89x0's
ALLOW_DMA is set to 1, and when building for another platform, ALLOW_DMA
is set to 0.

rmk proposed replacing CONFIG_ARCH_IXDP2X01 with CONFIG_ISA_DMA_API.  Ok?

Signed-off-by: Lennert Buytenhek <[EMAIL PROTECTED]>

--- linux-2.6.15/drivers/net/cs89x0.c.orig  2006-01-08 21:35:35.0 
+0100
+++ linux-2.6.15/drivers/net/cs89x0.c   2006-01-08 21:35:53.0 +0100
@@ -100,7 +100,7 @@
  * Note that even if DMA is turned off we still support the 'dma' and  
'use_dma'
  * module options so we don't break any startup scripts.
  */
-#ifndef CONFIG_ARCH_IXDP2X01
+#ifndef CONFIG_ISA_DMA_API
 #define ALLOW_DMA  0
 #else
 #define ALLOW_DMA  1
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: PATCH: fix qdisc return code

2006-01-08 Thread Patrick McHardy

Jamal Hadi Salim wrote:

On Sun, 2006-08-01 at 20:34 +0100, Patrick McHardy wrote:


Looking at it again, I think you should not change the existing return
code but just use NET_XMIT_BYPASS for the TC_ACT_SHOT (TC_POLICE_SHOT)
case. Otherwise you will also return it if the packet couldn't be
classified or for other errors.




All those at the moment mean policy decision is what decided the drop.
So the same return code is fair.


Mhh .. OK.


But imagine that mirred action is applied to a device at the moment when
the device is down you want the reaction to that to be different
from when mirred steals the packet because the device is up. I think at
some point a big surgery on the return path and associated error path is
needed.


Handling that would be possible now by returning something other than
TC_ACT_STOLEN from the mirred action, no?



It gets quiet complex when you start having multiple redirects
i.e redirect from device a -> device b --> device c -> 
As they are right now this is safer.
I think lets just leave it to that simple change i just submitted for
now and later revisit the error path. Let me know if you are having
different thoughts - I am gonna take a long break now.


Fine with me.
-
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 qdisc return code

2006-01-08 Thread Jamal Hadi Salim
On Sun, 2006-08-01 at 20:34 +0100, Patrick McHardy wrote:
> Jamal Hadi Salim wrote:
> > Maybe no need to worry about both situations for now, i will resubmit
> > the patch without worrying about NET_XMIT_DROP. 
> 
> Looking at it again, I think you should not change the existing return
> code but just use NET_XMIT_BYPASS for the TC_ACT_SHOT (TC_POLICE_SHOT)
> case. Otherwise you will also return it if the packet couldn't be
> classified or for other errors.
> 

All those at the moment mean policy decision is what decided the drop.
So the same return code is fair.

> > But imagine that mirred action is applied to a device at the moment when
> > the device is down you want the reaction to that to be different
> > from when mirred steals the packet because the device is up. I think at
> > some point a big surgery on the return path and associated error path is
> > needed.
> 
> Handling that would be possible now by returning something other than
> TC_ACT_STOLEN from the mirred action, no?

It gets quiet complex when you start having multiple redirects
i.e redirect from device a -> device b --> device c -> 
As they are right now this is safer.
I think lets just leave it to that simple change i just submitted for
now and later revisit the error path. Let me know if you are having
different thoughts - I am gonna take a long break now.

cheers,
jamal


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


Re: PATCH: fix qdisc return code

2006-01-08 Thread Patrick McHardy

Jamal Hadi Salim wrote:

Maybe no need to worry about both situations for now, i will resubmit
the patch without worrying about NET_XMIT_DROP. 


Looking at it again, I think you should not change the existing return
code but just use NET_XMIT_BYPASS for the TC_ACT_SHOT (TC_POLICE_SHOT)
case. Otherwise you will also return it if the packet couldn't be
classified or for other errors.


But imagine that mirred action is applied to a device at the moment when
the device is down you want the reaction to that to be different
from when mirred steals the packet because the device is up. I think at
some point a big surgery on the return path and associated error path is
needed.


Handling that would be possible now by returning something other than
TC_ACT_STOLEN from the mirred action, no?
-
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


Resubmit: PATCH: fix qdisc return code

2006-01-08 Thread Jamal Hadi Salim
Ok, heres a resubmit after discussion with Patrick.

cheers,
jamal

The mapping between TC_ACTION_SHOT and the qdisc return codes is better
suited to NET_XMIT_BYPASS so as not to confuse TCP

Signed-off-by: Jamal Hadi Salim <[EMAIL PROTECTED]>
---

diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 09453f9..6cd8170 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -257,7 +257,7 @@ cbq_classify(struct sk_buff *skb, struct
(cl = cbq_class_lookup(q, prio)) != NULL)
return cl;
 
-   *qerr = NET_XMIT_DROP;
+   *qerr = NET_XMIT_BYPASS;
for (;;) {
int result = 0;
defmap = head->defaults;
@@ -413,7 +413,7 @@ cbq_enqueue(struct sk_buff *skb, struct 
q->rx_class = cl;
 #endif
if (cl == NULL) {
-   if (ret == NET_XMIT_DROP)
+   if (ret == NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb(skb);
return ret;
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index c26764b..637a4ad 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1227,7 +1227,7 @@ hfsc_classify(struct sk_buff *skb, struc
if (cl->level == 0)
return cl;
 
-   *qerr = NET_XMIT_DROP;
+   *qerr = NET_XMIT_BYPASS;
tcf = q->root.filter_list;
while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
@@ -1643,7 +1643,7 @@ hfsc_enqueue(struct sk_buff *skb, struct
 
cl = hfsc_classify(skb, sch, &err);
if (cl == NULL) {
-   if (err == NET_XMIT_DROP)
+   if (err == NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb(skb);
return err;
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 558cc08..3ec95df 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -321,7 +321,7 @@ static struct htb_class *htb_classify(st
if ((cl = htb_find(skb->priority,sch)) != NULL && cl->level == 0) 
return cl;
 
-   *qerr = NET_XMIT_DROP;
+   *qerr = NET_XMIT_BYPASS;
tcf = q->filter_list;
while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
@@ -724,7 +724,7 @@ static int htb_enqueue(struct sk_buff *s
}
 #ifdef CONFIG_NET_CLS_ACT
 } else if (!cl) {
-   if (ret == NET_XMIT_DROP)
+   if (ret == NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb (skb);
return ret;
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 3ac0f49..5b3a3e4 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -54,7 +54,7 @@ prio_classify(struct sk_buff *skb, struc
u32 band = skb->priority;
struct tcf_result res;
 
-   *qerr = NET_XMIT_DROP;
+   *qerr = NET_XMIT_BYPASS;
if (TC_H_MAJ(skb->priority) != sch->handle) {
 #ifdef CONFIG_NET_CLS_ACT
switch (tc_classify(skb, q->filter_list, &res)) {
@@ -91,7 +91,8 @@ prio_enqueue(struct sk_buff *skb, struct
qdisc = prio_classify(skb, sch, &ret);
 #ifdef CONFIG_NET_CLS_ACT
if (qdisc == NULL) {
-   if (ret == NET_XMIT_DROP)
+
+   if (ret == NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb(skb);
return ret;
@@ -118,7 +119,7 @@ prio_requeue(struct sk_buff *skb, struct
qdisc = prio_classify(skb, sch, &ret);
 #ifdef CONFIG_NET_CLS_ACT
if (qdisc == NULL) {
-   if (ret == NET_XMIT_DROP)
+   if (ret == NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb(skb);
return ret;


Re: PATCH: fix qdisc return code

2006-01-08 Thread Jamal Hadi Salim
On Sun, 2006-08-01 at 20:01 +0100, Patrick McHardy wrote:
> Jamal Hadi Salim wrote:
[..]
> > I could get rid of that - but there is one dilemma:
> > There are really two reasons to ask the qdisc to drop
> > 1) policy said so 
> > 2) an error happened
> 
> In both cases NET_XMIT_DROP can not happen. The only place
> where "ret" is set is in cbq_classify (in case of CBQ), and
> it only uses NET_XMIT_BYPASS (with your patch) or
> NET_XMIT_SUCCESS.


Maybe no need to worry about both situations for now, i will resubmit
the patch without worrying about NET_XMIT_DROP. 
But imagine that mirred action is applied to a device at the moment when
the device is down you want the reaction to that to be different
from when mirred steals the packet because the device is up. I think at
some point a big surgery on the return path and associated error path is
needed.

cheers,
jamal

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


Re: PATCH: fix qdisc return code

2006-01-08 Thread Patrick McHardy

Jamal Hadi Salim wrote:

On Sun, 2006-08-01 at 19:35 +0100, Patrick McHardy wrote:


Jamal Hadi Salim wrote:


[..]


if (cl == NULL) {
-   if (ret == NET_XMIT_DROP)
+   if (ret == NET_XMIT_DROP || ret == NET_XMIT_BYPASS)


No objections to the new mapping, but the NET_XMIT_DROP handling
here and in the other qdiscs looks unneccessary, AFAICT it can't
happen anymore with your change.



I could get rid of that - but there is one dilemma:
There are really two reasons to ask the qdisc to drop
1) policy said so 
2) an error happened


In both cases NET_XMIT_DROP can not happen. The only place
where "ret" is set is in cbq_classify (in case of CBQ), and
it only uses NET_XMIT_BYPASS (with your patch) or
NET_XMIT_SUCCESS.
-
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 qdisc return code

2006-01-08 Thread Jamal Hadi Salim
On Sun, 2006-08-01 at 19:35 +0100, Patrick McHardy wrote:
> Jamal Hadi Salim wrote:
[..]
> > if (cl == NULL) {
> > -   if (ret == NET_XMIT_DROP)
> > +   if (ret == NET_XMIT_DROP || ret == NET_XMIT_BYPASS)
> 
> No objections to the new mapping, but the NET_XMIT_DROP handling
> here and in the other qdiscs looks unneccessary, AFAICT it can't
> happen anymore with your change.

I could get rid of that - but there is one dilemma:
There are really two reasons to ask the qdisc to drop
1) policy said so 
2) an error happened

There is no way to differentiate the two at the moment - and i was
hopping at some point to scrutinize the code closely (since it is a
subtle change). Actually:
#1 could probably use NET_XMIT_POLICED but that requires a lot more
changes at the qdiscs and a lot more confusion to TCP and upper layers;
hence the reason i kept both codes. 

cheers,
jamal



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


Re: [PATCH 3/6][PKT_SCHED]: Convert tc action functions to single skb pointers

2006-01-08 Thread Jamal Hadi Salim
On Sun, 2006-08-01 at 19:32 +0100, Patrick McHardy wrote:
> Jamal Hadi Salim wrote:
> >It seems to be a big
> > change at glance and normally i would like to run some serious tests
> > on something like this (this one you can actually test with a series of
> > mirred, pedit and gact while tcpdump is running - doesnt matter if
> > ingress or egress and then watch the hex dump of modified packets)
> 
> Its not a big change, just look at the patch, all it does is change
> the argument to a single skb pointer instead of a double skb pointer
> to a local variable. Every action did "struct sk_buff *skb = *pskb"
> right at the beginning of their action function anyway.
> 

[..]

> This is all fine and doesn't need double skb pointers. Double pointers
> are needed if an action wants to replace the skb in the callers context.
> It can replace it in tcf_action_exec's context, but the caller of
> tcf_action_exec will still see and use the old skb because
> tcf_action_exec only gets a copy of its pointer. So using double
> skb pointers is confusing at least, because it looks like actions could
> replace skbs in the callers context, which they can't.
> I hope that clears it up.

;-> Yes it does and now i remember we discussed it ;->

I am gonna take a nap i think;->

cheers,
jamal

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


Re: PATCH: fix qdisc return code

2006-01-08 Thread Patrick McHardy

Jamal Hadi Salim wrote:

The little discussion going on reminds me of this other patch i was
sitting on. Patrick made the last changes to this area.
Dave please apply if ACK from Patrick.

--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -257,7 +257,7 @@ cbq_classify(struct sk_buff *skb, struct
(cl = cbq_class_lookup(q, prio)) != NULL)
return cl;
 
-	*qerr = NET_XMIT_DROP;

+   *qerr = NET_XMIT_BYPASS;
for (;;) {
int result = 0;
defmap = head->defaults;
@@ -413,7 +413,7 @@ cbq_enqueue(struct sk_buff *skb, struct 
 	q->rx_class = cl;

 #endif
if (cl == NULL) {
-   if (ret == NET_XMIT_DROP)
+   if (ret == NET_XMIT_DROP || ret == NET_XMIT_BYPASS)


No objections to the new mapping, but the NET_XMIT_DROP handling
here and in the other qdiscs looks unneccessary, AFAICT it can't
happen anymore with your change.
-
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/6][PKT_SCHED]: Convert tc action functions to single skb pointers

2006-01-08 Thread Patrick McHardy

Jamal Hadi Salim wrote:

On Sun, 2006-08-01 at 18:46 +0100, Patrick McHardy wrote:
[..]

Anyway, why do you want to keep this obvious broken behaviour?



I dont wanna keep it if it is broken Patrick;-> It seems to be a big
change at glance and normally i would like to run some serious tests
on something like this (this one you can actually test with a series of
mirred, pedit and gact while tcpdump is running - doesnt matter if
ingress or egress and then watch the hex dump of modified packets)


Its not a big change, just look at the patch, all it does is change
the argument to a single skb pointer instead of a double skb pointer
to a local variable. Every action did "struct sk_buff *skb = *pskb"
right at the beginning of their action function anyway.


Ok, so lets go over the steps you described to see if i will make sense
of it.
 
Someone calls:

-> tcf_action_exec(skb ...)
---> ret = a->ops->act(&skb, a, res)
--> one or more actions 


You are saying the user (I assume either caller of tcf_action_exec() or
an action)  will crash if the skb was replaced. So lets start with
actions:


I'm talking about users of tcf_action_exec.

The "enviromental" rules are:   


1) if you steal any packet thou shalt clone it (as in queueing it etc).
2) If you munge any packet thou shalt call skb_expand in the case
someone else is referencing the skb. Then you "own" it. You must also
tell us if it is ok to munge the packet (TC_OK2MUNGE)
3) dropping packets you dont own is a nono. You simply return
TC_ACT_SHOT

The "enviromental" rules for callers of actions (qdiscs etc) are:
thou art responsible for freeing anything returned as being
TC_ACT_SHOT/STOLEN/QUEUED otherwise all is great.


This is all fine and doesn't need double skb pointers. Double pointers
are needed if an action wants to replace the skb in the callers context.
It can replace it in tcf_action_exec's context, but the caller of
tcf_action_exec will still see and use the old skb because
tcf_action_exec only gets a copy of its pointer. So using double
skb pointers is confusing at least, because it looks like actions could
replace skbs in the callers context, which they can't.
I hope that clears it up.
-
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 qdisc return code

2006-01-08 Thread Jamal Hadi Salim

The little discussion going on reminds me of this other patch i was
sitting on. Patrick made the last changes to this area.
Dave please apply if ACK from Patrick.


cheers,
jamal

The mapping between TC_ACTION_SHOT and the qdisc return codes is better
suited to NET_XMIT_BYPASS so as not to confuse TCP

Signed-off-by: Jamal Hadi Salim <[EMAIL PROTECTED]>
---

diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 09453f9..c962070 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -257,7 +257,7 @@ cbq_classify(struct sk_buff *skb, struct
(cl = cbq_class_lookup(q, prio)) != NULL)
return cl;
 
-   *qerr = NET_XMIT_DROP;
+   *qerr = NET_XMIT_BYPASS;
for (;;) {
int result = 0;
defmap = head->defaults;
@@ -413,7 +413,7 @@ cbq_enqueue(struct sk_buff *skb, struct 
q->rx_class = cl;
 #endif
if (cl == NULL) {
-   if (ret == NET_XMIT_DROP)
+   if (ret == NET_XMIT_DROP || ret == NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb(skb);
return ret;
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index c26764b..7431666 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1227,7 +1227,7 @@ hfsc_classify(struct sk_buff *skb, struc
if (cl->level == 0)
return cl;
 
-   *qerr = NET_XMIT_DROP;
+   *qerr = NET_XMIT_BYPASS;
tcf = q->root.filter_list;
while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
@@ -1643,7 +1643,7 @@ hfsc_enqueue(struct sk_buff *skb, struct
 
cl = hfsc_classify(skb, sch, &err);
if (cl == NULL) {
-   if (err == NET_XMIT_DROP)
+   if (err == NET_XMIT_DROP || err == NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb(skb);
return err;
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 558cc08..39ebc01 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -321,7 +321,7 @@ static struct htb_class *htb_classify(st
if ((cl = htb_find(skb->priority,sch)) != NULL && cl->level == 0) 
return cl;
 
-   *qerr = NET_XMIT_DROP;
+   *qerr = NET_XMIT_BYPASS;
tcf = q->filter_list;
while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
@@ -724,7 +724,7 @@ static int htb_enqueue(struct sk_buff *s
}
 #ifdef CONFIG_NET_CLS_ACT
 } else if (!cl) {
-   if (ret == NET_XMIT_DROP)
+   if (ret == NET_XMIT_DROP || ret == NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb (skb);
return ret;
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 3ac0f49..33ad2e9 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -54,7 +54,7 @@ prio_classify(struct sk_buff *skb, struc
u32 band = skb->priority;
struct tcf_result res;
 
-   *qerr = NET_XMIT_DROP;
+   *qerr = NET_XMIT_BYPASS;
if (TC_H_MAJ(skb->priority) != sch->handle) {
 #ifdef CONFIG_NET_CLS_ACT
switch (tc_classify(skb, q->filter_list, &res)) {
@@ -91,7 +91,8 @@ prio_enqueue(struct sk_buff *skb, struct
qdisc = prio_classify(skb, sch, &ret);
 #ifdef CONFIG_NET_CLS_ACT
if (qdisc == NULL) {
-   if (ret == NET_XMIT_DROP)
+
+   if (ret == NET_XMIT_DROP || ret == NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb(skb);
return ret;
@@ -118,7 +119,7 @@ prio_requeue(struct sk_buff *skb, struct
qdisc = prio_classify(skb, sch, &ret);
 #ifdef CONFIG_NET_CLS_ACT
if (qdisc == NULL) {
-   if (ret == NET_XMIT_DROP)
+   if (ret == NET_XMIT_DROP || ret == NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb(skb);
return ret;


Re: [PATCH 3/6][PKT_SCHED]: Convert tc action functions to single skb pointers

2006-01-08 Thread Jamal Hadi Salim
On Sun, 2006-08-01 at 18:46 +0100, Patrick McHardy wrote:
[..]
> >>int tcf_action_exec(struct sk_buff *skb, struct tc_action *act,
> >> struct tcf_result *res)
> >>{
> >>...
> >> ret = a->ops->act(&skb, a, res);
> >>
> >>The caller later continues to use the skb passed to tcf_action_exec
> >>and will crash if it was replaced.
> >>

> I think we discussed it at netconf. 

Ok. 

> Anyway, why do you want to keep this obvious broken behaviour?

I dont wanna keep it if it is broken Patrick;-> It seems to be a big
change at glance and normally i would like to run some serious tests
on something like this (this one you can actually test with a series of
mirred, pedit and gact while tcpdump is running - doesnt matter if
ingress or egress and then watch the hex dump of modified packets)

Ok, so lets go over the steps you described to see if i will make sense
of it.
 
Someone calls:
-> tcf_action_exec(skb ...)
---> ret = a->ops->act(&skb, a, res)
--> one or more actions 

You are saying the user (I assume either caller of tcf_action_exec() or
an action)  will crash if the skb was replaced. So lets start with
actions:

The "enviromental" rules are:   

1) if you steal any packet thou shalt clone it (as in queueing it etc).
2) If you munge any packet thou shalt call skb_expand in the case
someone else is referencing the skb. Then you "own" it. You must also
tell us if it is ok to munge the packet (TC_OK2MUNGE)
3) dropping packets you dont own is a nono. You simply return
TC_ACT_SHOT

The "enviromental" rules for callers of actions (qdiscs etc) are:
thou art responsible for freeing anything returned as being
TC_ACT_SHOT/STOLEN/QUEUED otherwise all is great.

cheers,
jamal

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


Re: [PATCH 3/6][PKT_SCHED]: Convert tc action functions to single skb pointers

2006-01-08 Thread Patrick McHardy

Jamal Hadi Salim wrote:

On Sun, 2006-08-01 at 18:10 +0100, Patrick McHardy wrote:
[..]


That discussion had nothing to do with this patch, you actually
already agreed to doing this. Passing double skb pointers is broken:


int tcf_action_exec(struct sk_buff *skb, struct tc_action *act,
struct tcf_result *res)
{
...
ret = a->ops->act(&skb, a, res);

The caller later continues to use the skb passed to tcf_action_exec
and will crash if it was replaced.




I am slower that usual today for lack of sleep and travel - can you
point me to the discussion or remind me by forwarding me some email?


I think we discussed it at netconf. Anyway, why do you want to keep
this obvious broken behaviour?
-
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


Resubmit: PATCH: IFB as IMQ replacement

2006-01-08 Thread Jamal Hadi Salim

Heres a resubmit of the IFB device. Updates from latest comments (much
much thanks Patrick). 
Dave please apply this one. Any further comments that come up after this
go in as separate patches.

cheers,
jamal

A new device to do intermidiate functional block in a system shared manner.
To use the new functionality, you need to turn on qos/classifier actions.

The new functionality can be grouped as:
1) qdiscs/policies that are per device as opposed to system wide.
ifb allows for a device which can be redirected to thus providing
an impression of sharing.

2) Allows for queueing incoming traffic for shaping instead of
dropping.

Packets are redirected to this device using tc/action mirred redirect
construct. If they are sent to it by plain routing instead
then they will merely be dropped and the stats would indicate that.

Signed-off-by: Jamal Hadi Salim <[EMAIL PROTECTED]>

---
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index ebd7313..0a1c67d 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -27,6 +27,19 @@ config NETDEVICES
 # that for each of the symbols.
 if NETDEVICES
 
+config IFB
+   tristate "Intermediate Functional Block support"
+   depends on NET_CLS_ACT
+   ---help---
+ This is an intermidiate driver that allows sharing of
+ resources.
+ To compile this driver as a module, choose M here: the module
+ will be called ifb.  If you want to use more than one ifb
+ device at a time, you need to compile this driver as a module.
+ Instead of 'ifb', the devices will then be called 'ifb0',
+ 'ifb1' etc.
+ Look at the iproute2 documentation directory for usage etc
+
 config DUMMY
tristate "Dummy net driver support"
---help---
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 4cffd34..66878a1 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -121,6 +121,7 @@ ifeq ($(CONFIG_SLIP_COMPRESSED),y)
 endif
 
 obj-$(CONFIG_DUMMY) += dummy.o
+obj-$(CONFIG_IFB) += ifb.o
 obj-$(CONFIG_DE600) += de600.o
 obj-$(CONFIG_DE620) += de620.o
 obj-$(CONFIG_LANCE) += lance.o
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
new file mode 100644
index 000..d409118
--- /dev/null   2006-01-08 10:15:46.576893136 -0500
+++ drivers/net/ifb.c   2006-01-08 12:14:49.0 -0500
@@ -0,0 +1,294 @@
+/* drivers/net/ifb.c: 
+
+   The purpose of this driver is to provide a device that allows
+   for sharing of resources:
+
+   1) qdiscs/policies that are per device as opposed to system wide.
+   ifb allows for a device which can be redirected to thus providing
+   an impression of sharing.
+
+   2) Allows for queueing incoming traffic for shaping instead of
+   dropping. 
+   
+   The original concept is based on what is known as the IMQ
+   driver initially written by Martin Devera, later rewritten
+   by Patrick McHardy and then maintained by Andre Correa.
+
+   You need the tc action  mirror or redirect to feed this device
+   packets.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License
+   as published by the Free Software Foundation; either version
+   2 of the License, or (at your option) any later version.
+ 
+   Authors:Jamal Hadi Salim (2005)
+ 
+*/
+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include  
+
+#define TX_TIMEOUT  (2*HZ)
+   
 
+#define TX_Q_LIMIT32
+struct ifb_private {
+   struct net_device_stats stats;
+   struct tasklet_struct   ifb_tasklet;
+   int tasklet_pending;
+   /* mostly debug stats leave in for now */
+   unsigned long   st_task_enter; /* tasklet entered */
+   unsigned long   st_txq_refl_try; /* transmit queue refill attempt */
+   unsigned long   st_rxq_enter; /* receive queue entered */
+   unsigned long   st_rx2tx_tran; /* receive to trasmit transfers */
+   unsigned long   st_rxq_notenter; /*receiveQ not entered, resched */
+   unsigned long   st_rx_frm_egr; /* received from egress path */
+   unsigned long   st_rx_frm_ing; /* received from ingress path */
+   unsigned long   st_rxq_check;
+   unsigned long   st_rxq_rsch;
+   struct sk_buff_head rq;
+   struct sk_buff_head tq;
+};
+
+static int numifbs = 1;
+
+static void ri_tasklet(unsigned long dev);
+static int ifb_xmit(struct sk_buff *skb, struct net_device *dev);
+static struct net_device_stats *ifb_get_stats(struct net_device *dev);
+static int ifb_open(struct net_device *dev);
+static int ifb_close(struct net_device *dev);
+
+static void ri_tasklet(unsigned long dev) 
+{
+
+   struct net_device *_dev = (struct net_device *)dev;
+   struct ifb_private *dp = netdev_priv(_dev);
+   struct net_device_stats *stats = &dp->stats;
+   str

Re: [PATCH 3/6][PKT_SCHED]: Convert tc action functions to single skb pointers

2006-01-08 Thread Jamal Hadi Salim
On Sun, 2006-08-01 at 18:10 +0100, Patrick McHardy wrote:
[..]
> That discussion had nothing to do with this patch, you actually
> already agreed to doing this. Passing double skb pointers is broken:
> 
> 
> int tcf_action_exec(struct sk_buff *skb, struct tc_action *act,
>  struct tcf_result *res)
> {
> ...
>  ret = a->ops->act(&skb, a, res);
> 
> The caller later continues to use the skb passed to tcf_action_exec
> and will crash if it was replaced.
> 

I am slower that usual today for lack of sleep and travel - can you
point me to the discussion or remind me by forwarding me some email?

cheers,
jamal

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


Re: SiS190 on ASUS. monodirectional traffic

2006-01-08 Thread Marco Atzeri
On Sun, Jan 08, 2006 at 01:58:24AM +0100, Francois Romieu wrote:
> Marco Atzeri <[EMAIL PROTECTED]> :
> [...]
> > everything uploaded at
> > 
> > http://www.geocities.com/marco_atzeri/sis190/
> 
uploaded again. The previous moved to subdirectory old_01

> 
> Can you add a '-x' to the main tethereal capture ?
> If some data must not leak, you may want a filter like
> tethereal -l -x 'arp or icmp and (host 192.168.1.2 or host 192.168.2.252)'
> 
> Before the ftp, please issue:
> for i in $(seq 1460 1478); do
>   ping -c 256 -qf -l 32 -s $i 192.168.1.252
> done

done. But now the tethereal dump is very large 59 Mb, so 
it is bzipped and uuencoded to overcome the blocks of geocities.   
The ping sequence is from the ASUS 192.168.1.2 to the laptop 192.168.1.252,
I tried also the reverse but due to a problem of ping under cygwin
the log is too large > 1.5 GB; ping-cygwin sends more than 2 packets 
per each sequences.
All the other ping and the ftp are from the laptop

In both the two directions I noted that from 1469 and over the loss is 100%

> In the future, it could be useful to change:
> CONFIG_DEBUG_KERNEL=y
> # CONFIG_MAGIC_SYSRQ is not set
>   ^^ -> enable it
> CONFIG_LOG_BUF_SHIFT=14
>  ^^ -> low: dmesg gets truncated.
> CONFIG_DETECT_SOFTLOCKUP=y
>

Both done. I increased to 17

> [...]
> > I note now that eth1 shares the IRQ5 with other drivers while
> > eth0 is alone
> > 
> >  5:392  XT-PIC  ohci_hcd:usb2, ohci_hcd:usb4, ohci1394, eth1
> > 10:  21238  XT-PIC  eth0
> >  
> > could be a reason for the hang ? 
> 
> None that I see but you can compile them out to see if it makes a difference.

Tentative for the a next time

> Is there any different reference for the motherboard ? I have not been able
> to find any manual for the K8S-MV at Asus's site. Not that they miss a lot,
> but...
>
The motherboard is used on a ASUS Vintage AE1

http://dlsvr02.asus.com/pub/ASUS/Barebone/Vintage-AE1/u2102_vintage-ae1_qsg.pdf


I found  a new effect after changing the PREEMPT to none, now when eth1 hangs 
also eth0 does the same. For few times is possible to recover the interfaces
putting them down and then up; but after 3-4 tentatives every network interface
hangs forever also 127.0.0.1, after that, a reboot is needed to recover the 
network.

Regards
Marco
-- 
   marco.atzeri at fastwebnet.it

La prima delle Frequently Asked Questions: 
dove sono le FAQ ?  it.faq
-
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/6][PKT_SCHED]: Convert tc action functions to single skb pointers

2006-01-08 Thread Patrick McHardy

Jamal Hadi Salim wrote:

We've had this discussion before, Patrick;->

Heres one i was able to find:

http://marc.theaimsgroup.com/?t=11061115951&r=1&w=2

So NACK this spefic patch please.


That discussion had nothing to do with this patch, you actually
already agreed to doing this. Passing double skb pointers is broken:


int tcf_action_exec(struct sk_buff *skb, struct tc_action *act,
struct tcf_result *res)
{
...
ret = a->ops->act(&skb, a, res);

The caller later continues to use the skb passed to tcf_action_exec
and will crash if it was replaced.
-
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/6][PKT_SCHED]: Convert tc action functions to single skb pointers

2006-01-08 Thread Jamal Hadi Salim
We've had this discussion before, Patrick;->

Heres one i was able to find:

http://marc.theaimsgroup.com/?t=11061115951&r=1&w=2

So NACK this spefic patch please.

cheers,
jamal

PS:- Please CC me on stuff like this so it doesnt get buried by my
filters for congestion control reasoning.


-
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


[2.6.15] running tcpdump on 3c905b causes freeze (reproducable)

2006-01-08 Thread Folkert van Heusden
Hi,

My system freezes (crashes) when I run tcpdump on the interface
connected to a 3c905b card. I've tried swapping the card for an other
3c905b card but that did not help. 2 out of 3 times the last message on
the console is "Transmit error, Tx status register 82". sysreq+t doesn't
work. Not only tcpdump, any program which put the interface into
promisques mode makes the system crash. All other interfaces (eth0 and
eth2) are fine. I tried starting the system with 'debug=7' attached to
the modprobe for the module but then the system crashes with a
"vortex_error() status=0x8081".
The tcpdump-problem is reproducable, in fact: the system crashes always
when I run tcpdump on that interface.
This seems to be the only problem with that system: no other crashes or
segfaults or anything out of the ordinary.

kernel 2.6.15
3.2GHz P4, HT enabled, 2GB ram

[   13.422920] ACPI: PCI Interrupt :02:09.0[A] -> GSI 21 (level, low) -> 
IRQ 16
[   13.423004] 3c59x: Donald Becker and others. 
www.scyld.com/network/vortex.html
[   13.423051] :02:09.0: 3Com PCI 3c905B Cyclone 100baseTx at f8882400. 
Vers LK1.1.19
[   13.445519] ACPI: PCI Interrupt :02:09.0[A] -> GSI 21 (level, low) -> 
IRQ 16

02:09.0 Ethernet controller: 3Com Corporation 3c905B 100BaseTX [Cyclone] (rev 
30)
Subsystem: 3Com Corporation 3C905B Fast Etherlink XL 10/100
Flags: bus master, medium devsel, latency 64, IRQ 16
I/O ports at d880 [size=128]
Memory at feaff400 (32-bit, non-prefetchable) [size=128]
Expansion ROM at fe70 [disabled] [size=128K]
Capabilities: [dc] Power Management version 1
00: b7 10 55 90 17 01 10 02 30 00 00 02 04 40 00 00
10: 81 d8 00 00 00 f4 af fe 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 b7 10 55 90
30: 00 00 ac fe dc 00 00 00 00 00 00 00 05 01 0a 0a

UTP connected to a switching hub

vortex-diag.c:v2.16 1/12/2004 Donald Becker ([EMAIL PROTECTED])
 http://www.scyld.com/diag/index.html
Index #1: Found a 3c905B Cyclone 100baseTx adapter at 0xd880.
 Station address 00:50:da:df:1d:3a.
  Receive mode is 0x07: Normal unicast and all multicast.
The Vortex chip may be active, so FIFO registers will not be read.
To see all register values use the '-f' flag.
Initial window 4, registers values by window:
  Window 0:     f5f5 00bf  .
  Window 1: FIFO FIFO      2000.
  Window 2: 5000 dfda 3a1d    000a 4000.
  Window 3:  0180 05ea 0020 000a 0800 0800 6000.
  Window 4:    0cd8 0003 8880  8000.
  Window 5: 1ffc   0600 0807 06ce 06c6 a000.
  Window 6:    da00 1000 4a47 52cf c000.
  Window 7:        e000.
Vortex chip registers at 0xd880
  0xD890: **FIFO**  001c *STATUS*
  0xD8A0: 0020  0008 0004
  0xD8B0:  e7be1842 377a9110 00080004
  0xD8C0: 008b890f   
  0xD8D0:    
  0xD8E0:    
  0xD8F0: 9000  01600160 
  DMA control register is 0020.
   Tx list starts at .
   Tx FIFO thresholds: min. burst 256 bytes, priority with 128 bytes to empty.
   Rx FIFO thresholds: min. burst 256 bytes, priority with 128 bytes to full.
   Poll period Tx 00 ns.,  Rx 0 ns.
   Maximum burst recorded Tx 352,  Rx 352.
 Indication enable is 06c6, interrupt enable is 06ce.
 No interrupt sources are pending.
 Transceiver/media interfaces available:  100baseTx 10baseT.
Transceiver type in use:  Autonegotiate.
 MAC settings: full-duplex.
 Station address set to 00:50:da:df:1d:3a.
 Configuration options 000a.
EEPROM format 64x16, configuration table at offset 0:
00: 0050 dadf 1d3a 9055 002d 0036 4258 6d50
  0x08: 2971  0050 dadf 1d3a 0010  0022
  0x10: 32a2   0180    10b7
  0x18: 9055 000a      
  0x20: 00ea       
  0x28:        
  ...

 The word-wide EEPROM checksum is 0x30f7.
Saved EEPROM settings of a 3Com Vortex/Boomerang:
 3Com Node Address 00:50:DA:DF:1D:3A (used as a unique ID only).
 OEM Station address 00:50:DA:DF:1D:3A (used as the ethernet address).
  Device ID 9055,  Manufacturer ID 6d50.
  Manufacture date (MM/DD/) 1/13/2000, division 6, product XB.
  No BIOS ROM is present.
 Transceiver selection: Autonegotiate.
   Options: negotiated duplex, link beat required.
   PCI bus requested settings --  minimum grant 10, maximum latency 10 (250ns 
units).
 PCI Subsystem IDs: Vendor 10b7 Device 9055.
 100baseTx 10baseT.
  Vortex format checksum is incorrect (82 vs. 10b7).
  Cyclone format checksum is correct (0xea vs. 0xea).
  Hurricane format checksum is correct (0xea vs. 0xea).


mii-diag.c:v2.11 3/21/2005 Donald Becker ([EMAIL PROTECTED])
 http://www.scyld.com/diag/index.html
  Using the new SIOCGMIIPHY value on PHY 24 (BMCR 0x3000).
 The autonegotiated capability is 01e0.
The autonegotiated 

Re: ax25/mkiss: unbalanced spinlock_bh in ax_encaps()

2006-01-08 Thread Ralf Baechle
On Sat, Jan 07, 2006 at 03:22:43AM +0100, Francois Romieu wrote:

> The unlocking disappeared during commit
> 5793f4be23f0171b4999ca68a39a9157b44139f3.
> 
> Signed-off-by: Francois Romieu <[EMAIL PROTECTED]>
> 
> diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
> index 3e9accf..41b3d83 100644
> --- a/drivers/net/hamradio/mkiss.c
> +++ b/drivers/net/hamradio/mkiss.c
> @@ -524,6 +524,7 @@ static void ax_encaps(struct net_device 
>   ax->dev->trans_start = jiffies;
>   ax->xleft = count - actual;
>   ax->xhead = ax->xbuff + actual;
> + spin_unlock_bh(&ax->buflock);
>  }
>  
>  /* Encapsulate an AX.25 packet and kick it into a TTY queue. */

No, with your patch the spinlock is dropped only after the
tty->driver->write() call which might sleep.

  Ralf

Signed-off-by: Ralf Baechle <[EMAIL PROTECTED]>

Index: net.git/drivers/net/hamradio/mkiss.c
===
--- net.git.orig/drivers/net/hamradio/mkiss.c
+++ net.git/drivers/net/hamradio/mkiss.c
@@ -515,6 +515,7 @@ static void ax_encaps(struct net_device 
count = kiss_esc(p, (unsigned char *)ax->xbuff, len);
}
}
+   spin_unlock_bh(&ax->buflock);
 
set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags);
actual = ax->tty->driver->write(ax->tty, ax->xbuff, count);
-
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: [W1]: Remove incorrect MODULE_ALIAS

2006-01-08 Thread Evgeniy Polyakov
On Sun, Jan 08, 2006 at 12:44:15AM +0100, Patrick McHardy ([EMAIL PROTECTED]) 
wrote:

> [W1]: Remove incorrect MODULE_ALIAS
> 
> The w1 netlink socket is created by a hardware specific driver calling
> w1_add_master_device, so there is no point in including a module alias
> for netlink autoloading in the core.
> 
> Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

ACK.
Thanks, Patrick.

> ---
> commit a8657adb8c04bbe30544306ec55005a635ba65fd
> tree 2c029cf104239958220629d34c76c7290bd99e43
> parent b73952761225e41cb81afe157cb312a594a95693
> author Patrick McHardy <[EMAIL PROTECTED]> Sun, 08 Jan 2006 00:42:42 +0100
> committer Patrick McHardy <[EMAIL PROTECTED]> Sun, 08 Jan 2006 00:42:42 +0100
> 
>  drivers/w1/w1_int.c |2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
> index c3f67ea..e2920f0 100644
> --- a/drivers/w1/w1_int.c
> +++ b/drivers/w1/w1_int.c
> @@ -217,5 +217,3 @@ void w1_remove_master_device(struct w1_b
>  
>  EXPORT_SYMBOL(w1_add_master_device);
>  EXPORT_SYMBOL(w1_remove_master_device);
> -
> -MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_W1);


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