* Re: [PATCH net-next-2.6] xfrm: remove export of xfrm4_rcv_encap.
From: Eric Dumazet @ 2010-06-29 5:37 UTC (permalink / raw)
To: Rami Rosen; +Cc: davem, netdev
In-Reply-To: <AANLkTimIJ_vhe7wwCqTrfjj4HUdrbpyrlAwnQGrtAiOk@mail.gmail.com>
Le mardi 29 juin 2010 à 08:05 +0300, Rami Rosen a écrit :
> Hi,
> The patch removes EXPORT_SYMBOL of xfrm4_rcv_encap() method
> as it is unneeded.
>
> Regards,
> Rami Rosen
>
This claim seems wrong. I wonder how you came to it.
CONFIG_INET_XFRM_TUNNEL=m
CONFIG_XFRM_IPCOMP=m
CONFIG_INET_IPCOMP=m
ERROR: "xfrm4_rcv_encap" [net/ipv4/xfrm4_tunnel.ko] undefined!
^ permalink raw reply
* Re: b44: Reset due to FIFO overflow.
From: Eric Dumazet @ 2010-06-29 5:17 UTC (permalink / raw)
To: Mitchell Erblich; +Cc: James Courtier-Dutton, netdev
In-Reply-To: <ED315045-4A5D-4ECA-99C8-06B4714D8FA0@earthlink.net>
Le lundi 28 juin 2010 à 14:21 -0700, Mitchell Erblich a écrit :
> On Jun 28, 2010, at 4:09 AM, Eric Dumazet wrote:
>
> > Le lundi 28 juin 2010 à 11:17 +0100, James Courtier-Dutton a écrit :
> >> On 28 June 2010 11:00, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >>>
> >>> Problem is we receive a spike of RX network frames (possibly UDP or some
> >>> other RX only trafic), and chip raises an RX fifo overflow _error_
> >>> indication.
> >>>
>
> IMO, spikes are a normal behaviour.
Yes, this is why I said NIC is buggy, if it requires a reset (lasting a
_very_ long time) on a normal condition.
>
> >>
> >> The cause of the RX overflow is in my case is TCP.
> >> It is reproducible in mythtv.
> >> While watching LiveTV, press "s" for the program guide.
> >> The program guide is implemented into mythtv by a SQL query that
> >> results in a large response.
> >> The kernel is probably not servicing the RX FIFO quickly enough due to
> >> it being busy doing something else. In this case, probably a video
> >> mode switch.
> >>
> >
> > Thats strange, b44 has a big RX ring... and tcp sender should wait for
> > ACK...
> >
>
> Slow start, etc SHOULD/CAN double the number of in-flight segments in each
> next round-trip, placing them back to back.
>
rx ring buffer is about 200 frames on b44. One single tcp flow should
fit.
Limit is 511. James, did you try to increase rx ring ?
ethtool -G eth0 rx 511
> IMO, a stress test, would be a large number/wirespeed set of pings?
>
Better is to use frames that are going to slow down receiver.
Say multicast trafic with 100 receivers on same multicast group.
Send 1000 consecutive frames, last ones will trigger RX overflow,
because softirq handler cannot be fast enough.
Ping is answered by kernel, its pretty fast.
> >>> Some hardware are buggy enough that such error indication is fatal and
> >>> _require_ hardware reset. Thats life. I suspect b44 driver doing a full
> >>> reset is not a random guess from driver author, but to avoid a complete
> >>> NIC lockup.
> >>>
> >>
> >> Interesting, which hardware, apart from the b44, is it that "requires"
> >> a hardware reset after a RX FIFO overflow.
> >
> > Just take a look at some net drivers and you'll see some of them have
> > this requirement.
> >
> > rtl8169_rx_interrupt()
> > ...
> > if (status & RxFOVF) {
> > rtl8169_schedule_work(dev, rtl8169_reset_task);
> > dev->stats.rx_fifo_errors++;
> > }
> >
> >
> >
> >
>
>
> If they can reset in say X frame loss units, then why not reset if
> X is an acceptable number?
>
Because a reset is an exception. While card is reset, we lose many tx
and rx frames and this should be the very last thing to consider.
Why not a complete reboot of the host while we are at it ?
> And a hammer may fix the dent, while I may be more
> interested in preventing the dent in the first place.
So ? Please submit an alternative firmware for this NIC, or provide
another NIC on thousand of machines that are stuck with it.
^ permalink raw reply
* [PATCH net-next-2.6] xfrm: remove export of xfrm4_rcv_encap.
From: Rami Rosen @ 2010-06-29 5:05 UTC (permalink / raw)
To: davem, netdev
[-- Attachment #1: Type: text/plain, Size: 155 bytes --]
Hi,
The patch removes EXPORT_SYMBOL of xfrm4_rcv_encap() method
as it is unneeded.
Regards,
Rami Rosen
Signed-off-by: Rami Rosen <ramirose@gmail.com>
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 464 bytes --]
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index ad8fbb8..d85336c 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -44,7 +44,6 @@ int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr);
return xfrm_input(skb, nexthdr, spi, encap_type);
}
-EXPORT_SYMBOL(xfrm4_rcv_encap);
int xfrm4_transport_finish(struct sk_buff *skb, int async)
{
^ permalink raw reply related
* Re: [PATCH 3/3] pm_qos: get rid of the allocation in pm_qos_add_request()
From: mark gross @ 2010-06-29 4:39 UTC (permalink / raw)
To: James Bottomley; +Cc: Linux PM, markgross, netdev, Takashi Iwai
In-Reply-To: <1277747088.10879.201.camel@mulgrave.site>
On Mon, Jun 28, 2010 at 12:44:48PM -0500, James Bottomley wrote:
> Since every caller has to squirrel away the returned pointer anyway,
> they might as well supply the memory area. This fixes a bug in a few of
> the call sites where the returned pointer was dereferenced without
> checking it for NULL (which gets returned if the kzalloc failed).
>
> I'd like to hear how sound and netdev feels about this: it will add
> about two more pointers worth of data to struct netdev and struct
> snd_pcm_substream .. but I think it's worth it. If you're OK, I'll add
> your acks and send through the pm tree.
>
> This also looks to me like an android independent clean up (even though
> it renders the request_add atomically callable). I also added include
> guards to include/linux/pm_qos_params.h
>
> cc: netdev@vger.kernel.org
> cc: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Thank you for doing this!, I'll integrate it into some testing targets
in the morning!
Signed-off-by: mark gross <markgross@thegnar.org>
--mgross
> ---
> drivers/net/e1000e/netdev.c | 17 +++-----
> drivers/net/igbvf/netdev.c | 9 ++--
> drivers/net/wireless/ipw2x00/ipw2100.c | 12 +++---
> include/linux/netdevice.h | 2 +-
> include/linux/pm_qos_params.h | 13 +++++-
> include/sound/pcm.h | 2 +-
> kernel/pm_qos_params.c | 67 +++++++++++++++++++-------------
> sound/core/pcm_native.c | 13 ++----
> 8 files changed, 74 insertions(+), 61 deletions(-)
>
> diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
> index 24507f3..47ea62f 100644
> --- a/drivers/net/e1000e/netdev.c
> +++ b/drivers/net/e1000e/netdev.c
> @@ -2901,10 +2901,10 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
> * dropped transactions.
> */
> pm_qos_update_request(
> - adapter->netdev->pm_qos_req, 55);
> + &adapter->netdev->pm_qos_req, 55);
> } else {
> pm_qos_update_request(
> - adapter->netdev->pm_qos_req,
> + &adapter->netdev->pm_qos_req,
> PM_QOS_DEFAULT_VALUE);
> }
> }
> @@ -3196,9 +3196,9 @@ int e1000e_up(struct e1000_adapter *adapter)
>
> /* DMA latency requirement to workaround early-receive/jumbo issue */
> if (adapter->flags & FLAG_HAS_ERT)
> - adapter->netdev->pm_qos_req =
> - pm_qos_add_request(PM_QOS_CPU_DMA_LATENCY,
> - PM_QOS_DEFAULT_VALUE);
> + pm_qos_add_request(&adapter->netdev->pm_qos_req,
> + PM_QOS_CPU_DMA_LATENCY,
> + PM_QOS_DEFAULT_VALUE);
>
> /* hardware has been reset, we need to reload some things */
> e1000_configure(adapter);
> @@ -3263,11 +3263,8 @@ void e1000e_down(struct e1000_adapter *adapter)
> e1000_clean_tx_ring(adapter);
> e1000_clean_rx_ring(adapter);
>
> - if (adapter->flags & FLAG_HAS_ERT) {
> - pm_qos_remove_request(
> - adapter->netdev->pm_qos_req);
> - adapter->netdev->pm_qos_req = NULL;
> - }
> + if (adapter->flags & FLAG_HAS_ERT)
> + pm_qos_remove_request(&adapter->netdev->pm_qos_req);
>
> /*
> * TODO: for power management, we could drop the link and
> diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
> index 5e2b2a8..add6197 100644
> --- a/drivers/net/igbvf/netdev.c
> +++ b/drivers/net/igbvf/netdev.c
> @@ -48,7 +48,7 @@
> #define DRV_VERSION "1.0.0-k0"
> char igbvf_driver_name[] = "igbvf";
> const char igbvf_driver_version[] = DRV_VERSION;
> -struct pm_qos_request_list *igbvf_driver_pm_qos_req;
> +static struct pm_qos_request_list igbvf_driver_pm_qos_req;
> static const char igbvf_driver_string[] =
> "Intel(R) Virtual Function Network Driver";
> static const char igbvf_copyright[] = "Copyright (c) 2009 Intel Corporation.";
> @@ -2902,8 +2902,8 @@ static int __init igbvf_init_module(void)
> printk(KERN_INFO "%s\n", igbvf_copyright);
>
> ret = pci_register_driver(&igbvf_driver);
> - igbvf_driver_pm_qos_req = pm_qos_add_request(PM_QOS_CPU_DMA_LATENCY,
> - PM_QOS_DEFAULT_VALUE);
> + pm_qos_add_request(&igbvf_driver_pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
> + PM_QOS_DEFAULT_VALUE);
>
> return ret;
> }
> @@ -2918,8 +2918,7 @@ module_init(igbvf_init_module);
> static void __exit igbvf_exit_module(void)
> {
> pci_unregister_driver(&igbvf_driver);
> - pm_qos_remove_request(igbvf_driver_pm_qos_req);
> - igbvf_driver_pm_qos_req = NULL;
> + pm_qos_remove_request(&igbvf_driver_pm_qos_req);
> }
> module_exit(igbvf_exit_module);
>
> diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
> index 0bd4dfa..7f0d98b 100644
> --- a/drivers/net/wireless/ipw2x00/ipw2100.c
> +++ b/drivers/net/wireless/ipw2x00/ipw2100.c
> @@ -174,7 +174,7 @@ that only one external action is invoked at a time.
> #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver"
> #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation"
>
> -struct pm_qos_request_list *ipw2100_pm_qos_req;
> +struct pm_qos_request_list ipw2100_pm_qos_req;
>
> /* Debugging stuff */
> #ifdef CONFIG_IPW2100_DEBUG
> @@ -1741,7 +1741,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
> /* the ipw2100 hardware really doesn't want power management delays
> * longer than 175usec
> */
> - pm_qos_update_request(ipw2100_pm_qos_req, 175);
> + pm_qos_update_request(&ipw2100_pm_qos_req, 175);
>
> /* If the interrupt is enabled, turn it off... */
> spin_lock_irqsave(&priv->low_lock, flags);
> @@ -1889,7 +1889,7 @@ static void ipw2100_down(struct ipw2100_priv *priv)
> ipw2100_disable_interrupts(priv);
> spin_unlock_irqrestore(&priv->low_lock, flags);
>
> - pm_qos_update_request(ipw2100_pm_qos_req, PM_QOS_DEFAULT_VALUE);
> + pm_qos_update_request(&ipw2100_pm_qos_req, PM_QOS_DEFAULT_VALUE);
>
> /* We have to signal any supplicant if we are disassociating */
> if (associated)
> @@ -6669,8 +6669,8 @@ static int __init ipw2100_init(void)
> if (ret)
> goto out;
>
> - ipw2100_pm_qos_req = pm_qos_add_request(PM_QOS_CPU_DMA_LATENCY,
> - PM_QOS_DEFAULT_VALUE);
> + pm_qos_add_request(&ipw2100_pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
> + PM_QOS_DEFAULT_VALUE);
> #ifdef CONFIG_IPW2100_DEBUG
> ipw2100_debug_level = debug;
> ret = driver_create_file(&ipw2100_pci_driver.driver,
> @@ -6692,7 +6692,7 @@ static void __exit ipw2100_exit(void)
> &driver_attr_debug_level);
> #endif
> pci_unregister_driver(&ipw2100_pci_driver);
> - pm_qos_remove_request(ipw2100_pm_qos_req);
> + pm_qos_remove_request(&ipw2100_pm_qos_req);
> }
>
> module_init(ipw2100_init);
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 40291f3..393555a 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -779,7 +779,7 @@ struct net_device {
> */
> char name[IFNAMSIZ];
>
> - struct pm_qos_request_list *pm_qos_req;
> + struct pm_qos_request_list pm_qos_req;
>
> /* device name hash chain */
> struct hlist_node name_hlist;
> diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
> index 8ba440e..77cbddb 100644
> --- a/include/linux/pm_qos_params.h
> +++ b/include/linux/pm_qos_params.h
> @@ -1,8 +1,10 @@
> +#ifndef _LINUX_PM_QOS_PARAMS_H
> +#define _LINUX_PM_QOS_PARAMS_H
> /* interface for the pm_qos_power infrastructure of the linux kernel.
> *
> * Mark Gross <mgross@linux.intel.com>
> */
> -#include <linux/list.h>
> +#include <linux/plist.h>
> #include <linux/notifier.h>
> #include <linux/miscdevice.h>
>
> @@ -14,9 +16,12 @@
> #define PM_QOS_NUM_CLASSES 4
> #define PM_QOS_DEFAULT_VALUE -1
>
> -struct pm_qos_request_list;
> +struct pm_qos_request_list {
> + struct plist_node list;
> + int pm_qos_class;
> +};
>
> -struct pm_qos_request_list *pm_qos_add_request(int pm_qos_class, s32 value);
> +void pm_qos_add_request(struct pm_qos_request_list *l, int pm_qos_class, s32 value);
> void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
> s32 new_value);
> void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req);
> @@ -24,4 +29,6 @@ void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req);
> int pm_qos_request(int pm_qos_class);
> int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier);
> int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
> +int pm_qos_request_active(struct pm_qos_request_list *req);
>
> +#endif
> diff --git a/include/sound/pcm.h b/include/sound/pcm.h
> index dd76cde..6e3a297 100644
> --- a/include/sound/pcm.h
> +++ b/include/sound/pcm.h
> @@ -366,7 +366,7 @@ struct snd_pcm_substream {
> int number;
> char name[32]; /* substream name */
> int stream; /* stream (direction) */
> - struct pm_qos_request_list *latency_pm_qos_req; /* pm_qos request */
> + struct pm_qos_request_list latency_pm_qos_req; /* pm_qos request */
> size_t buffer_bytes_max; /* limit ring buffer size */
> struct snd_dma_buffer dma_buffer;
> unsigned int dma_buf_id;
> diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c
> index b130b97..bff4053 100644
> --- a/kernel/pm_qos_params.c
> +++ b/kernel/pm_qos_params.c
> @@ -30,7 +30,6 @@
> /*#define DEBUG*/
>
> #include <linux/pm_qos_params.h>
> -#include <linux/plist.h>
> #include <linux/sched.h>
> #include <linux/spinlock.h>
> #include <linux/slab.h>
> @@ -49,11 +48,6 @@
> * or pm_qos_object list and pm_qos_objects need to happen with pm_qos_lock
> * held, taken with _irqsave. One lock to rule them all
> */
> -struct pm_qos_request_list {
> - struct plist_node list;
> - int pm_qos_class;
> -};
> -
> enum pm_qos_type {
> PM_QOS_MAX, /* return the largest value */
> PM_QOS_MIN /* return the smallest value */
> @@ -210,6 +204,12 @@ int pm_qos_request(int pm_qos_class)
> }
> EXPORT_SYMBOL_GPL(pm_qos_request);
>
> +int pm_qos_request_active(struct pm_qos_request_list *req)
> +{
> + return req->pm_qos_class != 0;
> +}
> +EXPORT_SYMBOL_GPL(pm_qos_request_active);
> +
> /**
> * pm_qos_add_request - inserts new qos request into the list
> * @pm_qos_class: identifies which list of qos request to us
> @@ -221,25 +221,23 @@ EXPORT_SYMBOL_GPL(pm_qos_request);
> * element as a handle for use in updating and removal. Call needs to save
> * this handle for later use.
> */
> -struct pm_qos_request_list *pm_qos_add_request(int pm_qos_class, s32 value)
> +void pm_qos_add_request(struct pm_qos_request_list *dep,
> + int pm_qos_class, s32 value)
> {
> - struct pm_qos_request_list *dep;
> -
> - dep = kzalloc(sizeof(struct pm_qos_request_list), GFP_KERNEL);
> - if (dep) {
> - struct pm_qos_object *o = pm_qos_array[pm_qos_class];
> - int new_value;
> -
> - if (value == PM_QOS_DEFAULT_VALUE)
> - new_value = o->default_value;
> - else
> - new_value = value;
> - plist_node_init(&dep->list, new_value);
> - dep->pm_qos_class = pm_qos_class;
> - update_target(o, &dep->list, 0, PM_QOS_DEFAULT_VALUE);
> - }
> + struct pm_qos_object *o = pm_qos_array[pm_qos_class];
> + int new_value;
>
> - return dep;
> + if (pm_qos_request_active(dep)) {
> + WARN(1, KERN_ERR "pm_qos_add_request() called for already added request\n");
> + return;
> + }
> + if (value == PM_QOS_DEFAULT_VALUE)
> + new_value = o->default_value;
> + else
> + new_value = value;
> + plist_node_init(&dep->list, new_value);
> + dep->pm_qos_class = pm_qos_class;
> + update_target(o, &dep->list, 0, PM_QOS_DEFAULT_VALUE);
> }
> EXPORT_SYMBOL_GPL(pm_qos_add_request);
>
> @@ -262,6 +260,11 @@ void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
> if (!pm_qos_req) /*guard against callers passing in null */
> return;
>
> + if (pm_qos_request_active(pm_qos_req)) {
> + WARN(1, KERN_ERR "pm_qos_update_request() called for unknown object\n");
> + return;
> + }
> +
> o = pm_qos_array[pm_qos_req->pm_qos_class];
>
> if (new_value == PM_QOS_DEFAULT_VALUE)
> @@ -290,9 +293,14 @@ void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req)
> return;
> /* silent return to keep pcm code cleaner */
>
> + if (!pm_qos_request_active(pm_qos_req)) {
> + WARN(1, KERN_ERR "pm_qos_remove_request() called for unknown object\n");
> + return;
> + }
> +
> o = pm_qos_array[pm_qos_req->pm_qos_class];
> update_target(o, &pm_qos_req->list, 1, PM_QOS_DEFAULT_VALUE);
> - kfree(pm_qos_req);
> + memset(pm_qos_req, 0, sizeof(*pm_qos_req));
> }
> EXPORT_SYMBOL_GPL(pm_qos_remove_request);
>
> @@ -340,8 +348,12 @@ static int pm_qos_power_open(struct inode *inode, struct file *filp)
>
> pm_qos_class = find_pm_qos_object_by_minor(iminor(inode));
> if (pm_qos_class >= 0) {
> - filp->private_data = (void *) pm_qos_add_request(pm_qos_class,
> - PM_QOS_DEFAULT_VALUE);
> + struct pm_qos_request_list *req = kzalloc(GFP_KERNEL, sizeof(*req));
> + if (!req)
> + return -ENOMEM;
> +
> + pm_qos_add_request(req, pm_qos_class, PM_QOS_DEFAULT_VALUE);
> + filp->private_data = req;
>
> if (filp->private_data)
> return 0;
> @@ -353,8 +365,9 @@ static int pm_qos_power_release(struct inode *inode, struct file *filp)
> {
> struct pm_qos_request_list *req;
>
> - req = (struct pm_qos_request_list *)filp->private_data;
> + req = filp->private_data;
> pm_qos_remove_request(req);
> + kfree(req);
>
> return 0;
> }
> diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
> index 303ac04..a3b2a64 100644
> --- a/sound/core/pcm_native.c
> +++ b/sound/core/pcm_native.c
> @@ -451,13 +451,11 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
> snd_pcm_timer_resolution_change(substream);
> runtime->status->state = SNDRV_PCM_STATE_SETUP;
>
> - if (substream->latency_pm_qos_req) {
> - pm_qos_remove_request(substream->latency_pm_qos_req);
> - substream->latency_pm_qos_req = NULL;
> - }
> + if (pm_qos_request_active(&substream->latency_pm_qos_req))
> + pm_qos_remove_request(&substream->latency_pm_qos_req);
> if ((usecs = period_to_usecs(runtime)) >= 0)
> - substream->latency_pm_qos_req = pm_qos_add_request(
> - PM_QOS_CPU_DMA_LATENCY, usecs);
> + pm_qos_add_request(&substream->latency_pm_qos_req,
> + PM_QOS_CPU_DMA_LATENCY, usecs);
> return 0;
> _error:
> /* hardware might be unuseable from this time,
> @@ -512,8 +510,7 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream)
> if (substream->ops->hw_free)
> result = substream->ops->hw_free(substream);
> runtime->status->state = SNDRV_PCM_STATE_OPEN;
> - pm_qos_remove_request(substream->latency_pm_qos_req);
> - substream->latency_pm_qos_req = NULL;
> + pm_qos_remove_request(&substream->latency_pm_qos_req);
> return result;
> }
>
> --
> 1.6.4.2
>
>
>
^ permalink raw reply
* Re: PATCH: uninitialized memory access in tcp_parse_options
From: David Miller @ 2010-06-29 4:22 UTC (permalink / raw)
To: eric.dumazet; +Cc: mathieu.lacage, netdev
In-Reply-To: <1277531884.2481.22.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 26 Jun 2010 07:58:04 +0200
> If you want to avoid valgrind false positive at this point, without
> introducing bug for other tcp_parse_options() callers, a better fix
> would be following patch.
>
> Thanks
>
> diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
> index 794c2e1..4e758ac 100644
> --- a/net/ipv4/tcp_minisocks.c
> +++ b/net/ipv4/tcp_minisocks.c
> @@ -520,14 +520,13 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
> struct request_sock *req,
> struct request_sock **prev)
> {
> - struct tcp_options_received tmp_opt;
> + struct tcp_options_received tmp_opt = {0};
> u8 *hash_location;
> struct sock *child;
That's a 28 byte memset() in the connect fast-path. We shouldn't eat this
just to placate a valgrind miscue. :-)
^ permalink raw reply
* Re: [PATCH] cpmac: do not leak struct net_device on phy_connect errors
From: David Miller @ 2010-06-29 4:20 UTC (permalink / raw)
To: florian; +Cc: netdev
In-Reply-To: <201006271905.26506.florian@openwrt.org>
From: Florian Fainelli <florian@openwrt.org>
Date: Sun, 27 Jun 2010 19:05:24 +0200
> Forgot to mention that this is relevant for -stable and current net-next-2.6
I put it into net-2.6 and since you CC:'d stable it should show up there
automatically.
^ permalink raw reply
* Re: [RFC net-2.6 PATCH] ixgbe: need to purge skb qdisc lists when changing real_num_tx_queues
From: David Miller @ 2010-06-29 4:19 UTC (permalink / raw)
To: john.r.fastabend; +Cc: netdev, jeffrey.t.kirsher
In-Reply-To: <20100621052520.2417.65984.stgit@jf-dev1-dcblab>
From: John Fastabend <john.r.fastabend@intel.com>
Date: Sun, 20 Jun 2010 22:25:20 -0700
> This patch exports dev_deactivate() symbol.
>
> The qdisc needs to be purged when real_num_tx_queues is
> changed so that skbs do not hit ndo_start_xmit with
> queue_mappings corresponding to tx_rings already freed.
>
> real_num_tx_queues is changed when dynamically enabling or
> disabling DCB or FCoE. To purge the qdisc use dev_deactivate().
>
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Whatever it is that needs to happen when real_num_tx_queues changes
outght to be transparent to drivers.
Therefore we should hide all of these details behind a well named
interface drivers can call when they need to change real_num_tx_queues.
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv4: sysctl to block responding on down interface
From: David Miller @ 2010-06-29 3:01 UTC (permalink / raw)
To: joakim.tjernlund; +Cc: eric.dumazet, netdev, shemminger
In-Reply-To: <OFA9AE9CDE.69224382-ONC1257750.007F44EA-C1257750.0081210A@transmode.se>
From: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Date: Tue, 29 Jun 2010 01:30:26 +0200
> This is an strict interpretation of the weak host model and does not
> answer my questions. Mind to elaborate why such a strict view and
> what is gained by answering on an IP address which has been "downed"?
IP addresses are never "downed" just as your default route is not
"downed" when you take down an interface.
Rather, hosts are configured with an IP address and when they are so
configured they respond to it and can generate local application
sourced packets with that IP address as a source.
And what this means is that even in situations where hosts are
slightly mis-configured communication between them can still be
possible. That's the goal of the weak host model, to get a host
respond to IP datagrams in every situation where such an act is
plausible.
All of the design decisions we've made in the networking in this area
are meant to increase the likelyhood of successful communication
between two hosts.
And in the 10+ years this behavior has existed, I know for sure that
people have ended up with a working networking because of the way we
do things.
So from that perspective it doesn't matter one iota what you or any
other particular entity wish things to be, since 10+ years of having
this behavior is ingrained enough that changing it is guarenteed to
break someone's setup so we absolutely can't do it.
This topic comes up at least once every few months, therefore someone
should post a FAQ somewhere because it's tiring to explain over and
over again why this is a good design decision and why the default
behavior is never going to change.
The RFCs allow both models equally, and just because many other
system does things the other way doesn't make it any better or more
valid than what Linux is doing.
^ permalink raw reply
* [PATCH linux-2.6.35-rc3] micrel phy driver - updated(1)
From: Choi, David @ 2010-06-29 1:23 UTC (permalink / raw)
To: netdev; +Cc: bhutchings
Hello all:
This patch fixes what Ben mentioned, namely duplicated ids.
From: David J. Choi <david.choi@micrel.com>
Body of the explanation: This patch has changes as followings;
-support the interrupt from phy devices from Micrel Inc.
-support more phy devices, ks8737, ks8721, ks8041, ks8051 from Micrel.
-remove vsc8201 because this device was used only internal test at Micrel.
Signed-off-by: David J. Choi <david.choi@micrel.com>
---
--- ./linux-2.6.35-rc3/drivers/net/phy/micrel.c.orig 2010-06-28 17:55:30.000000000 -0700
+++ ./linux-2.6.35-rc3/drivers/net/phy/micrel.c 2010-06-28 18:06:00.000000000 -0700
@@ -12,7 +12,8 @@
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
- * Support : ksz9021 , vsc8201, ks8001
+ * Support : ksz9021 1000/100/10 phy from Micrel
+ * ks8001, ks8737, ks8721, ks8041, ks8051 100/10 phy
*/
#include <linux/kernel.h>
@@ -20,37 +21,146 @@
#include <linux/phy.h>
#define PHY_ID_KSZ9021 0x00221611
-#define PHY_ID_VSC8201 0x000FC413
+#define PHY_ID_KS8737 0x00221720
+#define PHY_ID_KS8041 0x00221510
+#define PHY_ID_KS8051 0x00221550
+/* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */
#define PHY_ID_KS8001 0x0022161A
+/* general Interrupt control/status reg in vendor specific block. */
+#define MII_KSZPHY_INTCS 0x1B
+#define KSZPHY_INTCS_JABBER (1 << 15)
+#define KSZPHY_INTCS_RECEIVE_ERR (1 << 14)
+#define KSZPHY_INTCS_PAGE_RECEIVE (1 << 13)
+#define KSZPHY_INTCS_PARELLEL (1 << 12)
+#define KSZPHY_INTCS_LINK_PARTNER_ACK (1 << 11)
+#define KSZPHY_INTCS_LINK_DOWN (1 << 10)
+#define KSZPHY_INTCS_REMOTE_FAULT (1 << 9)
+#define KSZPHY_INTCS_LINK_UP (1 << 8)
+#define KSZPHY_INTCS_ALL (KSZPHY_INTCS_LINK_UP |\
+ KSZPHY_INTCS_LINK_DOWN)
+
+/* general PHY control reg in vendor specific block. */
+#define MII_KSZPHY_CTRL 0x1F
+/* bitmap of PHY register to set interrupt mode */
+#define KSZPHY_CTRL_INT_ACTIVE_HIGH (1 << 9)
+#define KSZ9021_CTRL_INT_ACTIVE_HIGH (1 << 14)
+#define KS8737_CTRL_INT_ACTIVE_HIGH (1 << 14)
+
+static int kszphy_ack_interrupt(struct phy_device *phydev)
+{
+ /* bit[7..0] int status, which is a read and clear register. */
+ int rc;
+
+ rc = phy_read(phydev, MII_KSZPHY_INTCS);
+
+ return (rc < 0) ? rc : 0;
+}
+
+static int kszphy_set_interrupt(struct phy_device *phydev)
+{
+ int temp;
+ temp = (PHY_INTERRUPT_ENABLED == phydev->interrupts) ?
+ KSZPHY_INTCS_ALL : 0;
+ return phy_write(phydev, MII_KSZPHY_INTCS, temp);
+}
+
+static int kszphy_config_intr(struct phy_device *phydev)
+{
+ int temp, rc;
+
+ /* set the interrupt pin active low */
+ temp = phy_read(phydev, MII_KSZPHY_CTRL);
+ temp &= ~KSZPHY_CTRL_INT_ACTIVE_HIGH;
+ phy_write(phydev, MII_KSZPHY_CTRL, temp);
+ rc = kszphy_set_interrupt(phydev);
+ return rc < 0 ? rc : 0;
+}
+
+static int ksz9021_config_intr(struct phy_device *phydev)
+{
+ int temp, rc;
+
+ /* set the interrupt pin active low */
+ temp = phy_read(phydev, MII_KSZPHY_CTRL);
+ temp &= ~KSZ9021_CTRL_INT_ACTIVE_HIGH;
+ phy_write(phydev, MII_KSZPHY_CTRL, temp);
+ rc = kszphy_set_interrupt(phydev);
+ return rc < 0 ? rc : 0;
+}
+
+static int ks8737_config_intr(struct phy_device *phydev)
+{
+ int temp, rc;
+
+ /* set the interrupt pin active low */
+ temp = phy_read(phydev, MII_KSZPHY_CTRL);
+ temp &= ~KS8737_CTRL_INT_ACTIVE_HIGH;
+ phy_write(phydev, MII_KSZPHY_CTRL, temp);
+ rc = kszphy_set_interrupt(phydev);
+ return rc < 0 ? rc : 0;
+}
static int kszphy_config_init(struct phy_device *phydev)
{
return 0;
}
+static struct phy_driver ks8737_driver = {
+ .phy_id = PHY_ID_KS8737,
+ .phy_id_mask = 0x00fffff0,
+ .name = "Micrel KS8737",
+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .config_init = kszphy_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = ks8737_config_intr,
+ .driver = { .owner = THIS_MODULE,},
+};
+
+static struct phy_driver ks8041_driver = {
+ .phy_id = PHY_ID_KS8041,
+ .phy_id_mask = 0x00fffff0,
+ .name = "Micrel KS8041",
+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause
+ | SUPPORTED_Asym_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .config_init = kszphy_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = kszphy_config_intr,
+ .driver = { .owner = THIS_MODULE,},
+};
-static struct phy_driver ks8001_driver = {
- .phy_id = PHY_ID_KS8001,
- .name = "Micrel KS8001",
+static struct phy_driver ks8051_driver = {
+ .phy_id = PHY_ID_KS8051,
.phy_id_mask = 0x00fffff0,
- .features = PHY_BASIC_FEATURES,
- .flags = PHY_POLL,
+ .name = "Micrel KS8051",
+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause
+ | SUPPORTED_Asym_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
.config_init = kszphy_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = kszphy_config_intr,
.driver = { .owner = THIS_MODULE,},
};
-static struct phy_driver vsc8201_driver = {
- .phy_id = PHY_ID_VSC8201,
- .name = "Micrel VSC8201",
+static struct phy_driver ks8001_driver = {
+ .phy_id = PHY_ID_KS8001,
+ .name = "Micrel KS8001 or KS8721",
.phy_id_mask = 0x00fffff0,
- .features = PHY_BASIC_FEATURES,
- .flags = PHY_POLL,
+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
.config_init = kszphy_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = kszphy_config_intr,
.driver = { .owner = THIS_MODULE,},
};
@@ -58,11 +168,14 @@ static struct phy_driver ksz9021_driver
.phy_id = PHY_ID_KSZ9021,
.phy_id_mask = 0x000fff10,
.name = "Micrel KSZ9021 Gigabit PHY",
- .features = PHY_GBIT_FEATURES | SUPPORTED_Pause,
- .flags = PHY_POLL,
+ .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause
+ | SUPPORTED_Asym_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
.config_init = kszphy_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = ksz9021_config_intr,
.driver = { .owner = THIS_MODULE, },
};
@@ -73,17 +186,29 @@ static int __init ksphy_init(void)
ret = phy_driver_register(&ks8001_driver);
if (ret)
goto err1;
- ret = phy_driver_register(&vsc8201_driver);
+
+ ret = phy_driver_register(&ksz9021_driver);
if (ret)
goto err2;
- ret = phy_driver_register(&ksz9021_driver);
+ ret = phy_driver_register(&ks8737_driver);
if (ret)
goto err3;
+ ret = phy_driver_register(&ks8041_driver);
+ if (ret)
+ goto err4;
+ ret = phy_driver_register(&ks8051_driver);
+ if (ret)
+ goto err5;
+
return 0;
+err5:
+ phy_driver_unregister(&ks8041_driver);
+err4:
+ phy_driver_unregister(&ks8737_driver);
err3:
- phy_driver_unregister(&vsc8201_driver);
+ phy_driver_unregister(&ksz9021_driver);
err2:
phy_driver_unregister(&ks8001_driver);
err1:
@@ -93,8 +218,10 @@ err1:
static void __exit ksphy_exit(void)
{
phy_driver_unregister(&ks8001_driver);
- phy_driver_unregister(&vsc8201_driver);
+ phy_driver_unregister(&ks8737_driver);
phy_driver_unregister(&ksz9021_driver);
+ phy_driver_unregister(&ks8041_driver);
+ phy_driver_unregister(&ks8051_driver);
}
module_init(ksphy_init);
@@ -106,8 +233,10 @@ MODULE_LICENSE("GPL");
static struct mdio_device_id micrel_tbl[] = {
{ PHY_ID_KSZ9021, 0x000fff10 },
- { PHY_ID_VSC8201, 0x00fffff0 },
{ PHY_ID_KS8001, 0x00fffff0 },
+ { PHY_ID_KS8737, 0x00fffff0 },
+ { PHY_ID_KS8041, 0x00fffff0 },
+ { PHY_ID_KS8051, 0x00fffff0 },
{ }
};
---
^ permalink raw reply
* RE: [REGRESSION] e1000e stopped working
From: Allan, Bruce W @ 2010-06-29 1:09 UTC (permalink / raw)
To: Maxim Levitsky; +Cc: netdev@vger.kernel.org
In-Reply-To: <1277745247.12841.1.camel@localhost.localdomain>
On Monday, June 28, 2010 10:14 AM, Maxim Levitsky wrote:
> On Mon, 2010-06-28 at 10:04 -0700, Allan, Bruce W wrote:
>> On Sunday, June 27, 2010 10:47 AM, Maxim Levitsky wrote:
>>> On Sun, 2010-06-27 at 20:43 +0300, Maxim Levitsky wrote:
>>>> On Sun, 2010-06-27 at 20:29 +0300, Maxim Levitsky wrote:
>>>>> On Sun, 2010-06-27 at 20:27 +0300, Maxim Levitsky wrote:
>>>>>> Just that,
>>>>>>
>>>>>> It doesn't receive anything from my internet router during DHCP.
>>>>>>
>>>>>>
>>>>>> 00:19.0 Ethernet controller [0200]: Intel Corporation 82566DC
>>>>>> Gigabit Network Connection [8086:104b] (rev 02) Subsystem: Intel
>>>>>> Corporation Device [8086:0001] Control: I/O+ Mem+ BusMaster+
>>>>>> SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
>>>>>> DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast
>>>>>> >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0
>>>>>> Interrupt: pin A routed to IRQ 47 Region 0: Memory at 50300000
>>>>>> (32-bit, non-prefetchable) [size=128K] Region 1: Memory at
>>>>>> 50324000 (32-bit, non-prefetchable) [size=4K] Region 2: I/O
>>>>>> ports at 30e0 [size=32] Capabilities: [c8] Power Management
>>>>>> version 2 Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA
>>>>>> PME(D0+,D1-,D2-,D3hot+,D3cold+) Status: D0 PME-Enable- DSel=0
>>>>>> DScale=1 PME- Capabilities: [d0] Message Signalled Interrupts:
>>>>>> Mask- 64bit+ Queue=0/0 Enable+ Address: 00000000fee0100c Data:
>>>>>> 41c9 Kernel driver in use: e1000e Kernel modules: e1000e
>>>>>>
>>>>>> I use vanilla tree, commit
>>>>>> bf2937695fe2330bfd8933a2310e7bdd2581dc2e
>>>>>>
>>>>>>
>>>>>> Best regards,
>>>>>> Maxim Levitsky
>>>>>>
>>>>>
>>>>> It appears to work now after reboot.
>>>>> Will keep a look for this.
>>>>>
>>>>> Disregard for now.
>>>>
>>>>
>>>> Just s2ram cycle, problem is back.
>>>> Did full reboot (power off then on), same thing card doesn't
>>>> work...
>>>>
>>>
>>> Yep, s2ram sometimes 'fixes', sometimes breaks the card.
>>> Something got broken in device initialization path.
>>>
>>> Best regards,
>>> Maxim Levitsky
>>
>> What distro are you using? If RedHat, since you are using DHCP will
>> you please try putting a "LINKDELAY=10" in the
>> /etc/sysconfig/network-scripts/ifcfg-ethX config file.
>>
> I use ubuntu 9.10
>
>> Is there anything in the system log that might help narrow down the
>> issue?
>
> Nothing, really nothing.
> It seems to detect link, dhcp client sends requests, but doesn't
> recieve a thing (even tried promisc mode - doesn't help)
>
>
>
> Best regards,
> Maxim Levitsky
Since you say this is a regression, when did this last work for you without this problem, i.e. which distro, which kernel?
I have been unable to reproduce similar behavior.
Thanks,
Bruce.
^ permalink raw reply
* Re: [PATCH 4/9] cxgb4vf: Add code to provision T4 PCI-E SR-IOV Virtual Functions with hardware resources
From: Simon Horman @ 2010-06-29 0:51 UTC (permalink / raw)
To: Casey Leedom; +Cc: netdev
In-Reply-To: <201006280955.07352.leedom@chelsio.com>
On Mon, Jun 28, 2010 at 09:55:07AM -0700, Casey Leedom wrote:
> | From: Simon Horman <horms@verge.net.au>
> | Date: Saturday, June 26, 2010 06:37 am
> |
> | I wonder if it would be cleaner to move the guts of the last hunk
> | into a function (e.g. adap_init_sriov()) and have that be a dummy
> | function in the case that CONFIG_PCI_IOV in the first hunk is not set.
>
> I have no objection to this. I'd like to do minor tuning work like
> that as a follow on rather than respin the patch. But, as I said in my
> submission, I'm not familiar with this process so if making changes like
> the above is required I'll definitely jump on it. I don't know what
> issues are "critical show stoppers" and which ones are "nice to have"
> once things are in place.
I don't regard my suggestion as merge-critical.
^ permalink raw reply
* Re: IGB driver upgrade
From: Alexander Duyck @ 2010-06-29 0:00 UTC (permalink / raw)
To: sbs; +Cc: netdev@vger.kernel.org, e1000-devel@lists.sourceforge.net
In-Reply-To: <AANLkTinUoQG4BWC4Q2UFDwGvAwYujlUXz6P-ZLkZozaQ@mail.gmail.com>
sbs wrote:
> Hello guys.
>
> Is it possible to upgrade intel gigabit adapter's e1000 driver to
> 2.2.9? This is the latest version according to Intel website.
>
I assume you are referring to the igb driver since that is what is in
the subject and not the e1000 driver correct?
> I've got a problem with 2.1.0-k2 drivers statically compiled into kernel.
>
> Surely I can download drivers from intel and compile it as module, but
> I need to compile it statically
> Intel drivers do not provide sources for static compilation :(
>
> Is it possible to upgrade drivers to igb-2.2.9 in the source tree and
> allow the static compilation of them?
>
Normally the upstream driver should be up to date with any fixes that
are in the standalone module. What version of the kernel are you
currently running? Also have your tried testing the older standalone
igb modules to see if the same issues exist there in either igb 2.1.9 or
igb 2.0.6? This would help us to determine what changes in the
standalone module might be missing from the in-kernel version of the driver.
> Because having 2.1.0-k2 we experience some strange random freezes with
> network interface which can be fixed only by restarting network.
>
> 2.2.9 module has no such problems but we need to use static kernels
> according to our policy.
I have CCed our e1000-devel list. In the future you may want to CC this
list as it will provide better visibility to the Intel wired networking
maintainers.
Thanks,
Alex
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv4: sysctl to block responding on down interface
From: Joakim Tjernlund @ 2010-06-28 23:30 UTC (permalink / raw)
To: David Miller; +Cc: eric.dumazet, netdev, shemminger
In-Reply-To: <20100628.145744.39186500.davem@davemloft.net>
David Miller <davem@davemloft.net> wrote on 2010/06/28 23:57:44:
>
> From: Joakim Tjernlund <joakim.tjernlund@transmode.se>
> Date: Mon, 28 Jun 2010 23:09:02 +0200
>
> > To me it "ifconfig eth0 down" means not only to stop using the I/F
> > but also any IP address associated with the I/F.
>
> IP addresses are associated with the host, not a particular interface.
>
> Therefore the state of the interface should not influence the behavior
> of the IP address.
>
> If you want the IP address to stop being responded to, delete the IP
> address.
This is an strict interpretation of the weak host model and does not
answer my questions. Mind to elaborate why such a strict view and
what is gained by answering on an IP address which has been "downed"?
What types of apps use this property?
Jocke
^ permalink raw reply
* Re: ss -p is much too slow
From: David Miller @ 2010-06-28 23:21 UTC (permalink / raw)
To: sphink; +Cc: netdev, stephen.hemminger
In-Reply-To: <AANLkTikd3VaSUa-pxzyi7_fND40vQ-L79X7yv19jj3y0@mail.gmail.com>
From: Steve Fink <sphink@gmail.com>
Date: Wed, 9 Jun 2010 11:42:38 -0700
> On closer inspection, it appears that ss -p does a quadratic scan. It
> rescans every entry in /proc/*/fd/* repeatedly (once per listening
> port? per process? I don't remember what I figured out.)
>
> I humbly suggest that this is not a good idea.
Yep, this is junk. Please give this patch a try:
ss: Avoid quadradic complexity with '-p'
Scan the process list of open sockets once, and store in a hash
table to be used by subsequent find_user() calls.
Reported-by: Steve Fink <sphink@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/misc/ss.c b/misc/ss.c
index 8a9663c..482b6bb 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -195,90 +195,147 @@ static FILE *ephemeral_ports_open(void)
return generic_proc_open("PROC_IP_LOCAL_PORT_RANGE", "sys/net/ipv4/ip_local_port_range");
}
-int find_users(unsigned ino, char *buf, int buflen)
+struct user_ent {
+ struct user_ent *next;
+ unsigned int ino;
+ int pid;
+ int fd;
+ char process[0];
+};
+
+#define USER_ENT_HASH_SIZE 256
+struct user_ent *user_ent_hash[USER_ENT_HASH_SIZE];
+
+static int user_ent_hashfn(unsigned int ino)
{
- char pattern[64];
- int pattern_len;
- char *ptr = buf;
- char name[1024];
- DIR *dir;
- struct dirent *d;
- int cnt = 0;
- int nameoff;
+ int val = (ino >> 24) ^ (ino >> 16) ^ (ino >> 8) ^ ino;
- if (!ino)
- return 0;
+ return val & (USER_ENT_HASH_SIZE - 1);
+}
+
+static void user_ent_add(unsigned int ino, const char *process, int pid, int fd)
+{
+ struct user_ent *p, **pp;
+ int str_len;
- sprintf(pattern, "socket:[%u]", ino);
- pattern_len = strlen(pattern);
+ str_len = strlen(process) + 1;
+ p = malloc(sizeof(struct user_ent) + str_len);
+ if (!p)
+ abort();
+ p->next = NULL;
+ p->ino = ino;
+ p->pid = pid;
+ p->fd = fd;
+ strcpy(p->process, process);
+
+ pp = &user_ent_hash[user_ent_hashfn(ino)];
+ p->next = *pp;
+ *pp = p;
+}
- strncpy(name, getenv("PROC_ROOT") ? : "/proc/", sizeof(name)/2);
- name[sizeof(name)/2] = 0;
- if (strlen(name) == 0 ||
- name[strlen(name)-1] != '/')
+static void user_ent_hash_build(void)
+{
+ const char *root = getenv("PROC_ROOT") ? : "/proc/";
+ struct dirent *d;
+ char name[1024];
+ int nameoff;
+ DIR *dir;
+
+ strcpy(name, root);
+ if (strlen(name) == 0 || name[strlen(name)-1] != '/')
strcat(name, "/");
+
nameoff = strlen(name);
- if ((dir = opendir(name)) == NULL)
- return 0;
+
+ dir = opendir(name);
+ if (!dir)
+ return;
while ((d = readdir(dir)) != NULL) {
- DIR *dir1;
struct dirent *d1;
- int pid;
- int pos;
- char crap;
char process[16];
+ int pid, pos;
+ DIR *dir1;
+ char crap;
if (sscanf(d->d_name, "%d%c", &pid, &crap) != 1)
continue;
- sprintf(name+nameoff, "%d/fd/", pid);
+ sprintf(name + nameoff, "%d/fd/", pid);
pos = strlen(name);
if ((dir1 = opendir(name)) == NULL)
continue;
- process[0] = 0;
+ process[0] = '\0';
while ((d1 = readdir(dir1)) != NULL) {
- int fd, n;
+ const char *pattern = "socket:[";
+ unsigned int ino;
char lnk[64];
+ int fd, n;
if (sscanf(d1->d_name, "%d%c", &fd, &crap) != 1)
continue;
sprintf(name+pos, "%d", fd);
n = readlink(name, lnk, sizeof(lnk)-1);
- if (n != pattern_len ||
- memcmp(lnk, pattern, n))
+ if (strncmp(lnk, pattern, strlen(pattern)))
continue;
- if (ptr-buf >= buflen-1)
- break;
+ sscanf(lnk, "socket:[%u]", &ino);
- if (process[0] == 0) {
+ if (process[0] == '\0') {
char tmp[1024];
FILE *fp;
- snprintf(tmp, sizeof(tmp), "%s/%d/stat",
- getenv("PROC_ROOT") ? : "/proc", pid);
+
+ snprintf(tmp, sizeof(tmp), "%s/%d/stat", root, pid);
if ((fp = fopen(tmp, "r")) != NULL) {
fscanf(fp, "%*d (%[^)])", process);
fclose(fp);
}
}
- snprintf(ptr, buflen-(ptr-buf), "(\"%s\",%d,%d),", process, pid, fd);
- ptr += strlen(ptr);
- cnt++;
+ user_ent_add(ino, process, pid, fd);
}
closedir(dir1);
}
closedir(dir);
+}
+
+int find_users(unsigned ino, char *buf, int buflen)
+{
+ struct user_ent *p;
+ int cnt = 0;
+ char *ptr;
+
+ if (!ino)
+ return 0;
+
+ p = user_ent_hash[user_ent_hashfn(ino)];
+ ptr = buf;
+ while (p) {
+ if (p->ino != ino)
+ goto next;
+
+ if (ptr - buf >= buflen - 1)
+ break;
+
+ snprintf(ptr, buflen - (ptr - buf),
+ "(\"%s\",%d,%d),",
+ p->process, p->pid, p->fd);
+ ptr += strlen(ptr);
+ cnt++;
+
+ next:
+ p = p->next;
+ }
+
if (ptr != buf)
- ptr[-1] = 0;
+ ptr[-1] = '\0';
+
return cnt;
}
-
/* Get stats from slab */
struct slabstat
@@ -2476,6 +2533,7 @@ int main(int argc, char *argv[])
break;
case 'p':
show_users++;
+ user_ent_hash_build();
break;
case 'd':
current_filter.dbs |= (1<<DCCP_DB);
^ permalink raw reply related
* Re: [PATCHv2] vhost-net: add dhclient work-around from userspace
From: Sridhar Samudrala @ 2010-06-28 22:19 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Aristeu Rozanski, Herbert Xu, Juan Quintela, David S. Miller, kvm,
virtualization, netdev, linux-kernel, ykaul, markmc
In-Reply-To: <20100628100807.GA30685@redhat.com>
On Mon, 2010-06-28 at 13:08 +0300, Michael S. Tsirkin wrote:
> Userspace virtio server has the following hack
> so guests rely on it, and we have to replicate it, too:
>
> Use port number to detect incoming IPv4 DHCP response packets,
> and fill in the checksum for these.
>
> The issue we are solving is that on linux guests, some apps
> that use recvmsg with AF_PACKET sockets, don't know how to
> handle CHECKSUM_PARTIAL;
> The interface to return the relevant information was added
> in 8dc4194474159660d7f37c495e3fc3f10d0db8cc,
> and older userspace does not use it.
> One important user of recvmsg with AF_PACKET is dhclient,
> so we add a work-around just for DHCP.
>
> Don't bother applying the hack to IPv6 as userspace virtio does not
> have a work-around for that - let's hope guests will do the right
> thing wrt IPv6.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>
> Dave, I'm going to put this patch on the vhost tree,
> no need for you to bother merging it - you'll get
> it with a pull request.
>
>
> drivers/vhost/net.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 43 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index cc19595..03bba6a 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -24,6 +24,10 @@
> #include <linux/if_tun.h>
> #include <linux/if_macvlan.h>
>
> +#include <linux/ip.h>
> +#include <linux/udp.h>
> +#include <linux/netdevice.h>
> +
> #include <net/sock.h>
>
> #include "vhost.h"
> @@ -186,6 +190,44 @@ static void handle_tx(struct vhost_net *net)
> unuse_mm(net->dev.mm);
> }
>
> +static int peek_head(struct sock *sk)
This routine is doing more than just peeking the head of sk's receive
queue. May be this should be named similar to what qemu calls
'work_around_broken_dhclient()'
> +{
> + struct sk_buff *skb;
> +
> + lock_sock(sk);
> + skb = skb_peek(&sk->sk_receive_queue);
> + if (unlikely(!skb)) {
> + release_sock(sk);
> + return 0;
> + }
> + /* Userspace virtio server has the following hack so
> + * guests rely on it, and we have to replicate it, too: */
> + /* Use port number to detect incoming IPv4 DHCP response packets,
> + * and fill in the checksum. */
> +
> + /* The issue we are solving is that on linux guests, some apps
> + * that use recvmsg with AF_PACKET sockets, don't know how to
> + * handle CHECKSUM_PARTIAL;
> + * The interface to return the relevant information was added in
> + * 8dc4194474159660d7f37c495e3fc3f10d0db8cc,
> + * and older userspace does not use it.
> + * One important user of recvmsg with AF_PACKET is dhclient,
> + * so we add a work-around just for DHCP. */
> + if (skb->ip_summed == CHECKSUM_PARTIAL &&
> + skb_headlen(skb) >= skb_transport_offset(skb) +
> + sizeof(struct udphdr) &&
> + udp_hdr(skb)->dest == htons(68) &&
> + skb_network_header_len(skb) >= sizeof(struct iphdr) &&
> + ip_hdr(skb)->protocol == IPPROTO_UDP &&
> + skb->protocol == htons(ETH_P_IP)) {
Isn't it more logical to check for skb->protocol, followed by ip_hdr and
then udp_hdr?
> + skb_checksum_help(skb);
> + /* Restore ip_summed value: tun passes it to user. */
> + skb->ip_summed = CHECKSUM_PARTIAL;
> + }
> + release_sock(sk);
> + return 1;
> +}
> +
> /* Expects to be always run from workqueue - which acts as
> * read-size critical section for our kind of RCU. */
> static void handle_rx(struct vhost_net *net)
> @@ -222,7 +264,7 @@ static void handle_rx(struct vhost_net *net)
> vq_log = unlikely(vhost_has_feature(&net->dev, VHOST_F_LOG_ALL)) ?
> vq->log : NULL;
>
> - for (;;) {
> + while (peek_head(sock->sk)) {
> head = vhost_get_vq_desc(&net->dev, vq, vq->iov,
> ARRAY_SIZE(vq->iov),
> &out, &in,
^ permalink raw reply
* Re: [linux-pm] [PATCH 3/3] pm_qos: get rid of the allocation in pm_qos_add_request()
From: James Bottomley @ 2010-06-28 22:10 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Takashi Iwai, netdev, linux-pm, markgross
In-Reply-To: <201006282359.18045.rjw@sisk.pl>
On Mon, 2010-06-28 at 23:59 +0200, Rafael J. Wysocki wrote:
> On Monday, June 28, 2010, James Bottomley wrote:
> > Since every caller has to squirrel away the returned pointer anyway,
> > they might as well supply the memory area. This fixes a bug in a few of
> > the call sites where the returned pointer was dereferenced without
> > checking it for NULL (which gets returned if the kzalloc failed).
> >
> > I'd like to hear how sound and netdev feels about this: it will add
> > about two more pointers worth of data to struct netdev and struct
> > snd_pcm_substream .. but I think it's worth it. If you're OK, I'll add
> > your acks and send through the pm tree.
> >
> > This also looks to me like an android independent clean up (even though
> > it renders the request_add atomically callable). I also added include
> > guards to include/linux/pm_qos_params.h
> >
> > cc: netdev@vger.kernel.org
> > cc: Takashi Iwai <tiwai@suse.de>
> > Signed-off-by: James Bottomley <James.Bottomley@suse.de>
>
> I like all of the patches in this series, thanks a lot for doing this!
>
> I guess it might be worth sending a CC to the LKML next round so that people
> can see [1/3] (I don't expect any objections, but anyway it would be nice).
I cc'd the latest owners of plist.h ... although Daniel Walker has
apparently since left MontaVista, Thomas Gleixner is still current ...
and he can speak for the RT people, who are the primary plist users.
I can do another round and cc lkml, I was just hoping this would be the
last revision.
James
^ permalink raw reply
* Re: IGB driver upgrade
From: sbs @ 2010-06-28 22:02 UTC (permalink / raw)
To: netdev
In-Reply-To: <AANLkTim6kfnr6yNeUXlLHOztB-qjyvj50D4p7nebqj9r@mail.gmail.com>
Hello guys.
Is it possible to upgrade intel gigabit adapter's e1000 driver to
2.2.9? This is the latest version according to Intel website.
I've got a problem with 2.1.0-k2 drivers statically compiled into kernel.
Surely I can download drivers from intel and compile it as module, but
I need to compile it statically
Intel drivers do not provide sources for static compilation :(
Is it possible to upgrade drivers to igb-2.2.9 in the source tree and
allow the static compilation of them?
Because having 2.1.0-k2 we experience some strange random freezes with
network interface which can be fixed only by restarting network.
2.2.9 module has no such problems but we need to use static kernels
according to our policy.
^ permalink raw reply
* Re: [linux-pm] [PATCH 3/3] pm_qos: get rid of the allocation in pm_qos_add_request()
From: Rafael J. Wysocki @ 2010-06-28 21:59 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-pm, Takashi Iwai, netdev, markgross
In-Reply-To: <1277747088.10879.201.camel@mulgrave.site>
On Monday, June 28, 2010, James Bottomley wrote:
> Since every caller has to squirrel away the returned pointer anyway,
> they might as well supply the memory area. This fixes a bug in a few of
> the call sites where the returned pointer was dereferenced without
> checking it for NULL (which gets returned if the kzalloc failed).
>
> I'd like to hear how sound and netdev feels about this: it will add
> about two more pointers worth of data to struct netdev and struct
> snd_pcm_substream .. but I think it's worth it. If you're OK, I'll add
> your acks and send through the pm tree.
>
> This also looks to me like an android independent clean up (even though
> it renders the request_add atomically callable). I also added include
> guards to include/linux/pm_qos_params.h
>
> cc: netdev@vger.kernel.org
> cc: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
I like all of the patches in this series, thanks a lot for doing this!
I guess it might be worth sending a CC to the LKML next round so that people
can see [1/3] (I don't expect any objections, but anyway it would be nice).
Thanks,
Rafael
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv4: sysctl to block responding on down interface
From: Joakim Tjernlund @ 2010-06-28 21:58 UTC (permalink / raw)
To: Mitchell Erblich; +Cc: David Miller, Eric Dumazet, netdev, Stephen Hemminger
In-Reply-To: <D1C84781-4EC6-42D0-AE3E-258BE8BAA4BC@earthlink.net>
Mitchell Erblich <erblichs@earthlink.net> wrote on 2010/06/28 23:28:29:
>
>
> On Jun 28, 2010, at 2:09 PM, Joakim Tjernlund wrote:
>
> > Eric Dumazet <eric.dumazet@gmail.com> wrote on 2010/06/28 21:42:01:
> >>
> >> Le lundi 28 juin 2010 à 21:03 +0200, Joakim Tjernlund a écrit :
> >>> Stephen Hemminger <shemminger@vyatta.com> wrote on 2010/06/11 17:48:54:
> >>>>
> >>>> When Linux is used as a router, it is undesirable for the kernel to process
> >>>> incoming packets when the address assigned to the interface is down.
> >>>> The initial problem report was for a management application that used ICMP
> >>>> to check link availability.
> >>>>
> >>>> The default is disabled to maintain compatibility with previous behavior.
> >>>> This is not recommended for server systems because it makes fail over more
> >>>> difficult, and does not account for configurations where multiple interfaces
> >>>> have the same IP address.
> >>>>
> >>>> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >>>
> >>> Ping David et. all?
> >>> I too want this.
> >>
> >> You probably missed David reply
> >>
> >> http://permalink.gmane.org/gmane.linux.network/164494
> >
> > Sure did, don't know how that happened, sorry.
> >
> > Reading David's reply I do wonder about the current behaviour. Why
> > is it so important to keep responding to an IP address when the
> > admin has put the interface holding that IP address into administratively
> > down state? I don't think the weak host model stipulates that it must be so, does it?
> >
> > To me it "ifconfig eth0 down" means not only to stop using the I/F but
> > also any IP address associated with the I/F. I was rather surprised that
> > it didn't work that way. I don't see any way to make Linux stop responding to
> > that IP other that removing it completely from the system, which is rather
> > awkward.
> >
> > Note, I don't mean that the same should be applied for the No Carrier case, just
> > ifconfig down.
> >
> > Jocke
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> Hey guys, isn't the support of magic pkts/ Energy star require the receipt
> of pkts while the intf is down?
No idea, but if so, does it need to process IP pkgs destined for
the IP address in question and pass these up to user space?
Jocke
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv4: sysctl to block responding on down interface
From: David Miller @ 2010-06-28 21:57 UTC (permalink / raw)
To: joakim.tjernlund; +Cc: eric.dumazet, netdev, shemminger
In-Reply-To: <OF0640B724.BFF8DEB7-ONC1257750.00728ECF-C1257750.00742EFA@transmode.se>
From: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Date: Mon, 28 Jun 2010 23:09:02 +0200
> To me it "ifconfig eth0 down" means not only to stop using the I/F
> but also any IP address associated with the I/F.
IP addresses are associated with the host, not a particular interface.
Therefore the state of the interface should not influence the behavior
of the IP address.
If you want the IP address to stop being responded to, delete the IP
address.
^ permalink raw reply
* Re: b44: Reset due to FIFO overflow.
From: James Courtier-Dutton @ 2010-06-28 21:37 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1277723471.4235.393.camel@edumazet-laptop>
On 28 June 2010 12:11, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le lundi 28 juin 2010 à 11:24 +0100, James Courtier-Dutton a écrit :
>> On 28 June 2010 10:13, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> >
>> > Hi
>> >
>> > Problem is we dont know if a Receive Fifo overflow is a minor or major
>> > indication from b44 chip.
>> >
>> > A minor indication would be : Chip tells us one or more frame were lost.
>> > No special action needed from driver.
>> >
>> > A major indication (as of current implemented in b44 driver) is :
>> > I am completely out of order and need a reset. Please do it.
>> >
>> > Patch to switch from major to minor indication is easy, but we dont know
>> > if its valid or not.
>> >
>> > diff --git a/drivers/net/b44.h b/drivers/net/b44.h
>> > index e1905a4..514dc3a 100644
>> > --- a/drivers/net/b44.h
>> > +++ b/drivers/net/b44.h
>> > @@ -42,7 +42,7 @@
>> > #define ISTAT_EMAC 0x04000000 /* EMAC Interrupt */
>> > #define ISTAT_MII_WRITE 0x08000000 /* MII Write Interrupt */
>> > #define ISTAT_MII_READ 0x10000000 /* MII Read Interrupt */
>> > -#define ISTAT_ERRORS (ISTAT_DSCE|ISTAT_DATAE|ISTAT_DPE|ISTAT_RDU|ISTAT_RFO|ISTAT_TFU)
>> > +#define ISTAT_ERRORS (ISTAT_DSCE|ISTAT_DATAE|ISTAT_DPE|ISTAT_RDU|ISTAT_TFU)
>> > #define B44_IMASK 0x0024UL /* Interrupt Mask */
>> > #define IMASK_DEF (ISTAT_ERRORS | ISTAT_TO | ISTAT_RX | ISTAT_TX)
>> > #define B44_GPTIMER 0x0028UL /* General Purpose Timer */
>> >
>> >
>> >
>>
>> Ok, are you saying that all I have to do is apply this patch,
>> reproduce the problem condition, and if it recovers OK, then we can go
>> with this fix?
>> If so, I will try it out after work.
>>
>
> Yes, please try the patch and tell us what happens.
>
> Note : It can be better, it can be worse.
>
> It can work on your b44 chip, and freeze another computer with another
> b44 chip. Use at your own risk.
>
I tried the patch.
I also tried without the patch, but bypassed the hw reset in the RFO case.
In both cases, the hardware did not recover from the overflow.
An "ifconfig eth0 down" then "ifconfig eth0 up" was required to bring
it back to life, I.e. A manual hw reset.
What I did find is that once the RFO state is reached, it is not cleared.
I think we need to find a way to clear the RFO state.
The RFO state is cleared after a HW reset.
Kind Regards
James
^ permalink raw reply
* Re: [PATCH net-next-2.6] ipv4: sysctl to block responding on down interface
From: Mitchell Erblich @ 2010-06-28 21:28 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: Eric Dumazet, David Miller, netdev, Stephen Hemminger
In-Reply-To: <OF0640B724.BFF8DEB7-ONC1257750.00728ECF-C1257750.00742EFA@transmode.se>
On Jun 28, 2010, at 2:09 PM, Joakim Tjernlund wrote:
> Eric Dumazet <eric.dumazet@gmail.com> wrote on 2010/06/28 21:42:01:
>>
>> Le lundi 28 juin 2010 à 21:03 +0200, Joakim Tjernlund a écrit :
>>> Stephen Hemminger <shemminger@vyatta.com> wrote on 2010/06/11 17:48:54:
>>>>
>>>> When Linux is used as a router, it is undesirable for the kernel to process
>>>> incoming packets when the address assigned to the interface is down.
>>>> The initial problem report was for a management application that used ICMP
>>>> to check link availability.
>>>>
>>>> The default is disabled to maintain compatibility with previous behavior.
>>>> This is not recommended for server systems because it makes fail over more
>>>> difficult, and does not account for configurations where multiple interfaces
>>>> have the same IP address.
>>>>
>>>> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>>>
>>> Ping David et. all?
>>> I too want this.
>>
>> You probably missed David reply
>>
>> http://permalink.gmane.org/gmane.linux.network/164494
>
> Sure did, don't know how that happened, sorry.
>
> Reading David's reply I do wonder about the current behaviour. Why
> is it so important to keep responding to an IP address when the
> admin has put the interface holding that IP address into administratively
> down state? I don't think the weak host model stipulates that it must be so, does it?
>
> To me it "ifconfig eth0 down" means not only to stop using the I/F but
> also any IP address associated with the I/F. I was rather surprised that
> it didn't work that way. I don't see any way to make Linux stop responding to
> that IP other that removing it completely from the system, which is rather
> awkward.
>
> Note, I don't mean that the same should be applied for the No Carrier case, just
> ifconfig down.
>
> Jocke
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Hey guys, isn't the support of magic pkts/ Energy star require the receipt
of pkts while the intf is down?
Mitchell Erblich
^ permalink raw reply
* [patch] isdn/gigaset: add a kfree() to error path
From: Dan Carpenter @ 2010-06-28 21:20 UTC (permalink / raw)
To: Hansjoerg Lipp
Cc: Tilman Schmidt, Karsten Keil, David S. Miller, gigaset307x-common,
netdev, kernel-janitors
We should free "commands" here. The main reason is to please the static
checkers.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index f01c3c2..f1abb8f 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -419,6 +419,7 @@ oom:
dev_err(bcs->cs->dev, "out of memory\n");
for (i = 0; i < AT_NUM; ++i)
kfree(commands[i]);
+ kfree(commands);
return -ENOMEM;
}
^ permalink raw reply related
* [patch] cpmac: use resource_size()
From: Dan Carpenter @ 2010-06-28 21:19 UTC (permalink / raw)
To: Florian Fainelli
Cc: David S. Miller, Jiri Pirko, Eric Dumazet, netdev,
kernel-janitors
The original code is off by one because we should start counting at
zero. So the size of the resource is end - start + 1. I switched it to
use resource_size() to do the calculation.
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
I don't have a cross compile environment, so I can't even compile test
this. Sorry.
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 23786ee..38de1a4 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -964,7 +964,7 @@ static int cpmac_open(struct net_device *dev)
struct sk_buff *skb;
mem = platform_get_resource_byname(priv->pdev, IORESOURCE_MEM, "regs");
- if (!request_mem_region(mem->start, mem->end - mem->start, dev->name)) {
+ if (!request_mem_region(mem->start, resource_size(mem), dev->name)) {
if (netif_msg_drv(priv))
printk(KERN_ERR "%s: failed to request registers\n",
dev->name);
@@ -972,7 +972,7 @@ static int cpmac_open(struct net_device *dev)
goto fail_reserve;
}
- priv->regs = ioremap(mem->start, mem->end - mem->start);
+ priv->regs = ioremap(mem->start, resource_size(mem));
if (!priv->regs) {
if (netif_msg_drv(priv))
printk(KERN_ERR "%s: failed to remap registers\n",
@@ -1049,7 +1049,7 @@ fail_alloc:
iounmap(priv->regs);
fail_remap:
- release_mem_region(mem->start, mem->end - mem->start);
+ release_mem_region(mem->start, resource_size(mem));
fail_reserve:
return res;
@@ -1077,7 +1077,7 @@ static int cpmac_stop(struct net_device *dev)
free_irq(dev->irq, dev);
iounmap(priv->regs);
mem = platform_get_resource_byname(priv->pdev, IORESOURCE_MEM, "regs");
- release_mem_region(mem->start, mem->end - mem->start);
+ release_mem_region(mem->start, resource_size(mem));
priv->rx_head = &priv->desc_ring[CPMAC_QUEUES];
for (i = 0; i < priv->ring_size; i++) {
if (priv->rx_head[i].skb) {
^ permalink raw reply related
* Re: b44: Reset due to FIFO overflow.
From: Mitchell Erblich @ 2010-06-28 21:21 UTC (permalink / raw)
To: Eric Dumazet; +Cc: James Courtier-Dutton, netdev
In-Reply-To: <1277723370.4235.388.camel@edumazet-laptop>
On Jun 28, 2010, at 4:09 AM, Eric Dumazet wrote:
> Le lundi 28 juin 2010 à 11:17 +0100, James Courtier-Dutton a écrit :
>> On 28 June 2010 11:00, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>>>
>>> Problem is we receive a spike of RX network frames (possibly UDP or some
>>> other RX only trafic), and chip raises an RX fifo overflow _error_
>>> indication.
>>>
IMO, spikes are a normal behaviour.
>>
>> The cause of the RX overflow is in my case is TCP.
>> It is reproducible in mythtv.
>> While watching LiveTV, press "s" for the program guide.
>> The program guide is implemented into mythtv by a SQL query that
>> results in a large response.
>> The kernel is probably not servicing the RX FIFO quickly enough due to
>> it being busy doing something else. In this case, probably a video
>> mode switch.
>>
>
> Thats strange, b44 has a big RX ring... and tcp sender should wait for
> ACK...
>
Slow start, etc SHOULD/CAN double the number of in-flight segments in each
next round-trip, placing them back to back.
IMO, a stress test, would be a large number/wirespeed set of pings?
>>> Some hardware are buggy enough that such error indication is fatal and
>>> _require_ hardware reset. Thats life. I suspect b44 driver doing a full
>>> reset is not a random guess from driver author, but to avoid a complete
>>> NIC lockup.
>>>
>>
>> Interesting, which hardware, apart from the b44, is it that "requires"
>> a hardware reset after a RX FIFO overflow.
>
> Just take a look at some net drivers and you'll see some of them have
> this requirement.
>
> rtl8169_rx_interrupt()
> ...
> if (status & RxFOVF) {
> rtl8169_schedule_work(dev, rtl8169_reset_task);
> dev->stats.rx_fifo_errors++;
> }
>
>
>
>
If they can reset in say X frame loss units, then why not reset if
X is an acceptable number?
And a hammer may fix the dent, while I may be more
interested in preventing the dent in the first place.
Mitchell Erblich
^ 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