RE: [PATCH] ucc_geth: kmalloc casting cleanups

2007-01-08 Thread Li Yang-r58472
> -Original Message-
> From: Jeff Garzik [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 09, 2007 3:16 PM
> To: Li Yang-r58472
> Cc: netdev@vger.kernel.org; [EMAIL PROTECTED]
> Subject: Re: [PATCH] ucc_geth: kmalloc casting cleanups
> 
> Li Yang wrote:
> > From: Ahmed S. Darwish <[EMAIL PROTECTED]>
> >
> > Switch kmalloc to kzalloc and clean some redundant kmalloc
> > casts.
> >
> > Signed-off-by: Ahmed S. Darwish <[EMAIL PROTECTED]>
> > Signed-off-by: Li Yang <[EMAIL PROTECTED]>
> > ---
> 
> 
> I should wait for Kumar to resend ucc_geth fixes before applying this,
> right?

Ok.  The patch is based on 2.6.20-rc3, but I think it can still apply.
If not, please ping me.

- Leo
-
To unsubscribe from this list: send 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] s390: qeth driver fixes

2007-01-08 Thread Jeff Garzik

Frank Pavlic wrote:

Hi ,

please apply following 5 patches for s390 network device drivers.
Sorry for the fifth patch containing some lines which just remove
whitespaces. Another patch will follow in the next couple of days
with more whitespace and coding style cleanups in drivers/s390/net.

Thank you 


Frank

[PATCH 1/5] s390: qeth driver fixes

From: Frank Blaschka <[EMAIL PROTECTED]>
From: Ursula Braun <[EMAIL PROTECTED]>
- VLAN header reordering did not work on packets
  received through qeth interface in layer 2 mode.
  This caused dhcpcd not to work with VLAN devices.
- set qeth performance statistics initally inactive

Signed-off-by: Frank Pavlic <[EMAIL PROTECTED]>


applied patches 1-4 of 5.  patch #5 failed to apply, and also, it's not 
really appropriate for the current release candidate bugfix window.


Also:

1) Please include notes to me and reviewers following the "---" marker. 
 Everything before the "---" is copied /verbatim/ into the kernel 
changelog.  Everything after "---", except the patch itself, is ignored.


I had to hand-edit each of your patches, to remove the "Hi , ... Frank" 
paragraph and the "[PATCH 1/5] S390: ..." from the body of each email.


2) Your subject line should be more descriptive.  The subject line is 
used to generate a one-line summary.  You can see how your subject lines 
are vague:


[PATCH] s390: qeth driver fixes
[PATCH] s390: qeth driver fixes
[PATCH] s390: qeth driver fixes

Here, I had to hand-edit each email subject line to be more descriptive.

3) In general, review Documentation/SubmittingPatches and 
http://linux.yyz.us/patch-format.html


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] ucc_geth: kmalloc casting cleanups

2007-01-08 Thread Jeff Garzik

Li Yang wrote:

From: Ahmed S. Darwish <[EMAIL PROTECTED]>

Switch kmalloc to kzalloc and clean some redundant kmalloc
casts.

Signed-off-by: Ahmed S. Darwish <[EMAIL PROTECTED]>
Signed-off-by: Li Yang <[EMAIL PROTECTED]>
---



I should wait for Kumar to resend ucc_geth fixes before applying this, 
right?


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] forcedeth: sideband management fix

2007-01-08 Thread Jeff Garzik

Ayaz Abdulla wrote:
This patch contains a fix that implements proper communication with the 
sideband management unit. Also, it makes sure that the speed is 
correctly set for gigabit phys in the case where sideband mgmt unit 
initialized the phy. Refer to bug #7684 for more details.


Signed-Off-By: Ayaz Abdulla <[EMAIL PROTECTED]>


applied


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


2.6.20-rc4: known regressions with patches (v2)

2007-01-08 Thread Adrian Bunk
This email lists some known regressions in 2.6.20-rc4 compared to 2.6.19
with patches available.

If you find your name in the Cc header, you are either submitter of one
of the bugs, maintainer of an affectected subsystem or driver, a patch
of you caused a breakage or I'm considering you in any other way possibly
involved with one or more of these issues.

Due to the huge amount of recipients, please trim the Cc when answering.


Subject: BUG: at mm/truncate.c:60 cancel_dirty_page()  (XFS)
References : http://lkml.org/lkml/2007/1/5/308
Submitter  : Sami Farin <[EMAIL PROTECTED]>
Handled-By : David Chinner <[EMAIL PROTECTED]>
Patch  : http://lkml.org/lkml/2007/1/7/201
Status : patch available


Subject: bluetooth oopses because of multiple kobject_add()
References : http://lkml.org/lkml/2007/1/2/101
Submitter  : Pavel Machek <[EMAIL PROTECTED]>
Handled-By : Marcel Holtmann <[EMAIL PROTECTED]>
Patch  : http://lkml.org/lkml/2007/1/2/147
Status : patch available


Subject: ftp: get or put stops during file-transfer
References : http://lkml.org/lkml/2006/12/16/174
Submitter  : Komuro <[EMAIL PROTECTED]>
Caused-By  : YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
 commit cfb6eeb4c860592edd123fdea908d23c6ad1c7dc
Handled-By : Craig Schlenter <[EMAIL PROTECTED]>
 YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
Patch  : http://lkml.org/lkml/2007/1/9/5
Status : patch available


Subject: nf_conntrack_netbios_ns.c causes Oops
References : http://lkml.org/lkml/2007/1/7/188
Submitter  : Peter Osterlund <[EMAIL PROTECTED]>
Caused-By  : Patrick McHardy <[EMAIL PROTECTED]>
 commit 92703eee4ccde3c55ee067a89c373e8a51a8adf9
Handled-By : Patrick McHardy <[EMAIL PROTECTED]>
Patch  : http://lkml.org/lkml/2007/1/8/290
Status : patch available


Subject: forcedeth.c 0.59: problem with sideband managment
References : http://bugzilla.kernel.org/show_bug.cgi?id=7684
Submitter  : Michael Reske <[EMAIL PROTECTED]>
Handled-By : Ayaz Abdulla <[EMAIL PROTECTED]>
Patch  : http://bugzilla.kernel.org/show_bug.cgi?id=7684
Status : patch available


Subject: nVidia CK804 chipset: not detecting HT MSI capabilities
References : http://lkml.org/lkml/2007/1/5/215
Submitter  : Brice Goglin <[EMAIL PROTECTED]>
 Robert Hancock <[EMAIL PROTECTED]>
Handled-By : Brice Goglin <[EMAIL PROTECTED]>
Patch  : http://lkml.org/lkml/2007/1/5/215
Status : patch available
-
To unsubscribe from this list: send 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] Re: [BUG KERNEL 2.6.20-rc1] ftp: get or put stops during file-transfer

2007-01-08 Thread YOSHIFUJI Hideaki / 吉藤英明
Dave, please apply.  Thank you.

In article <[EMAIL PROTECTED]> (at Tue, 9 Jan 2007 07:11:39 +0200), Craig 
Schlenter <[EMAIL PROTECTED]> says:

> All credit goes to Komuro <[EMAIL PROTECTED]> for tracking
> this down. The patch is untested but it looks *cough* obviously
> correct.
> 
> Signed-off-by: Craig Schlenter <[EMAIL PROTECTED]>
Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
--- Begin Message ---
SGkgRGF2ZQ0KDQpZT1NISUZVSkkgSGlkZWFraSAvIOWQieiXpOiLseaYjiBoYXMgc3VnZ2VzdGVk
IHRoYXQgSSBzZW5kIHRoZSBwYXRjaA0KYmVsb3cgdG8gZml4IHRoZSBmdHAgc3RhbGxzIHByZXNl
bnQgaW4gdGhlIGN1cnJlbnQga2VybmVscy4NCg0KQWxsIGNyZWRpdCBnb2VzIHRvIEtvbXVybyA8
a29tdXJvanVuLW1ibkBuaWZ0eS5jb20+IGZvciB0cmFja2luZw0KdGhpcyBkb3duLiBUaGUgcGF0
Y2ggaXMgdW50ZXN0ZWQgYnV0IGl0IGxvb2tzICpjb3VnaCogb2J2aW91c2x5DQpjb3JyZWN0Lg0K
DQpTaWduZWQtb2ZmLWJ5OiBDcmFpZyBTY2hsZW50ZXIgPGNyYWlnQGNvZGVmb3VudGFpbi5jb20+
DQoNClRoYW5rIHlvdSENCg0KLS1DcmFpZw0KDQpkaWZmIC0tZ2l0IGEvbmV0L2lwdjQvdGNwX2lw
djQuYyBiL25ldC9pcHY0L3RjcF9pcHY0LmMNCmluZGV4IGJmN2EyMjQuLjEyZGU5MGEgMTAwNjQ0
DQotLS0gYS9uZXQvaXB2NC90Y3BfaXB2NC5jDQorKysgYi9uZXQvaXB2NC90Y3BfaXB2NC5jDQpA
QCAtNjQ4LDcgKzY0OCw3IEBAIHN0YXRpYyB2b2lkIHRjcF92NF9zZW5kX2FjayhzdHJ1Y3QgdGNw
X3RpbWV3YWl0X3NvY2sgKnR3c2ssDQogCQkJCSAgIFRDUE9MRU5fVElNRVNUQU1QKTsNCiAJCXJl
cC5vcHRbMV0gPSBodG9ubCh0Y3BfdGltZV9zdGFtcCk7DQogCQlyZXAub3B0WzJdID0gaHRvbmwo
dHMpOw0KLQkJYXJnLmlvdlswXS5pb3ZfbGVuID0gVENQT0xFTl9UU1RBTVBfQUxJR05FRDsNCisJ
CWFyZy5pb3ZbMF0uaW92X2xlbiArPSBUQ1BPTEVOX1RTVEFNUF9BTElHTkVEOw0KIAl9DQogDQog
CS8qIFN3YXAgdGhlIHNlbmQgYW5kIHRoZSByZWNlaXZlLiAqLw0K
--- End Message ---


[PATCH] Re: [BUG KERNEL 2.6.20-rc1] ftp: get or put stops during file-transfer

2007-01-08 Thread Craig Schlenter
Hi Dave

YOSHIFUJI Hideaki / 吉藤英明 has suggested that I send the patch
below to fix the ftp stalls present in the current kernels.

All credit goes to Komuro <[EMAIL PROTECTED]> for tracking
this down. The patch is untested but it looks *cough* obviously
correct.

Signed-off-by: Craig Schlenter <[EMAIL PROTECTED]>

Thank you!

--Craig

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index bf7a224..12de90a 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -648,7 +648,7 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk,
   TCPOLEN_TIMESTAMP);
rep.opt[1] = htonl(tcp_time_stamp);
rep.opt[2] = htonl(ts);
-   arg.iov[0].iov_len = TCPOLEN_TSTAMP_ALIGNED;
+   arg.iov[0].iov_len += TCPOLEN_TSTAMP_ALIGNED;
}
 
/* Swap the send and the receive. */
-
To unsubscribe from this list: send 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: [TG3]: Add PHY workaround for 5755M.

2007-01-08 Thread David Miller
From: "Michael Chan" <[EMAIL PROTECTED]>
Date: Mon, 08 Jan 2007 15:58:00 -0800

> [TG3]: Add PHY workaround for 5755M.
> 
> Some PHY trim values need to be fine-tuned on 5755M to be
> IEEE-compliant.
> 
> Update version to 3.72.
> 
> Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

Applied, thanks Michael.
-
To unsubscribe from this list: send 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: [BNX2 4/4]: Update version and reldate.

2007-01-08 Thread David Miller
From: "Michael Chan" <[EMAIL PROTECTED]>
Date: Mon, 08 Jan 2007 16:04:24 -0800

> Sorry, the date was wrong on the one sent earlier.
> 
> [BNX2]: Update version and reldate.
> 
> Update version to 1.5.3.
> 
> Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

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


Re: [BNX2 3/4]: Fix bug in bnx2_nvram_write().

2007-01-08 Thread David Miller
From: "Michael Chan" <[EMAIL PROTECTED]>
Date: Mon, 08 Jan 2007 15:56:48 -0800

> [BNX2]: Fix bug in bnx2_nvram_write().
> 
> The bug was a bogus pointer being passed to kfree().  The pointer was
> incremented in the write loop and then passed to kfree().
> 
> The fix is to use align_buf to save the original address.
> 
> Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

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


Re: [BNX2 1/4]: Don't apply CRC PHY workaround to 5709.

2007-01-08 Thread David Miller
From: "Michael Chan" <[EMAIL PROTECTED]>
Date: Mon, 08 Jan 2007 15:56:21 -0800

> [BNX2]: Don't apply CRC PHY workaround to 5709.
> 
> The workaround is only needed on 5706/5708 and cannot be applied on
> 5709.
> 
> Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

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


Re: [BNX2 2/4]: Fix 5709 Serdes detection.

2007-01-08 Thread David Miller
From: "Michael Chan" <[EMAIL PROTECTED]>
Date: Mon, 08 Jan 2007 15:56:31 -0800

> [BNX2]: Fix 5709 Serdes detection.
> 
> 5709 has a new register to detect copper/fiber PHYs.
> 
> Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

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


Re: [GIT][Netlabel] Pull request

2007-01-08 Thread David Miller
From: James Morris <[EMAIL PROTECTED]>
Date: Mon, 8 Jan 2007 18:24:41 -0500 (EST)

> The following changes since commit bf81b46482c0fa8ea638e409d39768ea92a6b0f0:
>   Linus Torvalds:
> Linux 2.6.20-rc4
> 
> are found in the git repository at:
> 
>   
> git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-davem
> 
> Paul Moore:
>   NetLabel: correct locking in selinux_netlbl_socket_setsid()
>   NetLabel: correct CIPSO tag handling when adding new DOI definitions
> 
>  net/netlabel/netlabel_cipso_v4.c |6 +++---
>  security/selinux/ss/services.c   |4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)

Pulled, thanks a lot James.
-
To unsubscribe from this list: send 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] ucc_geth: kmalloc casting cleanups

2007-01-08 Thread Li Yang

From: Ahmed S. Darwish <[EMAIL PROTECTED]>

Switch kmalloc to kzalloc and clean some redundant kmalloc
casts.

Signed-off-by: Ahmed S. Darwish <[EMAIL PROTECTED]>
Signed-off-by: Li Yang <[EMAIL PROTECTED]>
---
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 8243150..0f58f5f 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2926,10 +2926,9 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
/* Init Tx bds */
for (j = 0; j < ug_info->numQueuesTx; j++) {
/* Setup the skbuff rings */
-   ugeth->tx_skbuff[j] =
-   (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) *
-  ugeth->ug_info->bdRingLenTx[j],
-  GFP_KERNEL);
+   ugeth->tx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
+ ugeth->ug_info->bdRingLenTx[j],
+ GFP_KERNEL);

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

if (ugeth->rx_skbuff[j] == NULL) {
ugeth_err("%s: Could not allocate rx_skbuff",
@@ -3450,19 +3448,16 @@ static int ucc_geth_startup(struct ucc_geth_private 
*ugeth)
 * resource.
 * This shadow structure keeps a copy of what was done so that the
 * allocated resources can be released when the channel is freed.
+* *p_init_enet_param_shadow is zeroed by kzalloc
 */
-   if (!(ugeth->p_init_enet_param_shadow =
-(struct ucc_geth_init_pram *) kmalloc(sizeof(struct 
ucc_geth_init_pram),
- GFP_KERNEL))) {
+	if (!(ugeth->p_init_enet_param_shadow = 
+	  kzalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) {

ugeth_err
("%s: Can not allocate memory for"
" p_UccInitEnetParamShadows.", __FUNCTION__);
ucc_geth_memclean(ugeth);
return -ENOMEM;
}
-   /* Zero out *p_init_enet_param_shadow */
-   memset((char *)ugeth->p_init_enet_param_shadow,
-  0, sizeof(struct ucc_geth_init_pram));

/* Fill shadow InitEnet command parameter structure */

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


RE: [PATCH 2.6.20-rc3] UCC Ether driver: kmalloc casting cleanups

2007-01-08 Thread Li Yang-r58472
> -Original Message-
> From: Ahmed S. Darwish [mailto:[EMAIL PROTECTED]
> Sent: Saturday, January 06, 2007 9:19 PM
> To: Li Yang-r58472
> Cc: linux-kernel@vger.kernel.org
> Subject: [PATCH 2.6.20-rc3] UCC Ether driver: kmalloc casting cleanups
> 
> [Please inform me if you are not the maintaner cause I'm not sure:)]
> 
> Hi,
> A kmalloc casting cleanup patch.
> 
> I wasn't able to compile the file drivers/net/ucc_geth.c cause of
> some not found headers (asm/of_platform.h, asm/qe.h, and others )

You need to use ARCH=powerpc to compile this driver.  I don't know how
you could select this driver without using powerpc arch.

> 
> Signed-off-by: Ahmed Darwish <[EMAIL PROTECTED]>
> 
> diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
> index 8243150..001109e 100644
> --- a/drivers/net/ucc_geth.c
> +++ b/drivers/net/ucc_geth.c
> @@ -2864,8 +2864,8 @@ static int ucc_geth_startup(struct
ucc_geth_private *ugeth)
>   if (UCC_GETH_TX_BD_RING_ALIGNMENT > 4)
>   align = UCC_GETH_TX_BD_RING_ALIGNMENT;
>   ugeth->tx_bd_ring_offset[j] =
> - (u32) (kmalloc((u32) (length + align),
> - GFP_KERNEL));
> + kmalloc((u32) (length + align),
GFP_KERNEL);
> +
>   if (ugeth->tx_bd_ring_offset[j] != 0)
>   ugeth->p_tx_bd_ring[j] =
>
(void*)((ugeth->tx_bd_ring_offset[j] +
> @@ -2900,7 +2900,7 @@ static int ucc_geth_startup(struct
ucc_geth_private *ugeth)
>   if (UCC_GETH_RX_BD_RING_ALIGNMENT > 4)
>   align = UCC_GETH_RX_BD_RING_ALIGNMENT;
>   ugeth->rx_bd_ring_offset[j] =
> - (u32) (kmalloc((u32) (length + align),
GFP_KERNEL));
> + kmalloc((u32) (length + align),
GFP_KERNEL);

NACK about the 2 clean-ups above.  Cast from pointer to integer is
required here.

>   if (ugeth->rx_bd_ring_offset[j] != 0)
>   ugeth->p_rx_bd_ring[j] =
>
(void*)((ugeth->rx_bd_ring_offset[j] +
> @@ -2926,10 +2926,9 @@ static int ucc_geth_startup(struct
ucc_geth_private *ugeth)
>   /* Init Tx bds */
>   for (j = 0; j < ug_info->numQueuesTx; j++) {
>   /* Setup the skbuff rings */
> - ugeth->tx_skbuff[j] =
> - (struct sk_buff **)kmalloc(sizeof(struct sk_buff *)
*
> -
ugeth->ug_info->bdRingLenTx[j],
> -GFP_KERNEL);
> + ugeth->tx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
> +
ugeth->ug_info->bdRingLenTx[j],
> +   GFP_KERNEL);
> 
>   if (ugeth->tx_skbuff[j] == NULL) {
>   ugeth_err("%s: Could not allocate tx_skbuff",
> @@ -2958,10 +2957,9 @@ static int ucc_geth_startup(struct
ucc_geth_private *ugeth)
>   /* Init Rx bds */
>   for (j = 0; j < ug_info->numQueuesRx; j++) {
>   /* Setup the skbuff rings */
> - ugeth->rx_skbuff[j] =
> - (struct sk_buff **)kmalloc(sizeof(struct sk_buff *)
*
> -
ugeth->ug_info->bdRingLenRx[j],
> -GFP_KERNEL);
> + ugeth->rx_skbuff[j] = kmalloc(sizeof(struct sk_buff *) *
> +
ugeth->ug_info->bdRingLenRx[j],
> +   GFP_KERNEL);
> 
>   if (ugeth->rx_skbuff[j] == NULL) {
>   ugeth_err("%s: Could not allocate rx_skbuff",
> @@ -3452,8 +3450,7 @@ static int ucc_geth_startup(struct
ucc_geth_private *ugeth)
>* allocated resources can be released when the channel is
freed.
>*/
>   if (!(ugeth->p_init_enet_param_shadow =
> -  (struct ucc_geth_init_pram *) kmalloc(sizeof(struct
> ucc_geth_init_pram),
> -   GFP_KERNEL))) {
> +   kmalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) {
>   ugeth_err
>   ("%s: Can not allocate memory for"
>   " p_UccInitEnetParamShadows.", __FUNCTION__);
> 
> --
> Ahmed S. Darwish
> http://darwish-07.blogspot.com

- Leo
-
To unsubscribe from this list: send 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: [BUG KERNEL 2.6.20-rc1] ftp: get or put stops during file-transfer

2007-01-08 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Thu, 4 Jan 2007 14:23:30 +0200), Craig 
Schlenter <[EMAIL PROTECTED]> says:

> On Fri, Jan 05, 2007 at 05:45:46AM +0900, Komuro wrote:
> > Hi,
> > 
> > I made a patch below.
> > With this patch, the ftp-transfer-stop problem does not happen.
> > Therefore, I think this is not a problem of vsftpd.
> > 
> > Mr.YOSHIFUJI san, why did you set TCPOLEN_TSTAMP_ALIGNED
> > to iov_len?
> > 
> > 
> > 
> > --- linux-2.6.20-rc3/net/ipv4/tcp_ipv4.c.orig   2007-01-03 
> > 11:50:04.0 +0900
> > +++ linux-2.6.20-rc3/net/ipv4/tcp_ipv4.c2007-01-03 15:30:44.0 
> > +0900
> > @@ -648,7 +648,7 @@ static void tcp_v4_send_ack(struct tcp_t
> >TCPOLEN_TIMESTAMP);
> > rep.opt[1] = htonl(tcp_time_stamp);
> > rep.opt[2] = htonl(ts);
> > -   arg.iov[0].iov_len = TCPOLEN_TSTAMP_ALIGNED;
> > +   arg.iov[0].iov_len = sizeof(rep);
> 
> Perhaps this was supposed to be
> arg.iov[0].iov_len += TCPOLEN_TSTAMP_ALIGNED;
> 
> That's what the ipv6 stuff does in places.

Good catch! I agree.
Craig, please provide a patch for us, please.

Thank you again.

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


[PACKET]: Add optional checksum computation for recvmsg

2007-01-08 Thread Herbert Xu
Hi Dave:

[PACKET]: Add optional checksum computation for recvmsg

This patch is needed to make ISC's DHCP server (and probably other
DHCP servers/clients using AF_PACKET) to be able to serve another
client on the same Xen host.

The problem is that packets between different domains on the same
Xen host only have partial checksums.  Unfortunately this piece of
information is not passed along in AF_PACKET unless you're using
the mmap interface.  Since the standard libpcap doesn't support
mmap (and even the ones which do support it don't pass along the
flag anyway), UDP packets from the same host come out with apparently
bogus checksums.

Since there is no way to pass the flag for the recvmsg(2) interface,
an alternative is to compute the checksum in the kernel.  This is a
bit of waste but can be useful for other user-space applications such
as tcpdump.

The following patch taps into the existing sockopt of SO_NO_CHECK.
It changes the default sk_no_check value for packet sockets to 1
so that the default behaviour is identical to the status quo.  If
the application disables SO_NO_CHECK, then partial checksums will
be computed for recvmsg(2) (mmap is unaffected).  The checksum
computation will only proceed if the packet is not truncated by
the socket.

In addition, this patch removes the GSO check from skb_checksum_help
so that checksums are computed for GSO packets too for consistency.

That check is no longer relevant since netfilter now computes the
checksum updates for GSO packets correctly.  Even without the fixes
to netfilter, that check is only a small optimisation since all it
does is avoid an unnecessary checksum computation on GSO packets.

Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>

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
--
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
diff --git a/net/core/dev.c b/net/core/dev.c
index e660cb5..142194f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1175,11 +1175,6 @@ int skb_checksum_help(struct sk_buff *skb)
if (skb->ip_summed == CHECKSUM_COMPLETE)
goto out_set_summed;
 
-   if (unlikely(skb_shinfo(skb)->gso_size)) {
-   /* Let GSO fix up the checksum. */
-   goto out_set_summed;
-   }
-
if (skb_cloned(skb)) {
ret = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
if (ret)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index da73e8a..a5efa31 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -526,8 +526,11 @@ static int packet_rcv(struct sk_buff *skb, struct 
net_device *dev, struct packet
if (dev->hard_header_parse)
sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr);
 
-   if (pskb_trim(skb, snaplen))
-   goto drop_n_acct;
+   if (snaplen < skb->len) {
+   if (__pskb_trim(skb, snaplen))
+   goto drop_n_acct;
+   skb->ip_summed = CHECKSUM_UNNECESSARY;
+   }
 
skb_set_owner_r(skb, sk);
skb->dev = NULL;
@@ -1017,6 +1020,9 @@ static int packet_create(struct socket *sock, int 
protocol)
sk->sk_destruct = packet_sock_destruct;
atomic_inc(&packet_socks_nr);
 
+   /* We don't want checksums by default for performance reasons. */
+   sk->sk_no_check = 1;
+
/*
 *  Attach a protocol block
 */
@@ -1110,6 +1116,12 @@ static int packet_recvmsg(struct kiocb *iocb, struct 
socket *sock,
msg->msg_flags|=MSG_TRUNC;
}
 
+   if (unlikely(!sk->sk_no_check && skb->ip_summed == CHECKSUM_PARTIAL)) {
+   err = skb_checksum_help(skb);
+   if (err)
+   goto out_free;
+   }
+
err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
if (err)
goto out_free;
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT][Netlabel] Pull request

2007-01-08 Thread James Morris
Dave, please pull per below.



The following changes since commit bf81b46482c0fa8ea638e409d39768ea92a6b0f0:
  Linus Torvalds:
Linux 2.6.20-rc4

are found in the git repository at:

  
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-davem

Paul Moore:
  NetLabel: correct locking in selinux_netlbl_socket_setsid()
  NetLabel: correct CIPSO tag handling when adding new DOI definitions

 net/netlabel/netlabel_cipso_v4.c |6 +++---
 security/selinux/ss/services.c   |4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)




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


Re: [BNX2 4/4]: Update version and reldate.

2007-01-08 Thread Michael Chan
Sorry, the date was wrong on the one sent earlier.

[BNX2]: Update version and reldate.

Update version to 1.5.3.

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

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 08a77a3..6494f5b 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -57,8 +57,8 @@
 
 #define DRV_MODULE_NAME"bnx2"
 #define PFX DRV_MODULE_NAME": "
-#define DRV_MODULE_VERSION "1.5.2"
-#define DRV_MODULE_RELDATE "December 13, 2006"
+#define DRV_MODULE_VERSION "1.5.3"
+#define DRV_MODULE_RELDATE "January 8, 2007"
 
 #define RUN_AT(x) (jiffies + (x))
 


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


[TG3]: Add PHY workaround for 5755M.

2007-01-08 Thread Michael Chan
[TG3]: Add PHY workaround for 5755M.

Some PHY trim values need to be fine-tuned on 5755M to be
IEEE-compliant.

Update version to 3.72.

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

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 4056ba1..d5c2241 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -68,8 +68,8 @@
 
 #define DRV_MODULE_NAME"tg3"
 #define PFX DRV_MODULE_NAME": "
-#define DRV_MODULE_VERSION "3.71"
-#define DRV_MODULE_RELDATE "December 15, 2006"
+#define DRV_MODULE_VERSION "3.72"
+#define DRV_MODULE_RELDATE "January 8, 2007"
 
 #define TG3_DEF_MAC_MODE   0
 #define TG3_DEF_RX_MODE0
@@ -1015,7 +1015,12 @@ out:
else if (tp->tg3_flags2 & TG3_FLG2_PHY_JITTER_BUG) {
tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a);
-   tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x010b);
+   if (tp->tg3_flags2 & TG3_FLG2_PHY_ADJUST_TRIM) {
+   tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x110b);
+   tg3_writephy(tp, MII_TG3_TEST1,
+MII_TG3_TEST1_TRIM_EN | 0x4);
+   } else
+   tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x010b);
tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
}
/* Set Extended packet length bit (bit 14) on all chips that */
@@ -10803,9 +10808,11 @@ static int __devinit tg3_get_invariants(
 
if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) {
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
-   GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787)
+   GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) {
tp->tg3_flags2 |= TG3_FLG2_PHY_JITTER_BUG;
-   else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906)
+   if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5755M)
+   tp->tg3_flags2 |= TG3_FLG2_PHY_ADJUST_TRIM;
+   } else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5906)
tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG;
}
 
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index cf78a7e..80f59ac 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -1658,6 +1658,9 @@
 #define MII_TG3_EPHY_TEST  0x1f /* 5906 PHY register */
 #define MII_TG3_EPHY_SHADOW_EN 0x80
 
+#define MII_TG3_TEST1  0x1e
+#define MII_TG3_TEST1_TRIM_EN  0x0010
+
 /* There are two ways to manage the TX descriptors on the tigon3.
  * Either the descriptors are in host DMA'able memory, or they
  * exist only in the cards on-chip SRAM.  All 16 send bds are under
@@ -2256,6 +2259,7 @@ struct tg3 {
 #define TG3_FLG2_1SHOT_MSI 0x1000
 #define TG3_FLG2_PHY_JITTER_BUG0x2000
 #define TG3_FLG2_NO_FWARE_REPORTED 0x4000
+#define TG3_FLG2_PHY_ADJUST_TRIM   0x8000
 
u32 split_mode_max_reqs;
 #define SPLIT_MODE_5704_MAX_REQ3


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


[BNX2 3/4]: Fix bug in bnx2_nvram_write().

2007-01-08 Thread Michael Chan
[BNX2]: Fix bug in bnx2_nvram_write().

The bug was a bogus pointer being passed to kfree().  The pointer was
incremented in the write loop and then passed to kfree().

The fix is to use align_buf to save the original address.

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

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index e325f93..08a77a3 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -3083,7 +3083,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 of
int buf_size)
 {
u32 written, offset32, len32;
-   u8 *buf, start[4], end[4], *flash_buffer = NULL;
+   u8 *buf, start[4], end[4], *align_buf = NULL, *flash_buffer = NULL;
int rc = 0;
int align_start, align_end;
 
@@ -3111,16 +3111,17 @@ bnx2_nvram_write(struct bnx2 *bp, u32 of
}
 
if (align_start || align_end) {
-   buf = kmalloc(len32, GFP_KERNEL);
-   if (buf == NULL)
+   align_buf = kmalloc(len32, GFP_KERNEL);
+   if (align_buf == NULL)
return -ENOMEM;
if (align_start) {
-   memcpy(buf, start, 4);
+   memcpy(align_buf, start, 4);
}
if (align_end) {
-   memcpy(buf + len32 - 4, end, 4);
+   memcpy(align_buf + len32 - 4, end, 4);
}
-   memcpy(buf + align_start, data_buf, buf_size);
+   memcpy(align_buf + align_start, data_buf, buf_size);
+   buf = align_buf;
}
 
if (bp->flash_info->buffered == 0) {
@@ -3254,11 +3255,8 @@ bnx2_nvram_write(struct bnx2 *bp, u32 of
}
 
 nvram_write_end:
-   if (bp->flash_info->buffered == 0)
-   kfree(flash_buffer);
-
-   if (align_start || align_end)
-   kfree(buf);
+   kfree(flash_buffer);
+   kfree(align_buf);
return rc;
 }
 


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


[BNX2 4/4]: Update version and reldate.

2007-01-08 Thread Michael Chan
[BNX2]: Update version and reldate.

Update version to 1.5.3.

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

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 08a77a3..6494f5b 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -57,8 +57,8 @@
 
 #define DRV_MODULE_NAME"bnx2"
 #define PFX DRV_MODULE_NAME": "
-#define DRV_MODULE_VERSION "1.5.2"
-#define DRV_MODULE_RELDATE "December 13, 2006"
+#define DRV_MODULE_VERSION "1.5.3"
+#define DRV_MODULE_RELDATE "December 8, 2006"
 
 #define RUN_AT(x) (jiffies + (x))
 


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


[BNX2 2/4]: Fix 5709 Serdes detection.

2007-01-08 Thread Michael Chan
[BNX2]: Fix 5709 Serdes detection.

5709 has a new register to detect copper/fiber PHYs.

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

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 8d682fc..e325f93 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -5643,6 +5643,44 @@ poll_bnx2(struct net_device *dev)
 }
 #endif
 
+static void __devinit
+bnx2_get_5709_media(struct bnx2 *bp)
+{
+   u32 val = REG_RD(bp, BNX2_MISC_DUAL_MEDIA_CTRL);
+   u32 bond_id = val & BNX2_MISC_DUAL_MEDIA_CTRL_BOND_ID;
+   u32 strap;
+
+   if (bond_id == BNX2_MISC_DUAL_MEDIA_CTRL_BOND_ID_C)
+   return;
+   else if (bond_id == BNX2_MISC_DUAL_MEDIA_CTRL_BOND_ID_S) {
+   bp->phy_flags |= PHY_SERDES_FLAG;
+   return;
+   }
+
+   if (val & BNX2_MISC_DUAL_MEDIA_CTRL_STRAP_OVERRIDE)
+   strap = (val & BNX2_MISC_DUAL_MEDIA_CTRL_PHY_CTRL) >> 21;
+   else
+   strap = (val & BNX2_MISC_DUAL_MEDIA_CTRL_PHY_CTRL_STRAP) >> 8;
+
+   if (PCI_FUNC(bp->pdev->devfn) == 0) {
+   switch (strap) {
+   case 0x4:
+   case 0x5:
+   case 0x6:
+   bp->phy_flags |= PHY_SERDES_FLAG;
+   return;
+   }
+   } else {
+   switch (strap) {
+   case 0x1:
+   case 0x2:
+   case 0x4:
+   bp->phy_flags |= PHY_SERDES_FLAG;
+   return;
+   }
+   }
+}
+
 static int __devinit
 bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 {
@@ -5863,10 +5901,9 @@ bnx2_init_board(struct pci_dev *pdev, st
bp->phy_addr = 1;
 
/* Disable WOL support if we are running on a SERDES chip. */
-   if (CHIP_NUM(bp) == CHIP_NUM_5709) {
-   if (CHIP_BOND_ID(bp) != BNX2_MISC_DUAL_MEDIA_CTRL_BOND_ID_C)
-   bp->phy_flags |= PHY_SERDES_FLAG;
-   } else if (CHIP_BOND_ID(bp) & CHIP_BOND_ID_SERDES_BIT)
+   if (CHIP_NUM(bp) == CHIP_NUM_5709)
+   bnx2_get_5709_media(bp);
+   else if (CHIP_BOND_ID(bp) & CHIP_BOND_ID_SERDES_BIT)
bp->phy_flags |= PHY_SERDES_FLAG;
 
if (bp->phy_flags & PHY_SERDES_FLAG) {


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


[BNX2 1/4]: Don't apply CRC PHY workaround to 5709.

2007-01-08 Thread Michael Chan
[BNX2]: Don't apply CRC PHY workaround to 5709.

The workaround is only needed on 5706/5708 and cannot be applied on
5709.

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

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index ada5e9b..8d682fc 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -1345,8 +1345,6 @@ bnx2_init_copper_phy(struct bnx2 *bp)
 {
u32 val;
 
-   bp->phy_flags |= PHY_CRC_FIX_FLAG;
-
if (bp->phy_flags & PHY_CRC_FIX_FLAG) {
bnx2_write_phy(bp, 0x18, 0x0c00);
bnx2_write_phy(bp, 0x17, 0x000a);
@@ -5880,7 +5878,9 @@ bnx2_init_board(struct pci_dev *pdev, st
if (reg & BNX2_SHARED_HW_CFG_PHY_2_5G)
bp->phy_flags |= PHY_2_5G_CAPABLE_FLAG;
}
-   }
+   } else if (CHIP_NUM(bp) == CHIP_NUM_5706 ||
+  CHIP_NUM(bp) == CHIP_NUM_5708)
+   bp->phy_flags |= PHY_CRC_FIX_FLAG;
 
if ((CHIP_ID(bp) == CHIP_ID_5708_A0) ||
(CHIP_ID(bp) == CHIP_ID_5708_B0) ||


-
To unsubscribe from this list: send 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] X.25 Add missing sock_put in x25_receive_data

2007-01-08 Thread ahendry

__x25_find_socket does a sock_hold.
This adds a missing sock_put in x25_receive_data.

Signed-off-by: Andrew Hendry <[EMAIL PROTECTED]>

--- linux-2.6.19-vanilla/net/x25/x25_dev.c  2006-12-31 22:31:07.0 
+1100
+++ linux-2.6.19/net/x25/x25_dev.c  2007-01-06 16:40:54.0 +1100
@@ -56,6 +56,7 @@ static int x25_receive_data(struct sk_bu
sk_add_backlog(sk, skb);
}
bh_unlock_sock(sk);
+   sock_put(sk);
return queued;
}

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


wireless-dev updated (sync w/ 2.6.20-rc3 + lots of new stuff)

2007-01-08 Thread John W. Linville
Lots of wireless-dev activity around the holidays...still
catching-up...  I got stuff compiling, so I thought I'd push it out.

John

---

The following changes since commit 3622152cf1ed4613addde30bce9cd9f71d17efa2:
  John W. Linville (1):
Merge branch 'from-linus'

are found in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-dev.git

David Kimdon (9):
  d80211: allow for hardware crypto of default keys
  d80211: set default_wep_only dynamically
  d80211: fix potential interface name overflow
  d80211: fix potential invalid array index returning key information
  d80211: remove unused references to sub interface data
  d80211: fix invalid check for sub interface type AP
  d80211: do not pass an invalid key index to set_key()
  d80211: clear ifsta->associated flag when authentication starts
  d80211: inhibit duplicate authentication requests when setting bssid

Jan Kiszka (1):
  d80211: Reinit keys on mode change

Jiri Benc (5):
  Merge branch 'from-john'
  d80211: simplify classify_1d
  d80211: small documentation fix
  d80211: do not cancel uninitialized work
  rt2x00: fix breakage after pkt_type field was removed

Johannes Berg (3):
  d80211: add missing \n in skb queue warning
  fix some wireless ext stuff
  fix cfg80211 WE compat code

John W. Linville (8):
  Merge branch 'up' of git://git.kernel.org/.../jbenc/dscape
  Merge branch 'adm8211-week51' of 
git://git.kernel.org/.../mwu/d80211-drivers
  Merge branch 'p54-week51' of git://git.kernel.org/.../mwu/d80211-drivers
  Merge branch 'zd1211rw-week51' of 
git://git.kernel.org/.../mwu/d80211-drivers
  Merge branch 'up2' of git://git.kernel.org/.../jbenc/dscape
  cfg80211: fix build breakage from genlmsg_put signature change
  bcm43xx, rt2x00: fix build breakage from INIT_DELAYED_WORK changes
  zd1211rw-d80211: port INIT_DELAYED_WORK changes from mainline

Michael Buesch (7):
  d80211: Fix errorcode in ieee80211_update_hw
  d80211: Fix passing of invalid pointer
  d80211: Fix 64bit printk warnings
  d80211: Turn PHYmode list from an array into a linked list
  d80211: constify ieee80211_ops pointer
  bcm43xx-d80211: Fix for PHYmode API change.
  rt2x00: Fix compilation for d80211 hwmode API change

Michael Wu (31):
  d80211: remove pkt_type/pkt_probe_resp
  d80211: move 802.11 defines to linux/ieee80211.h
  d80211: merge d80211_shared.h into d80211.h
  d80211: merge d80211_mgmt.h into linux/ieee80211.h
  d80211: move d80211_common.h to net/d80211
  zd1211rw-d80211: Fix of a locking bug
  zd1211rw-d80211: Revert "zd1211rw: Removed unneeded packed attributes"
  zd1211rw-d80211: Add 3 more device IDs
  zd1211rw-d80211: Add ID for ZyXEL G-220
  zd1211rw-d80211: Add ID for Planex GW-US54Mini
  zd1211rw-d80211: Add ID for Belkin F5D7050 v4000
  zd1211rw-d80211: cleanups
  zd1211rw-d80211: Optimized handling of zero length entries in length info
  zd1211rw-d80211: check IEEE80211_TXCTL_USE_CTS_PROTECT
  zd1211rw-d80211: Use ieee80211_tx_status
  p54: fix device memory allocator
  p54: fix TX of encrypted frames
  p54: remove unnecessary use of __constant_cpu_to_*
  p54: use hardware RX frequency reporting
  p54: use link LED
  p54: fix issues found by sparse
  p54: set phymode in RX
  zd1211rw-d80211: 2 new ZD1211B device ID's
  zd1211rw-d80211: Add ID for Linksys WUSBF54G
  adm8211: set phymode in RX
  d80211: fix wep.c breakage
  d80211: fix wme.c breakage
  d80211: fix workqueue breakage
  adm8211: Fix compilation for d80211 hwmode API change
  p54: Fix compilation for d80211 hwmode API change
  zd1211rw-d80211: Fix compilation for d80211 hwmode API change

Mohamed Abbas (1):
  d80211: add mising sta_info_put function

Zhu Yi (1):
  d80211: fix classify_1d() priority selection

 drivers/net/wireless/d80211/adm8211/adm8211.c  |9 +-
 drivers/net/wireless/d80211/adm8211/adm8211.h  |2 +-
 drivers/net/wireless/d80211/bcm43xx/bcm43xx.h  |6 +-
 drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c |   68 +++--
 drivers/net/wireless/d80211/p54/prism54.h  |3 +-
 drivers/net/wireless/d80211/p54/prism54common.c|  123 +---
 drivers/net/wireless/d80211/p54/prism54common.h|   15 +-
 drivers/net/wireless/d80211/p54/prism54pci.c   |   65 ++--
 drivers/net/wireless/d80211/p54/prism54usb.c   |  105 
 drivers/net/wireless/d80211/rt2x00/rt2400pci.c |  130 +
 drivers/net/wireless/d80211/rt2x00/rt2400pci.h |6 +-
 drivers/net/wireless/d80211/rt2x00/rt2500pci.c |  170 ++-
 drivers/net/wireless/d80211/rt2x00/rt2500pci.h |6 +-
 drivers/net/wireless/d80211/rt2x00/rt2500usb.c |  170 ++-
 drivers/net/wireless/d80211/rt2x00/rt2500usb.h |6 +-
 drivers/net/wireles

Re: [git patches] net driver fixes

2007-01-08 Thread Kumar Gala


On Jan 8, 2007, at 5:40 AM, Jeff Garzik wrote:


Li Yang-r58472 wrote:

Hi Jeff,
Could you apply the updates for ucc_geth driver?
The patches from Timur that make the driver compile correctly on  
2.6.20.

[PATCH] Fix phy_read/write redefinition errors in ucc_geth_phy.c
[PATCH] Update ucc_geth.c for new workqueue structure
The patch from Ahmed that cleans up some unnecessary casts.
[PATCH 2.6.20-rc3] UCC Ether driver: kmalloc casting cleanups


I don't have any of these in my queue.


Here's links to the orig patches:

http://marc.theaimsgroup.com/?l=linux-netdev&m=116605401912152&w=2
http://marc.theaimsgroup.com/?l=linux-netdev&m=116605366909148&w=2

- k
-
To unsubscribe from this list: send 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/RFC 00/10] Transparent proxying patches version 4

2007-01-08 Thread KOVACS Krisztian

  Hi Evgeniy,

On Wednesday 03 January 2007 18:23, Evgeniy Polyakov wrote:
> Out of curiosity, would you use netchannels [1] if the implementation
> will be much broader? Since what you have created works exactly like
> netchannels netfilter NAT target (although it does not change ports,
> but it can be trivially extended), but without all existing netfilter
> overhead and without hacks in core TCP/UDP/IP/route code.

  Indeed, a netchannels based implementation would be very nice. Combined 
with a userspace network stack I think this could be a very powerful 
tool, especially for people doing dirty tricks -- like transparent 
proxying in our case.

  However, I think that adopting netchannels now would be an enormous work 
on our part. Of course, personally I'm really interested in netchannels 
and the related projects, but I agree with Harald that we still have a 
long way to go before being able to switch to netchannels. And I 
definitely _hate_ the previous incarnations of our tproxy patches enough 
that even this patchset seems acceptable for me. ;)

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


Re: d80211: How does TX flow control work?

2007-01-08 Thread Jan Kiszka
Jan Kiszka wrote:
> Jan Kiszka wrote:
>> Jiri Benc wrote:
>>> On Wed, 03 Jan 2007 19:10:01 +0100, Jan Kiszka wrote:
 BUG: warning at 
 /usr/src/rt2x00/rt2x00/ieee80211/ieee80211.c:1256/ieee80211_tx()
   ieee80211_master_start_xmit+0x105/0x430 [80211]   
 __ip_ct_refresh_acct+0x4d/0x60
   tcp_packet+0x941/0x970   qdisc_restart+0x92/0x100
   dev_queue_xmit+0xbd/0x1a0   
 ieee80211_subif_start_xmit+0x468/0x480 [80211]
   skb_clone+0x3a/0x1a0   nf_hook_slow+0x4d/0xc0
   dev_queue_xmit+0x115/0x1a0   ip_output+0x1c3/0x200
   ip_finish_output+0x0/0x180   
 ip_queue_xmit+0x36b/0x3b0
   dst_output+0x0/0x10   usb_hcd_giveback_urb+0x2d/0x60 
 [usbcore]
   tcp_v4_send_check+0x82/0xd0   
 tcp_v4_send_check+0x82/0xd0
   tcp_transmit_skb+0x5e4/0x610   
 __tcp_push_pending_frames+0x676/0x740
   __alloc_skb+0x51/0x100   tcp_sendmsg+0x897/0x980
   core_sys_select+0x1b9/0x2b0   inet_sendmsg+0x3d/0x50
   do_sock_write+0x8f/0xa0   sock_aio_write+0x5f/0x70
   do_sync_write+0xc3/0x100   
 autoremove_wake_function+0x0/0x40
   vfs_write+0xa1/0x140   sys_write+0x43/0x70
   syscall_call+0x7/0xb

 Does it tell you anything already? Is there something I may instrument? 
 What
 could the driver do wrong to trigger such bug?
>>> Do you have CONFIG_NET_SCHED enabled?
>>>
> 
> Sorry, this was most probably false alarm for the official stack. The
> problem now appears to be related to a patch against d80211 that is only
> present in the rt2x00 CVS.

Well, I said "most probably"...

The actual problem was meanwhile identified: shorewall happened to
overwrite the queueing discipline of wmaster0 with pfifo_fast. I found
the magic knob to tell shorewall to no longer do this (at least until I
want to manage traffic control that way...), but I still wonder if it is
an acceptable situation. Currently, the user can intentionally or
accidentally screw up the stack this way.

Jan


PS: Tests performed on a 2.6.17 kernel, but I don't see a reason why
newer kernels should be immune.



signature.asc
Description: OpenPGP digital signature


[take31 7/10] kevent: Signal notifications.

2007-01-08 Thread Evgeniy Polyakov

Signal notifications.

This type of notifications allows to deliver signals through kevent queue.
One can find example application signal.c on project homepage.

If KEVENT_SIGNAL_NOMASK bit is set in raw_u64 id then signal will be
delivered only through queue, otherwise both delivery types are used - old
through update of mask of pending signals and through queue.

If signal is delivered only through kevent queue mask of pending signals
is not updated at all, which is equal to putting signal into blocked mask,
but with delivery of that signal through kevent queue.

Signed-off-by: Evgeniy Polyakov <[EMAIL PROTECTED]>


diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4463735..e7372f2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -82,6 +82,7 @@ struct sched_param {
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -1048,6 +1049,10 @@ struct task_struct {
 #ifdef CONFIG_TASK_DELAY_ACCT
struct task_delay_info *delays;
 #endif
+#ifdef CONFIG_KEVENT_SIGNAL
+   struct kevent_storage st;
+   u32 kevent_signals;
+#endif
 #ifdef CONFIG_FAULT_INJECTION
int make_it_fail;
 #endif
diff --git a/kernel/fork.c b/kernel/fork.c
index fc723e5..fd7c749 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -118,6 +119,9 @@ void __put_task_struct(struct task_struct *tsk)
WARN_ON(atomic_read(&tsk->usage));
WARN_ON(tsk == current);
 
+#ifdef CONFIG_KEVENT_SIGNAL
+   kevent_storage_fini(&tsk->st);
+#endif
security_task_free(tsk);
free_uid(tsk->user);
put_group_info(tsk->group_info);
@@ -1126,6 +1130,10 @@ static struct task_struct *copy_process(unsigned long 
clone_flags,
if (retval)
goto bad_fork_cleanup_namespaces;
 
+#ifdef CONFIG_KEVENT_SIGNAL
+   kevent_storage_init(p, &p->st);
+#endif
+
p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : 
NULL;
/*
 * Clear TID on mm_release()?
diff --git a/kernel/kevent/kevent_signal.c b/kernel/kevent/kevent_signal.c
new file mode 100644
index 000..abe3972
--- /dev/null
+++ b/kernel/kevent/kevent_signal.c
@@ -0,0 +1,94 @@
+/*
+ * kevent_signal.c
+ * 
+ * 2006 Copyright (c) Evgeniy Polyakov <[EMAIL PROTECTED]>
+ * All rights reserved.
+ * 
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int kevent_signal_callback(struct kevent *k)
+{
+   struct task_struct *tsk = k->st->origin;
+   int sig = k->event.id.raw[0];
+   int ret = 0;
+
+   if (sig == tsk->kevent_signals)
+   ret = 1;
+
+   if (ret && (k->event.id.raw_u64 & KEVENT_SIGNAL_NOMASK))
+   tsk->kevent_signals |= 0x8000;
+
+   return ret;
+}
+
+int kevent_signal_enqueue(struct kevent *k)
+{
+   int err;
+
+   err = kevent_storage_enqueue(¤t->st, k);
+   if (err)
+   goto err_out_exit;
+
+   if (k->event.req_flags & KEVENT_REQ_ALWAYS_QUEUE) {
+   kevent_requeue(k);
+   err = 0;
+   } else {
+   err = k->callbacks.callback(k);
+   if (err)
+   goto err_out_dequeue;
+   }
+
+   return err;
+
+err_out_dequeue:
+   kevent_storage_dequeue(k->st, k);
+err_out_exit:
+   return err;
+}
+
+int kevent_signal_dequeue(struct kevent *k)
+{
+   kevent_storage_dequeue(k->st, k);
+   return 0;
+}
+
+int kevent_signal_notify(struct task_struct *tsk, int sig)
+{
+   tsk->kevent_signals = sig;
+   kevent_storage_ready(&tsk->st, NULL, KEVENT_SIGNAL_DELIVERY);
+   return (tsk->kevent_signals & 0x8000);
+}
+
+static int __init kevent_init_signal(void)
+{
+   struct kevent_callbacks sc = {
+   .callback = &kevent_signal_callback,
+   .enqueue = &kevent_signal_enqueue,
+   .dequeue = &kevent_signal_dequeue,
+   .flags = 0,
+   };
+
+   return kevent_add_callbacks(&sc, KEVENT_SIGNAL);
+}
+module_init(kevent_init_signal);
diff --git a/kernel/signal.c b/kernel/signal.c
index 5630255..f12ebc0 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 

[take31 1/10] kevent: Description.

2007-01-08 Thread Evgeniy Polyakov

Description.


diff --git a/Documentation/kevent.txt b/Documentation/kevent.txt
new file mode 100644
index 000..95cb36e
--- /dev/null
+++ b/Documentation/kevent.txt
@@ -0,0 +1,244 @@
+Description.
+
+int kevent_init(struct kevent_ring *ring, unsigned int ring_size, 
+   unsigned int flags);
+
+num - size of the ring buffer in events 
+ring - pointer to allocated ring buffer
+flags - various flags, see KEVENT_FLAGS_* definitions.
+
+Return value: kevent control file descriptor or negative error value.
+
+ struct kevent_ring
+ {
+   unsigned int ring_kidx, ring_over;
+   struct ukevent event[0];
+ }
+
+ring_kidx - index in the ring buffer where kernel will put new events 
+   when kevent_wait() or kevent_get_events() is called 
+ring_over - number of overflows of ring_uidx happend from the start.
+   Overflow counter is used to prevent situation when two threads 
+   are going to free the same events, but one of them was scheduled 
+   away for too long, so ring indexes were wrapped, so when that 
+   thread will be awakened, it will free not those events, which 
+   it suppose to free.
+
+Example userspace code (ring_buffer.c) can be found on project's homepage.
+
+Each kevent syscall can be so called cancellation point in glibc, i.e. when 
+thread has been cancelled in kevent syscall, thread can be safely removed 
+and no events will be lost, since each syscall (kevent_wait() or 
+kevent_get_events()) will copy event into special ring buffer, accessible 
+from other threads or even processes (if shared memory is used).
+
+When kevent is removed (not dequeued when it is ready, but just removed), 
+even if it was ready, it is not copied into ring buffer, since if it is 
+removed, no one cares about it (otherwise user would wait until it becomes 
+ready and got it through usual way using kevent_get_events() or kevent_wait()) 
+and thus no need to copy it to the ring buffer.
+
+---
+
+
+int kevent_ctl(int fd, unsigned int cmd, unsigned int num, struct ukevent 
*arg);
+
+fd - is the file descriptor referring to the kevent queue to manipulate. 
+It is created by opening "/dev/kevent" char device, which is created with 
+dynamic minor number and major number assigned for misc devices. 
+
+cmd - is the requested operation. It can be one of the following:
+KEVENT_CTL_ADD - add event notification 
+KEVENT_CTL_REMOVE - remove event notification 
+KEVENT_CTL_MODIFY - modify existing notification 
+KEVENT_CTL_READY - mark existing events as ready, if number of events is 
zero,
+   it just wakes up parked in syscall thread
+
+num - number of struct ukevent in the array pointed to by arg 
+arg - array of struct ukevent
+
+Return value: 
+ number of events processed or negative error value.
+
+When called, kevent_ctl will carry out the operation specified in the 
+cmd parameter.
+---
+
+ int kevent_get_events(int ctl_fd, unsigned int min_nr, unsigned int max_nr, 
+   struct timespec timeout, struct ukevent *buf, unsigned flags);
+
+ctl_fd - file descriptor referring to the kevent queue 
+min_nr - minimum number of completed events that kevent_get_events will block 
+waiting for 
+max_nr - number of struct ukevent in buf 
+timeout - time to wait before returning less than min_nr 
+ events. If this is -1, then wait forever. 
+buf - pointer to an array of struct ukevent. 
+flags - various flags, see KEVENT_FLAGS_* definitions.
+
+Return value:
+ number of events copied or negative error value.
+
+kevent_get_events will wait timeout milliseconds for at least min_nr completed 
+events, copying completed struct ukevents to buf and deleting any 
+KEVENT_REQ_ONESHOT event requests. In nonblocking mode it returns as many 
+events as possible, but not more than max_nr. In blocking mode it waits until 
+timeout or if at least min_nr events are ready.
+
+This function copies event into ring buffer if it was initialized, if ring 
buffer
+is full, KEVENT_RET_COPY_FAILED flag is set in ret_flags field.
+---
+
+ int kevent_wait(int ctl_fd, unsigned int num, unsigned int old_uidx, 
+   struct timespec timeout, unsigned int flags);
+
+ctl_fd - file descriptor referring to the kevent queue 
+num - number of processed kevents 
+old_uidx - the last index user is aware of
+timeout - time to wait until there is free space in kevent queue
+flags - various flags, see KEVENT_FLAGS_* definitions.
+
+Return value:
+ number of events copied into ring buffer or negative error value.
+
+This syscall waits until either timeout expires or at least one event becomes 
+ready. It also copies events into special ring buffer. If ring buffer is full,
+it waits until there are ready events and then return.
+If kevent is one-shot kevent it is remo

[take31 5/10] kevent: Timer notifications.

2007-01-08 Thread Evgeniy Polyakov

Timer notifications.

Timer notifications can be used for fine grained per-process time 
management, since interval timers are very inconvenient to use, 
and they are limited.

This subsystem uses high-resolution timers.
id.raw[0] is used as number of seconds
id.raw[1] is used as number of nanoseconds

Signed-off-by: Evgeniy Polyakov <[EMAIL PROTECTED]>

diff --git a/kernel/kevent/kevent_timer.c b/kernel/kevent/kevent_timer.c
new file mode 100644
index 000..c21a155
--- /dev/null
+++ b/kernel/kevent/kevent_timer.c
@@ -0,0 +1,114 @@
+/*
+ * 2006 Copyright (c) Evgeniy Polyakov <[EMAIL PROTECTED]>
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct kevent_timer
+{
+   struct hrtimer  ktimer;
+   struct kevent_storage   ktimer_storage;
+   struct kevent   *ktimer_event;
+};
+
+static int kevent_timer_func(struct hrtimer *timer)
+{
+   struct kevent_timer *t = container_of(timer, struct kevent_timer, 
ktimer);
+   struct kevent *k = t->ktimer_event;
+
+   kevent_storage_ready(&t->ktimer_storage, NULL, KEVENT_MASK_ALL);
+   hrtimer_forward(timer, timer->base->softirq_time,
+   ktime_set(k->event.id.raw[0], k->event.id.raw[1]));
+   return HRTIMER_RESTART;
+}
+
+static struct lock_class_key kevent_timer_key;
+
+static int kevent_timer_enqueue(struct kevent *k)
+{
+   int err;
+   struct kevent_timer *t;
+
+   t = kmalloc(sizeof(struct kevent_timer), GFP_KERNEL);
+   if (!t)
+   return -ENOMEM;
+
+   hrtimer_init(&t->ktimer, CLOCK_MONOTONIC, HRTIMER_REL);
+   t->ktimer.expires = ktime_set(k->event.id.raw[0], k->event.id.raw[1]);
+   t->ktimer.function = kevent_timer_func;
+   t->ktimer_event = k;
+
+   err = kevent_storage_init(&t->ktimer, &t->ktimer_storage);
+   if (err)
+   goto err_out_free;
+   lockdep_set_class(&t->ktimer_storage.lock, &kevent_timer_key);
+
+   err = kevent_storage_enqueue(&t->ktimer_storage, k);
+   if (err)
+   goto err_out_st_fini;
+
+   hrtimer_start(&t->ktimer, t->ktimer.expires, HRTIMER_REL);
+
+   return 0;
+
+err_out_st_fini:
+   kevent_storage_fini(&t->ktimer_storage);
+err_out_free:
+   kfree(t);
+
+   return err;
+}
+
+static int kevent_timer_dequeue(struct kevent *k)
+{
+   struct kevent_storage *st = k->st;
+   struct kevent_timer *t = container_of(st, struct kevent_timer, 
ktimer_storage);
+
+   hrtimer_cancel(&t->ktimer);
+   kevent_storage_dequeue(st, k);
+   kfree(t);
+
+   return 0;
+}
+
+static int kevent_timer_callback(struct kevent *k)
+{
+   k->event.ret_data[0] = jiffies_to_msecs(jiffies);
+   return 1;
+}
+
+static int __init kevent_init_timer(void)
+{
+   struct kevent_callbacks tc = {
+   .callback = &kevent_timer_callback,
+   .enqueue = &kevent_timer_enqueue,
+   .dequeue = &kevent_timer_dequeue,
+   .flags = 0,
+   };
+
+   return kevent_add_callbacks(&tc, KEVENT_TIMER);
+}
+module_init(kevent_init_timer);
+

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


[take31 3/10] kevent: poll/select() notifications.

2007-01-08 Thread Evgeniy Polyakov

poll/select() notifications.

This patch includes generic poll/select notifications.
kevent_poll works simialr to epoll and has the same issues (callback
is invoked not from internal state machine of the caller, but through
process awake, a lot of allocations and so on).

Signed-off-by: Evgeniy Polyakov <[EMAIL PROTECTED]>

diff --git a/fs/file_table.c b/fs/file_table.c
index 4c17a18..46f458c 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -119,6 +120,7 @@ struct file *get_empty_filp(void)
f->f_uid = tsk->fsuid;
f->f_gid = tsk->fsgid;
eventpoll_init_file(f);
+   kevent_init_file(f);
/* f->f_version: 0 */
return f;
 
@@ -164,6 +166,7 @@ void fastcall __fput(struct file *file)
 * in the file cleanup chain.
 */
eventpoll_release(file);
+   kevent_cleanup_file(file);
locks_remove_flock(file);
 
if (file->f_op && file->f_op->release)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 186da81..59e6069 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -280,6 +280,7 @@ extern int dir_notify_enable;
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -408,6 +409,8 @@ struct address_space_operations {
 
int (*readpages)(struct file *filp, struct address_space *mapping,
struct list_head *pages, unsigned nr_pages);
+   int (*aio_readpages)(struct file *filp, struct address_space *mapping,
+   struct list_head *pages, unsigned nr_pages, void *priv);
 
/*
 * ext3 requires that a successful prepare_write() call be followed
@@ -578,6 +581,10 @@ struct inode {
struct mutexinotify_mutex;  /* protects the watches list */
 #endif
 
+#if defined CONFIG_KEVENT_SOCKET || defined CONFIG_KEVENT_PIPE
+   struct kevent_storage   st;
+#endif
+
unsigned long   i_state;
unsigned long   dirtied_when;   /* jiffies of first dirtying */
 
@@ -737,6 +744,9 @@ struct file {
struct list_headf_ep_links;
spinlock_t  f_ep_lock;
 #endif /* #ifdef CONFIG_EPOLL */
+#ifdef CONFIG_KEVENT_POLL
+   struct kevent_storage   st;
+#endif
struct address_space*f_mapping;
 };
 extern spinlock_t files_lock;
diff --git a/kernel/kevent/kevent_poll.c b/kernel/kevent/kevent_poll.c
new file mode 100644
index 000..58129fa
--- /dev/null
+++ b/kernel/kevent/kevent_poll.c
@@ -0,0 +1,234 @@
+/*
+ * 2006 Copyright (c) Evgeniy Polyakov <[EMAIL PROTECTED]>
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static struct kmem_cache *kevent_poll_container_cache;
+static struct kmem_cache *kevent_poll_priv_cache;
+
+struct kevent_poll_ctl
+{
+   struct poll_table_structpt;
+   struct kevent   *k;
+};
+
+struct kevent_poll_wait_container
+{
+   struct list_headcontainer_entry;
+   wait_queue_head_t   *whead;
+   wait_queue_twait;
+   struct kevent   *k;
+};
+
+struct kevent_poll_private
+{
+   struct list_headcontainer_list;
+   spinlock_t  container_lock;
+};
+
+static int kevent_poll_enqueue(struct kevent *k);
+static int kevent_poll_dequeue(struct kevent *k);
+static int kevent_poll_callback(struct kevent *k);
+
+static int kevent_poll_wait_callback(wait_queue_t *wait,
+   unsigned mode, int sync, void *key)
+{
+   struct kevent_poll_wait_container *cont =
+   container_of(wait, struct kevent_poll_wait_container, wait);
+   struct kevent *k = cont->k;
+
+   kevent_storage_ready(k->st, NULL, KEVENT_MASK_ALL);
+   return 0;
+}
+
+static void kevent_poll_qproc(struct file *file, wait_queue_head_t *whead,
+   struct poll_table_struct *poll_table)
+{
+   struct kevent *k =
+   container_of(poll_table, struct kevent_poll_ctl, pt)->k;
+   struct kevent_poll_private *priv = k->priv;
+   struct kevent_poll_wait_container *cont;
+   unsigned long flags;
+
+   cont = kmem_cache_alloc(kevent_poll_container_cache, GFP_KERNEL);
+   if (!cont) {
+   kevent_break(k);
+   return;
+   }
+
+   cont->k = k;
+   init_waitqueue_fu

[take31 9/10] kevent: Private userspace notifications.

2007-01-08 Thread Evgeniy Polyakov

Private userspace notifications.

Allows to register notifications of any private userspace
events over kevent. Events can be marked as readt using 
kevent_ctl(KEVENT_READY) command.

Signed-off-by: Evgeniy Polyakov <[EMAIL PROTECTED]>

diff --git a/kernel/kevent/kevent_unotify.c b/kernel/kevent/kevent_unotify.c
new file mode 100644
index 000..618c09c
--- /dev/null
+++ b/kernel/kevent/kevent_unotify.c
@@ -0,0 +1,62 @@
+/*
+ * 2006 Copyright (c) Evgeniy Polyakov <[EMAIL PROTECTED]>
+ * All rights reserved.
+ * 
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include 
+#include 
+
+static int kevent_unotify_callback(struct kevent *k)
+{
+   return 1;
+}
+
+int kevent_unotify_enqueue(struct kevent *k)
+{
+   int err;
+
+   err = kevent_storage_enqueue(&k->user->st, k);
+   if (err)
+   goto err_out_exit;
+
+   if (k->event.req_flags & KEVENT_REQ_ALWAYS_QUEUE)
+   kevent_requeue(k);
+
+   return 0;
+
+err_out_exit:
+   return err;
+}
+
+int kevent_unotify_dequeue(struct kevent *k)
+{
+   kevent_storage_dequeue(k->st, k);
+   return 0;
+}
+
+static int __init kevent_init_unotify(void)
+{
+   struct kevent_callbacks sc = {
+   .callback = &kevent_unotify_callback,
+   .enqueue = &kevent_unotify_enqueue,
+   .dequeue = &kevent_unotify_dequeue,
+   .flags = 0,
+   };
+
+   return kevent_add_callbacks(&sc, KEVENT_UNOTIFY);
+}
+module_init(kevent_init_unotify);

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


[take31 4/10] kevent: Socket notifications.

2007-01-08 Thread Evgeniy Polyakov

Socket notifications.

This patch includes socket send/recv/accept notifications.
Using trivial web server based on kevent and this features
instead of epoll it's performance increased more than noticebly.
More details about various benchmarks and server itself 
(evserver_kevent.c) can be found on project's homepage.

Signed-off-by: Evgeniy Polyakov <[EMAIL PROTECTED]>

diff --git a/fs/inode.c b/fs/inode.c
index bf21dc6..82817b1 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /*
@@ -164,12 +165,18 @@ static struct inode *alloc_inode(struct super_block *sb)
}
inode->i_private = NULL;
inode->i_mapping = mapping;
+#if defined CONFIG_KEVENT_SOCKET || defined CONFIG_KEVENT_PIPE
+   kevent_storage_init(inode, &inode->st);
+#endif
}
return inode;
 }
 
 void destroy_inode(struct inode *inode) 
 {
+#if defined CONFIG_KEVENT_SOCKET || defined CONFIG_KEVENT_PIPE
+   kevent_storage_fini(&inode->st);
+#endif
BUG_ON(inode_has_buffers(inode));
security_inode_free(inode);
if (inode->i_sb->s_op->destroy_inode)
diff --git a/include/net/sock.h b/include/net/sock.h
index 03684e7..d840399 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -49,6 +49,7 @@
 #include   /* struct sk_buff */
 #include 
 #include 
+#include 
 
 #include 
 
@@ -451,6 +452,21 @@ static inline int sk_stream_memory_free(struct sock *sk)
 
 extern void sk_stream_rfree(struct sk_buff *skb);
 
+struct socket_alloc {
+   struct socket socket;
+   struct inode vfs_inode;
+};
+
+static inline struct socket *SOCKET_I(struct inode *inode)
+{
+   return &container_of(inode, struct socket_alloc, vfs_inode)->socket;
+}
+
+static inline struct inode *SOCK_INODE(struct socket *socket)
+{
+   return &container_of(socket, struct socket_alloc, socket)->vfs_inode;
+}
+
 static inline void sk_stream_set_owner_r(struct sk_buff *skb, struct sock *sk)
 {
skb->sk = sk;
@@ -478,6 +494,7 @@ static inline void sk_add_backlog(struct sock *sk, struct 
sk_buff *skb)
sk->sk_backlog.tail = skb;
}
skb->next = NULL;
+   kevent_socket_notify(sk, KEVENT_SOCKET_RECV);
 }
 
 #define sk_wait_event(__sk, __timeo, __condition)  \
@@ -679,21 +696,6 @@ static inline struct kiocb *siocb_to_kiocb(struct 
sock_iocb *si)
return si->kiocb;
 }
 
-struct socket_alloc {
-   struct socket socket;
-   struct inode vfs_inode;
-};
-
-static inline struct socket *SOCKET_I(struct inode *inode)
-{
-   return &container_of(inode, struct socket_alloc, vfs_inode)->socket;
-}
-
-static inline struct inode *SOCK_INODE(struct socket *socket)
-{
-   return &container_of(socket, struct socket_alloc, socket)->vfs_inode;
-}
-
 extern void __sk_stream_mem_reclaim(struct sock *sk);
 extern int sk_stream_mem_schedule(struct sock *sk, int size, int kind);
 
diff --git a/include/net/tcp.h b/include/net/tcp.h
index b7d8317..2763b30 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -864,6 +864,7 @@ static inline int tcp_prequeue(struct sock *sk, struct 
sk_buff *skb)
tp->ucopy.memory = 0;
} else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
wake_up_interruptible(sk->sk_sleep);
+   kevent_socket_notify(sk, 
KEVENT_SOCKET_RECV|KEVENT_SOCKET_SEND);
if (!inet_csk_ack_scheduled(sk))
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
  (3 * TCP_RTO_MIN) / 4,
diff --git a/kernel/kevent/kevent_socket.c b/kernel/kevent/kevent_socket.c
new file mode 100644
index 000..d1a2701
--- /dev/null
+++ b/kernel/kevent/kevent_socket.c
@@ -0,0 +1,144 @@
+/*
+ * kevent_socket.c
+ * 
+ * 2006 Copyright (c) Evgeniy Polyakov <[EMAIL PROTECTED]>
+ * All rights reserved.
+ * 
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+static int kevent_socket_callback(struct kevent *k)
+{
+   struct inode *inode = k->st->origin;
+   unsigned int events = SOCKET_I(inode)

[take31 0/10] kevent: Generic event handling mechanism.

2007-01-08 Thread Evgeniy Polyakov

Generic event handling mechanism.

Kevent is a generic subsytem which allows to handle event notifications.
It supports both level and edge triggered events. It is similar to
poll/epoll in some cases, but it is more scalable, it is faster and
allows to work with essentially eny kind of events.

Events are provided into kernel through control syscall and can be read
back through ring buffer or using usual syscalls.
Kevent update (i.e. readiness switching) happens directly from internals
of the appropriate state machine of the underlying subsytem (like
network, filesystem, timer or any other).

Homepage:
http://tservice.net.ru/~s0mbre/old/?section=projects&item=kevent

Documentation page:
http://linux-net.osdl.org/index.php/Kevent

Consider for inclusion.

P.S. If you want to be removed from Cc: list just drop me a mail.

Changes from 'take30' patchset:
 * AIO state machine.
 * aio_sendfile() implementation.
 * moved kevent_user_get/kevent_user_put into header.
 * use *zalloc where needed.

Changes from 'take29' patchset:
 * new private userspace notifications - allows to queue any userspace private 
event and then mark it as ready using kevent_ctl(KEVENT_READY) command
 * KEVENT_REQ_READY flag - if set kevent will be marked as ready at enqueue time
 * port to 2.6.20-rc2 tree (54abb5fcdae74a811ed440ec6556cabc6b24f404 commit)
 * use struct kmem_cache instead of kmem_cache_t
 * added notificaion type into search key, this allows to have the same id for 
different types of notifications

Changes from 'take28' patchset:
 * optimized af_unix to use socket notifications
 * changed ALWAYS_QUEUE behaviour with poll/select notifications - previously
kevent was not queued into poll wait queue when ALWAYS_QUEUE flag
is set
 * added KEVENT_POLL_POLLRDHUP definition into ukevent.h header
 * libevent-1.2 patch (Jamal, your request is completed, so I'm waiting two 
weeks
before starting final countdown :)
All regression tests passed successfully except test_evbuffer(), which 
is
crashed on my amd64 linux 2.6 test machine for all types of 
notifications,
probably it was fixed in libevent-1.2a version, I did not check.
Patch and README can be found at project homepage.

Changes from 'take27' patchset:
 * made kevent default yes in non embedded case.
 * added falgs to callback structures - currently used to check if kevent
can be requested from kernelspace only (posix timers) or 
userspace (all others)

Changes from 'take26' patchset:
 * made kevent visible in config only in case of embedded setup.
 * added comment about KEVENT_MAX number.
 * spell fix.

Changes from 'take25' patchset:
 * use timespec as timeout parameter.
 * added high-resolution timer to handle absolute timeouts.
 * added flags to waiting and initialization syscalls.
 * kevent_commit() has new_uidx parameter.
 * kevent_wait() has old_uidx parameter, which, if not equal to u->uidx,
results in immediate wakeup (usefull for the case when entries
are added asynchronously from kernel (not supported for now)).
 * added interface to mark any event as ready.
 * event POSIX timers support.
 * return -ENOSYS if there is no registered event type.
 * provided file descriptor must be checked for fifo type (spotted by Eric 
Dumazet).
 * signal notifications.
 * documentation update.
 * lighttpd patch updated (the latest benchmarks with lighttpd patch can be 
found in blog).

Changes from 'take24' patchset:
 * new (old (new)) ring buffer implementation with kernel and user indexes.
 * added initialization syscall instead of opening /dev/kevent
 * kevent_commit() syscall to commit ring buffer entries
 * changed KEVENT_REQ_WAKEUP_ONE flag to KEVENT_REQ_WAKEUP_ALL, kevent wakes
   only first thread always if that flag is not set
 * KEVENT_REQ_ALWAYS_QUEUE flag. If set, kevent will be queued into ready queue
   instead of copying back to userspace when kevent is ready immediately when
   it is added.
 * lighttpd patch (Hail! Although nothing really outstanding compared to epoll)

Changes from 'take23' patchset:
 * kevent PIPE notifications
 * KEVENT_REQ_LAST_CHECK flag, which allows to perform last check at dequeueing 
time
 * fixed poll/select notifications (were broken due to tree manipulations)
 * made Documentation/kevent.txt look nice in 80-col terminal
 * fix for copy_to_user() failure report for the first kevent (Andrew Morton)
 * minor function renames

Changes from 'take22' patchset:
 * new ring buffer implementation in process' memory
 * wakeup-one-thread flag
 * edge-triggered behaviour

Changes from 'take21' patchset:
 * minor cleanups (different return values, removed unneded variables, 
whitespaces and so on)
 * fixed bug in kevent removal in case when kevent being removed
   is the same as overflow_kevent (spotted by Eric Dumazet)

Changes from 'take20' patchset:
 * new ring buffer implementation
 * removed artificial limit on possible number of kevents

Cha

[take31 10/10] kevent: Kevent based AIO (aio_sendfile()).

2007-01-08 Thread Evgeniy Polyakov

Kevent based AIO (aio_sendfile()).

aio_sendfile() contains of two major parts: AIO state machine and page 
processing code. The former is just a small subsystem, which allows to 
queue callback for theirs invocation in process' context on behalf of 
pool of kernel threads. It allows to queue caches of callbacks to the 
local thread or to any other specified. Each cache of callbacks is 
processed until there are callbacks in it, callbacks can requeue 
themselfs into the same cache.

Real work is being done in page processing code - code which populates 
pages into VFS cache and then sends pages to the destination socket 
via ->sendpage(). Unlike previous aio_sendfile() implementation, new 
one does not require low-level filesystem specific callbacks (->get_block())
at all, instead I extended struct address_space_operations to contain new 
member called ->aio_readpages(), which is exactly the same as ->readpage() 
(read: mpage_readpages()) except different BIO allocation and sumbission 
routines. I changed mpage_readpages() to provide mpage_alloc() and 
mpage_bio_submit() to the new function called __mpage_readpages(), which is 
exactly old mpage_readpages() with provided callback invocation instead of 
usage for old functions. mpage_readpages_aio() provides kevent specific 
callbacks, which calls old functions, but with different destructor callbacks,
which are essentially the same, except that they reschedule AIO processing.

Benchmarks of simple sendfile vs. aio_sendfile did not show noticeble
win of any approach, but I want to notice, that my receiving side is 
not that best in my case (I managed to create a test where usual
senfile() stuck until signal received, the same hapend with aio_sendfile()
too, but the latter can be buggy).
It would be good to use it in lighttpd (I will create a patch after
some feedback received and approach will be considered as good.

AIO state machine is a base for network AIO (which becomes
quite trivial), but I will not start implementation until
roadback of kevent as a whole and AIO implementation become more clear.

Signed-off-by: Evgeniy Polyakov <[EMAIL PROTECTED]>

diff --git a/fs/bio.c b/fs/bio.c
index 7618bcb..291e7e8 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -120,7 +120,7 @@ void bio_free(struct bio *bio, struct bio_set *bio_set)
 /*
  * default destructor for a bio allocated with bio_alloc_bioset()
  */
-static void bio_fs_destructor(struct bio *bio)
+void bio_fs_destructor(struct bio *bio)
 {
bio_free(bio, fs_bio_set);
 }
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index beaf25f..f08c957 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1650,6 +1650,13 @@ ext3_readpages(struct file *file, struct address_space 
*mapping,
return mpage_readpages(mapping, pages, nr_pages, ext3_get_block);
 }
 
+static int
+ext3_readpages_aio(struct file *file, struct address_space *mapping,
+   struct list_head *pages, unsigned nr_pages, void *priv)
+{
+   return mpage_readpages_aio(mapping, pages, nr_pages, ext3_get_block, 
priv);
+}
+
 static void ext3_invalidatepage(struct page *page, unsigned long offset)
 {
journal_t *journal = EXT3_JOURNAL(page->mapping->host);
@@ -1768,6 +1775,7 @@ static int ext3_journalled_set_page_dirty(struct page 
*page)
 }
 
 static const struct address_space_operations ext3_ordered_aops = {
+   .aio_readpages  = ext3_readpages_aio,
.readpage   = ext3_readpage,
.readpages  = ext3_readpages,
.writepage  = ext3_ordered_writepage,
diff --git a/fs/mpage.c b/fs/mpage.c
index 692a3e5..e5ba44b 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -102,7 +102,7 @@ static struct bio *mpage_bio_submit(int rw, struct bio *bio)
 static struct bio *
 mpage_alloc(struct block_device *bdev,
sector_t first_sector, int nr_vecs,
-   gfp_t gfp_flags)
+   gfp_t gfp_flags, void *priv)
 {
struct bio *bio;
 
@@ -116,6 +116,7 @@ mpage_alloc(struct block_device *bdev,
if (bio) {
bio->bi_bdev = bdev;
bio->bi_sector = first_sector;
+   bio->bi_private = priv;
}
return bio;
 }
@@ -175,7 +176,10 @@ map_buffer_to_page(struct page *page, struct buffer_head 
*bh, int page_block)
 static struct bio *
 do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
sector_t *last_block_in_bio, struct buffer_head *map_bh,
-   unsigned long *first_logical_block, get_block_t get_block)
+   unsigned long *first_logical_block, get_block_t get_block,
+   struct bio *(*alloc)(struct block_device *bdev, sector_t 
first_sector, 
+   int nr_vecs, gfp_t gfp_flags, void *priv),
+   struct bio *(*submit)(int rw, struct bio *bio), void *priv)
 {
struct inode *inode = page->mapping->host;
const unsigned blkbits = inode->i_blkbits;
@@ -302,25 +306,25 @@ do_mpage_readpage(struct bio *bio, struct page *page,

[take31 8/10] kevent: Kevent posix timer notifications.

2007-01-08 Thread Evgeniy Polyakov

Kevent posix timer notifications.

Simple extensions to POSIX timers which allows
to deliver notification of the timer expiration
through kevent queue.

Example application posix_timer.c can be found
in archive on project homepage.

Signed-off-by: Evgeniy Polyakov <[EMAIL PROTECTED]>


diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 8786e01..3768746 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -235,6 +235,7 @@ typedef struct siginfo {
 #define SIGEV_NONE 1   /* other notification: meaningless */
 #define SIGEV_THREAD   2   /* deliver via thread creation */
 #define SIGEV_THREAD_ID 4  /* deliver to thread */
+#define SIGEV_KEVENT   8   /* deliver through kevent queue */
 
 /*
  * This works because the alignment is ok on all current architectures
@@ -260,6 +261,8 @@ typedef struct sigevent {
void (*_function)(sigval_t);
void *_attribute;   /* really pthread_attr_t */
} _sigev_thread;
+
+   int kevent_fd;
} _sigev_un;
 } sigevent_t;
 
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index a7dd38f..4b9deb4 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -4,6 +4,7 @@
 #include 
 #include 
 #include 
+#include 
 
 union cpu_time_count {
cputime_t cpu;
@@ -49,6 +50,9 @@ struct k_itimer {
sigval_t it_sigev_value;/* value word of sigevent struct */
struct task_struct *it_process; /* process to send signal to */
struct sigqueue *sigq;  /* signal queue entry. */
+#ifdef CONFIG_KEVENT_TIMER
+   struct kevent_storage st;
+#endif
union {
struct {
struct hrtimer timer;
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 5fe87de..5ec805e 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -48,6 +48,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 /*
  * Management arrays for POSIX timers.  Timers are kept in slab memory
@@ -224,6 +226,100 @@ static int posix_ktime_get_ts(clockid_t which_clock, 
struct timespec *tp)
return 0;
 }
 
+#ifdef CONFIG_KEVENT_TIMER
+static int posix_kevent_enqueue(struct kevent *k)
+{
+   /*
+* It is not ugly - there is no pointer in the id field union, 
+* but its size is 64bits, which is ok for any known pointer size.
+*/
+   struct k_itimer *tmr = (struct k_itimer *)(unsigned 
long)k->event.id.raw_u64;
+   return kevent_storage_enqueue(&tmr->st, k);
+}
+static int posix_kevent_dequeue(struct kevent *k)
+{
+   struct k_itimer *tmr = (struct k_itimer *)(unsigned 
long)k->event.id.raw_u64;
+   kevent_storage_dequeue(&tmr->st, k);
+   return 0;
+}
+static int posix_kevent_callback(struct kevent *k)
+{
+   return 1;
+}
+static int posix_kevent_init(void)
+{
+   struct kevent_callbacks tc = {
+   .callback = &posix_kevent_callback,
+   .enqueue = &posix_kevent_enqueue,
+   .dequeue = &posix_kevent_dequeue,
+   .flags = KEVENT_CALLBACKS_KERNELONLY};
+
+   return kevent_add_callbacks(&tc, KEVENT_POSIX_TIMER);
+}
+
+extern struct file_operations kevent_user_fops;
+
+static int posix_kevent_init_timer(struct k_itimer *tmr, int fd)
+{
+   struct ukevent uk;
+   struct file *file;
+   struct kevent_user *u;
+   int err;
+
+   file = fget(fd);
+   if (!file) {
+   err = -EBADF;
+   goto err_out;
+   }
+
+   if (file->f_op != &kevent_user_fops) {
+   err = -EINVAL;
+   goto err_out_fput;
+   }
+
+   u = file->private_data;
+
+   memset(&uk, 0, sizeof(struct ukevent));
+
+   uk.event = KEVENT_MASK_ALL;
+   uk.type = KEVENT_POSIX_TIMER;
+   uk.id.raw_u64 = (unsigned long)(tmr); /* Just cast to something unique 
*/
+   uk.req_flags = KEVENT_REQ_ONESHOT | KEVENT_REQ_ALWAYS_QUEUE;
+   uk.ptr = tmr->it_sigev_value.sival_ptr;
+
+   err = kevent_user_add_ukevent(&uk, u);
+   if (err)
+   goto err_out_fput;
+
+   fput(file);
+
+   return 0;
+
+err_out_fput:
+   fput(file);
+err_out:
+   return err;
+}
+
+static void posix_kevent_fini_timer(struct k_itimer *tmr)
+{
+   kevent_storage_fini(&tmr->st);
+}
+#else
+static int posix_kevent_init_timer(struct k_itimer *tmr, int fd)
+{
+   return -ENOSYS;
+}
+static int posix_kevent_init(void)
+{
+   return 0;
+}
+static void posix_kevent_fini_timer(struct k_itimer *tmr)
+{
+}
+#endif
+
+
 /*
  * Initialize everything, well, just everything in Posix clocks/timers ;)
  */
@@ -241,6 +337,11 @@ static __init int init_posix_timers(void)
register_posix_clock(CLOCK_REALTIME, &clock_realtime);
register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic);
 
+   if (posix_kevent_init()) {
+   printk(KERN_ERR "Failed t

[take31 6/10] kevent: Pipe notifications.

2007-01-08 Thread Evgeniy Polyakov

Pipe notifications.


diff --git a/fs/pipe.c b/fs/pipe.c
index 68090e8..0c75bf1 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -313,6 +314,7 @@ redo:
break;
}
if (do_wakeup) {
+   kevent_pipe_notify(inode, KEVENT_SOCKET_SEND);
wake_up_interruptible_sync(&pipe->wait);
kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
}
@@ -322,6 +324,7 @@ redo:
 
/* Signal writers asynchronously that there is more room. */
if (do_wakeup) {
+   kevent_pipe_notify(inode, KEVENT_SOCKET_SEND);
wake_up_interruptible(&pipe->wait);
kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
}
@@ -484,6 +487,7 @@ redo2:
break;
}
if (do_wakeup) {
+   kevent_pipe_notify(inode, KEVENT_SOCKET_RECV);
wake_up_interruptible_sync(&pipe->wait);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
do_wakeup = 0;
@@ -495,6 +499,7 @@ redo2:
 out:
mutex_unlock(&inode->i_mutex);
if (do_wakeup) {
+   kevent_pipe_notify(inode, KEVENT_SOCKET_RECV);
wake_up_interruptible(&pipe->wait);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
}
@@ -590,6 +595,7 @@ pipe_release(struct inode *inode, int decr, int decw)
free_pipe_info(inode);
} else {
wake_up_interruptible(&pipe->wait);
+   kevent_pipe_notify(inode, 
KEVENT_SOCKET_SEND|KEVENT_SOCKET_RECV);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
}
diff --git a/kernel/kevent/kevent_pipe.c b/kernel/kevent/kevent_pipe.c
new file mode 100644
index 000..91dc1eb
--- /dev/null
+++ b/kernel/kevent/kevent_pipe.c
@@ -0,0 +1,123 @@
+/*
+ * kevent_pipe.c
+ * 
+ * 2006 Copyright (c) Evgeniy Polyakov <[EMAIL PROTECTED]>
+ * All rights reserved.
+ * 
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int kevent_pipe_callback(struct kevent *k)
+{
+   struct inode *inode = k->st->origin;
+   struct pipe_inode_info *pipe = inode->i_pipe;
+   int nrbufs = pipe->nrbufs;
+
+   if (k->event.event & KEVENT_SOCKET_RECV && nrbufs > 0) {
+   if (!pipe->writers)
+   return -1;
+   return 1;
+   }
+   
+   if (k->event.event & KEVENT_SOCKET_SEND && nrbufs < PIPE_BUFFERS) {
+   if (!pipe->readers)
+   return -1;
+   return 1;
+   }
+
+   return 0;
+}
+
+int kevent_pipe_enqueue(struct kevent *k)
+{
+   struct file *pipe;
+   int err = -EBADF;
+   struct inode *inode;
+
+   pipe = fget(k->event.id.raw[0]);
+   if (!pipe)
+   goto err_out_exit;
+
+   inode = igrab(pipe->f_dentry->d_inode);
+   if (!inode)
+   goto err_out_fput;
+
+   err = -EINVAL;
+   if (!S_ISFIFO(inode->i_mode))
+   goto err_out_iput;
+
+   err = kevent_storage_enqueue(&inode->st, k);
+   if (err)
+   goto err_out_iput;
+
+   if (k->event.req_flags & KEVENT_REQ_ALWAYS_QUEUE) {
+   kevent_requeue(k);
+   err = 0;
+   } else {
+   err = k->callbacks.callback(k);
+   if (err)
+   goto err_out_dequeue;
+   }
+
+   fput(pipe);
+
+   return err;
+
+err_out_dequeue:
+   kevent_storage_dequeue(k->st, k);
+err_out_iput:
+   iput(inode);
+err_out_fput:
+   fput(pipe);
+err_out_exit:
+   return err;
+}
+
+int kevent_pipe_dequeue(struct kevent *k)
+{
+   struct inode *inode = k->st->origin;
+
+   kevent_storage_dequeue(k->st, k);
+   iput(inode);
+
+   return 0;
+}
+
+void kevent_pipe_notify(struct inode *inode, u32 event)
+{
+   kevent_storage_ready(&inode->st, NULL, event);
+}
+
+static int __init kevent_init_pipe(void)
+{
+ 

[PATCH 1/3] chelsio: error path fix

2007-01-08 Thread Stephen Hemminger
Fix handling of allocation failure.

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

--- netdev-2.6.orig/drivers/net/chelsio/my3126.c
+++ netdev-2.6/drivers/net/chelsio/my3126.c
@@ -170,9 +170,10 @@ static struct cphy *my3126_phy_create(ad
 {
struct cphy *cphy = kzalloc(sizeof (*cphy), GFP_KERNEL);
 
-   if (cphy)
-   cphy_init(cphy, adapter, phy_addr, &my3126_ops, mdio_ops);
+   if (!cphy)
+   return NULL;
 
+   cphy_init(cphy, adapter, phy_addr, &my3126_ops, mdio_ops);
INIT_DELAYED_WORK(&cphy->phy_update, my3216_poll);
cphy->bmsr = 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 3/3] chelsio: more rx speedup

2007-01-08 Thread Stephen Hemminger
Cleanup receive processing some more:
   * do the reserve padding of skb during setup
   * don't pass constants to get_packet
   * do smart prefetch of skb
   * make copybreak a module parameter

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

---
 drivers/net/chelsio/sge.c |   87 +++---
 1 file changed, 45 insertions(+), 42 deletions(-)

--- netdev-2.6.orig/drivers/net/chelsio/sge.c
+++ netdev-2.6/drivers/net/chelsio/sge.c
@@ -71,12 +71,9 @@
 #define SGE_FREEL_REFILL_THRESH16
 #define SGE_RESPQ_E_N  1024
 #define SGE_INTRTIMER_NRES 1000
-#define SGE_RX_COPY_THRES  256
 #define SGE_RX_SM_BUF_SIZE 1536
 #define SGE_TX_DESC_MAX_PLEN   16384
 
-# define SGE_RX_DROP_THRES 2
-
 #define SGE_RESPQ_REPLENISH_THRES (SGE_RESPQ_E_N / 4)
 
 /*
@@ -846,6 +843,8 @@ static void refill_free_list(struct sge 
skb_reserve(skb, q->dma_offset);
mapping = pci_map_single(pdev, skb->data, dma_len,
 PCI_DMA_FROMDEVICE);
+   skb_reserve(skb, sge->rx_pkt_pad);
+
ce->skb = skb;
pci_unmap_addr_set(ce, dma_addr, mapping);
pci_unmap_len_set(ce, dma_len, dma_len);
@@ -1024,6 +1023,10 @@ static void recycle_fl_buf(struct freelQ
}
 }
 
+static int copybreak __read_mostly = 256;
+module_param(copybreak, int, 0);
+MODULE_PARM_DESC(copybreak, "Receive copy threshold");
+
 /**
  * get_packet - return the next ingress packet buffer
  * @pdev: the PCI device that received the packet
@@ -1043,45 +1046,42 @@ static void recycle_fl_buf(struct freelQ
  * be copied but there is no memory for the copy.
  */
 static inline struct sk_buff *get_packet(struct pci_dev *pdev,
-struct freelQ *fl, unsigned int len,
-int dma_pad, int skb_pad,
-unsigned int copy_thres,
-unsigned int drop_thres)
+struct freelQ *fl, unsigned int len)
 {
struct sk_buff *skb;
-   struct freelQ_ce *ce = &fl->centries[fl->cidx];
+   const struct freelQ_ce *ce = &fl->centries[fl->cidx];
 
-   if (len < copy_thres) {
-   skb = alloc_skb(len + skb_pad, GFP_ATOMIC);
-   if (likely(skb != NULL)) {
-   skb_reserve(skb, skb_pad);
-   skb_put(skb, len);
-   pci_dma_sync_single_for_cpu(pdev,
-   pci_unmap_addr(ce, dma_addr),
-   pci_unmap_len(ce, dma_len),
-   PCI_DMA_FROMDEVICE);
-   memcpy(skb->data, ce->skb->data + dma_pad, len);
-   pci_dma_sync_single_for_device(pdev,
+   if (len < copybreak) {
+   skb = alloc_skb(len + 2, GFP_ATOMIC);
+   if (!skb)
+   goto use_orig_buf;
+
+   skb_reserve(skb, 2);/* align IP header */
+   skb_put(skb, len);
+   pci_dma_sync_single_for_cpu(pdev,
pci_unmap_addr(ce, dma_addr),
pci_unmap_len(ce, dma_len),
PCI_DMA_FROMDEVICE);
-   } else if (!drop_thres)
-   goto use_orig_buf;
-
+   memcpy(skb->data, ce->skb->data, len);
+   pci_dma_sync_single_for_device(pdev,
+  pci_unmap_addr(ce, dma_addr),
+  pci_unmap_len(ce, dma_len),
+  PCI_DMA_FROMDEVICE);
recycle_fl_buf(fl, fl->cidx);
return skb;
}
 
-   if (fl->credits < drop_thres) {
+use_orig_buf:
+   if (fl->credits < 2) {
recycle_fl_buf(fl, fl->cidx);
return NULL;
}
 
-use_orig_buf:
pci_unmap_single(pdev, pci_unmap_addr(ce, dma_addr),
 pci_unmap_len(ce, dma_len), PCI_DMA_FROMDEVICE);
skb = ce->skb;
-   skb_reserve(skb, dma_pad);
+   prefetch(skb->data);
+
skb_put(skb, len);
return skb;
 }
@@ -1359,27 +1359,25 @@ static void restart_sched(unsigned long 
  *
  * Process an ingress ethernet pakcet and deliver it to the stack.
  */
-static int sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)
+static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)
 {
struct sk_buff *skb;
-   struct cpl_rx_pkt *p;
+   const struct cpl_rx_pkt *p;
struct adapter *adapter = sge->adapter;
struct sge_port_stats *st;
 
-   skb = get_packet(adapter->pdev, fl, len - sge->rx_pkt_pad,
-sge->rx_pkt_pad, 2, SGE_RX_COPY_THRES,
-

[PATCH 2/3] chelsio: NAPI speed improvement

2007-01-08 Thread Stephen Hemminger
Speedup and cleanup the receive processing by eliminating the
mmio read and a lock round trip.

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

---
 drivers/net/chelsio/sge.c |   77 --
 1 file changed, 35 insertions(+), 42 deletions(-)

--- netdev-2.6.orig/drivers/net/chelsio/sge.c
+++ netdev-2.6/drivers/net/chelsio/sge.c
@@ -1559,6 +1559,14 @@ static int process_responses(struct adap
return budget;
 }
 
+static inline int responses_pending(const struct adapter *adapter)
+{
+   const struct respQ *Q = &adapter->sge->respQ;
+   const struct respQ_e *e = &Q->entries[Q->cidx];
+
+   return (e->GenerationBit == Q->genbit);
+}
+
 #ifdef CONFIG_CHELSIO_T1_NAPI
 /*
  * A simpler version of process_responses() that handles only pure (i.e.,
@@ -1568,13 +1576,16 @@ static int process_responses(struct adap
  * which the caller must ensure is a valid pure response.  Returns 1 if it
  * encounters a valid data-carrying response, 0 otherwise.
  */
-static int process_pure_responses(struct adapter *adapter, struct respQ_e *e)
+static int process_pure_responses(struct adapter *adapter)
 {
struct sge *sge = adapter->sge;
struct respQ *q = &sge->respQ;
+   struct respQ_e *e = &q->entries[q->cidx];
unsigned int flags = 0;
unsigned int cmdq_processed[SGE_CMDQ_N] = {0, 0};
 
+   if (e->DataValid)
+   return 1;
do {
flags |= e->Qsleeping;
 
@@ -1610,23 +1621,20 @@ static int process_pure_responses(struct
 int t1_poll(struct net_device *dev, int *budget)
 {
struct adapter *adapter = dev->priv;
-   int effective_budget = min(*budget, dev->quota);
-   int work_done = process_responses(adapter, effective_budget);
+   int work_done;
 
+   work_done = process_responses(adapter, min(*budget, dev->quota));
*budget -= work_done;
dev->quota -= work_done;
 
-   if (work_done >= effective_budget)
+   if (unlikely(responses_pending(adapter)))
return 1;
 
-   spin_lock_irq(&adapter->async_lock);
-   __netif_rx_complete(dev);
+   netif_rx_complete(dev);
writel(adapter->sge->respQ.cidx, adapter->regs + A_SG_SLEEPING);
-   writel(adapter->slow_intr_mask | F_PL_INTR_SGE_DATA,
-  adapter->regs + A_PL_ENABLE);
-   spin_unlock_irq(&adapter->async_lock);
 
return 0;
+
 }
 
 /*
@@ -1635,44 +1643,33 @@ int t1_poll(struct net_device *dev, int 
 irqreturn_t t1_interrupt(int irq, void *data)
 {
struct adapter *adapter = data;
-   struct net_device *dev = adapter->sge->netdev;
struct sge *sge = adapter->sge;
-   u32 cause;
-   int handled = 0;
+   int handled;
 
-   cause = readl(adapter->regs + A_PL_CAUSE);
-   if (cause == 0 || cause == ~0)
-   return IRQ_NONE;
-
-   spin_lock(&adapter->async_lock);
-   if (cause & F_PL_INTR_SGE_DATA) {
-   struct respQ *q = &adapter->sge->respQ;
-   struct respQ_e *e = &q->entries[q->cidx];
+   if (likely(responses_pending(adapter))) {
+   struct net_device *dev = sge->netdev;
 
-   handled = 1;
writel(F_PL_INTR_SGE_DATA, adapter->regs + A_PL_CAUSE);
 
-   if (e->GenerationBit == q->genbit &&
-   __netif_rx_schedule_prep(dev)) {
-   if (e->DataValid || process_pure_responses(adapter, e)) 
{
-   /* mask off data IRQ */
-   writel(adapter->slow_intr_mask,
-  adapter->regs + A_PL_ENABLE);
-   __netif_rx_schedule(sge->netdev);
-   goto unlock;
+   if (__netif_rx_schedule_prep(dev)) {
+   if (process_pure_responses(adapter))
+   __netif_rx_schedule(dev);
+   else {
+   /* no data, no NAPI needed */
+   writel(sge->respQ.cidx, adapter->regs + 
A_SG_SLEEPING);
+   netif_poll_enable(dev); /* undo schedule_prep */
}
-   /* no data, no NAPI needed */
-   netif_poll_enable(dev);
-
}
-   writel(q->cidx, adapter->regs + A_SG_SLEEPING);
-   } else
-   handled = t1_slow_intr_handler(adapter);
+   return IRQ_HANDLED;
+   }
+
+   spin_lock(&adapter->async_lock);
+   handled = t1_slow_intr_handler(adapter);
+   spin_unlock(&adapter->async_lock);
 
if (!handled)
sge->stats.unhandled_irqs++;
-unlock:
-   spin_unlock(&adapter->async_lock);
+
return IRQ_RETVAL(handled != 0);
 }
 
@@ -1695,17 +1692,13 @@ unlock:
 irqreturn_t t1_interrupt(int irq, void *cookie)
 {
int work_done;
-   struct respQ_e *e;
struct adapter *adapt

Re: Question on advanced routing and/or virtual routers.

2007-01-08 Thread Brendan Cully
On Monday, 08 January 2007 at 09:08, Ben Greear wrote:
> Hello!
> 
> I am curious if a single machine can be made to look like several 
> routers.  Please consider the following
> configuration:
> 
> Linux Router-A has 4 ethernet interfaces.  PC-A is connected to eth0 and 
> has IP 192.168.0.2.
> eth0 on Router-A has IP 192.168.0.1/24
> eth1 has IP 192.168.1.1/24, and eth1 is connected directly to eth2
> eth2 has IP 192.168.2.1/24
> eth3 is connected 'upstream' and has IP 192.168.3.1/24
> 
> I would like for PC-A to be able to ping 192.168.0.1 and 192.168.1.1 as 
> normal.
> The part I'm not sure how to make work is that I want to be able to ping 
> 192.168.2.1 and
> have the packet route out of eth1 and into eth2 (PC-A -> eth0 -> eth1 -> 
> eth2), and have the return packet follow the
> eth2 -> eth1 -> eth0 -> PC-A path.  A trace-route from PC-A should show 
> each of these hops (or, at least eth0 and eth2.)
> 
> The eventual goal is to have arbitrary numbers of 'routers' in a single 
> Linux machine for emulation
> purposes.
> 
> I was thinking that I might could accomplish this using multiple routing 
> tables and perhaps
> specific subnet routes for each each virtual router, specifying which 
> interface the packets should
> leave in order to find the next hop.
> 
> Has anyone tried something similar to this or have ideas for how to best 
> proceed?

I started something like this a while ago (posted at
<[EMAIL PROTECTED]> with a couple of replies
by Thomas Graf, but I can't seem to find it in the archives) but then
dropped the ball. It seems to work fairly well with a one-line kernel
patch to allow route lookup before the local address check. Oh, and I
didn't get traceroute working quite right either - I think there was
some trick to finding the source address for the generated reply.

I've got some info and code here: http://dsg.cs.ubc.ca/~brendan/remus/
-
To unsubscribe from this list: send 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: BUG: soft lockup detected on CPU#0! (2.6.18.2 plus hacks)

2007-01-08 Thread Stephen Hemminger
On Mon, 08 Jan 2007 08:57:10 -0800
Ben Greear <[EMAIL PROTECTED]> wrote:

> Jarek Poplawski wrote:
> > On Fri, Jan 05, 2007 at 12:33:43PM -0800, Ben Greear wrote:
> > ...
> >   
> >> So, I do believe this was the problem we were hitting, and it seems fixed.
> >> 
> >
> > Congratulations!
> >
> > But I can see one strange thing in vlan.c:
> >
> > /* Must be invoked with RCU read lock (no preempt) */
> > static struct vlan_group *__vlan_find_group(int real_dev_ifindex)
> > ...
> >  * Must be invoked with RCU read lock (no preempt)
> >  */
> > struct net_device *__find_vlan_dev(struct net_device *real_dev,
> > ...
> >
> > But later in this file no sign of disabling preemption
> > for these calls and for hlist_add_head_rcu and hlist_del_rcu.
> >
> > I can't imagine how this works?

Preempt is already disabled on the receive path.

> >   
> Perhaps...I didn't RCU-ify VLANs, but I can take a look.
> 
> For the record, the soft lockup was using MAC-VLANs, not 802.1Q VLANs, 
> so it wouldn't
> have been affected by bugs in VLANs one way or the other.
> 
> Ben
> 
> > Jarek P. 
> >   
> 
> 


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


Question on advanced routing and/or virtual routers.

2007-01-08 Thread Ben Greear

Hello!

I am curious if a single machine can be made to look like several 
routers.  Please consider the following

configuration:

Linux Router-A has 4 ethernet interfaces.  PC-A is connected to eth0 and 
has IP 192.168.0.2.

eth0 on Router-A has IP 192.168.0.1/24
eth1 has IP 192.168.1.1/24, and eth1 is connected directly to eth2
eth2 has IP 192.168.2.1/24
eth3 is connected 'upstream' and has IP 192.168.3.1/24

I would like for PC-A to be able to ping 192.168.0.1 and 192.168.1.1 as 
normal.
The part I'm not sure how to make work is that I want to be able to ping 
192.168.2.1 and
have the packet route out of eth1 and into eth2 (PC-A -> eth0 -> eth1 -> 
eth2), and have the return packet follow the
eth2 -> eth1 -> eth0 -> PC-A path.  A trace-route from PC-A should show 
each of these hops (or, at least eth0 and eth2.)


The eventual goal is to have arbitrary numbers of 'routers' in a single 
Linux machine for emulation

purposes.

I was thinking that I might could accomplish this using multiple routing 
tables and perhaps
specific subnet routes for each each virtual router, specifying which 
interface the packets should

leave in order to find the next hop.

Has anyone tried something similar to this or have ideas for how to best 
proceed?


Thanks,
Ben

--
Ben Greear <[EMAIL PROTECTED]> 
Candela Technologies Inc  http://www.candelatech.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: BUG: soft lockup detected on CPU#0! (2.6.18.2 plus hacks)

2007-01-08 Thread Ben Greear

Jarek Poplawski wrote:

On Fri, Jan 05, 2007 at 12:33:43PM -0800, Ben Greear wrote:
...
  

So, I do believe this was the problem we were hitting, and it seems fixed.



Congratulations!

But I can see one strange thing in vlan.c:

/* Must be invoked with RCU read lock (no preempt) */
static struct vlan_group *__vlan_find_group(int real_dev_ifindex)
...
 * Must be invoked with RCU read lock (no preempt)
 */
struct net_device *__find_vlan_dev(struct net_device *real_dev,
...

But later in this file no sign of disabling preemption
for these calls and for hlist_add_head_rcu and hlist_del_rcu.

I can't imagine how this works?
  

Perhaps...I didn't RCU-ify VLANs, but I can take a look.

For the record, the soft lockup was using MAC-VLANs, not 802.1Q VLANs, 
so it wouldn't

have been affected by bugs in VLANs one way or the other.

Ben

Jarek P. 
  



--
Ben Greear <[EMAIL PROTECTED]> 
Candela Technologies Inc  http://www.candelatech.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


[PATCH 5/5] s390: qeth driver hardware specs adaptions

2007-01-08 Thread Frank Pavlic
[PATCH 5/5] s390: qeth driver hardware specs adaptions

From: Peter Tiedemann <[EMAIL PROTECTED]>

- according to the latest OSA hardware specification
  incorporate actual IPA command and return codes into qeth.
- whitespaces removed from qeth_mpc.h

Signed-off-by: Frank Pavlic <[EMAIL PROTECTED]>
---
 drivers/s390/net/qeth_main.c |   10 ++
 drivers/s390/net/qeth_mpc.c  |  101 +++
 drivers/s390/net/qeth_mpc.h  |  220 --
 3 files changed, 238 insertions(+), 93 deletions(-)

diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 19ec4c8..be4f815 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -1919,6 +1919,9 @@ qeth_send_ipa_cmd(struct qeth_card *card
 {
int rc;
char prot_type;
+   int cmd;
+   cmd = ((struct qeth_ipa_cmd *)
+   (iob->data+IPA_PDU_HEADER_SIZE))->hdr.command;
 
QETH_DBF_TEXT(trace,4,"sendipa");
 
@@ -1932,6 +1935,12 @@ qeth_send_ipa_cmd(struct qeth_card *card
qeth_prepare_ipa_cmd(card,iob,prot_type);
rc = qeth_send_control_data(card, IPA_CMD_LENGTH, iob,
reply_cb, reply_param);
+   if (rc != 0) {
+   char * ipa_cmd_name;
+   ipa_cmd_name = qeth_get_ipa_cmd_name(cmd);
+   printk("%s %s(%x) returned %s(%x)\n",__FUNCTION__,
+   ipa_cmd_name, cmd, qeth_get_ipa_msg(rc), rc);
+   }
return rc;
 }
 
@@ -2486,7 +2495,6 @@ qeth_process_inbound_buffer(struct qeth_
int offset;
int rxrc;
__u16 vlan_tag = 0;
-   __u16 *vlan_addr;
 
/* get first element of current buffer */
element = (struct qdio_buffer_element *)&buf->buffer->element[0];
diff --git a/drivers/s390/net/qeth_mpc.c b/drivers/s390/net/qeth_mpc.c
index 77c8320..f54fdfd 100644
--- a/drivers/s390/net/qeth_mpc.c
+++ b/drivers/s390/net/qeth_mpc.c
@@ -157,12 +157,113 @@ unsigned char READ_CCW[]={
 };
 
 
+struct ipa_rc_msg {
+   enum qeth_ipa_return_codes rc;
+   char *msg;
+};
 
+struct ipa_rc_msg qeth_ipa_rc_msg[] = {
+   {IPA_RC_SUCCESS,"success"},
+   {IPA_RC_NOTSUPP,"Command not supported"},
+   {IPA_RC_IP_TABLE_FULL,  "Add Addr IP Table Full - ipv6"},
+   {IPA_RC_UNKNOWN_ERROR,  "IPA command failed - reason unknown"},
+   {IPA_RC_UNSUPPORTED_COMMAND,"Command not supported"},
+   {IPA_RC_DUP_IPV6_REMOTE,"ipv6 address already registered remote"},
+   {IPA_RC_DUP_IPV6_HOME,  "ipv6 address already registered"},
+   {IPA_RC_UNREGISTERED_ADDR,  "Address not registered"},
+   {IPA_RC_NO_ID_AVAILABLE,"No identifiers available"},
+   {IPA_RC_ID_NOT_FOUND,   "Identifier not found"},
+   {IPA_RC_INVALID_IP_VERSION, "IP version incorrect"},
+   {IPA_RC_LAN_FRAME_MISMATCH, "LAN and frame mismatch"},
+   {IPA_RC_L2_UNSUPPORTED_CMD, "Unsupported layer 2 command"},
+   {IPA_RC_L2_DUP_MAC, "Duplicate MAC address"},
+   {IPA_RC_L2_ADDR_TABLE_FULL, "Layer2 address table full"},
+   {IPA_RC_L2_DUP_LAYER3_MAC,  "Duplicate with layer 3 MAC"},
+   {IPA_RC_L2_GMAC_NOT_FOUND,  "GMAC not found"},
+   {IPA_RC_L2_MAC_NOT_FOUND,   "L2 mac address not found"},
+   {IPA_RC_L2_INVALID_VLAN_ID, "L2 invalid vlan id"},
+   {IPA_RC_L2_DUP_VLAN_ID, "L2 duplicate vlan id"},
+   {IPA_RC_L2_VLAN_ID_NOT_FOUND,   "L2 vlan id not found"},
+   {IPA_RC_DATA_MISMATCH,  "Data field mismatch (v4/v6 mixed)"},
+   {IPA_RC_INVALID_MTU_SIZE,   "Invalid MTU size"},
+   {IPA_RC_INVALID_LANTYPE,"Invalid LAN type"},
+   {IPA_RC_INVALID_LANNUM, "Invalid LAN num"},
+   {IPA_RC_DUPLICATE_IP_ADDRESS,   "Address already registered"},
+   {IPA_RC_IP_ADDR_TABLE_FULL, "IP address table full"},
+   {IPA_RC_LAN_PORT_STATE_ERROR,   "LAN port state error"},
+   {IPA_RC_SETIP_NO_STARTLAN,  "Setip no startlan received"},
+   {IPA_RC_SETIP_ALREADY_RECEIVED, "Setip already received"},
+   {IPA_RC_IP_ADDR_ALREADY_USED,   "IP address already in use on LAN"},
+   {IPA_RC_MULTICAST_FULL, "No task available, multicast full"},
+   {IPA_RC_SETIP_INVALID_VERSION,  "SETIP invalid IP version"},
+   {IPA_RC_UNSUPPORTED_SUBCMD, "Unsupported assist subcommand"},
+   {IPA_RC_ARP_ASSIST_NO_ENABLE,   "Only partial success, no enable"},
+   {IPA_RC_PRIMARY_ALREADY_DEFINED,"Primary already defined"},
+   {IPA_RC_SECOND_ALREADY_DEFINED, "Secondary already defined"},
+   {IPA_RC_INVALID_SETRTG_INDICATOR,"Invalid SETRTG indicator"},
+   {IPA_RC_MC_ADDR_ALREADY_DEFINED,"Multicast address already defined"},
+   {IPA_RC_LAN_OFFLINE,"STRTLAN_LAN_DISABLED - LAN offline"},
+   {IPA_RC_INVALID_IP_VERSION2,"Invalid IP version"},
+   {IPA_RC_,  

[PATCH 1/5] s390: qeth driver fixes

2007-01-08 Thread Frank Pavlic
Hi ,

please apply following 5 patches for s390 network device drivers.
Sorry for the fifth patch containing some lines which just remove
whitespaces. Another patch will follow in the next couple of days
with more whitespace and coding style cleanups in drivers/s390/net.

Thank you 

Frank

[PATCH 1/5] s390: qeth driver fixes

From: Frank Blaschka <[EMAIL PROTECTED]>
From: Ursula Braun <[EMAIL PROTECTED]>
- VLAN header reordering did not work on packets
  received through qeth interface in layer 2 mode.
  This caused dhcpcd not to work with VLAN devices.
- set qeth performance statistics initally inactive

Signed-off-by: Frank Pavlic <[EMAIL PROTECTED]>
---
 drivers/s390/net/qeth_main.c |   21 +++--
 1 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 2bde4f1..67062d5 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -1074,7 +1074,7 @@ #endif /* QETH_IPV6 */
card->options.layer2 = 1;
else
card->options.layer2 = 0;
-   card->options.performance_stats = 1;
+   card->options.performance_stats = 0;
 }
 
 /**
@@ -2466,32 +2466,17 @@ qeth_rebuild_skb_fake_ll(struct qeth_car
qeth_rebuild_skb_fake_ll_eth(card, skb, hdr);
 }
 
-static inline __u16
+static inline void
 qeth_layer2_rebuild_skb(struct qeth_card *card, struct sk_buff *skb,
struct qeth_hdr *hdr)
 {
-   unsigned short vlan_id = 0;
-#ifdef CONFIG_QETH_VLAN
-   struct vlan_hdr *vhdr;
-#endif
-
skb->pkt_type = PACKET_HOST;
skb->protocol = qeth_type_trans(skb, skb->dev);
if (card->options.checksum_type == NO_CHECKSUMMING)
skb->ip_summed = CHECKSUM_UNNECESSARY;
else
skb->ip_summed = CHECKSUM_NONE;
-#ifdef CONFIG_QETH_VLAN
-   if (hdr->hdr.l2.flags[2] & (QETH_LAYER2_FLAG_VLAN)) {
-   vhdr = (struct vlan_hdr *) skb->data;
-   skb->protocol =
-   __constant_htons(vhdr->h_vlan_encapsulated_proto);
-   vlan_id = hdr->hdr.l2.vlan_id;
-   skb_pull(skb, VLAN_HLEN);
-   }
-#endif
*((__u32 *)skb->cb) = ++card->seqno.pkt_seqno;
-   return vlan_id;
 }
 
 static inline __u16
@@ -2571,7 +2556,7 @@ qeth_process_inbound_buffer(struct qeth_
   &offset, &hdr))) {
skb->dev = card->dev;
if (hdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2)
-   vlan_tag = qeth_layer2_rebuild_skb(card, skb, hdr);
+   qeth_layer2_rebuild_skb(card, skb, hdr);
else if (hdr->hdr.l3.id == QETH_HEADER_TYPE_LAYER3)
vlan_tag = qeth_rebuild_skb(card, skb, hdr);
else { /*in case of OSN*/
-- 
1.4.2.3

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


[PATCH 4/5] s390: iucv Kconfig help description changes

2007-01-08 Thread Frank Pavlic
[PATCH 4/5] s390: iucv Kconfig help description changes

From: Ursula Braun <[EMAIL PROTECTED]>
remove text from help description which does not
apply anymore for 2.6 kernel series.

Signed-off-by: Frank Pavlic <[EMAIL PROTECTED]>
---
 drivers/s390/net/Kconfig |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig
index 1a93fa6..5262515 100644
--- a/drivers/s390/net/Kconfig
+++ b/drivers/s390/net/Kconfig
@@ -27,10 +27,7 @@ config IUCV
help
  Select this option if you want to use inter-user communication
  under VM or VIF. If unsure, say "Y" to enable a fast communication
- link between VM guests. At boot time the user ID of the guest needs
- to be passed to the kernel. Note that both kernels need to be
- compiled with this option and both need to be booted with the user ID
- of the other VM guest.
+ link between VM guests.
 
 config NETIUCV
tristate "IUCV network device support (VM only)"
-- 
1.4.2.3

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


[PATCH 3/5] s390: qeth driver fixes

2007-01-08 Thread Frank Pavlic
[PATCH 3/5] s390: qeth driver fixes

From: Frank Blaschka <[EMAIL PROTECTED]>
- qeth device functions were not callable
  in atomic context due to usage of wait_event_xxx operations in qeth.
  "schedule while atomic" message appeared and kernel dumped when
  removing slave from bond device.

Signed-off-by: Frank Pavlic <[EMAIL PROTECTED]>
---
 drivers/s390/net/qeth.h  |2 -
 drivers/s390/net/qeth_main.c |  125 ++
 2 files changed, 30 insertions(+), 97 deletions(-)

diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h
index 53c358c..e95c281 100644
--- a/drivers/s390/net/qeth.h
+++ b/drivers/s390/net/qeth.h
@@ -710,7 +710,7 @@ struct qeth_reply {
int (*callback)(struct qeth_card *,struct qeth_reply *,unsigned long);
u32 seqno;
unsigned long offset;
-   int received;
+   atomic_t received;
int rc;
void *param;
struct qeth_card *card;
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 337304d..19ec4c8 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -471,7 +471,7 @@ qeth_irq(struct ccw_device *cdev, unsign
channel->state == CH_STATE_UP)
qeth_issue_next_read(card);
 
-   tasklet_schedule(&channel->irq_tasklet);
+   qeth_irq_tasklet((unsigned long)channel);
return;
 out:
wake_up(&card->wait_q);
@@ -951,40 +951,6 @@ qeth_do_run_thread(struct qeth_card *car
 }
 
 static int
-qeth_register_ip_addresses(void *ptr)
-{
-   struct qeth_card *card;
-
-   card = (struct qeth_card *) ptr;
-   daemonize("qeth_reg_ip");
-   QETH_DBF_TEXT(trace,4,"regipth1");
-   if (!qeth_do_run_thread(card, QETH_SET_IP_THREAD))
-   return 0;
-   QETH_DBF_TEXT(trace,4,"regipth2");
-   qeth_set_ip_addr_list(card);
-   qeth_clear_thread_running_bit(card, QETH_SET_IP_THREAD);
-   return 0;
-}
-
-/*
- * Drive the SET_PROMISC_MODE thread
- */
-static int
-qeth_set_promisc_mode(void *ptr)
-{
-   struct qeth_card *card = (struct qeth_card *) ptr;
-
-   daemonize("qeth_setprm");
-   QETH_DBF_TEXT(trace,4,"setprm1");
-   if (!qeth_do_run_thread(card, QETH_SET_PROMISC_MODE_THREAD))
-   return 0;
-   QETH_DBF_TEXT(trace,4,"setprm2");
-   qeth_setadp_promisc_mode(card);
-   qeth_clear_thread_running_bit(card, QETH_SET_PROMISC_MODE_THREAD);
-   return 0;
-}
-
-static int
 qeth_recover(void *ptr)
 {
struct qeth_card *card;
@@ -1047,11 +1013,6 @@ qeth_start_kernel_thread(struct work_str
if (card->read.state != CH_STATE_UP &&
card->write.state != CH_STATE_UP)
return;
-
-   if (qeth_do_start_thread(card, QETH_SET_IP_THREAD))
-   kernel_thread(qeth_register_ip_addresses, (void *)card,SIGCHLD);
-   if (qeth_do_start_thread(card, QETH_SET_PROMISC_MODE_THREAD))
-   kernel_thread(qeth_set_promisc_mode, (void *)card, SIGCHLD);
if (qeth_do_start_thread(card, QETH_RECOVER_THREAD))
kernel_thread(qeth_recover, (void *) card, SIGCHLD);
 }
@@ -1613,8 +1574,6 @@ qeth_issue_next_read(struct qeth_card *c
return -ENOMEM;
}
qeth_setup_ccw(&card->read, iob->data, QETH_BUFSIZE);
-   wait_event(card->wait_q,
-  atomic_cmpxchg(&card->read.irq_pending, 0, 1) == 0);
QETH_DBF_TEXT(trace, 6, "noirqpnd");
rc = ccw_device_start(card->read.ccwdev, &card->read.ccw,
  (addr_t) iob, 0, 0);
@@ -1635,6 +1594,7 @@ qeth_alloc_reply(struct qeth_card *card)
reply = kzalloc(sizeof(struct qeth_reply), GFP_ATOMIC);
if (reply){
atomic_set(&reply->refcnt, 1);
+   atomic_set(&reply->received, 0);
reply->card = card;
};
return reply;
@@ -1655,31 +1615,6 @@ qeth_put_reply(struct qeth_reply *reply)
kfree(reply);
 }
 
-static void
-qeth_cmd_timeout(unsigned long data)
-{
-   struct qeth_reply *reply, *list_reply, *r;
-   unsigned long flags;
-
-   reply = (struct qeth_reply *) data;
-   spin_lock_irqsave(&reply->card->lock, flags);
-   list_for_each_entry_safe(list_reply, r,
-&reply->card->cmd_waiter_list, list) {
-   if (reply == list_reply){
-   qeth_get_reply(reply);
-   list_del_init(&reply->list);
-   spin_unlock_irqrestore(&reply->card->lock, flags);
-   reply->rc = -ETIME;
-   reply->received = 1;
-   wake_up(&reply->wait_q);
-   qeth_put_reply(reply);
-   return;
-   }
-   }
-   spin_unlock_irqrestore(&reply->card->lock, flags);
-}
-
-
 static struct qeth_ipa_cmd *
 qeth_check_ipa_data(struct qeth_card *card, struct qeth_cmd_buffer *iob)
 {
@@ -174

[PATCH 2/5] s390: qeth driver fixes

2007-01-08 Thread Frank Pavlic
[PATCH 2/5] s390: qeth driver fixes

From: Frank Blaschka <[EMAIL PROTECTED]>
- packet socket support is not complete.
  Recvfrom a packet socket does not fill the sockaddr_ll structure.
  device function hard_header_parse is not implemented.
  For layer 2 mode and layer 3 mode with fake_ll turned on, we have
  the information to fill sockaddr_ll.

Signed-off-by: Frank Pavlic <[EMAIL PROTECTED]>
---
 drivers/s390/net/qeth_main.c |   58 ++
 1 files changed, 53 insertions(+), 5 deletions(-)

diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 67062d5..337304d 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -3953,13 +3953,22 @@ static inline struct sk_buff *
 qeth_prepare_skb(struct qeth_card *card, struct sk_buff *skb,
 struct qeth_hdr **hdr, int ipv)
 {
-   struct sk_buff *new_skb;
+   struct sk_buff *new_skb, *new_skb2;

QETH_DBF_TEXT(trace, 6, "prepskb");
-
-new_skb = qeth_realloc_headroom(card, skb, sizeof(struct qeth_hdr));
-   if (new_skb == NULL)
+   new_skb = skb;
+   new_skb = qeth_pskb_unshare(skb, GFP_ATOMIC);
+   if (!new_skb)
return NULL;
+   new_skb2 = qeth_realloc_headroom(card, new_skb,
+sizeof(struct qeth_hdr));
+   if (!new_skb2) {
+   __qeth_free_new_skb(skb, new_skb);
+   return NULL;
+   }
+   if (new_skb != skb)
+   __qeth_free_new_skb(new_skb2, new_skb);
+   new_skb = new_skb2;
*hdr = __qeth_prepare_skb(card, new_skb, ipv);
if (*hdr == NULL) {
__qeth_free_new_skb(skb, new_skb);
@@ -6336,6 +6345,42 @@ static struct ethtool_ops qeth_ethtool_o
 };
 
 static int
+qeth_hard_header_parse(struct sk_buff *skb, unsigned char *haddr)
+{
+   struct qeth_card *card;
+   struct ethhdr *eth;
+
+   card = qeth_get_card_from_dev(skb->dev);
+   if (card->options.layer2)
+   goto haveheader;
+#ifdef CONFIG_QETH_IPV6
+   /* cause of the manipulated arp constructor and the ARP
+  flag for OSAE devices we have some nasty exceptions */
+   if (card->info.type == QETH_CARD_TYPE_OSAE) {
+   if (!card->options.fake_ll) {
+   if ((skb->pkt_type==PACKET_OUTGOING) &&
+   (skb->protocol==ETH_P_IPV6))
+   goto haveheader;
+   else
+   return 0;
+   } else {
+   if ((skb->pkt_type==PACKET_OUTGOING) &&
+   (skb->protocol==ETH_P_IP))
+   return 0;
+   else
+   goto haveheader;
+   }
+   }
+#endif
+   if (!card->options.fake_ll)
+   return 0;
+haveheader:
+   eth = eth_hdr(skb);
+   memcpy(haddr, eth->h_source, ETH_ALEN);
+   return ETH_ALEN;
+}
+
+static int
 qeth_netdev_init(struct net_device *dev)
 {
struct qeth_card *card;
@@ -6373,7 +6418,10 @@ #endif
if (card->options.fake_ll &&
(qeth_get_netdev_flags(card) & IFF_NOARP))
dev->hard_header = qeth_fake_header;
-   dev->hard_header_parse = NULL;
+   if (dev->type == ARPHRD_IEEE802_TR)
+   dev->hard_header_parse = NULL;
+   else
+   dev->hard_header_parse = qeth_hard_header_parse;
dev->set_mac_address = qeth_layer2_set_mac_address;
dev->flags |= qeth_get_netdev_flags(card);
if ((card->options.fake_broadcast) ||
-- 
1.4.2.3

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


[PATCH]: 8139cp: Don't blindly enable interrupts in cp_start_xmit

2007-01-08 Thread Chris Lalancette
All,
 Similar to this commit:

http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=d15e9c4d9a75702b30e00cdf95c71c88e3f3f51e

It's not safe in cp_start_xmit to blindly call spin_lock_irq and then 
spin_unlock_irq, since it may very well be the case that cp_start_xmit was 
called with interrupts already disabled (I came across this bug in the context 
of netdump in RedHat kernels, but the same issue holds, for example, in 
netconsole).  Therefore, replace all instances of spin_lock_irq and 
spin_unlock_irq with spin_lock_irqsave and spin_unlock_irqrestore, 
respectively, in cp_start_xmit().  I tested this against a fully-virtualized 
Xen guest, which happens to use the 8139cp driver to talk to the emulated 
hardware.  I don't have a real piece of 8139cp hardware to test on, so someone 
else will have to do that.

Signed-off-by: Chris Lalancette <[EMAIL PROTECTED]>


diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index e2cb19b..6f93a76 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -765,17 +765,18 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
 	struct cp_private *cp = netdev_priv(dev);
 	unsigned entry;
 	u32 eor, flags;
+	unsigned long intr_flags;
 #if CP_VLAN_TAG_USED
 	u32 vlan_tag = 0;
 #endif
 	int mss = 0;
 
-	spin_lock_irq(&cp->lock);
+	spin_lock_irqsave(&cp->lock, intr_flags);
 
 	/* This is a hard error, log it. */
 	if (TX_BUFFS_AVAIL(cp) <= (skb_shinfo(skb)->nr_frags + 1)) {
 		netif_stop_queue(dev);
-		spin_unlock_irq(&cp->lock);
+		spin_unlock_irqrestore(&cp->lock, intr_flags);
 		printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n",
 		   dev->name);
 		return 1;
@@ -908,7 +909,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
 	if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1))
 		netif_stop_queue(dev);
 
-	spin_unlock_irq(&cp->lock);
+	spin_unlock_irqrestore(&cp->lock, intr_flags);
 
 	cpw8(TxPoll, NormalTxPoll);
 	dev->trans_start = jiffies;




Re: [PATCH] INET: fix incorrect "inet_sock->is_icsk" assignment

2007-01-08 Thread Paul Moore
On Monday, January 8 2007 8:25 am, Jarek Poplawski wrote:
> On 04-01-2007 21:04, Paul Moore wrote:
> > +++ net-2.6.20_bugfix_2/net/ipv4/af_inet.c
> > @@ -305,7 +305,7 @@ lookup_protocol:
> > sk->sk_reuse = 1;
> >
> > inet = inet_sk(sk);
> > -   inet->is_icsk = INET_PROTOSW_ICSK & answer_flags;
> > +   inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) ==
> > INET_PROTOSW_ICSK;
>
> Isn't this more readable like this?:
>
> inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0;

I guess it all depends on who is reading it ;)  Personally, I don't care too 
much either way as long as it is fixed.

-- 
paul moore
linux security @ hp
-
To unsubscribe from this list: send 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] INET: fix incorrect "inet_sock->is_icsk" assignment

2007-01-08 Thread Jarek Poplawski
On 04-01-2007 21:04, Paul Moore wrote:
...
> +++ net-2.6.20_bugfix_2/net/ipv4/af_inet.c
> @@ -305,7 +305,7 @@ lookup_protocol:
>   sk->sk_reuse = 1;
>  
>   inet = inet_sk(sk);
> - inet->is_icsk = INET_PROTOSW_ICSK & answer_flags;
> + inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) == INET_PROTOSW_ICSK;

Isn't this more readable like this?:
 
inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0;

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


Re: [git patches] net driver fixes

2007-01-08 Thread Jeff Garzik

Li Yang-r58472 wrote:

Hi Jeff,

Could you apply the updates for ucc_geth driver?

The patches from Timur that make the driver compile correctly on 2.6.20.
[PATCH] Fix phy_read/write redefinition errors in ucc_geth_phy.c
[PATCH] Update ucc_geth.c for new workqueue structure

The patch from Ahmed that cleans up some unnecessary casts.
[PATCH 2.6.20-rc3] UCC Ether driver: kmalloc casting cleanups


I don't have any of these in my queue.

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: [git patches] net driver fixes

2007-01-08 Thread Li Yang-r58472
Hi Jeff,

Could you apply the updates for ucc_geth driver?

The patches from Timur that make the driver compile correctly on 2.6.20.
[PATCH] Fix phy_read/write redefinition errors in ucc_geth_phy.c
[PATCH] Update ucc_geth.c for new workqueue structure

The patch from Ahmed that cleans up some unnecessary casts.
[PATCH 2.6.20-rc3] UCC Ether driver: kmalloc casting cleanups


- Leo

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Garzik
> Sent: Monday, January 08, 2007 5:48 PM
> To: Andrew Morton; Linus Torvalds
> Cc: netdev@vger.kernel.org; LKML
> Subject: [git patches] net driver fixes
> 
> 
> Please pull from 'upstream-linus' branch of
> master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
> upstream-linus
> 
> to receive the following updates:
> 
>  drivers/net/e1000/e1000_main.c  |6 
>  drivers/net/ixgb/ixgb.h |1 +
>  drivers/net/ixgb/ixgb_ethtool.c |1 +
>  drivers/net/ixgb/ixgb_hw.c  |3 +-
>  drivers/net/ixgb/ixgb_main.c|   57
++
>  drivers/net/qla3xxx.c   |   38 +++--
>  drivers/net/wireless/ipw2100.c  |2 +-
>  drivers/s390/net/qeth_main.c|   13 +---
>  include/net/ieee80211.h |2 +-
>  9 files changed, 88 insertions(+), 35 deletions(-)
> 
> Aaron Salter (1):
>   ixgb: Write RA register high word first, increment version
> 
> Heiko Carstens (1):
>   qeth: fix uaccess handling and get rid of unused variable
> 
> Jeff Garzik (1):
>   Revert "e1000: disable TSO on the 82544 with slab debugging"
> 
> Jesse Brandeburg (2):
>   ixgb: Fix early TSO completion
>   ixgb: Maybe stop TX if not enough free descriptors
> 
> Ron Mercer (2):
>   qla3xxx: Remove NETIF_F_LLTX from driver features.
>   qla3xxx: Add delay to NVRAM register access.
> 
> Zhu Yi (2):
>   ieee80211: WLAN_GET_SEQ_SEQ fix (select correct region)
>   ipw2100: Fix dropping fragmented small packet problem
> 
> diff --git a/drivers/net/e1000/e1000_main.c
b/drivers/net/e1000/e1000_main.c
> index 4c1ff75..c6259c7 100644
> --- a/drivers/net/e1000/e1000_main.c
> +++ b/drivers/net/e1000/e1000_main.c
> @@ -995,12 +995,6 @@ e1000_probe(struct pci_dev *pdev,
>  (adapter->hw.mac_type != e1000_82547))
>   netdev->features |= NETIF_F_TSO;
> 
> -#ifdef CONFIG_DEBUG_SLAB
> - /* 82544's work arounds do not play nicely with DEBUG SLAB */
> - if (adapter->hw.mac_type == e1000_82544)
> - netdev->features &= ~NETIF_F_TSO;
> -#endif
> -
>  #ifdef NETIF_F_TSO6
>   if (adapter->hw.mac_type > e1000_82547_rev_2)
>   netdev->features |= NETIF_F_TSO6;
> diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
> index 50ffe90..f4aba43 100644
> --- a/drivers/net/ixgb/ixgb.h
> +++ b/drivers/net/ixgb/ixgb.h
> @@ -171,6 +171,7 @@ struct ixgb_adapter {
> 
>   /* TX */
>   struct ixgb_desc_ring tx_ring cacheline_aligned_in_smp;
> + unsigned int restart_queue;
>   unsigned long timeo_start;
>   uint32_t tx_cmd_type;
>   uint64_t hw_csum_tx_good;
> diff --git a/drivers/net/ixgb/ixgb_ethtool.c
b/drivers/net/ixgb/ixgb_ethtool.c
> index cd22523..82c044d 100644
> --- a/drivers/net/ixgb/ixgb_ethtool.c
> +++ b/drivers/net/ixgb/ixgb_ethtool.c
> @@ -79,6 +79,7 @@ static struct ixgb_stats ixgb_gstrings_stats[] = {
>   {"tx_window_errors", IXGB_STAT(net_stats.tx_window_errors)},
>   {"tx_deferred_ok", IXGB_STAT(stats.dc)},
>   {"tx_timeout_count", IXGB_STAT(tx_timeout_count) },
> + {"tx_restart_queue", IXGB_STAT(restart_queue) },
>   {"rx_long_length_errors", IXGB_STAT(stats.roc)},
>   {"rx_short_length_errors", IXGB_STAT(stats.ruc)},
>  #ifdef NETIF_F_TSO
> diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
> index 02089b6..ecbf458 100644
> --- a/drivers/net/ixgb/ixgb_hw.c
> +++ b/drivers/net/ixgb/ixgb_hw.c
> @@ -399,8 +399,9 @@ ixgb_init_rx_addrs(struct ixgb_hw *hw)
>   /* Zero out the other 15 receive addresses. */
>   DEBUGOUT("Clearing RAR[1-15]\n");
>   for(i = 1; i < IXGB_RAR_ENTRIES; i++) {
> - IXGB_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
> + /* Write high reg first to disable the AV bit first */
>   IXGB_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
> + IXGB_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
>   }
> 
>   return;
> diff --git a/drivers/net/ixgb/ixgb_main.c
b/drivers/net/ixgb/ixgb_main.c
> index e628126..a083a91 100644
> --- a/drivers/net/ixgb/ixgb_main.c
> +++ b/drivers/net/ixgb/ixgb_main.c
> @@ -36,7 +36,7 @@ static char ixgb_driver_string[] = "Intel(R)
PRO/10GbE Network
> Driver";
>  #else
>  #define DRIVERNAPI "-NAPI"
>  #endif
> -#define DRV_VERSION  "1.0.117-k2"DRIVERNAPI
> +#define DRV_VERSION  "1.0.126-k2"DRIVERNAPI
>  char ixgb_driver_version[] = DRV_VERSION;
>  static char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel
Corporation.";
> 

[git patches] net driver fixes

2007-01-08 Thread Jeff Garzik

Please pull from 'upstream-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-linus

to receive the following updates:

 drivers/net/e1000/e1000_main.c  |6 
 drivers/net/ixgb/ixgb.h |1 +
 drivers/net/ixgb/ixgb_ethtool.c |1 +
 drivers/net/ixgb/ixgb_hw.c  |3 +-
 drivers/net/ixgb/ixgb_main.c|   57 ++
 drivers/net/qla3xxx.c   |   38 +++--
 drivers/net/wireless/ipw2100.c  |2 +-
 drivers/s390/net/qeth_main.c|   13 +---
 include/net/ieee80211.h |2 +-
 9 files changed, 88 insertions(+), 35 deletions(-)

Aaron Salter (1):
  ixgb: Write RA register high word first, increment version

Heiko Carstens (1):
  qeth: fix uaccess handling and get rid of unused variable

Jeff Garzik (1):
  Revert "e1000: disable TSO on the 82544 with slab debugging"

Jesse Brandeburg (2):
  ixgb: Fix early TSO completion
  ixgb: Maybe stop TX if not enough free descriptors

Ron Mercer (2):
  qla3xxx: Remove NETIF_F_LLTX from driver features.
  qla3xxx: Add delay to NVRAM register access.

Zhu Yi (2):
  ieee80211: WLAN_GET_SEQ_SEQ fix (select correct region)
  ipw2100: Fix dropping fragmented small packet problem

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4c1ff75..c6259c7 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -995,12 +995,6 @@ e1000_probe(struct pci_dev *pdev,
   (adapter->hw.mac_type != e1000_82547))
netdev->features |= NETIF_F_TSO;
 
-#ifdef CONFIG_DEBUG_SLAB
-   /* 82544's work arounds do not play nicely with DEBUG SLAB */
-   if (adapter->hw.mac_type == e1000_82544)
-   netdev->features &= ~NETIF_F_TSO;
-#endif
-
 #ifdef NETIF_F_TSO6
if (adapter->hw.mac_type > e1000_82547_rev_2)
netdev->features |= NETIF_F_TSO6;
diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index 50ffe90..f4aba43 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -171,6 +171,7 @@ struct ixgb_adapter {
 
/* TX */
struct ixgb_desc_ring tx_ring cacheline_aligned_in_smp;
+   unsigned int restart_queue;
unsigned long timeo_start;
uint32_t tx_cmd_type;
uint64_t hw_csum_tx_good;
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index cd22523..82c044d 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -79,6 +79,7 @@ static struct ixgb_stats ixgb_gstrings_stats[] = {
{"tx_window_errors", IXGB_STAT(net_stats.tx_window_errors)},
{"tx_deferred_ok", IXGB_STAT(stats.dc)},
{"tx_timeout_count", IXGB_STAT(tx_timeout_count) },
+   {"tx_restart_queue", IXGB_STAT(restart_queue) },
{"rx_long_length_errors", IXGB_STAT(stats.roc)},
{"rx_short_length_errors", IXGB_STAT(stats.ruc)},
 #ifdef NETIF_F_TSO
diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index 02089b6..ecbf458 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -399,8 +399,9 @@ ixgb_init_rx_addrs(struct ixgb_hw *hw)
/* Zero out the other 15 receive addresses. */
DEBUGOUT("Clearing RAR[1-15]\n");
for(i = 1; i < IXGB_RAR_ENTRIES; i++) {
-   IXGB_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
+   /* Write high reg first to disable the AV bit first */
IXGB_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
+   IXGB_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
}
 
return;
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index e628126..a083a91 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -36,7 +36,7 @@ static char ixgb_driver_string[] = "Intel(R) PRO/10GbE 
Network Driver";
 #else
 #define DRIVERNAPI "-NAPI"
 #endif
-#define DRV_VERSION"1.0.117-k2"DRIVERNAPI
+#define DRV_VERSION"1.0.126-k2"DRIVERNAPI
 char ixgb_driver_version[] = DRV_VERSION;
 static char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
 
@@ -1287,6 +1287,7 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff 
*skb,
struct ixgb_buffer *buffer_info;
int len = skb->len;
unsigned int offset = 0, size, count = 0, i;
+   unsigned int mss = skb_shinfo(skb)->gso_size;
 
unsigned int nr_frags = skb_shinfo(skb)->nr_frags;
unsigned int f;
@@ -1298,6 +1299,11 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff 
*skb,
while(len) {
buffer_info = &tx_ring->buffer_info[i];
size = min(len, IXGB_MAX_DATA_PER_TXD);
+   /* Workaround for premature desc write-backs
+* in TSO mode.  Append 4-byte sentinel desc */
+   if (unlikely(mss && !nr_frags && size == len && size > 8))
+   size -= 4

Re: [PATCH][RFC] tcp: fix ambiguity in the `before' relation

2007-01-08 Thread Gerrit Renker
|  > Since the old definition is not used in the way "before(x, y) && 
!before(y, x)", but rather in the
|  > fashion "before(x, y)" or "after(y, x)", the main advantage of the new 
definition is that it makes
|  > this type of use a safe case. 
|  
|  This is not true because
|  
|   if (before(x, y))
|   goto drop;
|  
|  means that you're effectively using it as !before(x, y).  In other words,
|  the change is good if our code read
|  
|   if (before(x, y))
|   process_packet();
|  
That is correct - whether it is indeed safe(r) to use needs to be evaluated in 
the individual context.
-
To unsubscribe from this list: send 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/RFC 00/10] Transparent proxying patches version 4

2007-01-08 Thread Harald Welte
On Sun, Jan 07, 2007 at 05:11:06PM +0100, Lennert Buytenhek wrote:
> On Sun, Jan 07, 2007 at 03:11:34PM +0100, Harald Welte wrote:
> 
> > > So instead of using NAT to dynamically redirect traffic to local
> > > addresses, we now rely on "native" non-locally-bound sockets and do
> > > early socket lookups for inbound IPv4 packets. 
> > 
> > It's good to see a solid implementation of this 'old idea'.  
> > 
> > Just as a quick historical note to netdev:  This is the way how the
> > netfilter project  advised the balabit guys to implement fully
> > transparent proxy support, after having seen the complexity of the old
> > nat-based TPROXY patches.
> 
> Didn't rusty tell the balabit guys to use the NAT approach?

that was originally, way back.  It turned out to be a bad idea, after
all... way too complex.  At least that's how I look at it.  Too sad :(

Rusty and me then had the idea about the routing based approach at some
point, if I remember correctly.  We talked about it with Krisztian and
Balazs at least on one occasion.

All that isn't really important.  All I wanted to say was:

"I (and AFAIR the netfilter core team) believe this is the way to
implement good support for transparent proxying.  It's already the
second completely independent implementation, let's merge it after all."

-- 
- Harald Welte <[EMAIL PROTECTED]> http://netfilter.org/

  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."-- Paul Vixie


signature.asc
Description: Digital signature


Re: [PATCH] netfilter: ipt_MASQUERADE: NULL check in device_cmp [BUG] panic 2.6.20-rc3 in nf_conntrack

2007-01-08 Thread Jarek Poplawski
On Thu, Jan 04, 2007 at 02:51:55PM +0100, Jarek Poplawski wrote:
> 
> Hello,
> 
> Below I attach a patch proposal.

It seems I wasted some time...

I wonder if there is any reason to forward netfilter
bugs to netdev if patches from netfilter aren't cc-d
here? It seems netfilter is really independent from
net.

Before sending the patch I did some seeking by subject
on both lists and found nothing. Now I see it was in
netfilter-devel, but wasn't even titled as patch
and no "masquerade" in title also. Maybe I should
check netfilter svn also but can't find it yet... 

Of course I'll try to remember to ignore such messages
next time, but others may be tricked.

Regards,
Jarek P.

PS: After some confusion I've also found a good side:
other systems will wet themselves when they see
linux has such work resources it can fix bugs twice. 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html