* Re: [Bonding-devel] bonding inside a bridge does not work when using arp monitoring
From: Jiri Pirko @ 2011-03-26 14:01 UTC (permalink / raw)
To: Nicolas de Pesloüan
Cc: Leonardo Borda, Nicolas de Pesloüan, Bridge, bonding-devel,
netdev@vger.kernel.org
In-Reply-To: <4D8DDA06.4040704@gmail.com>
Sat, Mar 26, 2011 at 01:20:22PM CET, nicolas.2p.debian@gmail.com wrote:
>Le 23/03/2011 22:13, Leonardo Borda a écrit :
>>Hi Nicolas,
>>
>>Thank you for answering my question.
>>Actually this is what I want to achieve:
>>
>>eth0----+ +----bond0.100----br0-100---{+virtual machines
>> | |
>> +----bond0----+----br0---(LAN)
>> | |
>>eth1----+ +----bond0.200----br0-200---{+virtual machines
>
>Hi Leonardo,
>
>I'm not sure recent kernels allow for a given interface to be a port
>for a bridge and the base interface for vlan interfaces at the same
>time. This might be particularly true for 2.6.38 or 2.6.38+, because
>of the new rx_handler usage.
This topology is not legit and should/will be prohibited.
Only consider that you have + br0.100 device on top of br0. Where should
the packet go?
I suggest to consider topology change.
>
>cc: netdev and Jiri Pirko, for advices. For the history of the thread, see:
>
>http://sourceforge.net/mailarchive/forum.php?thread_name=1300914794.32252.68.camel%40bordalnx&
>forum_name=bonding-devel
>
>>br0 --> br0 in my understanding is an untagged vlan therefore it
>>provides access to my LAN. So i am able to access that server from my
>>internal network.
>>br0-100 and br0-200 -> Vlans over a bridged interface will allow me to
>>have many virtual machines in the same vlan on each bridged interface.
>>
>>I am misunderstanding concepts, maybe?
>>If you need to do further tests I have a test environment ready for use.
>>
>>Leonardo
^ permalink raw reply
* Re: [PATCH V12 4/4] ptp: Added a clock driver for the National Semiconductor PHYTER.
From: Richard Cochran @ 2011-03-26 13:40 UTC (permalink / raw)
To: John Stultz
Cc: Rodolfo Giometti, Peter Zijlstra,
linux-api-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Russell King,
Thomas Gleixner, Alan Cox, netdev-u79uwXL29TY76Z2rM5mHXA,
Mike Frysinger, Christoph Lameter,
linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ, David Miller,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
Krzysztof Halasa
In-Reply-To: <1300916785.848.54.camel@work-vm>
On Wed, Mar 23, 2011 at 02:46:25PM -0700, John Stultz wrote:
> On Mon, 2011-02-28 at 08:58 +0100, Richard Cochran wrote:
> > +static int tdr_write(int bc, struct phy_device *dev,
> > + const struct timespec *ts, u16 cmd)
> > +{
> > + ext_write(bc, dev, PAGE4, PTP_TDR, ts->tv_nsec & 0xffff);/* ns[15:0] */
> > + ext_write(bc, dev, PAGE4, PTP_TDR, ts->tv_nsec >> 16); /* ns[31:16] */
> > + ext_write(bc, dev, PAGE4, PTP_TDR, ts->tv_sec & 0xffff); /* sec[15:0] */
> > + ext_write(bc, dev, PAGE4, PTP_TDR, ts->tv_sec >> 16); /* sec[31:16]*/
> > +
> > + ext_write(bc, dev, PAGE4, PTP_CTL, cmd);
> > +
> > + return 0;
> > +}
>
> The above needs to hold the extreg_lock, and should be commented as
> such.
Okay, will do.
> And again, the function names are sort of generic, and could use a
> dp83640_ prefix or something.
So, I will rename the IXP functions in the other driver to make them
more unique, but in this case I really prefer to keep the short names
for the sake of readability.
Just about every operation on this PHY requires four 16-bit writes,
where each write can really mean two writes, with the first one to set
a "page" register for the following write.
Keeping the tabular style (shown above) makes it much more clear what
is going on, IMHO. If the function names become longer, that would
force line breaks and spoil the nice formatting.
Also, these names are not in use anywhere else in the kernel's eight
million LOC.
Thanks,
Richard
^ permalink raw reply
* Re: [PATCH] ip_fragment:kernel may panic when replay big packet with RST flag
From: Changli Gao @ 2011-03-26 13:36 UTC (permalink / raw)
To: Feng Gao
Cc: netdev, Eric Dumazet, Patrick McHardy,
Netfilter Developer Mailing List
In-Reply-To: <AANLkTikoSxVd3kTggsCGpjXz-5CFuVNxjnpuZNgWd3eV@mail.gmail.com>
On Wed, Mar 23, 2011 at 6:49 PM, Feng Gao <kernel.goter@gmail.com> wrote:
> Hello everyone:
>
> PC(A)-linux(B)-PC(C)
> computer(linux B) with two net interface,eth0 and eth1.
> PC(A) send syn to PC(C) though linux B.
> then PC(C) replay a big packet with RST flag(use tcpsic or other tools).
>
> This RST packet(1480) come in from eth0(mtu 1500) and go out from
> eth1(mtu 700), so this RST packet should fragment.
>
> BUT in tcp_packet func: if the connection has no reply packet,and
> receive the RST packet.ip_conntrack should destroy.
> if (!test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
> /* If only reply is a RST, we can consider ourselves not to
> have an established connection: this is a fairly common
> problem case, so we can delete the conntrack
> immediately. --RR */
> if (th->rst) {
> nf_ct_kill_acct(ct, ctinfo, skb);
> return NF_ACCEPT;
> }
> }
>
> BUT the skb->nfct is not set NULL in func nf_ct_kill_acct.
> so when this RST packet goto ip_fragment,ip_fragment call nf_copy, in
> __nf_copy func
> the fragment skb->nfct point to the destory mem.
> dst->nfct = src->nfct;
> nf_conntrack_get(src->nfct);
>
> SO finally.kfree_skb call destroy_conntrack again. this may result in
> LINUX B kernel panic.
>
>
Have you ever tested that? I am afraid no panic will happen.
nf_ct_kill_acct() just drops the reference owned by the corresponding
timeout timer to the ct if the timer is installed, so the skb still
has the reference to the ct after nf_ct_kill_acct() returns. Thanks.
BTW: all the patches related to netfilter should be sent to the
netfilter developer mailing list.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH V12 2/4] ptp: Added a clock that uses the eTSEC found on the MPC85xx.
From: Richard Cochran @ 2011-03-26 13:23 UTC (permalink / raw)
To: John Stultz
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-api-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ, Alan Cox, Arnd Bergmann,
Christoph Lameter, David Miller, Krzysztof Halasa, Peter Zijlstra,
Rodolfo Giometti, Thomas Gleixner, Benjamin Herrenschmidt,
Mike Frysinger, Paul Mackerras, Russell King
In-Reply-To: <1300915804.848.40.camel@work-vm>
On Wed, Mar 23, 2011 at 02:30:04PM -0700, John Stultz wrote:
> On Mon, 2011-02-28 at 08:57 +0100, Richard Cochran wrote:
> > +/*
> > + * Register access functions
> > + */
>
> So what are the locking rules on the functions below? I assume the
> etsects->lock needs to be held prior to calling, so that should be made
> explicit in a comment.
Yes, you are right. I'll add comments.
> > + gfar_write(&etsects->regs->tmr_ctrl, tmr_ctrl);
> > + gfar_write(&etsects->regs->tmr_add, etsects->tmr_add);
> > + gfar_write(&etsects->regs->tmr_prsc, etsects->tmr_prsc);
> > + gfar_write(&etsects->regs->tmr_fiper1, etsects->tmr_fiper1);
> > + gfar_write(&etsects->regs->tmr_fiper2, etsects->tmr_fiper2);
> > + set_alarm(etsects);
> > + gfar_write(&etsects->regs->tmr_ctrl, tmr_ctrl|FS|RTPE|TE);
>
> Does any of the above need a lock should an irq land in the middle of
> the writes?
Since these interrupts first must be enabled, I think it unlikely that
an IRQ could occur. However, it can't hurt to add the lock, either.
Thanks,
Richard
^ permalink raw reply
* Re: [PATCH V12 1/4] ptp: Added a brand new class driver for ptp clocks.
From: Richard Cochran @ 2011-03-26 13:12 UTC (permalink / raw)
To: John Stultz
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-api-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ, Alan Cox, Arnd Bergmann,
Christoph Lameter, David Miller, Krzysztof Halasa, Peter Zijlstra,
Rodolfo Giometti, Thomas Gleixner, Benjamin Herrenschmidt,
Mike Frysinger, Paul Mackerras, Russell King
In-Reply-To: <1300915160.848.33.camel@work-vm>
On Wed, Mar 23, 2011 at 02:19:20PM -0700, John Stultz wrote:
> On Mon, 2011-02-28 at 08:57 +0100, Richard Cochran wrote:
> > +++ b/drivers/ptp/ptp_clock.c
> > @@ -0,0 +1,320 @@
> [snip]
> > +static void enqueue_external_timestamp(struct timestamp_event_queue *queue,
> > + struct ptp_clock_event *src)
> > +{
> > + struct ptp_extts_event *dst;
> > + unsigned long flags;
> > + u32 remainder;
> > +
> > + dst = &queue->buf[queue->tail];
>
> Doesn't the lock need to happen before you access the
> queue->buf[queue->tail] ?
>
> For example: What happens if two cpus enter the function at the same
> time, both get the same tail index, one overwrite the other's data, then
> both take turns bumping up the tail pointer?
Yes, thanks for that catch.
> > +struct timestamp_event_queue {
> > + struct ptp_extts_event buf[PTP_MAX_TIMESTAMPS];
> > + int head;
> > + int tail;
> > + spinlock_t lock;
> > +};
> > +
> > +struct ptp_clock {
> > + struct posix_clock clock;
> > + struct device *dev;
> > + struct ptp_clock_info *info;
> > + dev_t devid;
> > + int index; /* index into clocks.map */
> > + struct pps_device *pps_source;
> > + struct timestamp_event_queue tsevq; /* simple fifo for time stamps */
> > + struct mutex tsevq_mux; /* one process at a time reading the fifo */
> > + wait_queue_head_t tsev_wq;
> > +};
> > +
> > +static inline int queue_cnt(struct timestamp_event_queue *q)
> > +{
> > + int cnt = q->tail - q->head;
> > + return cnt < 0 ? PTP_MAX_TIMESTAMPS + cnt : cnt;
> > +}
>
> q->tail and head access probably need to happen only when locked.
>
> So probably need a comment that queue_cnt must be called only when
> holding the proper lock.
In this case, calling without a lock is allowed. However, I'll add
comment like the following.
* The function queue_cnt() is safe for readers to call without
* holding q->lock. Readers use this function to verify that the queue
* is nonempty before proceeding with a dequeue operation. The fact
* that a writer might concurrently increment the tail does not
* matter, since the queue remains nonempty nonetheless.
Thanks for your feedback,
Richard
^ permalink raw reply
* Re: [Bonding-devel] bonding inside a bridge does not work when using arp monitoring
From: Nicolas de Pesloüan @ 2011-03-26 12:20 UTC (permalink / raw)
To: Leonardo Borda
Cc: Nicolas de Pesloüan, Bridge, bonding-devel,
netdev@vger.kernel.org, Jiri Pirko
In-Reply-To: <1300914794.32252.68.camel@bordalnx>
Le 23/03/2011 22:13, Leonardo Borda a écrit :
> Hi Nicolas,
>
> Thank you for answering my question.
> Actually this is what I want to achieve:
>
> eth0----+ +----bond0.100----br0-100---{+virtual machines
> | |
> +----bond0----+----br0---(LAN)
> | |
> eth1----+ +----bond0.200----br0-200---{+virtual machines
Hi Leonardo,
I'm not sure recent kernels allow for a given interface to be a port for a bridge and the base
interface for vlan interfaces at the same time. This might be particularly true for 2.6.38 or
2.6.38+, because of the new rx_handler usage.
cc: netdev and Jiri Pirko, for advices. For the history of the thread, see:
http://sourceforge.net/mailarchive/forum.php?thread_name=1300914794.32252.68.camel%40bordalnx&
forum_name=bonding-devel
> br0 --> br0 in my understanding is an untagged vlan therefore it
> provides access to my LAN. So i am able to access that server from my
> internal network.
> br0-100 and br0-200 -> Vlans over a bridged interface will allow me to
> have many virtual machines in the same vlan on each bridged interface.
>
> I am misunderstanding concepts, maybe?
> If you need to do further tests I have a test environment ready for use.
>
> Leonardo
^ permalink raw reply
* [PATCH] Net / jme: Do not use legacy PCI power management
From: Rafael J. Wysocki @ 2011-03-26 11:34 UTC (permalink / raw)
To: netdev; +Cc: LKML, Linux PM mailing list, David Miller
From: Rafael J. Wysocki <rjw@sisk.pl>
The jme driver uses the legacy PCI power management, so it has to do
some PCI-specific things in its ->suspend() and ->resume() callbacks,
which isn't necessary and should better be done by the PCI
sybsystem-level power management code. It also doesn't use device
wakeup flags correctly.
Convert jme to the new PCI power management framework and make it
let the PCI subsystem take care of all the PCI-specific aspects of
device handling during system power transitions.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/net/jme.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
Index: linux-2.6/drivers/net/jme.c
===================================================================
--- linux-2.6.orig/drivers/net/jme.c
+++ linux-2.6/drivers/net/jme.c
@@ -273,7 +273,7 @@ jme_clear_pm(struct jme_adapter *jme)
{
jwrite32(jme, JME_PMCS, 0xFFFF0000 | jme->reg_pmcs);
pci_set_power_state(jme->pdev, PCI_D0);
- pci_enable_wake(jme->pdev, PCI_D0, false);
+ device_set_wakeup_enable(&jme->pdev->dev, false);
}
static int
@@ -2538,6 +2538,8 @@ jme_set_wol(struct net_device *netdev,
jwrite32(jme, JME_PMCS, jme->reg_pmcs);
+ device_set_wakeup_enable(&jme->pdev->dev, jme->reg_pmcs);
+
return 0;
}
@@ -3172,9 +3174,9 @@ jme_shutdown(struct pci_dev *pdev)
}
#ifdef CONFIG_PM
-static int
-jme_suspend(struct pci_dev *pdev, pm_message_t state)
+static int jme_suspend(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct net_device *netdev = pci_get_drvdata(pdev);
struct jme_adapter *jme = netdev_priv(netdev);
@@ -3206,22 +3208,18 @@ jme_suspend(struct pci_dev *pdev, pm_mes
tasklet_hi_enable(&jme->rxclean_task);
tasklet_hi_enable(&jme->rxempty_task);
- pci_save_state(pdev);
jme_powersave_phy(jme);
- pci_enable_wake(jme->pdev, PCI_D3hot, true);
- pci_set_power_state(pdev, PCI_D3hot);
return 0;
}
-static int
-jme_resume(struct pci_dev *pdev)
+static int jme_resume(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct net_device *netdev = pci_get_drvdata(pdev);
struct jme_adapter *jme = netdev_priv(netdev);
- jme_clear_pm(jme);
- pci_restore_state(pdev);
+ jwrite32(jme, JME_PMCS, 0xFFFF0000 | jme->reg_pmcs);
jme_phy_on(jme);
if (test_bit(JME_FLAG_SSET, &jme->flags))
@@ -3238,6 +3236,13 @@ jme_resume(struct pci_dev *pdev)
return 0;
}
+
+static SIMPLE_DEV_PM_OPS(jme_pm_ops, jme_suspend, jme_resume);
+#define JME_PM_OPS (&jme_pm_ops)
+
+#else
+
+#define JME_PM_OPS NULL
#endif
static DEFINE_PCI_DEVICE_TABLE(jme_pci_tbl) = {
@@ -3251,11 +3256,8 @@ static struct pci_driver jme_driver = {
.id_table = jme_pci_tbl,
.probe = jme_init_one,
.remove = __devexit_p(jme_remove_one),
-#ifdef CONFIG_PM
- .suspend = jme_suspend,
- .resume = jme_resume,
-#endif /* CONFIG_PM */
.shutdown = jme_shutdown,
+ .driver.pm = JME_PM_OPS,
};
static int __init
^ permalink raw reply
* Re: [PATCH v2] net: don't allow CAP_NET_ADMIN to load non-netdev kernel modules
From: Vasiliy Kulikov @ 2011-03-26 10:35 UTC (permalink / raw)
To: David Miller
Cc: shemminger, serge.hallyn, bhutchings, eparis, eparis,
linux-kernel, mjt, arnd, mirqus, netdev, kuznet, pekkas, jmorris,
yoshfuji, kaber, eric.dumazet, therbert, xiaosuo, jesse,
kees.cook, eugene, dan.j.rosenberg, akpm, greg, sds,
linux-security-module, dwalsh, dhowells
In-Reply-To: <20110324.144628.58411809.davem@davemloft.net>
On Thu, Mar 24, 2011 at 14:46 -0700, David Miller wrote:
> You can't say "userland will fix things up"
>
> Because we're never supposed to break userland in the first place.
I admit that the patch breaks things.
But the thing is that kernel changes _are_ breaking userspace here and
there, not only by such obvious policy changes, but by indirect changes.
Note that the patch that changed CAP_SYS_MODULE to CAP_NET_ADMIN has
broken userspace behavior too - one could load modules with
CAP_SYS_MODULE without CAP_NET_ADMIN via "ifconfig wifi0" and after the
patch it could not.
Look at this patch:
http://patchwork.ozlabs.org/patch/42148/
It breaks userspace tools too - one might run LSM in learning mode to
create a profile for netfilter configuring, saw it didn't need any CAP_*
and totally denied them in the profile. After many years (the bug was
fixed after 5+ years!) of good work it was broken by the patch. The same
with plenty of patches that introduce different checks in places where
there were no permission checks at all or these checks were broken.
--
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments
^ permalink raw reply
* Re: [PATCH 2/2] socket: add minimum listen queue length sysctl
From: Eric Dumazet @ 2011-03-26 7:06 UTC (permalink / raw)
To: Hagen Paul Pfeifer; +Cc: Rick Jones, netdev
In-Reply-To: <20110325235101.GA2641@hell>
Le samedi 26 mars 2011 à 00:51 +0100, Hagen Paul Pfeifer a écrit :
> IMHO, _if_ a programmer modifies the send or receive buffer he _knows_ exactly
> why. If he does not modify the buffer it is fine too, because _we_ tune the
> buffers as good as we can - and we are good in this.
>
> But, the backlog is different. Often the programmer does _not_ know how to
> tune this variable. And, often the backlog depends on the target system, on
> the network characteristic and the like.
>
> Therefore we provide the system administrator the _ability_ to tune the actual
> backlog.
What you want to tune is not the backlog (max number of ready to be
delivered connections to accept()), but the number of SYN_RECV half
connections, still waiting for a second packet coming from clients.
An application might really want to have a listen(fd, 1) to accept one
incoming connection, but still be able to survive to a SYNFLOOD.
By the way, you still are confused by the fact that tcp_max_syn_backlog
has nothing to do with the 'backlog', as I already mentioned it, its a
parameter to cap the size of the hash table associated to a listener
socket.
You can have a hash table with 1024 slots, and still have a backlog of
16384 for example.
^ permalink raw reply
* Re: [PATCH] ipv4: do not ignore route errors
From: David Miller @ 2011-03-26 3:33 UTC (permalink / raw)
To: ja; +Cc: netdev
In-Reply-To: <201103252345.p2PNjP1n025209@ja.ssi.bg>
From: Julian Anastasov <ja@ssi.bg>
Date: Sat, 26 Mar 2011 01:45:25 +0200
> The "ipv4: Inline fib_semantic_match into check_leaf"
> change forgets to return the route errors. check_leaf should
> return the same results as fib_table_lookup.
>
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
Your mailer corrupted this patch, so I applied it by hand.
^ permalink raw reply
* Re: [PATCH 2/2] socket: add minimum listen queue length sysctl
From: Rick Jones @ 2011-03-26 0:21 UTC (permalink / raw)
To: Hagen Paul Pfeifer; +Cc: netdev, Eric Dumazet
In-Reply-To: <20110325235101.GA2641@hell>
On Sat, 2011-03-26 at 00:51 +0100, Hagen Paul Pfeifer wrote:
> * Rick Jones | 2011-03-25 13:24:37 [-0700]:
>
> Hello Rick
>
> >Well, one could LD_PRELOAD something that intercepted listen() calls no?
>
> Noes, for dynamically linked programs yes, for statically linked ones no.
>
> Furthermore, for distribution shipped programs an administrator would not
> alter the init script or something. Editing /etc/sysctl.conf is as simple
> as ...
>
>
> >Is there already a similar minimum the admin can configure when the
> >applications makes "too small" an explicit setsockopt() call against
> >SO_SNDBUF or SO_RCVBUF?
>
> net.ipv4.tcp_rmem, net.ipv4.tcp_mem, net.core.rmem_default, ...?
I believe (based on my netperf experience) tcp_rmem and tcp_wmem aren't
consulted when one makes an explicit setsockopt() call against the
SO_*BUF sizes. and the net.core.[rw]mem_default are used by UDP sockets:
raj@tardy:~/netperf2_trunk$ uname -a
Linux tardy 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:39:03 UTC 2011
x86_64 GNU/Linux
raj@tardy:~/netperf2_trunk$ sysctl net.ipv4.tcp_rmem
net.ipv4.tcp_rmem = 4096 87380 4194304
raj@tardy:~/netperf2_trunk$ sysctl net.ipv4.tcp_wmem
net.ipv4.tcp_wmem = 4096 16384 4194304
raj@tardy:~/netperf2_trunk$ sysctl net.core.wmem_default
net.core.wmem_default = 126976
raj@tardy:~/netperf2_trunk$ sysctl net.core.rmem_default
net.core.rmem_default = 126976
(lss == local socket send; rsr == remote socket receive)
src/netperf -t omni -- -k lss_size,lss_size_end,rsr_size,rsr_size_end
OMNI TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to localhost.localdomain
(127.0.0.1) port 0 AF_INET : demo
LSS_SIZE=16384
LSS_SIZE_END=2679048
RSR_SIZE=87380
RSR_SIZE_END=4194304
raj@tardy:~/netperf2_trunk$ src/netperf -t omni -- -k
lss_size,lss_size_end,rsr_size,rsr_size_end -T udp -m 1024
OMNI TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to localhost.localdomain
(127.0.0.1) port 0 AF_INET : demo
LSS_SIZE=126976
LSS_SIZE_END=126976
RSR_SIZE=126976
RSR_SIZE_END=126976
I believe that net.core.[rw]mem_max are the upper limits (modulo the
2X?) applied when making explicit setsockopt() calls:
raj@tardy:~/netperf2_trunk$ sysctl net.core.rmem_max
net.core.rmem_max = 131071
raj@tardy:~/netperf2_trunk$ sysctl net.core.wmem_max
net.core.wmem_max = 131071
raj@tardy:~/netperf2_trunk$ src/netperf -t omni -- -k
lss_size,lss_size_end,rsr_size,rsr_size_end -T udp -m 1024 -s 1M -S 1M
OMNI TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to localhost.localdomain
(127.0.0.1) port 0 AF_INET : demo
LSS_SIZE=262142
LSS_SIZE_END=262142
RSR_SIZE=262142
RSR_SIZE_END=262142
raj@tardy:~/netperf2_trunk$ src/netperf -t omni -- -k
lss_size,lss_size_end,rsr_size,rsr_size_end -s 1M -S 1M
OMNI TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to localhost.localdomain
(127.0.0.1) port 0 AF_INET : demo
LSS_SIZE=262142
LSS_SIZE_END=262142
RSR_SIZE=262142
RSR_SIZE_END=262142
When though one asks for single-byte socket buffers:
raj@tardy:~/netperf2_trunk$ src/netperf -t omni -- -k
lss_size,lss_size_end,rsr_size,rsr_size_end -s 1 -S 1
OMNI TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to localhost.localdomain
(127.0.0.1) port 0 AF_INET : demo
LSS_SIZE=2048
LSS_SIZE_END=2048
RSR_SIZE=256
RSR_SIZE_END=256
One gets values that at face value don't seem to be related to sysctl
settings. Although perhaps the receive socket size comes from the min
mss:
raj@tardy:~/netperf2_trunk$ sysctl -a | grep 256
error: permission denied on key 'kernel.cad_pid'
error: permission denied on key 'fs.binfmt_misc.register'
vm.lowmem_reserve_ratio = 256 256 32
fs.mqueue.queues_max = 256
error: permission denied on key 'net.ipv4.route.flush'
net.ipv4.route.min_adv_mss = 256
error: permission denied on key 'net.ipv6.route.flush'
raj@tardy:~/netperf2_trunk$ sysctl -a | grep 2048
error: permission denied on key 'kernel.cad_pid'
error: permission denied on key 'fs.binfmt_misc.register'
error: permission denied on key 'net.ipv4.route.flush'
net.core.optmem_max = 20480
net.ipv4.route.redirect_silence = 2048
net.ipv4.tcp_max_syn_backlog = 2048
net.ipv6.xfrm6_gc_thresh = 2048
error: permission denied on key 'net.ipv6.route.flush'
> IMHO, _if_ a programmer modifies the send or receive buffer he _knows_ exactly
> why.
I admire your optimism - particularly in the face of all the 10GbE NIC
vendors' suggestions that everyone use 16 MB socket buffers (or at least
set the auto tuning limits to 16 MB).
> If he does not modify the buffer it is fine too, because _we_ tune the
> buffers as good as we can - and we are good in this.
The "bloat" folks might disagree :)
> But, the backlog is different. Often the programmer does _not_ know how to
> tune this variable. And, often the backlog depends on the target system, on
> the network characteristic and the like.
As do the settings for socket buffer sizes. So, how is it that the
programmer is educated and intelligent enough to set a minimum socket
buffer size but not a minimum listen queue backlog?
> Therefore we provide the system administrator the _ability_ to tune the actual
> backlog.
And, perhaps, do something that flies in the face of what the programmer
was trying to do, by limiting how many connections could be queued and
so changing the behaviour for the N+1st connection attempt while service
was backlogged.
It really is a rather existential "Who's right? The Programmer or the
Administrator" question. And perhaps my asking if there should be a
(possibly) foolish consistency.
rick jones
^ permalink raw reply
* [PATCH] smsc911x: Use pr_fmt, netdev_<level>, and netif_<level>
From: Joe Perches @ 2011-03-26 0:21 UTC (permalink / raw)
To: Steve Glendinning; +Cc: Jeongtae Park, netdev
Use the more common/verbose logging styles.
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Remove smsc911x prefixes from format strings.
Rename SMSC_WARNING to SMSC_WARN.
Remove DPRINTK macro.
Use netif_<level> in SMSC_<level> macros.
Convert NETIF_MSG_<foo> uses to lower case.
Add no_printk verification in non-debug uses.
Add pdata to SMSC_<level> uses to avoid hidden variable uses.
Convert printks to netdev_<level> as appropriate.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/smsc911x.c | 292 ++++++++++++++++++++++++------------------------
drivers/net/smsc911x.h | 22 ++--
2 files changed, 155 insertions(+), 159 deletions(-)
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index 1566259..5453b74 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -29,6 +29,8 @@
*
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/crc32.h>
#include <linux/delay.h>
#include <linux/errno.h>
@@ -248,8 +250,8 @@ static int smsc911x_mac_complete(struct smsc911x_data *pdata)
if (!(val & MAC_CSR_CMD_CSR_BUSY_))
return 0;
}
- SMSC_WARNING(HW, "Timed out waiting for MAC not BUSY. "
- "MAC_CSR_CMD: 0x%08X", val);
+ SMSC_WARN(pdata, hw, "Timed out waiting for MAC not BUSY. "
+ "MAC_CSR_CMD: 0x%08X", val);
return -EIO;
}
@@ -262,7 +264,7 @@ static u32 smsc911x_mac_read(struct smsc911x_data *pdata, unsigned int offset)
temp = smsc911x_reg_read(pdata, MAC_CSR_CMD);
if (unlikely(temp & MAC_CSR_CMD_CSR_BUSY_)) {
- SMSC_WARNING(HW, "MAC busy at entry");
+ SMSC_WARN(pdata, hw, "MAC busy at entry");
return 0xFFFFFFFF;
}
@@ -277,7 +279,7 @@ static u32 smsc911x_mac_read(struct smsc911x_data *pdata, unsigned int offset)
if (likely(smsc911x_mac_complete(pdata) == 0))
return smsc911x_reg_read(pdata, MAC_CSR_DATA);
- SMSC_WARNING(HW, "MAC busy after read");
+ SMSC_WARN(pdata, hw, "MAC busy after read");
return 0xFFFFFFFF;
}
@@ -291,8 +293,8 @@ static void smsc911x_mac_write(struct smsc911x_data *pdata,
temp = smsc911x_reg_read(pdata, MAC_CSR_CMD);
if (unlikely(temp & MAC_CSR_CMD_CSR_BUSY_)) {
- SMSC_WARNING(HW,
- "smsc911x_mac_write failed, MAC busy at entry");
+ SMSC_WARN(pdata, hw,
+ "smsc911x_mac_write failed, MAC busy at entry");
return;
}
@@ -310,8 +312,7 @@ static void smsc911x_mac_write(struct smsc911x_data *pdata,
if (likely(smsc911x_mac_complete(pdata) == 0))
return;
- SMSC_WARNING(HW,
- "smsc911x_mac_write failed, MAC busy after write");
+ SMSC_WARN(pdata, hw, "smsc911x_mac_write failed, MAC busy after write");
}
/* Get a phy register */
@@ -326,8 +327,7 @@ static int smsc911x_mii_read(struct mii_bus *bus, int phyaddr, int regidx)
/* Confirm MII not busy */
if (unlikely(smsc911x_mac_read(pdata, MII_ACC) & MII_ACC_MII_BUSY_)) {
- SMSC_WARNING(HW,
- "MII is busy in smsc911x_mii_read???");
+ SMSC_WARN(pdata, hw, "MII is busy in smsc911x_mii_read???");
reg = -EIO;
goto out;
}
@@ -343,7 +343,7 @@ static int smsc911x_mii_read(struct mii_bus *bus, int phyaddr, int regidx)
goto out;
}
- SMSC_WARNING(HW, "Timed out waiting for MII read to finish");
+ SMSC_WARN(pdata, hw, "Timed out waiting for MII read to finish");
reg = -EIO;
out:
@@ -364,8 +364,7 @@ static int smsc911x_mii_write(struct mii_bus *bus, int phyaddr, int regidx,
/* Confirm MII not busy */
if (unlikely(smsc911x_mac_read(pdata, MII_ACC) & MII_ACC_MII_BUSY_)) {
- SMSC_WARNING(HW,
- "MII is busy in smsc911x_mii_write???");
+ SMSC_WARN(pdata, hw, "MII is busy in smsc911x_mii_write???");
reg = -EIO;
goto out;
}
@@ -385,7 +384,7 @@ static int smsc911x_mii_write(struct mii_bus *bus, int phyaddr, int regidx,
goto out;
}
- SMSC_WARNING(HW, "Timed out waiting for MII write to finish");
+ SMSC_WARN(pdata, hw, "Timed out waiting for MII write to finish");
reg = -EIO;
out:
@@ -426,18 +425,20 @@ static void smsc911x_phy_initialise_external(struct smsc911x_data *pdata)
unsigned int hwcfg = smsc911x_reg_read(pdata, HW_CFG);
if (pdata->config.flags & SMSC911X_FORCE_INTERNAL_PHY) {
- SMSC_TRACE(HW, "Forcing internal PHY");
+ SMSC_TRACE(pdata, hw, "Forcing internal PHY");
pdata->using_extphy = 0;
} else if (pdata->config.flags & SMSC911X_FORCE_EXTERNAL_PHY) {
- SMSC_TRACE(HW, "Forcing external PHY");
+ SMSC_TRACE(pdata, hw, "Forcing external PHY");
smsc911x_phy_enable_external(pdata);
pdata->using_extphy = 1;
} else if (hwcfg & HW_CFG_EXT_PHY_DET_) {
- SMSC_TRACE(HW, "HW_CFG EXT_PHY_DET set, using external PHY");
+ SMSC_TRACE(pdata, hw,
+ "HW_CFG EXT_PHY_DET set, using external PHY");
smsc911x_phy_enable_external(pdata);
pdata->using_extphy = 1;
} else {
- SMSC_TRACE(HW, "HW_CFG EXT_PHY_DET clear, using internal PHY");
+ SMSC_TRACE(pdata, hw,
+ "HW_CFG EXT_PHY_DET clear, using internal PHY");
pdata->using_extphy = 0;
}
}
@@ -509,13 +510,13 @@ static int smsc911x_phy_check_loopbackpkt(struct smsc911x_data *pdata)
} while ((i--) && (!status));
if (!status) {
- SMSC_WARNING(HW, "Failed to transmit "
- "during loopback test");
+ SMSC_WARN(pdata, hw,
+ "Failed to transmit during loopback test");
continue;
}
if (status & TX_STS_ES_) {
- SMSC_WARNING(HW, "Transmit encountered "
- "errors during loopback test");
+ SMSC_WARN(pdata, hw,
+ "Transmit encountered errors during loopback test");
continue;
}
@@ -527,13 +528,13 @@ static int smsc911x_phy_check_loopbackpkt(struct smsc911x_data *pdata)
} while ((i--) && (!status));
if (!status) {
- SMSC_WARNING(HW,
- "Failed to receive during loopback test");
+ SMSC_WARN(pdata, hw,
+ "Failed to receive during loopback test");
continue;
}
if (status & RX_STS_ES_) {
- SMSC_WARNING(HW, "Receive encountered "
- "errors during loopback test");
+ SMSC_WARN(pdata, hw,
+ "Receive encountered errors during loopback test");
continue;
}
@@ -546,9 +547,9 @@ static int smsc911x_phy_check_loopbackpkt(struct smsc911x_data *pdata)
smsc911x_rx_readfifo(pdata, (unsigned int *)bufp, rdsz);
if (pktlength != (MIN_PACKET_SIZE + 4)) {
- SMSC_WARNING(HW, "Unexpected packet size "
- "during loop back test, size=%d, will retry",
- pktlength);
+ SMSC_WARN(pdata, hw, "Unexpected packet size "
+ "during loop back test, size=%d, will retry",
+ pktlength);
} else {
unsigned int j;
int mismatch = 0;
@@ -560,12 +561,12 @@ static int smsc911x_phy_check_loopbackpkt(struct smsc911x_data *pdata)
}
}
if (!mismatch) {
- SMSC_TRACE(HW, "Successfully verified "
+ SMSC_TRACE(pdata, hw, "Successfully verified "
"loopback packet");
return 0;
} else {
- SMSC_WARNING(HW, "Data mismatch "
- "during loop back test, will retry");
+ SMSC_WARN(pdata, hw, "Data mismatch "
+ "during loop back test, will retry");
}
}
}
@@ -582,7 +583,7 @@ static int smsc911x_phy_reset(struct smsc911x_data *pdata)
BUG_ON(!phy_dev);
BUG_ON(!phy_dev->bus);
- SMSC_TRACE(HW, "Performing PHY BCR Reset");
+ SMSC_TRACE(pdata, hw, "Performing PHY BCR Reset");
smsc911x_mii_write(phy_dev->bus, phy_dev->addr, MII_BMCR, BMCR_RESET);
do {
msleep(1);
@@ -591,7 +592,7 @@ static int smsc911x_phy_reset(struct smsc911x_data *pdata)
} while ((i--) && (temp & BMCR_RESET));
if (temp & BMCR_RESET) {
- SMSC_WARNING(HW, "PHY reset failed to complete.");
+ SMSC_WARN(pdata, hw, "PHY reset failed to complete");
return -EIO;
}
/* Extra delay required because the phy may not be completed with
@@ -695,11 +696,11 @@ static void smsc911x_phy_update_flowcontrol(struct smsc911x_data *pdata)
else
afc &= ~0xF;
- SMSC_TRACE(HW, "rx pause %s, tx pause %s",
- (cap & FLOW_CTRL_RX ? "enabled" : "disabled"),
- (cap & FLOW_CTRL_TX ? "enabled" : "disabled"));
+ SMSC_TRACE(pdata, hw, "rx pause %s, tx pause %s",
+ (cap & FLOW_CTRL_RX ? "enabled" : "disabled"),
+ (cap & FLOW_CTRL_TX ? "enabled" : "disabled"));
} else {
- SMSC_TRACE(HW, "half duplex");
+ SMSC_TRACE(pdata, hw, "half duplex");
flow = 0;
afc |= 0xF;
}
@@ -722,17 +723,17 @@ static void smsc911x_phy_adjust_link(struct net_device *dev)
if (phy_dev->duplex != pdata->last_duplex) {
unsigned int mac_cr;
- SMSC_TRACE(HW, "duplex state has changed");
+ SMSC_TRACE(pdata, hw, "duplex state has changed");
spin_lock_irqsave(&pdata->mac_lock, flags);
mac_cr = smsc911x_mac_read(pdata, MAC_CR);
if (phy_dev->duplex) {
- SMSC_TRACE(HW,
- "configuring for full duplex mode");
+ SMSC_TRACE(pdata, hw,
+ "configuring for full duplex mode");
mac_cr |= MAC_CR_FDPX_;
} else {
- SMSC_TRACE(HW,
- "configuring for half duplex mode");
+ SMSC_TRACE(pdata, hw,
+ "configuring for half duplex mode");
mac_cr &= ~MAC_CR_FDPX_;
}
smsc911x_mac_write(pdata, MAC_CR, mac_cr);
@@ -744,9 +745,9 @@ static void smsc911x_phy_adjust_link(struct net_device *dev)
carrier = netif_carrier_ok(dev);
if (carrier != pdata->last_carrier) {
- SMSC_TRACE(HW, "carrier state has changed");
+ SMSC_TRACE(pdata, hw, "carrier state has changed");
if (carrier) {
- SMSC_TRACE(HW, "configuring for carrier OK");
+ SMSC_TRACE(pdata, hw, "configuring for carrier OK");
if ((pdata->gpio_orig_setting & GPIO_CFG_LED1_EN_) &&
(!pdata->using_extphy)) {
/* Restore original GPIO configuration */
@@ -755,7 +756,7 @@ static void smsc911x_phy_adjust_link(struct net_device *dev)
pdata->gpio_setting);
}
} else {
- SMSC_TRACE(HW, "configuring for no carrier");
+ SMSC_TRACE(pdata, hw, "configuring for no carrier");
/* Check global setting that LED1
* usage is 10/100 indicator */
pdata->gpio_setting = smsc911x_reg_read(pdata,
@@ -787,25 +788,25 @@ static int smsc911x_mii_probe(struct net_device *dev)
/* find the first phy */
phydev = phy_find_first(pdata->mii_bus);
if (!phydev) {
- pr_err("%s: no PHY found\n", dev->name);
+ netdev_err(dev, "no PHY found\n");
return -ENODEV;
}
- SMSC_TRACE(PROBE, "PHY: addr %d, phy_id 0x%08X",
- phydev->addr, phydev->phy_id);
+ SMSC_TRACE(pdata, probe, "PHY: addr %d, phy_id 0x%08X",
+ phydev->addr, phydev->phy_id);
ret = phy_connect_direct(dev, phydev,
&smsc911x_phy_adjust_link, 0,
pdata->config.phy_interface);
if (ret) {
- pr_err("%s: Could not attach to PHY\n", dev->name);
+ netdev_err(dev, "Could not attach to PHY\n");
return ret;
}
- pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
- dev->name, phydev->drv->name,
- dev_name(&phydev->dev), phydev->irq);
+ netdev_info(dev,
+ "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
+ phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
/* mask with MAC supported features */
phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause |
@@ -818,13 +819,13 @@ static int smsc911x_mii_probe(struct net_device *dev)
#ifdef USE_PHY_WORK_AROUND
if (smsc911x_phy_loopbacktest(dev) < 0) {
- SMSC_WARNING(HW, "Failed Loop Back Test");
+ SMSC_WARN(pdata, hw, "Failed Loop Back Test");
return -ENODEV;
}
- SMSC_TRACE(HW, "Passed Loop Back Test");
+ SMSC_TRACE(pdata, hw, "Passed Loop Back Test");
#endif /* USE_PHY_WORK_AROUND */
- SMSC_TRACE(HW, "phy initialised successfully");
+ SMSC_TRACE(pdata, hw, "phy initialised successfully");
return 0;
}
@@ -860,8 +861,8 @@ static int __devinit smsc911x_mii_init(struct platform_device *pdev,
smsc911x_phy_initialise_external(pdata);
break;
default:
- SMSC_TRACE(HW, "External PHY is not supported, "
- "using internal PHY");
+ SMSC_TRACE(pdata, hw, "External PHY is not supported, "
+ "using internal PHY");
pdata->using_extphy = 0;
break;
}
@@ -872,12 +873,12 @@ static int __devinit smsc911x_mii_init(struct platform_device *pdev,
}
if (mdiobus_register(pdata->mii_bus)) {
- SMSC_WARNING(PROBE, "Error registering mii bus");
+ SMSC_WARN(pdata, probe, "Error registering mii bus");
goto err_out_free_bus_2;
}
if (smsc911x_mii_probe(dev) < 0) {
- SMSC_WARNING(PROBE, "Error registering mii bus");
+ SMSC_WARN(pdata, probe, "Error registering mii bus");
goto err_out_unregister_bus_3;
}
@@ -913,8 +914,7 @@ static void smsc911x_tx_update_txcounters(struct net_device *dev)
* does not reference a hardware defined reserved bit
* but rather a driver defined one.
*/
- SMSC_WARNING(HW,
- "Packet tag reserved bit is high");
+ SMSC_WARN(pdata, hw, "Packet tag reserved bit is high");
} else {
if (unlikely(tx_stat & TX_STS_ES_)) {
dev->stats.tx_errors++;
@@ -977,8 +977,8 @@ smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes)
} while ((val & RX_DP_CTRL_RX_FFWD_) && --timeout);
if (unlikely(timeout == 0))
- SMSC_WARNING(HW, "Timed out waiting for "
- "RX FFWD to finish, RX_DP_CTRL: 0x%08X", val);
+ SMSC_WARN(pdata, hw, "Timed out waiting for "
+ "RX FFWD to finish, RX_DP_CTRL: 0x%08X", val);
} else {
unsigned int temp;
while (pktwords--)
@@ -1021,8 +1021,8 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
smsc911x_rx_counterrors(dev, rxstat);
if (unlikely(rxstat & RX_STS_ES_)) {
- SMSC_WARNING(RX_ERR,
- "Discarding packet with error bit set");
+ SMSC_WARN(pdata, rx_err,
+ "Discarding packet with error bit set");
/* Packet has an error, discard it and continue with
* the next */
smsc911x_rx_fastforward(pdata, pktwords);
@@ -1032,8 +1032,8 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
skb = netdev_alloc_skb(dev, pktlength + NET_IP_ALIGN);
if (unlikely(!skb)) {
- SMSC_WARNING(RX_ERR,
- "Unable to allocate skb for rx packet");
+ SMSC_WARN(pdata, rx_err,
+ "Unable to allocate skb for rx packet");
/* Drop the packet and stop this polling iteration */
smsc911x_rx_fastforward(pdata, pktwords);
dev->stats.rx_dropped++;
@@ -1083,8 +1083,8 @@ static void smsc911x_rx_multicast_update(struct smsc911x_data *pdata)
smsc911x_mac_write(pdata, MAC_CR, mac_cr);
smsc911x_mac_write(pdata, HASHH, pdata->hashhi);
smsc911x_mac_write(pdata, HASHL, pdata->hashlo);
- SMSC_TRACE(HW, "maccr 0x%08X, HASHH 0x%08X, HASHL 0x%08X",
- mac_cr, pdata->hashhi, pdata->hashlo);
+ SMSC_TRACE(pdata, hw, "maccr 0x%08X, HASHH 0x%08X, HASHL 0x%08X",
+ mac_cr, pdata->hashhi, pdata->hashlo);
}
static void smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata)
@@ -1102,7 +1102,7 @@ static void smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata)
/* Check Rx has stopped */
if (smsc911x_mac_read(pdata, MAC_CR) & MAC_CR_RXEN_)
- SMSC_WARNING(DRV, "Rx not stopped");
+ SMSC_WARN(pdata, drv, "Rx not stopped");
/* Perform the update - safe to do now Rx has stopped */
smsc911x_rx_multicast_update(pdata);
@@ -1131,7 +1131,7 @@ static int smsc911x_soft_reset(struct smsc911x_data *pdata)
} while ((--timeout) && (temp & HW_CFG_SRST_));
if (unlikely(temp & HW_CFG_SRST_)) {
- SMSC_WARNING(DRV, "Failed to complete reset");
+ SMSC_WARN(pdata, drv, "Failed to complete reset");
return -EIO;
}
return 0;
@@ -1160,18 +1160,18 @@ static int smsc911x_open(struct net_device *dev)
/* if the phy is not yet registered, retry later*/
if (!pdata->phy_dev) {
- SMSC_WARNING(HW, "phy_dev is NULL");
+ SMSC_WARN(pdata, hw, "phy_dev is NULL");
return -EAGAIN;
}
if (!is_valid_ether_addr(dev->dev_addr)) {
- SMSC_WARNING(HW, "dev_addr is not a valid MAC address");
+ SMSC_WARN(pdata, hw, "dev_addr is not a valid MAC address");
return -EADDRNOTAVAIL;
}
/* Reset the LAN911x */
if (smsc911x_soft_reset(pdata)) {
- SMSC_WARNING(HW, "soft reset failed");
+ SMSC_WARN(pdata, hw, "soft reset failed");
return -EIO;
}
@@ -1191,8 +1191,8 @@ static int smsc911x_open(struct net_device *dev)
}
if (unlikely(timeout == 0))
- SMSC_WARNING(IFUP,
- "Timed out waiting for EEPROM busy bit to clear");
+ SMSC_WARN(pdata, ifup,
+ "Timed out waiting for EEPROM busy bit to clear");
smsc911x_reg_write(pdata, GPIO_CFG, 0x70070000);
@@ -1210,22 +1210,22 @@ static int smsc911x_open(struct net_device *dev)
intcfg = ((10 << 24) | INT_CFG_IRQ_EN_);
if (pdata->config.irq_polarity) {
- SMSC_TRACE(IFUP, "irq polarity: active high");
+ SMSC_TRACE(pdata, ifup, "irq polarity: active high");
intcfg |= INT_CFG_IRQ_POL_;
} else {
- SMSC_TRACE(IFUP, "irq polarity: active low");
+ SMSC_TRACE(pdata, ifup, "irq polarity: active low");
}
if (pdata->config.irq_type) {
- SMSC_TRACE(IFUP, "irq type: push-pull");
+ SMSC_TRACE(pdata, ifup, "irq type: push-pull");
intcfg |= INT_CFG_IRQ_TYPE_;
} else {
- SMSC_TRACE(IFUP, "irq type: open drain");
+ SMSC_TRACE(pdata, ifup, "irq type: open drain");
}
smsc911x_reg_write(pdata, INT_CFG, intcfg);
- SMSC_TRACE(IFUP, "Testing irq handler using IRQ %d", dev->irq);
+ SMSC_TRACE(pdata, ifup, "Testing irq handler using IRQ %d", dev->irq);
pdata->software_irq_signal = 0;
smp_wmb();
@@ -1241,14 +1241,15 @@ static int smsc911x_open(struct net_device *dev)
}
if (!pdata->software_irq_signal) {
- dev_warn(&dev->dev, "ISR failed signaling test (IRQ %d)\n",
- dev->irq);
+ netdev_warn(dev, "ISR failed signaling test (IRQ %d)\n",
+ dev->irq);
return -ENODEV;
}
- SMSC_TRACE(IFUP, "IRQ handler passed test using IRQ %d", dev->irq);
+ SMSC_TRACE(pdata, ifup, "IRQ handler passed test using IRQ %d",
+ dev->irq);
- dev_info(&dev->dev, "SMSC911x/921x identified at %#08lx, IRQ: %d\n",
- (unsigned long)pdata->ioaddr, dev->irq);
+ netdev_info(dev, "SMSC911x/921x identified at %#08lx, IRQ: %d\n",
+ (unsigned long)pdata->ioaddr, dev->irq);
/* Reset the last known duplex and carrier */
pdata->last_duplex = -1;
@@ -1313,7 +1314,7 @@ static int smsc911x_stop(struct net_device *dev)
if (pdata->phy_dev)
phy_stop(pdata->phy_dev);
- SMSC_TRACE(IFDOWN, "Interface stopped");
+ SMSC_TRACE(pdata, ifdown, "Interface stopped");
return 0;
}
@@ -1331,8 +1332,8 @@ static int smsc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
freespace = smsc911x_reg_read(pdata, TX_FIFO_INF) & TX_FIFO_INF_TDFREE_;
if (unlikely(freespace < TX_FIFO_LOW_THRESHOLD))
- SMSC_WARNING(TX_ERR,
- "Tx data fifo low, space available: %d", freespace);
+ SMSC_WARN(pdata, tx_err,
+ "Tx data fifo low, space available: %d", freespace);
/* Word alignment adjustment */
tx_cmd_a = (u32)((ulong)skb->data & 0x03) << 16;
@@ -1432,7 +1433,7 @@ static void smsc911x_set_multicast_list(struct net_device *dev)
* receiving data */
if (!pdata->multicast_update_pending) {
unsigned int temp;
- SMSC_TRACE(HW, "scheduling mcast update");
+ SMSC_TRACE(pdata, hw, "scheduling mcast update");
pdata->multicast_update_pending = 1;
/* Request the hardware to stop, then perform the
@@ -1474,7 +1475,7 @@ static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id)
if (unlikely(intsts & inten & INT_STS_RXSTOP_INT_)) {
/* Called when there is a multicast update scheduled and
* it is now safe to complete the update */
- SMSC_TRACE(INTR, "RX Stop interrupt");
+ SMSC_TRACE(pdata, intr, "RX Stop interrupt");
smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_);
if (pdata->multicast_update_pending)
smsc911x_rx_multicast_update_workaround(pdata);
@@ -1491,7 +1492,7 @@ static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id)
}
if (unlikely(intsts & inten & INT_STS_RXE_)) {
- SMSC_TRACE(INTR, "RX Error interrupt");
+ SMSC_TRACE(pdata, intr, "RX Error interrupt");
smsc911x_reg_write(pdata, INT_STS, INT_STS_RXE_);
serviced = IRQ_HANDLED;
}
@@ -1505,8 +1506,7 @@ static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id)
/* Schedule a NAPI poll */
__napi_schedule(&pdata->napi);
} else {
- SMSC_WARNING(RX_ERR,
- "napi_schedule_prep failed");
+ SMSC_WARN(pdata, rx_err, "napi_schedule_prep failed");
}
serviced = IRQ_HANDLED;
}
@@ -1543,7 +1543,7 @@ static int smsc911x_set_mac_address(struct net_device *dev, void *p)
smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
spin_unlock_irq(&pdata->mac_lock);
- dev_info(&dev->dev, "MAC Address: %pM\n", dev->dev_addr);
+ netdev_info(dev, "MAC Address: %pM\n", dev->dev_addr);
return 0;
}
@@ -1649,9 +1649,9 @@ static int smsc911x_eeprom_send_cmd(struct smsc911x_data *pdata, u32 op)
int timeout = 100;
u32 e2cmd;
- SMSC_TRACE(DRV, "op 0x%08x", op);
+ SMSC_TRACE(pdata, drv, "op 0x%08x", op);
if (smsc911x_reg_read(pdata, E2P_CMD) & E2P_CMD_EPC_BUSY_) {
- SMSC_WARNING(DRV, "Busy at start");
+ SMSC_WARN(pdata, drv, "Busy at start");
return -EBUSY;
}
@@ -1664,12 +1664,12 @@ static int smsc911x_eeprom_send_cmd(struct smsc911x_data *pdata, u32 op)
} while ((e2cmd & E2P_CMD_EPC_BUSY_) && (--timeout));
if (!timeout) {
- SMSC_TRACE(DRV, "TIMED OUT");
+ SMSC_TRACE(pdata, drv, "TIMED OUT");
return -EAGAIN;
}
if (e2cmd & E2P_CMD_EPC_TIMEOUT_) {
- SMSC_TRACE(DRV, "Error occured during eeprom operation");
+ SMSC_TRACE(pdata, drv, "Error occured during eeprom operation");
return -EINVAL;
}
@@ -1682,7 +1682,7 @@ static int smsc911x_eeprom_read_location(struct smsc911x_data *pdata,
u32 op = E2P_CMD_EPC_CMD_READ_ | address;
int ret;
- SMSC_TRACE(DRV, "address 0x%x", address);
+ SMSC_TRACE(pdata, drv, "address 0x%x", address);
ret = smsc911x_eeprom_send_cmd(pdata, op);
if (!ret)
@@ -1698,7 +1698,7 @@ static int smsc911x_eeprom_write_location(struct smsc911x_data *pdata,
u32 temp;
int ret;
- SMSC_TRACE(DRV, "address 0x%x, data 0x%x", address, data);
+ SMSC_TRACE(pdata, drv, "address 0x%x, data 0x%x", address, data);
ret = smsc911x_eeprom_send_cmd(pdata, op);
if (!ret) {
@@ -1811,25 +1811,25 @@ static int __devinit smsc911x_init(struct net_device *dev)
struct smsc911x_data *pdata = netdev_priv(dev);
unsigned int byte_test;
- SMSC_TRACE(PROBE, "Driver Parameters:");
- SMSC_TRACE(PROBE, "LAN base: 0x%08lX",
- (unsigned long)pdata->ioaddr);
- SMSC_TRACE(PROBE, "IRQ: %d", dev->irq);
- SMSC_TRACE(PROBE, "PHY will be autodetected.");
+ SMSC_TRACE(pdata, probe, "Driver Parameters:");
+ SMSC_TRACE(pdata, probe, "LAN base: 0x%08lX",
+ (unsigned long)pdata->ioaddr);
+ SMSC_TRACE(pdata, probe, "IRQ: %d", dev->irq);
+ SMSC_TRACE(pdata, probe, "PHY will be autodetected.");
spin_lock_init(&pdata->dev_lock);
if (pdata->ioaddr == 0) {
- SMSC_WARNING(PROBE, "pdata->ioaddr: 0x00000000");
+ SMSC_WARN(pdata, probe, "pdata->ioaddr: 0x00000000");
return -ENODEV;
}
/* Check byte ordering */
byte_test = smsc911x_reg_read(pdata, BYTE_TEST);
- SMSC_TRACE(PROBE, "BYTE_TEST: 0x%08X", byte_test);
+ SMSC_TRACE(pdata, probe, "BYTE_TEST: 0x%08X", byte_test);
if (byte_test == 0x43218765) {
- SMSC_TRACE(PROBE, "BYTE_TEST looks swapped, "
- "applying WORD_SWAP");
+ SMSC_TRACE(pdata, probe, "BYTE_TEST looks swapped, "
+ "applying WORD_SWAP");
smsc911x_reg_write(pdata, WORD_SWAP, 0xffffffff);
/* 1 dummy read of BYTE_TEST is needed after a write to
@@ -1840,12 +1840,13 @@ static int __devinit smsc911x_init(struct net_device *dev)
}
if (byte_test != 0x87654321) {
- SMSC_WARNING(DRV, "BYTE_TEST: 0x%08X", byte_test);
+ SMSC_WARN(pdata, drv, "BYTE_TEST: 0x%08X", byte_test);
if (((byte_test >> 16) & 0xFFFF) == (byte_test & 0xFFFF)) {
- SMSC_WARNING(PROBE,
- "top 16 bits equal to bottom 16 bits");
- SMSC_TRACE(PROBE, "This may mean the chip is set "
- "for 32 bit while the bus is reading 16 bit");
+ SMSC_WARN(pdata, probe,
+ "top 16 bits equal to bottom 16 bits");
+ SMSC_TRACE(pdata, probe,
+ "This may mean the chip is set "
+ "for 32 bit while the bus is reading 16 bit");
}
return -ENODEV;
}
@@ -1880,17 +1881,18 @@ static int __devinit smsc911x_init(struct net_device *dev)
break;
default:
- SMSC_WARNING(PROBE, "LAN911x not identified, idrev: 0x%08X",
- pdata->idrev);
+ SMSC_WARN(pdata, probe, "LAN911x not identified, idrev: 0x%08X",
+ pdata->idrev);
return -ENODEV;
}
- SMSC_TRACE(PROBE, "LAN911x identified, idrev: 0x%08X, generation: %d",
- pdata->idrev, pdata->generation);
+ SMSC_TRACE(pdata, probe,
+ "LAN911x identified, idrev: 0x%08X, generation: %d",
+ pdata->idrev, pdata->generation);
if (pdata->generation == 0)
- SMSC_WARNING(PROBE,
- "This driver is not intended for this chip revision");
+ SMSC_WARN(pdata, probe,
+ "This driver is not intended for this chip revision");
/* workaround for platforms without an eeprom, where the mac address
* is stored elsewhere and set by the bootloader. This saves the
@@ -1927,7 +1929,7 @@ static int __devexit smsc911x_drv_remove(struct platform_device *pdev)
BUG_ON(!pdata->ioaddr);
BUG_ON(!pdata->phy_dev);
- SMSC_TRACE(IFDOWN, "Stopping driver.");
+ SMSC_TRACE(pdata, ifdown, "Stopping driver");
phy_disconnect(pdata->phy_dev);
pdata->phy_dev = NULL;
@@ -1961,11 +1963,11 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
int res_size, irq_flags;
int retval;
- pr_info("%s: Driver version %s.\n", SMSC_CHIPNAME, SMSC_DRV_VERSION);
+ pr_info("Driver version %s\n", SMSC_DRV_VERSION);
/* platform data specifies irq & dynamic bus configuration */
if (!pdev->dev.platform_data) {
- pr_warning("%s: platform_data not provided\n", SMSC_CHIPNAME);
+ pr_warn("platform_data not provided\n");
retval = -ENODEV;
goto out_0;
}
@@ -1975,8 +1977,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
if (!res)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
- pr_warning("%s: Could not allocate resource.\n",
- SMSC_CHIPNAME);
+ pr_warn("Could not allocate resource\n");
retval = -ENODEV;
goto out_0;
}
@@ -1984,8 +1985,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!irq_res) {
- pr_warning("%s: Could not allocate irq resource.\n",
- SMSC_CHIPNAME);
+ pr_warn("Could not allocate irq resource\n");
retval = -ENODEV;
goto out_0;
}
@@ -1997,7 +1997,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
dev = alloc_etherdev(sizeof(struct smsc911x_data));
if (!dev) {
- pr_warning("%s: Could not allocate device.\n", SMSC_CHIPNAME);
+ pr_warn("Could not allocate device\n");
retval = -ENOMEM;
goto out_release_io_1;
}
@@ -2017,8 +2017,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
pdata->msg_enable = ((1 << debug) - 1);
if (pdata->ioaddr == NULL) {
- SMSC_WARNING(PROBE,
- "Error smsc911x base address invalid");
+ SMSC_WARN(pdata, probe, "Error smsc911x base address invalid");
retval = -ENOMEM;
goto out_free_netdev_2;
}
@@ -2043,8 +2042,8 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
retval = request_irq(dev->irq, smsc911x_irqhandler,
irq_flags | IRQF_SHARED, dev->name, dev);
if (retval) {
- SMSC_WARNING(PROBE,
- "Unable to claim requested irq: %d", dev->irq);
+ SMSC_WARN(pdata, probe,
+ "Unable to claim requested irq: %d", dev->irq);
goto out_unmap_io_3;
}
@@ -2052,19 +2051,18 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
retval = register_netdev(dev);
if (retval) {
- SMSC_WARNING(PROBE,
- "Error %i registering device", retval);
+ SMSC_WARN(pdata, probe, "Error %i registering device", retval);
goto out_unset_drvdata_4;
} else {
- SMSC_TRACE(PROBE, "Network interface: \"%s\"", dev->name);
+ SMSC_TRACE(pdata, probe,
+ "Network interface: \"%s\"", dev->name);
}
spin_lock_init(&pdata->mac_lock);
retval = smsc911x_mii_init(pdev, dev);
if (retval) {
- SMSC_WARNING(PROBE,
- "Error %i initialising mii", retval);
+ SMSC_WARN(pdata, probe, "Error %i initialising mii", retval);
goto out_unregister_netdev_5;
}
@@ -2073,10 +2071,12 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
/* Check if mac address has been specified when bringing interface up */
if (is_valid_ether_addr(dev->dev_addr)) {
smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
- SMSC_TRACE(PROBE, "MAC Address is specified by configuration");
+ SMSC_TRACE(pdata, probe,
+ "MAC Address is specified by configuration");
} else if (is_valid_ether_addr(pdata->config.mac)) {
memcpy(dev->dev_addr, pdata->config.mac, 6);
- SMSC_TRACE(PROBE, "MAC Address specified by platform data");
+ SMSC_TRACE(pdata, probe,
+ "MAC Address specified by platform data");
} else {
/* Try reading mac address from device. if EEPROM is present
* it will already have been set */
@@ -2084,20 +2084,20 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
if (is_valid_ether_addr(dev->dev_addr)) {
/* eeprom values are valid so use them */
- SMSC_TRACE(PROBE,
- "Mac Address is read from LAN911x EEPROM");
+ SMSC_TRACE(pdata, probe,
+ "Mac Address is read from LAN911x EEPROM");
} else {
/* eeprom values are invalid, generate random MAC */
random_ether_addr(dev->dev_addr);
smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
- SMSC_TRACE(PROBE,
- "MAC Address is set to random_ether_addr");
+ SMSC_TRACE(pdata, probe,
+ "MAC Address is set to random_ether_addr");
}
}
spin_unlock_irq(&pdata->mac_lock);
- dev_info(&dev->dev, "MAC Address: %pM\n", dev->dev_addr);
+ netdev_info(dev, "MAC Address: %pM\n", dev->dev_addr);
return 0;
diff --git a/drivers/net/smsc911x.h b/drivers/net/smsc911x.h
index 50f712e..8d67aac 100644
--- a/drivers/net/smsc911x.h
+++ b/drivers/net/smsc911x.h
@@ -33,25 +33,21 @@
* can be successfully looped back */
#define USE_PHY_WORK_AROUND
-#define DPRINTK(nlevel, klevel, fmt, args...) \
- ((void)((NETIF_MSG_##nlevel & pdata->msg_enable) && \
- printk(KERN_##klevel "%s: %s: " fmt "\n", \
- pdata->dev->name, __func__, ## args)))
-
#if USE_DEBUG >= 1
-#define SMSC_WARNING(nlevel, fmt, args...) \
- DPRINTK(nlevel, WARNING, fmt, ## args)
+#define SMSC_WARN(pdata, nlevel, fmt, args...) \
+ netif_warn(pdata, nlevel, (pdata)->dev, \
+ "%s: " fmt "\n", __func__, ##args)
#else
-#define SMSC_WARNING(nlevel, fmt, args...) \
- ({ do {} while (0); 0; })
+#define SMSC_WARN(pdata, nlevel, fmt, args...) \
+ no_printk(fmt "\n", ##args)
#endif
#if USE_DEBUG >= 2
-#define SMSC_TRACE(nlevel, fmt, args...) \
- DPRINTK(nlevel, INFO, fmt, ## args)
+#define SMSC_TRACE(pdata, nlevel, fmt, args...) \
+ netif_info(pdata, nlevel, pdata->dev, fmt "\n", ##args)
#else
-#define SMSC_TRACE(nlevel, fmt, args...) \
- ({ do {} while (0); 0; })
+#define SMSC_TRACE(pdata, nlevel, fmt, args...) \
+ no_printk(fmt "\n", ##args)
#endif
#ifdef CONFIG_DEBUG_SPINLOCK
^ permalink raw reply related
* Re: [PATCH 2/2] socket: add minimum listen queue length sysctl
From: Hagen Paul Pfeifer @ 2011-03-25 23:51 UTC (permalink / raw)
To: Rick Jones; +Cc: netdev, Eric Dumazet
In-Reply-To: <1301084677.13505.26.camel@tardy>
* Rick Jones | 2011-03-25 13:24:37 [-0700]:
Hello Rick
>Well, one could LD_PRELOAD something that intercepted listen() calls no?
Noes, for dynamically linked programs yes, for statically linked ones no.
Furthermore, for distribution shipped programs an administrator would not
alter the init script or something. Editing /etc/sysctl.conf is as simple
as ...
>Is there already a similar minimum the admin can configure when the
>applications makes "too small" an explicit setsockopt() call against
>SO_SNDBUF or SO_RCVBUF?
net.ipv4.tcp_rmem, net.ipv4.tcp_mem, net.core.rmem_default, ...?
IMHO, _if_ a programmer modifies the send or receive buffer he _knows_ exactly
why. If he does not modify the buffer it is fine too, because _we_ tune the
buffers as good as we can - and we are good in this.
But, the backlog is different. Often the programmer does _not_ know how to
tune this variable. And, often the backlog depends on the target system, on
the network characteristic and the like.
Therefore we provide the system administrator the _ability_ to tune the actual
backlog.
Hagen
^ permalink raw reply
* [PATCH] ipv4: do not ignore route errors
From: Julian Anastasov @ 2011-03-25 23:45 UTC (permalink / raw)
To: David Miller; +Cc: netdev
The "ipv4: Inline fib_semantic_match into check_leaf"
change forgets to return the route errors. check_leaf should
return the same results as fib_table_lookup.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
---
net/ipv4/fib_trie.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff -urp net-2.6-fcd13f4/linux/net/ipv4/fib_trie.c linux/net/ipv4/fib_trie.c
--- net-2.6-fcd13f4/linux/net/ipv4/fib_trie.c 2011-03-25 22:33:44.000000000 +0200
+++ linux/net/ipv4/fib_trie.c 2011-03-26 01:37:15.027383449 +0200
@@ -1365,9 +1365,9 @@ static int check_leaf(struct fib_table *
err = fib_props[fa->fa_type].error;
if (err) {
#ifdef CONFIG_IP_FIB_TRIE_STATS
- t->stats.semantic_match_miss++;
+ t->stats.semantic_match_passed++;
#endif
- return 1;
+ return err;
}
if (fi->fib_flags & RTNH_F_DEAD)
continue;
^ permalink raw reply
* Re: [PATCH 0/2] Fix nh_saddr caching.
From: Julian Anastasov @ 2011-03-25 23:30 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20110324.181413.173844730.davem@davemloft.net>
Hello,
On Thu, 24 Mar 2011, David Miller wrote:
> Julian, the following two patches should take all of the
> issues we discovered the other week wrt. nh_saddr caching.
>
> First, we use a generation ID to invalidate cache nh_saddr
> settings any time a device goes up or an IP address is
> added/removed.
>
> Second, we move fa_scope up to fib_info->fib_scope, so that
> we always use the correct scope when computing the cached
> nh_saddr.
>
> Please review this carefully as this is delicate code.
Looks very good. I checked the tree to make sure that
FIB_RES_PREFSRC, FIB_RES_DEV and fib_info_update_nh_saddr are
called only for res after successful fib_lookup. Even
fib_create_info calls fib_info_update_nh_saddr at a place
where nh_dev != NULL.
Only one thing: as the preferred addresses can be used
even if they are configured on downed interface there is no
gain to increase dev_addr_genid in fib_netdev_event(). If there are
address changes while some device is down all nh_saddr_genid
values for the downed device will be outdated because there is
no traffic that can refresh the nh_saddr.
Tests revealed unrelated problem in fib_trie, preparing
separate patch...
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply
* Re: disabling ipv6 (when ipv6 module is already loaded or built in)
From: David Miller @ 2011-03-25 22:56 UTC (permalink / raw)
To: a.miskiewicz; +Cc: brian.haley, netdev
In-Reply-To: <201103252353.06297.a.miskiewicz@gmail.com>
From: Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>
Date: Fri, 25 Mar 2011 23:53:06 +0100
> The whole problem is that socket(AF_INET6,...) is allowed. If setting
> net.ipv6.conf.all.disable_ipv6=1 would also prevent such socket() from
> succeeding then everything would be fine.
You have to make this setting before the module loads, once we register
the protocol handlers (which is what allows socket() to succeed) the
cat is out of the bag.
If even just one socket exists, we can't perform the steps necessary
to block new ones.
That's why you have to use the module option, and it is the only way
to block this class of operations.
^ permalink raw reply
* Re: disabling ipv6 (when ipv6 module is already loaded or built in)
From: Arkadiusz Miskiewicz @ 2011-03-25 22:53 UTC (permalink / raw)
To: Brian Haley; +Cc: netdev
In-Reply-To: <4D8CF970.7020601@hp.com>
On Friday 25 of March 2011, Brian Haley wrote:
> On 03/25/2011 01:17 PM, Arkadiusz Miskiewicz wrote:
> > Hi,
> >
> > There are two options for disabling some ipv6 functionality in ipv6
> > module - disable and disable_ipv6. The second option is also available
> > as sysctl and can be switched runtime.
> >
> > First is nicer because it also prevents apps from creating sockets by
> > using socket(AF_INET6, ...). Various apps use AF_INET6 socket creation
> > to deterine if ipv6 is supported on the system. Unfortunately "disable"
> > one doesn't exist as sysctl and this is a problem.
> >
> > Is it possible to make "disable" sysctl option, too? Currently there is
> > no runtime way to disable ipv6 (or I'm unaware of such way).
>
> Not really, the module parameter causes IPv6 to be loaded just enough to
> allow other modules that rely on it to load, but it never registers
> any of the protocol handlers, sysctls, tables, etc. to make it usable.
> And the IPv6 module isn't unloadable, so you have to reboot to change
> this setting.
>
> When there are no addresses it's not very usable since you can't send
> out packets...
The whole problem is that socket(AF_INET6,...) is allowed. If setting
net.ipv6.conf.all.disable_ipv6=1 would also prevent such socket() from
succeeding then everything would be fine.
> -Brian
--
Arkadiusz Miśkiewicz PLD/Linux Team
arekm / maven.pl http://ftp.pld-linux.org/
^ permalink raw reply
* Re: [PATCH] net: allow shifted address in smsc911x
From: Ben Hutchings @ 2011-03-25 21:46 UTC (permalink / raw)
To: mathieu.poirier
Cc: steve.glendinning, netdev, lee.jones, patches, linus.walleij
In-Reply-To: <1301088437-31915-1-git-send-email-mathieu.poirier@linaro.org>
On Fri, 2011-03-25 at 15:27 -0600, mathieu.poirier@linaro.org wrote:
> From: Alessandro Rubini <rubini@gnudd.com>
>
> At least one device I'm using needs address shifting to access
> registers in the LAN9221 device (smsc911x driver). This patch
> adds a shift parameter in platform_data. The feature must be
> enabled at configuration time, because shifting by a pdata
> parameter makes access slower in those devices where no shift is
> needed (I tested one, it was 20% slower).
[...]
I guess you are using 16-bit registers, so that FIFO access involves
calling smsc911x_reg_{read,write}() in a loop. And the compiler
probably can't hoist the address calculation out of the loop due to
potential aliasing between the register lock and the platform data (yes,
really).
Try calculating the FIFO address in a local variable at the top of
smsc911x_tx_writefifo() and smsc911x_rx_readfifo() and then using that
variable in the calls to smsc911x_reg_{read,write}().
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH] net: allow shifted address in smsc911x
From: David Miller @ 2011-03-25 21:31 UTC (permalink / raw)
To: mathieu.poirier
Cc: steve.glendinning, netdev, lee.jones, patches, linus.walleij
In-Reply-To: <1301088437-31915-1-git-send-email-mathieu.poirier@linaro.org>
From: mathieu.poirier@linaro.org
Date: Fri, 25 Mar 2011 15:27:17 -0600
> From: Alessandro Rubini <rubini@gnudd.com>
>
> At least one device I'm using needs address shifting to access
> registers in the LAN9221 device (smsc911x driver). This patch
> adds a shift parameter in platform_data. The feature must be
> enabled at configuration time, because shifting by a pdata
> parameter makes access slower in those devices where no shift is
> needed (I tested one, it was 20% slower).
>
> If the platform data requests shifted access but the feature is
> unavailable, the probe method complains to the console. Board
> config files should set the configuration option when needed.
>
> Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Implement this at run time, keying off of a boolean or similar
in the platform data.
Implement a set of ops, one to do a PIO read one to do a PIO write,
and choose the set of ops appropriate for the device depending upon
the setting found in the platform device.
^ permalink raw reply
* [PATCH] net: allow shifted address in smsc911x
From: mathieu.poirier @ 2011-03-25 21:27 UTC (permalink / raw)
To: steve.glendinning
Cc: netdev, lee.jones, patches, linus.walleij, mathieu.poirier
From: Alessandro Rubini <rubini@gnudd.com>
At least one device I'm using needs address shifting to access
registers in the LAN9221 device (smsc911x driver). This patch
adds a shift parameter in platform_data. The feature must be
enabled at configuration time, because shifting by a pdata
parameter makes access slower in those devices where no shift is
needed (I tested one, it was 20% slower).
If the platform data requests shifted access but the feature is
unavailable, the probe method complains to the console. Board
config files should set the configuration option when needed.
Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
drivers/net/Kconfig | 10 ++++++++++
drivers/net/smsc911x.c | 37 +++++++++++++++++++++++++++++--------
include/linux/smsc911x.h | 1 +
3 files changed, 40 insertions(+), 8 deletions(-)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 0382332..70f2a17 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1075,6 +1075,16 @@ config SMSC911X_ARCH_HOOKS
hooks for more comprehensive interrupt control and also to override
the source of the MAC address.
+config SMSC911X_ENABLE_SHIFTED_ADDRESS
+ def_bool n
+ depends on SMSC911X
+ help
+ The option allows device registers to be accessed in a sparse
+ way. This is needed to allow boards where the address bus is
+ not wired in the usual way. You'll most like don't need this
+ option, unless your vendor-provided board configuration file
+ enables it.
+
config NET_VENDOR_RACAL
bool "Racal-Interlan (Micom) NI cards"
depends on ISA
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index d70bde9..67fb5d6 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -69,6 +69,13 @@ static int debug = 3;
module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
+/* Shift value is uncommon and makes things slower: if not selected, force 0 */
+#ifdef CONFIG_SMSC911X_ENABLE_SHIFTED_ADDRESS
+#define __smsc_shift(pdata, reg) ((reg) << ((pdata)->config.shift))
+#else
+#define __smsc_shift(pdata, reg) (reg)
+#endif
+
struct smsc911x_data {
void __iomem *ioaddr;
@@ -121,11 +128,13 @@ struct smsc911x_data {
static inline u32 __smsc911x_reg_read(struct smsc911x_data *pdata, u32 reg)
{
if (pdata->config.flags & SMSC911X_USE_32BIT)
- return readl(pdata->ioaddr + reg);
+ return readl(pdata->ioaddr + __smsc_shift(pdata, reg));
if (pdata->config.flags & SMSC911X_USE_16BIT)
- return ((readw(pdata->ioaddr + reg) & 0xFFFF) |
- ((readw(pdata->ioaddr + reg + 2) & 0xFFFF) << 16));
+ return ((readw(pdata->ioaddr +
+ __smsc_shift(pdata, reg)) & 0xFFFF) |
+ ((readw(pdata->ioaddr +
+ __smsc_shift(pdata, reg + 2)) & 0xFFFF) << 16));
BUG();
return 0;
@@ -147,13 +156,15 @@ static inline void __smsc911x_reg_write(struct smsc911x_data *pdata, u32 reg,
u32 val)
{
if (pdata->config.flags & SMSC911X_USE_32BIT) {
- writel(val, pdata->ioaddr + reg);
+ writel(val, pdata->ioaddr + __smsc_shift(pdata, reg));
return;
}
if (pdata->config.flags & SMSC911X_USE_16BIT) {
- writew(val & 0xFFFF, pdata->ioaddr + reg);
- writew((val >> 16) & 0xFFFF, pdata->ioaddr + reg + 2);
+ writew(val & 0xFFFF,
+ pdata->ioaddr + __smsc_shift(pdata, reg));
+ writew((val >> 16) & 0xFFFF,
+ pdata->ioaddr + __smsc_shift(pdata, reg + 2));
return;
}
@@ -187,7 +198,8 @@ smsc911x_tx_writefifo(struct smsc911x_data *pdata, unsigned int *buf,
}
if (pdata->config.flags & SMSC911X_USE_32BIT) {
- writesl(pdata->ioaddr + TX_DATA_FIFO, buf, wordcount);
+ writesl(pdata->ioaddr + __smsc_shift(pdata, TX_DATA_FIFO),
+ buf, wordcount);
goto out;
}
@@ -219,7 +231,8 @@ smsc911x_rx_readfifo(struct smsc911x_data *pdata, unsigned int *buf,
}
if (pdata->config.flags & SMSC911X_USE_32BIT) {
- readsl(pdata->ioaddr + RX_DATA_FIFO, buf, wordcount);
+ readsl(pdata->ioaddr + __smsc_shift(pdata, RX_DATA_FIFO),
+ buf, wordcount);
goto out;
}
@@ -2023,6 +2036,14 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
goto out_free_netdev_2;
}
+ /* If platform data wants a shifted address bus, we must support it */
+ if (pdata->config.shift && __smsc_shift(pdata, 1) == 1) {
+ pr_err("smsc911x: CONFIG_SMSC911X_ENABLE_SHIFTED_ADDRESS"
+ " is required but not available\n");
+ retval = -EINVAL;
+ goto out_unmap_io_3;
+ }
+
retval = smsc911x_init(dev);
if (retval < 0)
goto out_unmap_io_3;
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
index 7144e8a..ea9a8c5 100644
--- a/include/linux/smsc911x.h
+++ b/include/linux/smsc911x.h
@@ -29,6 +29,7 @@ struct smsc911x_platform_config {
unsigned int irq_polarity;
unsigned int irq_type;
unsigned int flags;
+ unsigned int shift; /* used if CONFIG_SMSC911X_ENABLE_SHIFTED_ADDRESS */
phy_interface_t phy_interface;
unsigned char mac[6];
};
--
1.7.1
^ permalink raw reply related
* Re: [RFC] Inconsistency in MDIO ioctl behaviour
From: Ben Hutchings @ 2011-03-25 21:07 UTC (permalink / raw)
To: netdev
In-Reply-To: <1252011886.2781.45.camel@achroite>
On Thu, 2009-09-03 at 22:04 +0100, Ben Hutchings wrote:
> While comparing the various implementations of SIOC{G,S}MIIREG and
> SIOCGMIIPHY, I found some differences in behaviour that could make some
> applications unreliable across different drivers.
...and I just got round to looking at this again.
> 1. Implementations of SIOCGMIIPHY must set phy_id to the PHY's MDIO
> address (PRTAD) or to a dummy address if there is no real MDIO bus.
> Many implementations, including the generic ones (mii, phylib,
> pci-skeleton and now mdio) then proceed as for SIOCGMIIPHY. Others
> return without accessing any registers. Which behaviour is right?
With a Google Code Search for SIOCGMIIPHY I found only one program that
assumes SIOCGMIIPHY reads a register. That is mii-diag, which in
verbose mode prints val_out as the BMCR value, and since reg_num is
statically zero-initialised this works for many implementations. For
all subsequent register reads, it uses SIOCGMIIREG.
In these 8 drivers, SIOCGMIIPHY doesn't read a register:
atl1c, atl1e, atl2, e1000, e1000e, igb, r8169, via-velocity
and in about 90 other drivers (including users of mii, mdio and phylib)
it does. But the chips covered by the first 7 of those 8 drivers are
extremely widely used, and I expect that if anyone cared about
'mii-diag -v' or another utility with the same assumption then this
would have been reported to netdev repeatedly.
I'm inclined to say we should drop the register read from SIOCGMIIPHY
from the common implementations and pci-skeleton.c.
> 2. Implementations of SIOC{G,S}MIIREG that do not support access to
> arbitary MDIO addresses handle non-matching values of phy_id in at least
> three different ways:
> (a) ignore it and always use the expected PHY address
> (b) ignore writes and return a dummy value for reads
> (c) fail
> I favour behaviour (c) but I'm not sure what the error code should be.
> ENODEV, EINVAL or EIO?
I think ENODEV should be reserved for 'network device does not exist',
and EIO for a failure in I/O to hardware that we actually expect to be
there. So EINVAL it is.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [GIT] Networking
From: David Miller @ 2011-03-25 21:02 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
This should be the final round, and I believe all known major
regressions added by the routing rework are cured now.
1) Route insert compares metrics incorrectly, fix from Eric Dumazet.
2) Cache route source addresses need to rechecked in more circumstances,
and need to use the correct scope when they are being calculated.
With help from Julian Anastasov.
3) ip_route_newports() uses the wrong source and destination addresses
in lookup key. Fix from Steffen Klassert.
4) Fix race in qdisc throttling, from Eric Dumazet.
5) Fix rmmod crash in myri10ge, NAPI instances are not deleted. From
Stanislaw Gruszka.
6) Bonding rx_handle locking still allows races, fix from Jiri Pirko.
7) mlx4 driver updates from Yevgeny Petrilin.
8) iwlwifi forgets mutex unlock on error, from Dan Carpenter.
9) orinoco needs to hold scan_lock over a larger section of code, from
Joe Gunn.
10) Add some device IDs to rt2x00 wireless driver. From Peter Lemenkov.
11) rtlwifi uses wrong memset() arg order, fix from Ilia Mirkin.
12) Fix panic on AR2427 ath9k chips when connecting with AP, from
Mohammed Shafi Shajakhan.
13) When an IP address is assigned multiple times to an interface,
using different prefixes, we sometimes leave stale subnet routes
in the routing table when those addresses are deleted. Fix from
Julian Anastasov.
14) Bridge ipv6 multicast code needs to set destination address before
using it. Fix from Linus Lüssing.
15) TCP moderates congestion window during undo when it need not do
so, since undo means that recovery was false. Fix from Yuchung
Cheng.
16) __ip_dev_find() needs to handle to obscure case of allowing any
IP address on a loopback device subnet, fix by adding fallback
code which searches the local FIB table when an explicit device
address is not found in the hash table.
17) ip_rt_update_pmtu() does one too many inet_putpeer()'s resulting
in memory corruption and other problems. Fix from Eric Dumazet.
Please pull, thanks a lot!
The following changes since commit 40471856f2e38e9bfa8d605295e8234421110dd6:
Merge branch 'nfs-for-2.6.39' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6 (2011-03-25 10:03:28 -0700)
are available in the git repository at:
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git master
Dan Carpenter (1):
iwlwifi: missing unlock on error path
David S. Miller (7):
Merge branch 'master' of git://git.kernel.org/.../linville/wireless-2.6
tcp: Make undo_ssthresh arg to tcp_undo_cwr() a bool.
ipv4: Fallback to FIB local table in __ip_dev_find().
Merge branch 'sfc-2.6.39' of git://git.kernel.org/.../bwh/sfc-2.6
Merge branch 'master' of git://git.kernel.org/.../linville/wireless-2.6
ipv4: Invalidate nexthop cache nh_saddr more correctly.
ipv4: Fix nexthop caching wrt. scoping.
Eli Cohen (3):
mlx4: Add blue flame support for kernel consumers
mlx4_core: maintain available field in bitmap allocator
mlx4_core: reserve UARs for userspace consumers
Eric Dumazet (3):
ipv4: fix ip_rt_update_pmtu()
net_sched: fix THROTTLED/RUNNING race
ipv4: fix fib metrics
Felix Fietkau (1):
mac80211: initialize sta->last_rx in sta_info_alloc
Florian Westphal (1):
ipv6: ip6_route_output does not modify sk parameter, so make it const
Ilia Mirkin (1):
rtlwifi: Fix memset argument order
Jiri Pirko (1):
bonding: fix rx_handler locking
Joe Gunn (1):
orinoco: Maintain lock until entry removed from list
Johannes Berg (1):
iwlagn: fix error in command waiting
Julia Lawall (2):
drivers/net/ariadne.c: Convert release_resource to release_region/release_mem_region
drivers/net/a2065.c: Convert release_resource to release_region/release_mem_region
Julian Anastasov (4):
ipv4: match prefsrc when deleting routes
ipv4: fix route deletion for IPs on many subnets
ipv4: remove the routes on secondary promotion
ipv4: optimize route adding on secondary promotion
Linus Lüssing (1):
bridge: Fix possibly wrong MLD queries' ethernet source address
Marc Zyngier (1):
NET: smsc95xx: don't use stack for async writes to the device
Michał Mirosław (1):
net: implement dev_disable_lro() hw_features compatibility
Mohammed Shafi Shajakhan (1):
ath9k: Fix kernel panic in AR2427
Peter Lemenkov (4):
rt2x00: Add rt2870 device id
rt2x00: Add Planex Communications, Inc. RT8070
rt2x00: Add 2L Central Europe BV 8070
rt2x00: Add unknown Toshiba device
Randy Dunlap (2):
wireless: fix 80211 kernel-doc warnings
net: fix pch_gbe section mismatch warning
Senthil Balasubramanian (2):
ath9k: Fix kernel panic caused by invalid rate index access.
ath9k: Fix TX queue stuck issue.
Sriram (1):
net: davinci_emac:Fix translation logic for buffer descriptor
Stanislaw Gruszka (1):
myri10ge: fix rmmod crash
Steffen Klassert (1):
route: Take the right src and dst addresses in ip_route_newports
Steve Hodgson (1):
sfc: Siena: Disable write-combining when SR-IOV is enabled
Tõnu Samuel (1):
zd1211rw: TrendNet TEW-509UB id added
Yevgeny Petrilin (14):
mlx4_en: going out of range of TX rings when reporting stats
mlx4_en: moderation parameters are not reseted.
mlx4_en: optimize adaptive moderation algorithm for better latency
mlx4_en: bringing link up when registering netdevice
mlx4: Changing interrupt scheme
mlx4_en: using new mlx4 interrupt scheme
mlx4: Wake on LAN support
mlx4_en: Reporting HW revision in ethtool -i
mlx4: generalization of multicast steering.
mlx4: Add support for promiscuous mode in the new steering model.
mlx4_en: Enabling new steering
mlx4_en: Using blue flame support
mlx4_en: updated driver version to 1.5.4.1
mlx4_en: Removing HW info from ethtool -i report.
Yuchung Cheng (1):
tcp: avoid cwnd moderation in undo
armadefuego@gmail.com (1):
orinoco: Clear dangling pointer on hardware busy
drivers/infiniband/hw/mlx4/main.c | 11 +-
drivers/net/a2065.c | 10 +-
drivers/net/ariadne.c | 10 +-
drivers/net/bonding/bond_main.c | 56 ++--
drivers/net/bonding/bonding.h | 1 +
drivers/net/davinci_cpdma.c | 11 +-
drivers/net/davinci_cpdma.h | 1 +
drivers/net/davinci_emac.c | 5 +-
drivers/net/mlx4/alloc.c | 13 +
drivers/net/mlx4/cq.c | 2 +-
drivers/net/mlx4/en_cq.c | 38 ++-
drivers/net/mlx4/en_ethtool.c | 66 +++-
drivers/net/mlx4/en_main.c | 22 +-
drivers/net/mlx4/en_netdev.c | 199 +++++++--
drivers/net/mlx4/en_port.c | 13 +-
drivers/net/mlx4/en_port.h | 19 +-
drivers/net/mlx4/en_rx.c | 11 +-
drivers/net/mlx4/en_tx.c | 72 +++-
drivers/net/mlx4/eq.c | 107 +++++-
drivers/net/mlx4/fw.c | 25 ++
drivers/net/mlx4/fw.h | 3 +
drivers/net/mlx4/main.c | 119 +++++-
drivers/net/mlx4/mcg.c | 646 ++++++++++++++++++++++++++--
drivers/net/mlx4/mlx4.h | 50 +++
drivers/net/mlx4/mlx4_en.h | 27 +-
drivers/net/mlx4/pd.c | 102 +++++
drivers/net/mlx4/port.c | 165 +++++++-
drivers/net/mlx4/profile.c | 4 +-
drivers/net/myri10ge/myri10ge.c | 1 +
drivers/net/pch_gbe/pch_gbe_main.c | 6 +-
drivers/net/sfc/efx.c | 18 +-
drivers/net/sfc/workarounds.h | 2 +
drivers/net/usb/smsc95xx.c | 17 +-
drivers/net/wireless/ath/ath9k/main.c | 2 +
drivers/net/wireless/ath/ath9k/rc.c | 2 +-
drivers/net/wireless/ath/ath9k/xmit.c | 4 +-
drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-agn.c | 7 +-
drivers/net/wireless/orinoco/cfg.c | 3 +
drivers/net/wireless/orinoco/main.c | 2 +-
drivers/net/wireless/rt2x00/rt2800usb.c | 7 +-
drivers/net/wireless/rtlwifi/efuse.c | 31 +-
drivers/net/wireless/zd1211rw/zd_usb.c | 1 +
include/linux/davinci_emac.h | 1 +
include/linux/ethtool.h | 3 +
include/linux/mlx4/device.h | 51 ++-
include/linux/mlx4/qp.h | 1 +
include/net/cfg80211.h | 3 +-
include/net/ip6_route.h | 2 +-
include/net/ip_fib.h | 18 +-
include/net/mac80211.h | 2 +-
include/net/netns/ipv4.h | 1 +
include/net/route.h | 5 +-
include/net/sch_generic.h | 8 +-
net/bridge/br_multicast.c | 2 +-
net/core/dev.c | 19 +-
net/core/ethtool.c | 2 +-
net/ipv4/devinet.c | 30 ++-
net/ipv4/fib_frontend.c | 112 ++++-
net/ipv4/fib_lookup.h | 3 +-
net/ipv4/fib_semantics.c | 47 +--
net/ipv4/fib_trie.c | 14 +-
net/ipv4/route.c | 8 +-
net/ipv4/tcp_input.c | 22 +-
net/ipv6/route.c | 2 +-
net/mac80211/sta_info.c | 1 +
66 files changed, 1906 insertions(+), 364 deletions(-)
^ permalink raw reply
* Re: [PATCH 2/2] socket: add minimum listen queue length sysctl
From: Rick Jones @ 2011-03-25 20:24 UTC (permalink / raw)
To: Hagen Paul Pfeifer; +Cc: netdev, Eric Dumazet
In-Reply-To: <1301077899-16482-2-git-send-email-hagen@jauu.net>
On Fri, 2011-03-25 at 19:31 +0100, Hagen Paul Pfeifer wrote:
> In the case that a server programmer misjudge network characteristic the
> backlog parameter for listen(2) may not adequate to utilize hosts
> capabilities and lead to unrequired SYN retransmission - thus a
> underestimated backlog value can form an artificial limitation.
>
> A listen queue length of 8 is often a way to small, but several
> server authors does not about know this limitation (from Erics server
> setup):
>
> ss -a | head
> State Recv-Q Send-Q Local Address:Port Peer
> Address:Port
> LISTEN 0 8 *:imaps *:*
> LISTEN 0 8 *:pop3s *:*
> LISTEN 0 50 *:mysql *:*
> LISTEN 0 8 *:pop3 *:*
> LISTEN 0 8 *:imap2 *:*
> LISTEN 0 511 *:www *:*
>
> Until now it was not possible for the system (network) administrator to
> increase this value. A bug report must be filled, the backlog increased,
> a new version released or even worse: if using closed source software
> you cannot make anything.
Well, one could LD_PRELOAD something that intercepted listen() calls no?
> sysctl_min_syn_backlog provides the ability to increase the minimum
> queue length.
Is there already a similar minimum the admin can configure when the
applications makes "too small" an explicit setsockopt() call against
SO_SNDBUF or SO_RCVBUF?
rick jones
^ permalink raw reply
* Re: disabling ipv6 (when ipv6 module is already loaded or built in)
From: Brian Haley @ 2011-03-25 20:22 UTC (permalink / raw)
To: Arkadiusz Miskiewicz; +Cc: netdev
In-Reply-To: <201103251817.04583.a.miskiewicz@gmail.com>
On 03/25/2011 01:17 PM, Arkadiusz Miskiewicz wrote:
>
> Hi,
>
> There are two options for disabling some ipv6 functionality in ipv6 module -
> disable and disable_ipv6. The second option is also available as sysctl and
> can be switched runtime.
>
> First is nicer because it also prevents apps from creating sockets by using
> socket(AF_INET6, ...). Various apps use AF_INET6 socket creation to deterine
> if ipv6 is supported on the system. Unfortunately "disable" one doesn't exist
> as sysctl and this is a problem.
>
> Is it possible to make "disable" sysctl option, too? Currently there is no
> runtime way to disable ipv6 (or I'm unaware of such way).
Not really, the module parameter causes IPv6 to be loaded just enough to
allow other modules that rely on it to load, but it never registers
any of the protocol handlers, sysctls, tables, etc. to make it usable.
And the IPv6 module isn't unloadable, so you have to reboot to change
this setting.
When there are no addresses it's not very usable since you can't send
out packets...
-Brian
^ permalink raw reply
* [PATCH 2/2] socket: add minimum listen queue length sysctl
From: Hagen Paul Pfeifer @ 2011-03-25 18:31 UTC (permalink / raw)
To: netdev; +Cc: Eric Dumazet
In-Reply-To: <1301077899-16482-1-git-send-email-hagen@jauu.net>
In the case that a server programmer misjudge network characteristic the
backlog parameter for listen(2) may not adequate to utilize hosts
capabilities and lead to unrequired SYN retransmission - thus a
underestimated backlog value can form an artificial limitation.
A listen queue length of 8 is often a way to small, but several
server authors does not about know this limitation (from Erics server
setup):
ss -a | head
State Recv-Q Send-Q Local Address:Port Peer
Address:Port
LISTEN 0 8 *:imaps *:*
LISTEN 0 8 *:pop3s *:*
LISTEN 0 50 *:mysql *:*
LISTEN 0 8 *:pop3 *:*
LISTEN 0 8 *:imap2 *:*
LISTEN 0 511 *:www *:*
Until now it was not possible for the system (network) administrator to
increase this value. A bug report must be filled, the backlog increased,
a new version released or even worse: if using closed source software
you cannot make anything.
sysctl_min_syn_backlog provides the ability to increase the minimum
queue length.
Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
---
include/net/request_sock.h | 1 +
net/core/request_sock.c | 6 +++++-
net/ipv4/af_inet.c | 2 +-
net/ipv4/sysctl_net_ipv4.c | 7 +++++++
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 99e6e19..3e8865f 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -89,6 +89,7 @@ static inline void reqsk_free(struct request_sock *req)
}
extern int sysctl_max_syn_backlog;
+extern int sysctl_min_syn_backlog;
/** struct listen_sock - listen state
*
diff --git a/net/core/request_sock.c b/net/core/request_sock.c
index 182236b..0e968b6 100644
--- a/net/core/request_sock.c
+++ b/net/core/request_sock.c
@@ -35,6 +35,9 @@
int sysctl_max_syn_backlog = 256;
EXPORT_SYMBOL(sysctl_max_syn_backlog);
+int sysctl_min_syn_backlog = 0;
+EXPORT_SYMBOL(sysctl_min_syn_backlog);
+
int reqsk_queue_alloc(struct request_sock_queue *queue,
unsigned int nr_table_entries)
{
@@ -42,7 +45,8 @@ int reqsk_queue_alloc(struct request_sock_queue *queue,
struct listen_sock *lopt;
nr_table_entries = min_t(u32, nr_table_entries, sysctl_max_syn_backlog);
- nr_table_entries = max_t(u32, nr_table_entries, 8);
+ nr_table_entries = max_t(u32, nr_table_entries,
+ max_t(u32, 8, sysctl_min_syn_backlog));
nr_table_entries = roundup_pow_of_two(nr_table_entries + 1);
lopt_size += nr_table_entries * sizeof(struct request_sock *);
if (lopt_size > PAGE_SIZE)
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 807d83c..c580d7c 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -213,7 +213,7 @@ int inet_listen(struct socket *sock, int backlog)
if (err)
goto out;
}
- sk->sk_max_ack_backlog = backlog;
+ sk->sk_max_ack_backlog = max_t(u32, backlog, sysctl_min_syn_backlog);
err = 0;
out:
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 1a45665..cc03c62 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -298,6 +298,13 @@ static struct ctl_table ipv4_table[] = {
.proc_handler = proc_dointvec
},
{
+ .procname = "tcp_min_syn_backlog",
+ .data = &sysctl_min_syn_backlog,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec
+ },
+ {
.procname = "ip_local_port_range",
.data = &sysctl_local_ports.range,
.maxlen = sizeof(sysctl_local_ports.range),
--
1.7.2.3
^ permalink raw reply related
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