* [PATCH 3/3] korina: count RX DMA OVR as rx_fifo_error
From: Phil Sutter @ 2010-05-29 23:23 UTC (permalink / raw)
To: David Miller; +Cc: Florian Fainelli, netdev
In-Reply-To: <1275175416-21267-2-git-send-email-phil@nwl.cc>
This way, RX DMA overruns (actually being caused by overrun of the
512byte input FIFO) show up in ifconfig output. The rx_fifo_errors
counter is unused otherwise.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
drivers/net/korina.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index 3e9b6b7..c7a9bef 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -376,7 +376,7 @@ static int korina_rx(struct net_device *dev, int limit)
if (devcs & ETH_RX_LE)
dev->stats.rx_length_errors++;
if (devcs & ETH_RX_OVR)
- dev->stats.rx_over_errors++;
+ dev->stats.rx_fifo_errors++;
if (devcs & ETH_RX_CV)
dev->stats.rx_frame_errors++;
if (devcs & ETH_RX_CES)
--
1.6.4.4
^ permalink raw reply related
* [PATCH 1/3] korina: fix deadlock on RX FIFO overrun
From: Phil Sutter @ 2010-05-29 23:23 UTC (permalink / raw)
To: David Miller; +Cc: Florian Fainelli, netdev
By calling korina_restart(), the IRQ handler tries to disable the
interrupt it's currently serving. This leads to a deadlock since
disable_irq() waits for any running IRQ handlers to finish before
returning. This patch addresses the issue by turning korina_restart()
into a workqueue task, which is then scheduled when needed.
Reproducing the deadlock is easily done using e.g. GNU netcat to send
large amounts of UDP data to the host running this driver.
Note that the same problem (and fix) applies to TX FIFO underruns, but
apparently these are less easy to trigger.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
drivers/net/korina.c | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index 26bf1b7..13533f9 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -135,6 +135,7 @@ struct korina_private {
struct napi_struct napi;
struct timer_list media_check_timer;
struct mii_if_info mii_if;
+ struct work_struct restart_task;
struct net_device *dev;
int phy_addr;
};
@@ -890,12 +891,12 @@ static int korina_init(struct net_device *dev)
/*
* Restart the RC32434 ethernet controller.
- * FIXME: check the return status where we call it
*/
-static int korina_restart(struct net_device *dev)
+static void korina_restart_task(struct work_struct *work)
{
- struct korina_private *lp = netdev_priv(dev);
- int ret;
+ struct korina_private *lp = container_of(work,
+ struct korina_private, restart_task);
+ struct net_device *dev = lp->dev;
/*
* Disable interrupts
@@ -916,10 +917,9 @@ static int korina_restart(struct net_device *dev)
napi_disable(&lp->napi);
- ret = korina_init(dev);
- if (ret < 0) {
+ if (korina_init(dev) < 0) {
printk(KERN_ERR "%s: cannot restart device\n", dev->name);
- return ret;
+ return;
}
korina_multicast_list(dev);
@@ -927,8 +927,6 @@ static int korina_restart(struct net_device *dev)
enable_irq(lp->ovr_irq);
enable_irq(lp->tx_irq);
enable_irq(lp->rx_irq);
-
- return ret;
}
static void korina_clear_and_restart(struct net_device *dev, u32 value)
@@ -937,7 +935,7 @@ static void korina_clear_and_restart(struct net_device *dev, u32 value)
netif_stop_queue(dev);
writel(value, &lp->eth_regs->ethintfc);
- korina_restart(dev);
+ schedule_work(&lp->restart_task);
}
/* Ethernet Tx Underflow interrupt */
@@ -962,11 +960,8 @@ static irqreturn_t korina_und_interrupt(int irq, void *dev_id)
static void korina_tx_timeout(struct net_device *dev)
{
struct korina_private *lp = netdev_priv(dev);
- unsigned long flags;
- spin_lock_irqsave(&lp->lock, flags);
- korina_restart(dev);
- spin_unlock_irqrestore(&lp->lock, flags);
+ schedule_work(&lp->restart_task);
}
/* Ethernet Rx Overflow interrupt */
@@ -1086,6 +1081,8 @@ static int korina_close(struct net_device *dev)
napi_disable(&lp->napi);
+ cancel_work_sync(&lp->restart_task);
+
free_irq(lp->rx_irq, dev);
free_irq(lp->tx_irq, dev);
free_irq(lp->ovr_irq, dev);
@@ -1198,6 +1195,8 @@ static int korina_probe(struct platform_device *pdev)
}
setup_timer(&lp->media_check_timer, korina_poll_media, (unsigned long) dev);
+ INIT_WORK(&lp->restart_task, korina_restart_task);
+
printk(KERN_INFO "%s: " DRV_NAME "-" DRV_VERSION " " DRV_RELDATE "\n",
dev->name);
out:
--
1.6.4.4
^ permalink raw reply related
* [PATCH 2/3] korina: use netdev_alloc_skb_ip_align() here, too
From: Phil Sutter @ 2010-05-29 23:23 UTC (permalink / raw)
To: David Miller; +Cc: Florian Fainelli, netdev
In-Reply-To: <1275175416-21267-1-git-send-email-phil@nwl.cc>
This patch completes commit 89d71a66c40d629e3b1285def543ab1425558cd5
which missed this spot, as it seems.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
drivers/net/korina.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index 13533f9..3e9b6b7 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -765,10 +765,9 @@ static int korina_alloc_ring(struct net_device *dev)
/* Initialize the receive descriptors */
for (i = 0; i < KORINA_NUM_RDS; i++) {
- skb = dev_alloc_skb(KORINA_RBSIZE + 2);
+ skb = netdev_alloc_skb_ip_align(dev, KORINA_RBSIZE);
if (!skb)
return -ENOMEM;
- skb_reserve(skb, 2);
lp->rx_skb[i] = skb;
lp->rd_ring[i].control = DMA_DESC_IOD |
DMA_COUNT(KORINA_RBSIZE);
--
1.6.4.4
^ permalink raw reply related
* [PATCH] Exclude DAHDI devices from being probed by netjet
From: Tzafrir Cohen @ 2010-05-29 23:29 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
Many early Zaptel / DAHDI devices were based on the same Netjet PCI
chipset. However they are not the ISDN BRI adapters the netjet driver
expects to driver.
The patch excludes devices based solely on sub-vendor ID. It seems that
all of those drivers probe for that, and I don't have a better way to
check what are the exact sub-product IDs.
Notes:
1. It seems that the same change need also be applied to some hisax
(i4l) drivers.
2. I don't have more precise data than the PCI ID tables in the drivers.
Does this run the risk of excluding some actual Netjet ISDN cards?
3. A more informative failure message may help (if one is actually needed).
4. The MAINTAINERS file lists the git tree
git://git.kernel.org/pub/scm/linux/kernel/git/kkeil/isdn-2.6.git but
it does not seem to exist.
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
---
drivers/isdn/hardware/mISDN/netjet.c | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
index 0a3553d..42dded4 100644
--- a/drivers/isdn/hardware/mISDN/netjet.c
+++ b/drivers/isdn/hardware/mISDN/netjet.c
@@ -1060,9 +1060,33 @@ nj_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
int cfg;
struct tiger_hw *card;
- if (pdev->subsystem_vendor == 0x8086 &&
- pdev->subsystem_device == 0x0003) {
- pr_notice("Netjet: Digium X100P/X101P not handled\n");
+ switch (pdev->subsystem_vendor) {
+ /* Fall-through */
+ case 0x2151: /* Yeastart YSTDM8xx (ystdm8xx) */
+ case 0xe16b: /* Zapata Project PCI-Radio (pciradio) */
+ case 0x6159: /* Digium Wildcard T100/E100 (wct1xxp) */
+ case 0x71fe: /* Digium Wildcard TE110P (wcte1xp) */
+ case 0x795e: /* Digium Wildcard TE110P (wcte1xp) */
+ case 0x797e: /* Digium Wildcard TE110P (wcte1xp) */
+ case 0x79de: /* Digium Wildcard TE110P (wcte1xp) */
+ case 0x79df: /* Digium Wildcard TE110P (wcte1xp) */
+ case 0x8084: /* Digium Wildcard X101P clone (wcfxo) */
+ case 0x8085: /* Digium Wildcard X101P (wcfxo) */
+ case 0x8086: /* Digium Wildcard X101P clone (wcfxo) */
+ case 0x8087: /* Digium Wildcard X101P clone (wcfxo) */
+ case 0xa800: /* Digium Wildcard TDM400P Rev H (wctdm) */
+ case 0xa801: /* Digium Wildcard TDM400P Rev H (wctdm) */
+ case 0xa8fd: /* Digium Wildcard TDM400P Rev H (wctdm) */
+ case 0xa901: /* Digium Wildcard TDM400P Rev H (wctdm) */
+ case 0xa908: /* Digium Wildcard TDM400P Rev H (wctdm) */
+ case 0xa9fd: /* Digium Wildcard TDM400P Rev H (wctdm) */
+ case 0xb100: /* Digium Wildcard TDM400P Rev E/F (wctdm) */
+ case 0xb118: /* Digium Wildcard TDM400P Rev I (wctdm) */
+ case 0xb119: /* Digium Wildcard TDM400P Rev I (wctdm) */
+ case 0xb1d9: /* Digium Wildcard TDM400P Rev I (wctdm) */
+ case 0xa159: /* Digium Wildcard S400P Prototype (wctdm) */
+ case 0xe159: /* Digium Wildcard S400P Prototype (wctdm) */
+ pr_notice("Netjet: DAHDI device not supported.\n");
return -ENODEV;
}
--
1.7.1
--
Tzafrir Cohen
icq#16849755 jabber:tzafrir.cohen@xorcom.com
+972-50-7952406 mailto:tzafrir.cohen@xorcom.com
http://www.xorcom.com iax:guest@local.xorcom.com/tzafrir
^ permalink raw reply related
* [PATCH v2] act_nat: fix the wrong checksum when addr isn't in old_addr/mask
From: Changli Gao @ 2010-05-30 0:26 UTC (permalink / raw)
To: Jamal Hadi Salim; +Cc: David S. Miller, netdev, linux-kernel, Changli Gao
fix the wrong checksum when addr isn't in old_addr/mask
For TCP and UDP packets, when addr isn't in old_addr/mask we don't do SNAT or
DNAT, and we should not update layer 4 checksum.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
net/sched/act_nat.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index d885ba3..5709494 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -159,6 +159,9 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
iph->daddr = new_addr;
csum_replace4(&iph->check, addr, new_addr);
+ } else if ((iph->frag_off & htons(IP_OFFSET)) ||
+ iph->protocol != IPPROTO_ICMP) {
+ goto out;
}
ihl = iph->ihl * 4;
@@ -247,6 +250,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
break;
}
+out:
return action;
drop:
^ permalink raw reply related
* Re: [PATCH] bnx2: Fix IRQ failures during kdump.
From: Matthew Wilcox @ 2010-05-30 1:24 UTC (permalink / raw)
To: David Miller; +Cc: mchan, grundler, netdev, linux-pci
In-Reply-To: <20100529.160527.108793180.davem@davemloft.net>
On Sat, May 29, 2010 at 04:05:27PM -0700, David Miller wrote:
> From: "Michael Chan" <mchan@broadcom.com>
> Date: Sat, 29 May 2010 09:22:07 -0700
>
> > I think there may be more issues after thinking about it some more.
> > The device is essentially still active at this time. The PCI
> > layer can turn off certain things, but enabling INTX can lead to
> > "irq x: nobody cared" if the driver is not ready for it. The
> > device really needs to be reset by the driver to be totally
> > reliable.
>
> We still have to find some generic way to do this.
>
> My position still stands, and it is entirely rediculious to
> have every single driver have to attend to all of these
> esoteric details just to handle interrupts properly. Drivers
> are hard enough to write as-is.
I think we can do this generically. PCI has disable bits for MSI,
MSI-X and pin-based interrupts. So we can leave MSIs enabled, but disable
interrupt generation.
We should probably set the interrupt type back to pin-based before the
kexec kernel starts, right? Or do we expect drivers to handle being
initialised with the device still set to MSI mode?
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply
* IAMT broken by commit 82776a4bcd7aa5fbcd2e6339b3ce88b727dd40ab
From: Aurelien Jarno @ 2010-05-30 1:02 UTC (permalink / raw)
To: Bruce Allan, Jeff Kirsher; +Cc: netdev
Hi,
I have recently upgrade my kernel, and found that Intel AMT support is
not working anymore as expected. I have configured IAMT so that is
always available, even when the machine is off ("Desktop: ON in S0, S3,
S4-5").
On recent kernels, IAMT support does not work after the machine has
been powered-off. Even worse, it also goes into this state when I try
to reboot it.
I have done a bisect and got this commit:
| commit 82776a4bcd7aa5fbcd2e6339b3ce88b727dd40ab
| Author: Bruce Allan <bruce.w.allan@intel.com>
| Date: Fri Aug 14 14:35:33 2009 +0000
|
| e1000e: WoL does not work on 82577/82578 with manageability enabled
|
| With manageability (Intel AMT) enabled via BIOS, PHY wakeup does not get
| configured on newer parts which use PHY wakeup vs. MAC wakeup which causes
| WoL to not work. The driver should configure PHY wakeup whether or not
| manageability is enabled.
|
| Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
| Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
| Signed-off-by: David S. Miller <davem@davemloft.net>
I have tried to revert it on recent kernels (2.6.34), and IAMT is then
working as expected. My machine is using a Gigabyte EQ45M-S2 motherboard
with an 82567LM-3 ethernet chip (8086:10de), that is a different model
than the one of the original problem.
I do wonder if the changes in the patch should not only be done on some
chip models, and I will appreciate any help in fixing this issue.
Thanks,
Aurelien
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply
* Re: [PATCH] bnx2: Fix IRQ failures during kdump.
From: David Miller @ 2010-05-30 3:49 UTC (permalink / raw)
To: matthew; +Cc: mchan, grundler, netdev, linux-pci
In-Reply-To: <20100530012401.GC9132@parisc-linux.org>
From: Matthew Wilcox <matthew@wil.cx>
Date: Sat, 29 May 2010 19:24:01 -0600
> We should probably set the interrupt type back to pin-based before the
> kexec kernel starts, right? Or do we expect drivers to handle being
> initialised with the device still set to MSI mode?
The expectation is that the device comes up in INTX mode, which is the
default after a PCI reset.
Basically all of these issues tend to be about the fact that unlike on
a normal boot, after a kexec an intermediate PCI reset has not occured.
^ permalink raw reply
* Re: [PATCH] bnx2: Fix IRQ failures during kdump.
From: Andi Kleen @ 2010-05-30 9:43 UTC (permalink / raw)
To: Michael Chan; +Cc: davem, netdev, linux-pci
In-Reply-To: <1275103462-8527-1-git-send-email-mchan@broadcom.com>
"Michael Chan" <mchan@broadcom.com> writes:
> When switching from the crashed kernel to the kdump kernel without going
> through PCI reset, IRQs may not work if a different IRQ mode is used on
PCIe with AER actually does support per link root port reset
(e.g. used for AER)
I've been wondering for some time if kexec should not simply
use that to reset all the devices, instead of addings hacks
around this to all drivers.
That would fix your problems too, right?
The question is just if AER is widely enough supported for this.
-Andi
--
ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply
* Re: [PATCH] bnx2: Fix IRQ failures during kdump.
From: Andi Kleen @ 2010-05-30 9:44 UTC (permalink / raw)
To: David Miller; +Cc: matthew, mchan, grundler, netdev, linux-pci
In-Reply-To: <20100529.204906.55850229.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
>
> Basically all of these issues tend to be about the fact that unlike on
> a normal boot, after a kexec an intermediate PCI reset has not occured.
This could be fixed, assuming the system has AER capability ...
-Andi
--
ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply
* Re: [PATCH 2/3] workqueue: Add an API to create a singlethread workqueue attached to the current task's cgroup
From: Michael S. Tsirkin @ 2010-05-30 11:29 UTC (permalink / raw)
To: Tejun Heo
Cc: Oleg Nesterov, Sridhar Samudrala, netdev, lkml,
kvm@vger.kernel.org, Andrew Morton, Dmitri Vorobiev, Jiri Kosina,
Thomas Gleixner, Ingo Molnar, Andi Kleen
In-Reply-To: <4BFFE742.2060205@kernel.org>
On Fri, May 28, 2010 at 05:54:42PM +0200, Tejun Heo wrote:
> Hello,
>
> On 05/28/2010 05:08 PM, Michael S. Tsirkin wrote:
> > Well, we have create_singlethread_workqueue, right?
> > This is not very different ... is it?
> >
> > Just copying structures and code from workqueue.c,
> > adding vhost_ in front of it will definitely work:
>
> Sure it will, but you'll probably be able to get away with much less.
>
> > there is nothing magic about the workqueue library.
> > But this just involves cut and paste which might be best avoided.
>
> What I'm saying is that some magic needs to be added to workqueue and
> if you add this single(!) exception, it will have to be backed out
> pretty soon, so it would be better to do it properly now.
>
> > One final idea before we go the cut and paste way: how about
> > 'create_workqueue_from_task' that would get a thread and have workqueue
> > run there?
>
> You can currently depend on that implementation detail but it's not
> the workqueue interface is meant to do. The single threadedness is
> there as execution ordering and concurrency specification and it
> doesn't (or rather won't) necessarily mean that a specific single
> thread is bound to certain workqueue.
>
> Can you please direct me to have a look at the code. I'll be happy to
> do the conversion for you.
Great, thanks! The code in question is in drivers/vhost/vhost.c
It is used from drivers/vhost/net.c
On top of this, we have patchset from Sridhar Samudrala,
titled '0/3 Make vhost multi-threaded and associate each thread to its
guest's cgroup':
cgroups: Add an API to attach a task to current task's cgroup
workqueue: Add an API to create a singlethread workqueue attached to the
current task's cgroup
vhost: make it more scalable by creating a vhost thread per device
I have bounced the last three your way.
> Thanks.
>
> --
> tejun
^ permalink raw reply
* [Patch]8139too: remove unnecessary cast of ioread32()'s return value
From: Junchang Wang @ 2010-05-30 12:22 UTC (permalink / raw)
To: davem, romieu; +Cc: netdev
ioread32() returns a 32-bit integer on all platforms.
There is no need to cast its return value.
Signed-off-by: Junchang Wang <junchangwang@gmail.com>
---
drivers/net/8139too.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 4ba7293..cc7d462 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -662,7 +662,7 @@ static const struct ethtool_ops rtl8139_ethtool_ops;
/* read MMIO register */
#define RTL_R8(reg) ioread8 (ioaddr + (reg))
#define RTL_R16(reg) ioread16 (ioaddr + (reg))
-#define RTL_R32(reg) ((unsigned long) ioread32 (ioaddr + (reg)))
+#define RTL_R32(reg) ioread32 (ioaddr + (reg))
static const u16 rtl8139_intr_mask =
@@ -861,7 +861,7 @@ retry:
/* if unknown chip, assume array element #0, original RTL-8139 in this case */
dev_dbg(&pdev->dev, "unknown chip version, assuming RTL-8139\n");
- dev_dbg(&pdev->dev, "TxConfig = 0x%lx\n", RTL_R32 (TxConfig));
+ dev_dbg(&pdev->dev, "TxConfig = 0x%x\n", RTL_R32 (TxConfig));
tp->chipset = 0;
match:
@@ -1642,7 +1642,7 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
netdev_dbg(dev, "Tx queue start entry %ld dirty entry %ld\n",
tp->cur_tx, tp->dirty_tx);
for (i = 0; i < NUM_TX_DESC; i++)
- netdev_dbg(dev, "Tx descriptor %d is %08lx%s\n",
+ netdev_dbg(dev, "Tx descriptor %d is %08x%s\n",
i, RTL_R32(TxStatus0 + (i * 4)),
i == tp->dirty_tx % NUM_TX_DESC ?
" (queue head)" : "");
@@ -2486,7 +2486,7 @@ static void __set_rx_mode (struct net_device *dev)
int rx_mode;
u32 tmp;
- netdev_dbg(dev, "rtl8139_set_rx_mode(%04x) done -- Rx config %08lx\n",
+ netdev_dbg(dev, "rtl8139_set_rx_mode(%04x) done -- Rx config %08x\n",
dev->flags, RTL_R32(RxConfig));
/* Note: do not reorder, GCC is clever about common statements. */
--
^ permalink raw reply related
* [Patch]r8169: remove unnecessary cast of readl()'s return value
From: Junchang Wang @ 2010-05-30 12:26 UTC (permalink / raw)
To: davem, romieu; +Cc: netdev
readl() returns a 32-bit integer on all platforms.
There is no need to cast its return value.
Signed-off-by: Junchang Wang <junchangwang@gmail.com>
---
drivers/net/r8169.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 217e709..ca93cdf 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -88,7 +88,7 @@ static const int multicast_filter_limit = 32;
#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
#define RTL_R8(reg) readb (ioaddr + (reg))
#define RTL_R16(reg) readw (ioaddr + (reg))
-#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg)))
+#define RTL_R32(reg) readl (ioaddr + (reg))
enum mac_version {
RTL_GIGA_MAC_NONE = 0x00,
--
^ permalink raw reply related
* Re: [PATCH v2] act_nat: fix the wrong checksum when addr isn't in old_addr/mask
From: jamal @ 2010-05-30 12:43 UTC (permalink / raw)
To: Changli Gao; +Cc: David S. Miller, netdev, Herbert Xu
In-Reply-To: <1275179219-10424-1-git-send-email-xiaosuo@gmail.com>
Copying Herbert, taking linux-kernel off...
On Sun, 2010-05-30 at 08:26 +0800, Changli Gao wrote:
> fix the wrong checksum when addr isn't in old_addr/mask
>
> For TCP and UDP packets, when addr isn't in old_addr/mask we don't do SNAT or
> DNAT, and we should not update layer 4 checksum.
>
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> ----
> net/sched/act_nat.c | 4 ++++
> 1 file changed, 4 insertions(+)
> diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
> index d885ba3..5709494 100644
> --- a/net/sched/act_nat.c
> +++ b/net/sched/act_nat.c
> @@ -159,6 +159,9 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
> iph->daddr = new_addr;
>
> csum_replace4(&iph->check, addr, new_addr);
> + } else if ((iph->frag_off & htons(IP_OFFSET)) ||
> + iph->protocol != IPPROTO_ICMP) {
> + goto out;
> }
>
> ihl = iph->ihl * 4;
> @@ -247,6 +250,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
> break;
> }
>
> +out:
> return action;
>
> drop:
^ permalink raw reply
* Re: [PATCH v2] act_nat: fix the wrong checksum when addr isn't in old_addr/mask
From: Herbert Xu @ 2010-05-30 12:58 UTC (permalink / raw)
To: jamal; +Cc: Changli Gao, David S. Miller, netdev
In-Reply-To: <1275223421.3587.0.camel@bigi>
On Sun, May 30, 2010 at 08:43:41AM -0400, jamal wrote:
>
> Copying Herbert, taking linux-kernel off...
Thanks Jamal.
> On Sun, 2010-05-30 at 08:26 +0800, Changli Gao wrote:
> > fix the wrong checksum when addr isn't in old_addr/mask
> >
> > For TCP and UDP packets, when addr isn't in old_addr/mask we don't do SNAT or
> > DNAT, and we should not update layer 4 checksum.
> >
> > Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> > ----
> > net/sched/act_nat.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> > diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
> > index d885ba3..5709494 100644
> > --- a/net/sched/act_nat.c
> > +++ b/net/sched/act_nat.c
> > @@ -159,6 +159,9 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
> > iph->daddr = new_addr;
> >
> > csum_replace4(&iph->check, addr, new_addr);
> > + } else if ((iph->frag_off & htons(IP_OFFSET)) ||
> > + iph->protocol != IPPROTO_ICMP) {
> > + goto out;
> > }
Yes the patch is correct.
However, the fact that you need this patch means that your act_nat
setup isn't perfect. Ideally all the unNATed packets should be
filtered out before you hit act_nat.
Thanks,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: Question about an assignment in handle_ing()
From: jamal @ 2010-05-30 13:29 UTC (permalink / raw)
To: Herbert Xu; +Cc: Jiri Pirko, netdev, davem, kaber
In-Reply-To: <1274873881.3878.988.camel@bigi>
[-- Attachment #1: Type: text/plain, Size: 1593 bytes --]
On Wed, 2010-05-26 at 07:38 -0400, jamal wrote:
> On Wed, 2010-05-26 at 09:13 +1000, Herbert Xu wrote:
>
> > If it did happen like you said then it would be a serious bug
> > in our stack as everything else (including the TCP stack) relies
> > on this.
>
> It could have been a bug. Note this was not a simple test, so there
> may be other factors involved. If you or Jiri are willing to run the
> test i will construct a scenario which will test this out. It will need
> a compile of the kernel and a small check in pedit to see if we see
> cloned skbs when we run the two tcpdumps (and to make sure the tcpdumps
> see the correct bytes). Otherwise i will get to it by weekend.
I have constructed a test case (attached) and my fear is unfortunately
still there;-< What am i doing wrong?
The packet path is:
-->eth0-->tcpdump eth0-->pedit-->mirror to dummy0-->tcpdump dummy0
I expect pedit to see a cloned packet. It doesnt. The check is in
tcf_pedit(), just before "if (!(skb->tc_verd & TC_OK2MUNGE))"
added:
printk("pedit: skb-%p is %s\n",skb,skb_cloned(skb)?"cloned":"!cloned");
Is pf packet not cloning etc? Sorry, I dont have much time today
to dig into the code - but i figure youd know the answer.
> > But how can the caller make that decision when you return exactly
> > the same value in the error case as the normal case?
>
> Ok - i see your point Herbert ;->
> it makes sense to have pedit have an error action code like some of the
> others actions which defaults to a drop.
> I will do a proper patch sometime this weekend.
I will get it done this week.
cheers,
jamal
[-- Attachment #2: jiri-q-test --]
[-- Type: text/plain, Size: 1855 bytes --]
machine running script is 10.0.0.111 receiving on eth0.
We are pinging from 10.0.0.26 to 10.0.0.111.
On 10.0.0.111:
1)Edit the packet when it comes in to change src/dst mac addresses
2)Mirror copy to dummy0
mirror to dummy0 is useful for debugging (ifconfig shows you stats and you
can run tcpdump to log the copies as we do)
run tcpdump before #1 and after #1 - this way we see the original
packet at eth0 and the modified packet at dummy0.
-------------- start script on 10.0.0.111 -----
tc qdisc del dev eth0 ingress
tc qdisc add dev eth0 ingress
ifconfig dummy0 up
tc filter add dev eth0 parent ffff: protocol ip prio 10 u32 \
match ip protocol 1 0xff flowid 1:2 \
action pedit \
munge offset -12 u32 set 0x00010100 \
munge offset -8 u32 set 0x0aaf0100 \
munge offset -4 u32 set 0x00080800 pipe \
action mirred egress mirror dev dummy0
------
To validate you did this right, dumping should look as follows:
----
filter protocol ip pref 10 u32
filter protocol ip pref 10 u32 fh 800: ht divisor 1
filter protocol ip pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:2
match 00010000/00ff0000 at 8
action order 1: pedit action pipe keys 3
index 1 ref 1 bind 1
key #0 at -12: val 00010100 mask 00000000
key #1 at -8: val 0aaf0100 mask 00000000
key #2 at -4: val 00080800 mask 00000000
action order 2: mirred (Egress Mirror to device dummy0) pipe
index 1 ref 1 bind 1
-----
tcpdump on dummy0 (showing modified macs):
0a:af:01:00:00:08 > 52:54:00:01:01:00, ethertype IPv4 (0x0800), length 98: 10.0.0.26 > 10.0.0.111: ICMP echo request, id 5981, seq 1, length 64
0x0000: 4500 0054 0000 4000 4001 2621 0a00 001a
0x0010: 0a00 006f 0800 a951 175d 0001 d3c8 fa4b
0x0020: 0000 0000 9d68 0d00 0000 0000 1011 1213
0x0030: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223
0x0040: 2425 2627 2829 2a2b 2c2d 2e2f
^ permalink raw reply
* Re: [PATCH v2] act_nat: fix the wrong checksum when addr isn't in old_addr/mask
From: Changli Gao @ 2010-05-30 13:33 UTC (permalink / raw)
To: Herbert Xu; +Cc: jamal, David S. Miller, netdev
In-Reply-To: <20100530125811.GA8120@gondor.apana.org.au>
On Sun, May 30, 2010 at 8:58 PM, Herbert Xu <herbert@gondor.apana.org.au> wrote:
> On Sun, May 30, 2010 at 08:43:41AM -0400, jamal wrote:
>>
>> Copying Herbert, taking linux-kernel off...
>
> Thanks Jamal.
>
>> On Sun, 2010-05-30 at 08:26 +0800, Changli Gao wrote:
>> > fix the wrong checksum when addr isn't in old_addr/mask
>> >
>> > For TCP and UDP packets, when addr isn't in old_addr/mask we don't do SNAT or
>> > DNAT, and we should not update layer 4 checksum.
>> >
>> > Signed-off-by: Changli Gao <xiaosuo@gmail.com>
>> > ----
>> > net/sched/act_nat.c | 4 ++++
>> > 1 file changed, 4 insertions(+)
>> > diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
>> > index d885ba3..5709494 100644
>> > --- a/net/sched/act_nat.c
>> > +++ b/net/sched/act_nat.c
>> > @@ -159,6 +159,9 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
>> > iph->daddr = new_addr;
>> >
>> > csum_replace4(&iph->check, addr, new_addr);
>> > + } else if ((iph->frag_off & htons(IP_OFFSET)) ||
>> > + iph->protocol != IPPROTO_ICMP) {
>> > + goto out;
>> > }
>
> Yes the patch is correct.
>
> However, the fact that you need this patch means that your act_nat
> setup isn't perfect. Ideally all the unNATed packets should be
> filtered out before you hit act_nat.
Thinking about this topologic:
client -> DNAT -> router -> server.
DNAT is used to map a public IP to server's private IP. If a
DEST_UNREACH ICMP packet is sent out by router, in order to handle
this ICMP packet correctly, I have to pass it to act_nat.c. How can I
filter out the other packets? By inspecting the inner IP destination
address of this ICMP packet? Maybe I can use u32 with complicate
parameters.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
^ permalink raw reply
* [PATCH 2/2] drivers/isdn/hardware/mISDN: Use GFP_ATOMIC when a lock is held
From: Julia Lawall @ 2010-05-30 13:49 UTC (permalink / raw)
To: Karsten Keil, netdev, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
The function inittiger is only called from nj_init_card, where a lock is held.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@gfp exists@
identifier fn;
position p;
@@
fn(...) {
... when != spin_unlock_irqrestore
when any
GFP_KERNEL@p
... when any
}
@locked@
identifier gfp.fn;
@@
spin_lock_irqsave(...)
... when != spin_unlock_irqrestore
fn(...)
@depends on locked@
position gfp.p;
@@
- GFP_KERNEL@p
+ GFP_ATOMIC
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/isdn/hardware/mISDN/netjet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff -u -p a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
--- a/drivers/isdn/hardware/mISDN/netjet.c
+++ b/drivers/isdn/hardware/mISDN/netjet.c
@@ -320,12 +320,12 @@ inittiger(struct tiger_hw *card)
return -ENOMEM;
}
for (i = 0; i < 2; i++) {
- card->bc[i].hsbuf = kmalloc(NJ_DMA_TXSIZE, GFP_KERNEL);
+ card->bc[i].hsbuf = kmalloc(NJ_DMA_TXSIZE, GFP_ATOMIC);
if (!card->bc[i].hsbuf) {
pr_info("%s: no B%d send buffer\n", card->name, i + 1);
return -ENOMEM;
}
- card->bc[i].hrbuf = kmalloc(NJ_DMA_RXSIZE, GFP_KERNEL);
+ card->bc[i].hrbuf = kmalloc(NJ_DMA_RXSIZE, GFP_ATOMIC);
if (!card->bc[i].hrbuf) {
pr_info("%s: no B%d recv buffer\n", card->name, i + 1);
return -ENOMEM;
^ permalink raw reply
* Re: [PATCH] Exclude DAHDI devices from being probed by netjet
From: Alan Cox @ 2010-05-30 14:07 UTC (permalink / raw)
To: Tzafrir Cohen; +Cc: netdev, linux-kernel
In-Reply-To: <20100529232946.GA1748@xorcom.com>
> 2. I don't have more precise data than the PCI ID tables in the drivers.
> Does this run the risk of excluding some actual Netjet ISDN cards?
Is there a reason you are seeing so many different vendor values - surely
you should see a single 'Digium' subvendor, and various subdevice values ?
> + switch (pdev->subsystem_vendor) {
> + /* Fall-through */
> + case 0x2151: /* Yeastart YSTDM8xx (ystdm8xx) */
> + case 0xe16b: /* Zapata Project PCI-Radio (pciradio) */
> + case 0x6159: /* Digium Wildcard T100/E100 (wct1xxp) */
> + case 0x71fe: /* Digium Wildcard TE110P (wcte1xp) */
> + case 0x795e: /* Digium Wildcard TE110P (wcte1xp) */
> + case 0x797e: /* Digium Wildcard TE110P (wcte1xp) */
> + case 0x79de: /* Digium Wildcard TE110P (wcte1xp) */
> + case 0x79df: /* Digium Wildcard TE110P (wcte1xp) */
> + case 0x8084: /* Digium Wildcard X101P clone (wcfxo) */
> + case 0x8085: /* Digium Wildcard X101P (wcfxo) */
> + case 0x8086: /* Digium Wildcard X101P clone (wcfxo) */
> + case 0x8087: /* Digium Wildcard X101P clone (wcfxo) */
> + case 0xa800: /* Digium Wildcard TDM400P Rev H (wctdm) */
> + case 0xa801: /* Digium Wildcard TDM400P Rev H (wctdm) */
> + case 0xa8fd: /* Digium Wildcard TDM400P Rev H (wctdm) */
> + case 0xa901: /* Digium Wildcard TDM400P Rev H (wctdm) */
> + case 0xa908: /* Digium Wildcard TDM400P Rev H (wctdm) */
> + case 0xa9fd: /* Digium Wildcard TDM400P Rev H (wctdm) */
> + case 0xb100: /* Digium Wildcard TDM400P Rev E/F (wctdm) */
> + case 0xb118: /* Digium Wildcard TDM400P Rev I (wctdm) */
> + case 0xb119: /* Digium Wildcard TDM400P Rev I (wctdm) */
> + case 0xb1d9: /* Digium Wildcard TDM400P Rev I (wctdm) */
> + case 0xa159: /* Digium Wildcard S400P Prototype (wctdm) */
> + case 0xe159: /* Digium Wildcard S400P Prototype (wctdm) */
That might be better as a table. You can then als include the name and
match details in the report which will help diagnose problems with it eg
struct whatever {
u16 svid, sdid;
const char *name;
}
And then print
netjet: %s card is not supported by this driver (%04X, %04X).\n",
name, svid, sdid
Then again we don't seem to have a driver for these other kernel devices
so perhaps the safe default would be to warn and continue unless a module
option is set. At least initially.
Alan
^ permalink raw reply
* Re: [PATCH v2] act_nat: fix the wrong checksum when addr isn't in old_addr/mask
From: Changli Gao @ 2010-05-30 14:11 UTC (permalink / raw)
To: Herbert Xu; +Cc: jamal, David S. Miller, netdev
In-Reply-To: <AANLkTinDe-AluGZx87q3nvxCfushfeH0jS35Fav95IXk@mail.gmail.com>
On Sun, May 30, 2010 at 9:33 PM, Changli Gao <xiaosuo@gmail.com> wrote:
> On Sun, May 30, 2010 at 8:58 PM, Herbert Xu <herbert@gondor.apana.org.au> wrote:
>>
>> Yes the patch is correct.
>>
>> However, the fact that you need this patch means that your act_nat
>> setup isn't perfect. Ideally all the unNATed packets should be
>> filtered out before you hit act_nat.
>
> Thinking about this topologic:
>
> client -> DNAT -> router -> server.
>
> DNAT is used to map a public IP to server's private IP. If a
> DEST_UNREACH ICMP packet is sent out by router, in order to handle
> this ICMP packet correctly, I have to pass it to act_nat.c. How can I
> filter out the other packets? By inspecting the inner IP destination
> address of this ICMP packet? Maybe I can use u32 with complicate
> parameters.
>
Oh, I can pass all the ICMP packets, and the packets to the public IP
and the packets from the private IP.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
^ permalink raw reply
* Re: MDNS is broken in latest -git
From: Maxim Levitsky @ 2010-05-30 14:44 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; +Cc: linux-wireless
In-Reply-To: <1275066591.3390.4.camel@maxim-laptop>
On Fri, 2010-05-28 at 20:09 +0300, Maxim Levitsky wrote:
> On Fri, 2010-05-28 at 18:02 +0300, Maxim Levitsky wrote:
> > On latest git, it became impossible to use hostname.local alias to
> > access my network hosts.
> >
> > In fact when I look at 'avahi-discover' I see nothing but local
> > services.
> >
> > I did a bisect, but unfortunely ended with merge commit, although
> > bisection seem to be normal (and I didn't do any shortcuts).
>
> Since starting 'wireshark' magicly temporarly fixes this, I suspect that
> mulicast packets don't get through.
>
> This smells like iwl3945 bug.
>
> I use linus' master tree now.
Anybody?
Best regards,
Maxim Levitsky
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] bnx2: Fix IRQ failures during kdump.
From: Michael Chan @ 2010-05-30 16:12 UTC (permalink / raw)
To: 'Andi Kleen'
Cc: 'davem@davemloft.net', 'netdev@vger.kernel.org',
'linux-pci@vger.kernel.org'
In-Reply-To: <87ocfxzpvf.fsf@basil.nowhere.org>
Andi Kleen wrote:
> "Michael Chan" <mchan@broadcom.com> writes:
>
> > When switching from the crashed kernel to the kdump kernel without
> going
> > through PCI reset, IRQs may not work if a different IRQ mode is used
> on
>
> PCIe with AER actually does support per link root port reset
> (e.g. used for AER)
Do you mean the slot_reset function in the pci_error_handlers? This
needs to be called in the context of the crashed kernel, right?
>
> I've been wondering for some time if kexec should not simply
> use that to reset all the devices, instead of addings hacks
> around this to all drivers.
>
> That would fix your problems too, right?
If it is called in the context of the crashed kernel, it won't work.
We would reset it and put in back into the same IRQ mode.
>
> The question is just if AER is widely enough supported for this.
>
Some newer PCIe devices support Function Level Reset, and that would
be ideal. But most existing devices including bnx2 devices don't have
this feature.
^ permalink raw reply
* Re: [PATCH] bnx2: Fix IRQ failures during kdump.
From: Michael Chan @ 2010-05-30 16:32 UTC (permalink / raw)
To: 'David Miller', 'matthew@wil.cx'
Cc: 'grundler@parisc-linux.org',
'netdev@vger.kernel.org',
'linux-pci@vger.kernel.org'
In-Reply-To: <20100529.204906.55850229.davem@davemloft.net>
David Miller wrote:
> From: Matthew Wilcox <matthew@wil.cx>
> Date: Sat, 29 May 2010 19:24:01 -0600
>
> > We should probably set the interrupt type back to pin-based before
> the
> > kexec kernel starts, right? Or do we expect drivers to handle being
> > initialised with the device still set to MSI mode?
>
> The expectation is that the device comes up in INTX mode, which is the
> default after a PCI reset.
We need to be very careful because the device may still be active as I
said earlier. Turning INTX on may lead to an IRQ storm that nobody will
handle. Some older devices don't have the INTX enable bit, and INTX will
automatically be enabled when MSI is disabled.
>
> Basically all of these issues tend to be about the fact that unlike on
> a normal boot, after a kexec an intermediate PCI reset has not occured.
^ permalink raw reply
* Re: [PATCH] bnx2: Fix IRQ failures during kdump.
From: Andi Kleen @ 2010-05-30 17:30 UTC (permalink / raw)
To: Michael Chan
Cc: 'Andi Kleen', 'davem@davemloft.net',
'netdev@vger.kernel.org',
'linux-pci@vger.kernel.org'
In-Reply-To: <C27F8246C663564A84BB7AB3439772421B78147574@IRVEXCHCCR01.corp.ad.broadcom.com>
On Sun, May 30, 2010 at 09:12:15AM -0700, Michael Chan wrote:
> Andi Kleen wrote:
>
> > "Michael Chan" <mchan@broadcom.com> writes:
> >
> > > When switching from the crashed kernel to the kdump kernel without
> > going
> > > through PCI reset, IRQs may not work if a different IRQ mode is used
> > on
> >
> > PCIe with AER actually does support per link root port reset
> > (e.g. used for AER)
>
> Do you mean the slot_reset function in the pci_error_handlers? This
Well the fallback code in the PCIE root port driver
that does the actual resets.
It could be called directly before kexec.
> needs to be called in the context of the crashed kernel, right?
It could be done on kexec, however of course you would rely
on PCI root port data structures still being intact on a crash
(I guess that's reasonable, they are not very complicated)
>
> >
> > I've been wondering for some time if kexec should not simply
> > use that to reset all the devices, instead of addings hacks
> > around this to all drivers.
> >
> > That would fix your problems too, right?
>
> If it is called in the context of the crashed kernel, it won't work.
> We would reset it and put in back into the same IRQ mode.
Who would put it back? Your driver wouldn't be called anymore.
>
> >
> > The question is just if AER is widely enough supported for this.
> >
>
> Some newer PCIe devices support Function Level Reset, and that would
> be ideal. But most existing devices including bnx2 devices don't have
> this feature.
Root port reset should be fine for this case. Even if some
innocent device on the same root port gets reset too that shouldn't matter.
Only drawback for the NIC would be that you have to renegotiate links I think.
Also there are systems without AER support.
-Andi
--
ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply
* Re: [Patch]8139too: remove unnecessary cast of ioread32()'s return value
From: Jeff Garzik @ 2010-05-30 17:35 UTC (permalink / raw)
To: davem, romieu, netdev
In-Reply-To: <20100530122213.GB1146@host-a-55.ustcsz.edu.cn>
On 05/30/2010 08:22 AM, Junchang Wang wrote:
> ioread32() returns a 32-bit integer on all platforms.
> There is no need to cast its return value.
>
> Signed-off-by: Junchang Wang<junchangwang@gmail.com>
> ---
> drivers/net/8139too.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
> index 4ba7293..cc7d462 100644
> --- a/drivers/net/8139too.c
> +++ b/drivers/net/8139too.c
> @@ -662,7 +662,7 @@ static const struct ethtool_ops rtl8139_ethtool_ops;
> /* read MMIO register */
> #define RTL_R8(reg) ioread8 (ioaddr + (reg))
> #define RTL_R16(reg) ioread16 (ioaddr + (reg))
> -#define RTL_R32(reg) ((unsigned long) ioread32 (ioaddr + (reg)))
> +#define RTL_R32(reg) ioread32 (ioaddr + (reg))
Have you verified this matches all architectures definition of readl()?
Jeff
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox