* RE: [PATCH] [V2] Add non-Virtex5 support for LL TEMAC driver
From: John Linn @ 2010-04-05 19:52 UTC (permalink / raw)
To: David Miller, grant.likely
Cc: netdev, linuxppc-dev, jwboyer, john.williams, michal.simek,
jtyner
In-Reply-To: <20100405.121647.91426186.davem@davemloft.net>
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Monday, April 05, 2010 1:17 PM
> To: grant.likely@secretlab.ca
> Cc: netdev@vger.kernel.org; linuxppc-dev@ozlabs.org;
jwboyer@linux.vnet.ibm.com;
> john.williams@petalogix.com; michal.simek@petalogix.com;
jtyner@cs.ucr.edu; John Linn
> Subject: Re: [PATCH] [V2] Add non-Virtex5 support for LL TEMAC driver
>
> From: Grant Likely <grant.likely@secretlab.ca>
> Date: Mon, 5 Apr 2010 12:10:51 -0600
>
> > David, are you going to pick up this patch, or would you like me to?
>
> The submitter, when asked, stated that he couldn't even get
> the driver to build on microblaze against mainline.
>
> So I marked the patch "changed requested" because being able
> to build is... you know... sort of a requirement for integration.
More changes made it into the MicroBlaze mainline and it looks like I
need to respin the patch again as there are some minor changes on the
top of the tree.
It built and ran fine on PowerPc, but not MicroBlaze. I'll check now.
Thanks,
John
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
^ permalink raw reply
* Re: [Bugme-new] [Bug 15682] New: XFRM is not updating RTAX_ADVMSS metric
From: Andrew Morton @ 2010-04-05 19:50 UTC (permalink / raw)
To: netdev
Cc: bugzilla-daemon, bugme-daemon, eduardo.panisset, David S. Miller,
Jamal Hadi Salim
In-Reply-To: <bug-15682-10286@https.bugzilla.kernel.org/>
(switched to email. Please respond via emailed reply-to-all, not via the
bugzilla web interface).
On Fri, 2 Apr 2010 17:34:35 GMT
bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=15682
>
> Summary: XFRM is not updating RTAX_ADVMSS metric
> Product: Networking
> Version: 2.5
> Kernel Version: 2.6.28-2
> Platform: All
> OS/Version: Linux
> Tree: Mainline
> Status: NEW
> Severity: normal
> Priority: P1
> Component: Other
> AssignedTo: acme@ghostprotocols.net
> ReportedBy: eduardo.panisset@gmail.com
> Regression: No
>
>
> I have been testing DSMIPv6 code which uses all kind of advanced
> features of XFRM framework and I believe I have found a bug related to
> update RTAX_ADVMSS route metric.
> The XFRM code on net/xfrm/xfrm_policy.c by its functions
> xfrm_init_pmtu and xfrm_bundle_ok updates RTAX_MTU route caching
> metric however I believe it must update RTAX_ADVMSS as this later is
> used by tcp connect function for adverting the MSS value on SYN
> messages.
>
> As MSS is not being updated by XFRM the TCP SYN messages (e.g.
> originated from a internet browser) is erroneously informing its MSS
> (without taking into account the overhead added to IP packet size by
> XFRM transformations). One result of that is the browser gets
> "frozen" after starts a TCP connection because TCP messages sent by
> TCP server will never get to it (TCP server is sending too large
> segments to browser).
>
> Below I describe the changes I have done (on xfrm_init_pmtu and
> xfrm_bundle_ok) and that seem to fix this problem:
>
> xfrm_init_pmtu:
> .
> .
> .
>
> dst->metrics[RTAX_MTU-1] = pmtu; // original code, below my changes
>
> if (dst->xfrm->props.mode == XFRM_MODE_TUNNEL)
> switch (dst->xfrm->props.family)
> {
> case AF_INET:
> dst->metrics[RTAX_ADVMSS-1] = max_t(unsigned int,
> pmtu - sizeof(struct iphdr) - sizeof(struct tcphdr), 256);
> break;
>
> case AF_INET6:
> dst->metrics[RTAX_ADVMSS-1] = max_t(unsigned int,
> pmtu - sizeof(struct ipv6hdr) - sizeof(struct tcphdr),
> dev_net(dst->dev)->ipv6.
> sysctl.ip6_rt_min_advmss);
> break;
> }
>
> xfrm_bundle_ok:
>
> .
> .
> .
>
> dst->metrics[RTAX_MTU-1] = mtu; // original code, below my changes
>
> if (dst->xfrm->props.mode == XFRM_MODE_TUNNEL)
> switch (dst->xfrm->props.family)
> {
> case AF_INET:
> dst->metrics[RTAX_ADVMSS-1] = max_t(unsigned
> int, mtu - sizeof(struct iphdr) - sizeof(struct tcphdr), 256);
> break;
>
> case AF_INET6:
> dst->metrics[RTAX_ADVMSS-1] = max_t(unsigned
> int, mtu - sizeof(struct ipv6hdr) - sizeof(struct tcphdr),
>
> dev_net(dst->dev)->ipv6.sysctl.ip6_rt_min_advmss);
> break;
> }
>
^ permalink raw reply
* Re: [v2 Patch 3/3] bonding: make bonding support netpoll
From: Andy Gospodarek @ 2010-04-05 19:43 UTC (permalink / raw)
To: Amerigo Wang
Cc: linux-kernel, Matt Mackall, netdev, bridge, Andy Gospodarek,
Neil Horman, Jeff Moyer, Stephen Hemminger, bonding-devel,
Jay Vosburgh, David Miller
In-Reply-To: <20100405091628.4890.30541.sendpatchset@localhost.localdomain>
On Mon, Apr 05, 2010 at 05:12:40AM -0400, Amerigo Wang wrote:
>
> Based on Andy's work, but I modified a lot.
>
> Similar to the patch for bridge, this patch does:
>
> 1) implement the 2 methods to support netpoll for bonding;
>
> 2) modify netpoll during forwarding packets via bonding;
>
> 3) disable netpoll support of bonding when a netpoll-unabled device
> is added to bonding;
>
> 4) enable netpoll support when all underlying devices support netpoll.
>
> Cc: Andy Gospodarek <gospo@redhat.com>
> Cc: Jeff Moyer <jmoyer@redhat.com>
> Cc: Matt Mackall <mpm@selenic.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> Cc: Jay Vosburgh <fubar@us.ibm.com>
> Cc: David Miller <davem@davemloft.net>
> Signed-off-by: WANG Cong <amwang@redhat.com>
>
I tried these patches on top of Linus' latest tree and still get
deadlocks. Your line numbers might differ a bit, but you should be
seeing them too.
# echo 7 4 1 7 > /proc/sys/kernel/printk
# ifup bond0
bonding: bond0: setting mode to balance-rr (0).
bonding: bond0: Setting MII monitoring interval to 1000.
ADDRCONF(NETDEV_UP): bond0: link is not ready
bonding: bond0: Adding slave eth4.
bnx2 0000:10:00.0: eth4: using MSIX
bonding: bond0: enslaving eth4 as an active interface with a down link.
bonding: bond0: Adding slave eth5.
bnx2 0000:10:00.1: eth5: using MSIX
bonding: bond0: enslaving eth5 as an active interface with a down link.
bnx2 0000:10:00.0: eth4: NIC Copper Link is Up, 100 Mbps full duplex,
receive & transmit flow control ON
bonding: bond0: link status definitely up for interface eth4.
ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
bnx2 0000:10:00.1: eth5: NIC Copper Link is Up, 100 Mbps full duplex,
receive & transmit flow control ON
bond0: IPv6 duplicate address fe80::210:18ff:fe36:ad4 detected!
bonding: bond0: link status definitely up for interface eth5.
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 1000
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth4
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:10:18:36:0a:d4
Slave Interface: eth5
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:10:18:36:0a:d6
# modprobe netconsole
netconsole: local port 1234
netconsole: local IP 10.0.100.2
netconsole: interface 'bond0'
netconsole: remote port 6666
netconsole: remote IP 10.0.100.1
netconsole: remote ethernet address 00:e0:81:71:ee:aa
console [netcon0] enabled
netconsole: network logging started
# echo -eth4 > /sys/class/net/bond0/bonding/slaves
bonding: bond0: Removing slave eth4
[ now the system is hung ]
My suspicion from dealing with this problem in the past is that there is
contention over bond->lock.
Since there statements that will result in netconsole messages inside
the write_lock_bh in bond_release:
1882 write_lock_bh(&bond->lock);
1883
1884 slave = bond_get_slave_by_dev(bond, slave_dev);
1885 if (!slave) {
1886 /* not a slave of this bond */
1887 pr_info("%s: %s not enslaved\n",
1888 bond_dev->name, slave_dev->name);
1889 write_unlock_bh(&bond->lock);
1890 return -EINVAL;
1891 }
1892
1893 if (!bond->params.fail_over_mac) {
1894 if (!compare_ether_addr(bond_dev->dev_addr, slave->perm_hwaddr) &&
1895 bond->slave_cnt > 1)
1896 pr_warning("%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s.
we are getting stuck at 1986 since bond_xmit_roundrobin (in my case)
will try and acquire bond->lock for reading.
One valuable aspect netpoll_start_xmit routine was that is could be used
to check to be sure that bond->lock could be taken for writing. This
made us sure that we were not in a call stack that has already taken the
lock and queuing the skb to be sent later would prevent the imminent
deadlock.
A way to prevent this is needed and a first-pass might be to do
something similar to what I below above for all the xmit routines. I
confirmed the following patch prevents that deadlock:
# git diff drivers/net/bonding/
diff --git a/drivers/net/bonding/bond_main.c
b/drivers/net/bonding/bond_main.c
index 4a41886..53b39cc 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4232,7 +4232,8 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struc
int i, slave_no, res = 1;
struct iphdr *iph = ip_hdr(skb);
- read_lock(&bond->lock);
+ if (!read_trylock(&bond->lock))
+ return NETDEV_TX_BUSY;
if (!BOND_IS_OK(bond))
goto out;
The kernel no longer hangs, but a new warning message shows up (over
netconsole even!):
------------[ cut here ]------------
WARNING: at kernel/softirq.c:143 local_bh_enable+0x43/0xba()
Hardware name: HP xw4400 Workstation
Modules linked in: tg3 netconsole bonding ipt_REJECT bridge stp autofs4
i2c_dev i2c_core hidp rfcomm l2cap crc16 bluetooth rfkill sunrpc 8021q
iptable_filter ip_tables ip6t_REJECT xt_tcpudp ip6table_filter
ip6_tables x_tables ipv6 cpufreq_ondemand acpi_cpufreq dm_multipath
video output sbs sbshc battery acpi_memhotplug ac lp sg ide_cd_mod
tpm_tis rtc_cmos rtc_core serio_raw cdrom libphy e1000e floppy
parport_pc parport button tpm tpm_bios bnx2 rtc_lib tulip pcspkr shpchp
dm_snapshot dm_zero dm_mirror dm_region_hash dm_log dm_mod ata_piix ahci
libata sd_mod scsi_mod ext3 jbd uhci_hcd ohci_hcd ehci_hcd [last
unloaded: tg3]
Pid: 9, comm: events/0 Not tainted 2.6.34-rc3 #6
Call Trace:
[<ffffffff81058754>] ? cpu_clock+0x2d/0x41
[<ffffffff810404d9>] ? local_bh_enable+0x43/0xba
[<ffffffff8103a350>] warn_slowpath_common+0x77/0x8f
[<ffffffff812a4659>] ? dev_queue_xmit+0x408/0x467
[<ffffffff8103a377>] warn_slowpath_null+0xf/0x11
[<ffffffff810404d9>] local_bh_enable+0x43/0xba
[<ffffffff812a4659>] dev_queue_xmit+0x408/0x467
[<ffffffff812a435e>] ? dev_queue_xmit+0x10d/0x467
[<ffffffffa04a3868>] bond_dev_queue_xmit+0x1cd/0x1f9 [bonding]
[<ffffffffa04a4217>] bond_start_xmit+0x139/0x3e9 [bonding]
[<ffffffff812b0e9a>] queue_process+0xa8/0x160
[<ffffffff812b0df2>] ? queue_process+0x0/0x160
[<ffffffff81003794>] kernel_thread_helper+0x4/0x10
[<ffffffff813362bc>] ? restore_args+0x0/0x30
[<ffffffff81053884>] ? kthread+0x0/0x85
to point out possible locking issues (probably in netpoll_send_skb) that
I would suggest you investigate further. It may point to why we cannot
perform an:
# rmmod bonding
without the system deadlocking (even with my patch above).
> ---
>
> Index: linux-2.6/drivers/net/bonding/bond_main.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/bonding/bond_main.c
> +++ linux-2.6/drivers/net/bonding/bond_main.c
> @@ -59,6 +59,7 @@
> #include <linux/uaccess.h>
> #include <linux/errno.h>
> #include <linux/netdevice.h>
> +#include <linux/netpoll.h>
> #include <linux/inetdevice.h>
> #include <linux/igmp.h>
> #include <linux/etherdevice.h>
> @@ -430,7 +431,18 @@ int bond_dev_queue_xmit(struct bonding *
> }
>
> skb->priority = 1;
> - dev_queue_xmit(skb);
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> + if (bond->dev->priv_flags & IFF_IN_NETPOLL) {
> + struct netpoll *np = bond->dev->npinfo->netpoll;
> + slave_dev->npinfo = bond->dev->npinfo;
> + np->real_dev = np->dev = skb->dev;
> + slave_dev->priv_flags |= IFF_IN_NETPOLL;
> + netpoll_send_skb(np, skb);
> + slave_dev->priv_flags &= ~IFF_IN_NETPOLL;
> + np->dev = bond->dev;
> + } else
> +#endif
> + dev_queue_xmit(skb);
>
> return 0;
> }
> @@ -1329,6 +1341,60 @@ static void bond_detach_slave(struct bon
> bond->slave_cnt--;
> }
>
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> +static bool slaves_support_netpoll(struct net_device *bond_dev)
> +{
> + struct bonding *bond = netdev_priv(bond_dev);
> + struct slave *slave;
> + int i = 0;
> + bool ret = true;
> +
> + read_lock(&bond->lock);
> + bond_for_each_slave(bond, slave, i) {
> + if ((slave->dev->priv_flags & IFF_DISABLE_NETPOLL)
> + || !slave->dev->netdev_ops->ndo_poll_controller)
> + ret = false;
> + }
> + read_unlock(&bond->lock);
> + return i != 0 && ret;
> +}
> +
> +static void bond_poll_controller(struct net_device *bond_dev)
> +{
> + struct net_device *dev = bond_dev->npinfo->netpoll->real_dev;
> + if (dev != bond_dev)
> + netpoll_poll_dev(dev);
> +}
> +
> +static void bond_netpoll_cleanup(struct net_device *bond_dev)
> +{
> + struct bonding *bond = netdev_priv(bond_dev);
> + struct slave *slave;
> + const struct net_device_ops *ops;
> + int i;
> +
> + read_lock(&bond->lock);
> + bond_dev->npinfo = NULL;
> + bond_for_each_slave(bond, slave, i) {
> + if (slave->dev) {
> + ops = slave->dev->netdev_ops;
> + if (ops->ndo_netpoll_cleanup)
> + ops->ndo_netpoll_cleanup(slave->dev);
> + else
> + slave->dev->npinfo = NULL;
> + }
> + }
> + read_unlock(&bond->lock);
> +}
> +
> +#else
> +
> +static void bond_netpoll_cleanup(struct net_device *bond_dev)
> +{
> +}
> +
> +#endif
> +
> /*---------------------------------- IOCTL ----------------------------------*/
>
> static int bond_sethwaddr(struct net_device *bond_dev,
> @@ -1746,6 +1812,18 @@ int bond_enslave(struct net_device *bond
> new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup",
> new_slave->link != BOND_LINK_DOWN ? "n up" : " down");
>
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> + if (slaves_support_netpoll(bond_dev)) {
> + bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
> + if (bond_dev->npinfo)
> + slave_dev->npinfo = bond_dev->npinfo;
> + } else if (!(bond_dev->priv_flags & IFF_DISABLE_NETPOLL)) {
> + bond_dev->priv_flags |= IFF_DISABLE_NETPOLL;
> + pr_info("New slave device %s does not support netpoll\n",
> + slave_dev->name);
> + pr_info("Disabling netpoll support for %s\n", bond_dev->name);
> + }
> +#endif
> /* enslave is successful */
> return 0;
>
> @@ -1929,6 +2007,15 @@ int bond_release(struct net_device *bond
>
> netdev_set_master(slave_dev, NULL);
>
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> + if (slaves_support_netpoll(bond_dev))
> + bond_dev->priv_flags &= ~IFF_DISABLE_NETPOLL;
> + if (slave_dev->netdev_ops->ndo_netpoll_cleanup)
> + slave_dev->netdev_ops->ndo_netpoll_cleanup(slave_dev);
> + else
> + slave_dev->npinfo = NULL;
> +#endif
> +
> /* close slave before restoring its mac address */
> dev_close(slave_dev);
>
> @@ -4448,6 +4535,10 @@ static const struct net_device_ops bond_
> .ndo_vlan_rx_register = bond_vlan_rx_register,
> .ndo_vlan_rx_add_vid = bond_vlan_rx_add_vid,
> .ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid,
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> + .ndo_netpoll_cleanup = bond_netpoll_cleanup,
> + .ndo_poll_controller = bond_poll_controller,
> +#endif
> };
>
> static void bond_setup(struct net_device *bond_dev)
> @@ -4533,6 +4624,8 @@ static void bond_uninit(struct net_devic
> {
> struct bonding *bond = netdev_priv(bond_dev);
>
> + bond_netpoll_cleanup(bond_dev);
> +
> /* Release the bonded slaves */
> bond_release_all(bond_dev);
>
^ permalink raw reply related
* Re: [Bugme-new] [Bug 15681] New: X25 fails to negotiate connection with Cisco router due to bad value for X25_DEFAULT_THROUGHPUT
From: Andrew Morton @ 2010-04-05 19:37 UTC (permalink / raw)
To: john; +Cc: bugzilla-daemon, bugme-daemon, Ralf Baechle, netdev
In-Reply-To: <bug-15681-10286@https.bugzilla.kernel.org/>
(switched to email. Please respond via emailed reply-to-all, not via the
bugzilla web interface).
On Fri, 2 Apr 2010 14:48:17 GMT
bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=15681
>
> Summary: X25 fails to negotiate connection with Cisco router
> due to bad value for X25_DEFAULT_THROUGHPUT
> Product: Networking
> Version: 2.5
> Platform: All
> OS/Version: Linux
> Tree: Mainline
> Status: NEW
> Severity: normal
> Priority: P1
> Component: Other
> AssignedTo: acme@ghostprotocols.net
> ReportedBy: john@calva.com
> Regression: No
>
>
> X.25 connection with a Cisco router fails because Linux X.25 tries to negotiate
> an illegal value "0" for the inbound throughput.
>
> This bug was first reported by Daniel Ferenci to the linux-x25 mailing list on
> 6/8/2004, but is still present.
>
> X25_DEFAULT_THROUGHPUT is defined as 0x0A, i.e. when the Linux system calls it
> wants a throughput of at least 0xA (9600bps) outbound and at least 0x0
> (Reserved value) inbound.
>
> See X.25 (1988) section 7.2.2.2
Thanks, but... please don't send patches via bugzilla - it bypasses
all our review and merge processes and tools.
I merged your patch as below and shall send it on to Ralf and David for
review.
From: John Hughes <john@calva.com>
The current (2.6.34) x.25 code doesn't seem to know that the X.25
throughput facility includes two values, one for the required throughput
outbound, one for inbound.
This causes it to attempt to negotiate throughput 0x0A, which is
throughput 9600 inbound and the illegal value "0" for inbound throughput.
Because of this some X.25 devices (e.g. Cisco 1600) refuse to connect to
Linux X.25.
The patch fixes this behaviour. Unless the user specifies a required
throughput it does not attempt to negotiate. If the user does not specify
a throughput it accepts the suggestion of the remote X.25 system. If the
user requests a throughput then it validates both the input and output
throughputs and correctly negotiates them with the remote end.
Signed-off-by: John Hughes <john@calva.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
net/x25/af_x25.c | 20 ++++++++++++++++----
net/x25/x25_facilities.c | 15 ++++++++++++---
2 files changed, 28 insertions(+), 7 deletions(-)
diff -puN net/x25/af_x25.c~a net/x25/af_x25.c
--- a/net/x25/af_x25.c~a
+++ a/net/x25/af_x25.c
@@ -554,7 +554,8 @@ static int x25_create(struct net *net, s
x25->facilities.winsize_out = X25_DEFAULT_WINDOW_SIZE;
x25->facilities.pacsize_in = X25_DEFAULT_PACKET_SIZE;
x25->facilities.pacsize_out = X25_DEFAULT_PACKET_SIZE;
- x25->facilities.throughput = X25_DEFAULT_THROUGHPUT;
+ x25->facilities.throughput = 0; /* by default don't negotiate
+ throughput */
x25->facilities.reverse = X25_DEFAULT_REVERSE;
x25->dte_facilities.calling_len = 0;
x25->dte_facilities.called_len = 0;
@@ -1415,9 +1416,20 @@ static int x25_ioctl(struct socket *sock
if (facilities.winsize_in < 1 ||
facilities.winsize_in > 127)
break;
- if (facilities.throughput < 0x03 ||
- facilities.throughput > 0xDD)
- break;
+ if (facilities.throughput) {
+ int out = facilities.throughput & 0xf0;
+ int in = facilities.throughput & 0x0f;
+ if (!out)
+ facilities.throughput |=
+ X25_DEFAULT_THROUGHPUT << 4;
+ else if (out < 0x30 || out > 0xD0)
+ break;
+ if (!in)
+ facilities.throughput |=
+ X25_DEFAULT_THROUGHPUT;
+ else if (in < 0x03 || in > 0x0D)
+ break;
+ }
if (facilities.reverse &&
(facilities.reverse & 0x81) != 0x81)
break;
diff -puN net/x25/x25_facilities.c~a net/x25/x25_facilities.c
--- a/net/x25/x25_facilities.c~a
+++ a/net/x25/x25_facilities.c
@@ -259,9 +259,18 @@ int x25_negotiate_facilities(struct sk_b
new->reverse = theirs.reverse;
if (theirs.throughput) {
- if (theirs.throughput < ours->throughput) {
- SOCK_DEBUG(sk, "X.25: throughput negotiated down\n");
- new->throughput = theirs.throughput;
+ int theirs_in = theirs.throughput & 0x0f;
+ int theirs_out = theirs.throughput & 0xf0;
+ int ours_in = ours->throughput & 0x0f;
+ int ours_out = ours->throughput & 0xf0;
+ if (!ours_in || theirs_in < ours_in) {
+ SOCK_DEBUG(sk, "X.25: inbound throughput negotiated\n");
+ new->throughput = (new->throughput & 0xf0) | theirs_in;
+ }
+ if (!ours_out || theirs_out < ours_out) {
+ SOCK_DEBUG(sk,
+ "X.25: outbound throughput negotiated\n");
+ new->throughput = (new->throughput & 0x0f) | theirs_out;
}
}
_
^ permalink raw reply
* Re: [PATCH 1/3] IPv6: Generic TTL Security Mechanism (original version)
From: Nick Hilliard @ 2010-04-05 19:06 UTC (permalink / raw)
To: YOSHIFUJI Hideaki; +Cc: Stephen Hemminger, davem, Pekka Savola, netdev
In-Reply-To: <4BB96B9A.3000203@linux-ipv6.org>
On 05/04/2010 05:48, YOSHIFUJI Hideaki wrote:
> I am for 1/3 (original), not for 2/3, 3/3.
>
> Because we should allow users to set respective value
> for IPv4 and IPv6, as we allow users to do so for TTL
> and hoplimit itself.
<non-linux-user>
I concur. ipv4 mapped addresses need special handling in lots of cases,
and I don't believe that patch 2/3 adds anything here - except possibly
confusion.
Regarding case 3/3, ipv4 and ipv6 are separate protocols. Treating them
as the same from the setsockopt() point of view is a clear case of the
Wrong Thing.
</non-linux-user>
Case 1/3 is IMO a better approach. It satisfies both KISS (keep it
simple...) and POLA (principle of least astonishment).
Nick
^ permalink raw reply
* Re: [PATCH] [V2] Add non-Virtex5 support for LL TEMAC driver
From: Grant Likely @ 2010-04-05 19:31 UTC (permalink / raw)
To: David Miller
Cc: netdev, linuxppc-dev, jwboyer, john.williams, michal.simek,
jtyner, john.linn
In-Reply-To: <20100405.121647.91426186.davem@davemloft.net>
On Mon, Apr 5, 2010 at 1:16 PM, David Miller <davem@davemloft.net> wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
> Date: Mon, 5 Apr 2010 12:10:51 -0600
>
>> David, are you going to pick up this patch, or would you like me to?
>
> The submitter, when asked, stated that he couldn't even get
> the driver to build on microblaze against mainline.
>
> So I marked the patch "changed requested" because being able
> to build is... you know... sort of a requirement for integration.
Heh, the current driver doesn't build on microblaze either. However,
John, since you're removing the depends on PPC_DCR_NATIVE, can you
please respin the patch to make it depend on CONFIG_PPC and CONFIG_OF.
Looking at it now I see that as-is it will cause collateral damage to
allmodconfig on every other architecture.
g.
^ permalink raw reply
* Re: [RFC PATCH 1/2] netdev: buffer infrastructure to log network driver's information
From: David Miller @ 2010-04-05 19:31 UTC (permalink / raw)
To: eric.dumazet
Cc: sanagi.koki, netdev, izumi.taku, kaneshige.kenji, nhorman,
jeffrey.t.kirsher, jesse.brandeburg, bruce.w.allan,
alexander.h.duyck, peter.p.waskiewicz.jr, john.ronciak
In-Reply-To: <1270456946.1971.27.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 05 Apr 2010 10:42:26 +0200
> Le lundi 05 avril 2010 à 15:52 +0900, Koki Sanagi a écrit :
>> This patch implements buffer infrastructure under driver/net.
>> This buffer records information from network driver.
>>
>> Signed-off-by: Koki Sanagi <sanagi.koki@jp.fujitsu.com>
>> ---
>> drivers/net/Kconfig | 8 +
>> drivers/net/Makefile | 1 +
>> drivers/net/ndrvbuf.c | 535 +++++++++++++++++++++++++++++++++++++++++++++++
>> include/linux/ndrvbuf.h | 57 +++++
>> 4 files changed, 601 insertions(+), 0 deletions(-)
>>
>
> Wow, 600 lines... thats what I call bloat...
And we have all sorts of facilities for creating filesystem
streams and ring buffers of debug information.
You could even hook into 'perf' to log and process these
events in probably like 12 lines of code.
^ permalink raw reply
* Re: Undefined behaviour of connect(fd, NULL, 0);
From: David Miller @ 2010-04-05 19:25 UTC (permalink / raw)
To: xiaosuo; +Cc: neilb, shemminger, netdev
In-Reply-To: <w2n412e6f7f1004050223j3e15df91tcdf133670c636a85@mail.gmail.com>
From: Changli Gao <xiaosuo@gmail.com>
Date: Mon, 5 Apr 2010 17:23:50 +0800
> I found this from the man page of FreeBSD's connect(2).
>
> Generally, stream sockets may successfully connect() only
> once; datagram sockets may use connect() multiple times to change their
> association. Datagram sockets may dissolve the association by connecting
> to an invalid address, such as a null address.
>
> And this from the man page of Darwin's connect(2).
>
> Datagram sockets may dissolve the association by connecting to an
> invalid address, such as a null address or an address with the address
> family set to AF_UNSPEC (the error EAFNOSUPPORT will be harmlessly
> returned).
>
> Since null address behavior has been defined by the others. I think
> Linux should be compatible with the others. So the patch submitted on
> this by me should not been applied. I'll work out another patch later.
Your patch is already applied and pushed out to the world.
Any corrections would need to be made relative to that.
But I think no changes should be made, and it doesn't matter
at all what some manual page says on another system.
It doesn't matter one iota what those paragraphs say, we've had the
existing behavior for FIFTEEN YEARS. So, like I said last time, any
application coding to this behavior of the zero length sockaddr doing
anything on connect() will NOT WORK ON ANY KERNEL.
So supporting it has absolutely zero value, for us and for app
developers.
^ permalink raw reply
* Re: [PATCH] [V2] Add non-Virtex5 support for LL TEMAC driver
From: David Miller @ 2010-04-05 19:16 UTC (permalink / raw)
To: grant.likely
Cc: netdev, linuxppc-dev, jwboyer, john.williams, michal.simek,
jtyner, john.linn
In-Reply-To: <q2xfa686aa41004051110hc960e9a0sd1d5e61f7e2a5412@mail.gmail.com>
From: Grant Likely <grant.likely@secretlab.ca>
Date: Mon, 5 Apr 2010 12:10:51 -0600
> David, are you going to pick up this patch, or would you like me to?
The submitter, when asked, stated that he couldn't even get
the driver to build on microblaze against mainline.
So I marked the patch "changed requested" because being able
to build is... you know... sort of a requirement for integration.
^ permalink raw reply
* [PATCH 11/11] drivers/uwb: Rename dev_info to wdi
From: Joe Perches @ 2010-04-05 19:05 UTC (permalink / raw)
To: Andrew Morton; +Cc: David Vrabel, netdev, linux-kernel
In-Reply-To: <cover.1270493677.git.joe@perches.com>
There is a macro called dev_info that prints struct device specific
information. Having variables with the same name can be confusing and
prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation
to converting the dev_info macro to a function.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/uwb/i1480/i1480u-wlp/lc.c | 16 ++++++------
drivers/uwb/wlp/messages.c | 40 ++++++++++++++++----------------
drivers/uwb/wlp/sysfs.c | 46 ++++++++++++++++++------------------
drivers/uwb/wlp/wlp-lc.c | 12 +++++-----
4 files changed, 57 insertions(+), 57 deletions(-)
diff --git a/drivers/uwb/i1480/i1480u-wlp/lc.c b/drivers/uwb/i1480/i1480u-wlp/lc.c
index f272dfe..bd52675 100644
--- a/drivers/uwb/i1480/i1480u-wlp/lc.c
+++ b/drivers/uwb/i1480/i1480u-wlp/lc.c
@@ -92,28 +92,28 @@ void i1480u_init(struct i1480u *i1480u)
* information elements have intuitive mappings, other not.
*/
static
-void i1480u_fill_device_info(struct wlp *wlp, struct wlp_device_info *dev_info)
+void i1480u_fill_device_info(struct wlp *wlp, struct wlp_device_info *wdi)
{
struct i1480u *i1480u = container_of(wlp, struct i1480u, wlp);
struct usb_device *usb_dev = i1480u->usb_dev;
/* Treat device name and model name the same */
if (usb_dev->descriptor.iProduct) {
usb_string(usb_dev, usb_dev->descriptor.iProduct,
- dev_info->name, sizeof(dev_info->name));
+ wdi->name, sizeof(wdi->name));
usb_string(usb_dev, usb_dev->descriptor.iProduct,
- dev_info->model_name, sizeof(dev_info->model_name));
+ wdi->model_name, sizeof(wdi->model_name));
}
if (usb_dev->descriptor.iManufacturer)
usb_string(usb_dev, usb_dev->descriptor.iManufacturer,
- dev_info->manufacturer,
- sizeof(dev_info->manufacturer));
- scnprintf(dev_info->model_nr, sizeof(dev_info->model_nr), "%04x",
+ wdi->manufacturer,
+ sizeof(wdi->manufacturer));
+ scnprintf(wdi->model_nr, sizeof(wdi->model_nr), "%04x",
__le16_to_cpu(usb_dev->descriptor.bcdDevice));
if (usb_dev->descriptor.iSerialNumber)
usb_string(usb_dev, usb_dev->descriptor.iSerialNumber,
- dev_info->serial, sizeof(dev_info->serial));
+ wdi->serial, sizeof(wdi->serial));
/* FIXME: where should we obtain category? */
- dev_info->prim_dev_type.category = cpu_to_le16(WLP_DEV_CAT_OTHER);
+ wdi->prim_dev_type.category = cpu_to_le16(WLP_DEV_CAT_OTHER);
/* FIXME: Complete OUI and OUIsubdiv attributes */
}
diff --git a/drivers/uwb/wlp/messages.c b/drivers/uwb/wlp/messages.c
index 7516486..4057942 100644
--- a/drivers/uwb/wlp/messages.c
+++ b/drivers/uwb/wlp/messages.c
@@ -712,7 +712,7 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
struct sk_buff *_skb;
void *d1_itr;
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0) {
dev_err(dev, "WLP: Unable to setup device "
@@ -720,7 +720,7 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,
goto error;
}
}
- info = wlp->dev_info;
+ info = wlp->wdi;
_skb = dev_alloc_skb(sizeof(*_d1)
+ sizeof(struct wlp_attr_uuid_e)
+ sizeof(struct wlp_attr_wss_sel_mthd)
@@ -794,7 +794,7 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
void *d2_itr;
size_t mem_needed;
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0) {
dev_err(dev, "WLP: Unable to setup device "
@@ -802,7 +802,7 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,
goto error;
}
}
- info = wlp->dev_info;
+ info = wlp->wdi;
mem_needed = sizeof(*_d2)
+ sizeof(struct wlp_attr_uuid_e)
+ sizeof(struct wlp_attr_uuid_r)
@@ -970,7 +970,7 @@ error_parse:
*/
static
int wlp_get_variable_info(struct wlp *wlp, void *data,
- struct wlp_device_info *dev_info, ssize_t len)
+ struct wlp_device_info *wdi, ssize_t len)
{
struct device *dev = &wlp->rc->uwb_dev.dev;
size_t used = 0;
@@ -993,7 +993,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data,
goto error_parse;
}
result = wlp_get_manufacturer(wlp, data + used,
- dev_info->manufacturer,
+ wdi->manufacturer,
len - used);
if (result < 0) {
dev_err(dev, "WLP: Unable to obtain "
@@ -1011,7 +1011,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data,
goto error_parse;
}
result = wlp_get_model_name(wlp, data + used,
- dev_info->model_name,
+ wdi->model_name,
len - used);
if (result < 0) {
dev_err(dev, "WLP: Unable to obtain Model "
@@ -1028,7 +1028,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data,
goto error_parse;
}
result = wlp_get_model_nr(wlp, data + used,
- dev_info->model_nr,
+ wdi->model_nr,
len - used);
if (result < 0) {
dev_err(dev, "WLP: Unable to obtain Model "
@@ -1045,7 +1045,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data,
goto error_parse;
}
result = wlp_get_serial(wlp, data + used,
- dev_info->serial, len - used);
+ wdi->serial, len - used);
if (result < 0) {
dev_err(dev, "WLP: Unable to obtain Serial "
"number attribute from D1 message.\n");
@@ -1061,7 +1061,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data,
goto error_parse;
}
result = wlp_get_prim_dev_type(wlp, data + used,
- &dev_info->prim_dev_type,
+ &wdi->prim_dev_type,
len - used);
if (result < 0) {
dev_err(dev, "WLP: Unable to obtain Primary "
@@ -1069,10 +1069,10 @@ int wlp_get_variable_info(struct wlp *wlp, void *data,
"message.\n");
goto error_parse;
}
- dev_info->prim_dev_type.category =
- le16_to_cpu(dev_info->prim_dev_type.category);
- dev_info->prim_dev_type.subID =
- le16_to_cpu(dev_info->prim_dev_type.subID);
+ wdi->prim_dev_type.category =
+ le16_to_cpu(wdi->prim_dev_type.category);
+ wdi->prim_dev_type.subID =
+ le16_to_cpu(wdi->prim_dev_type.subID);
last = WLP_ATTR_PRI_DEV_TYPE;
used += result;
break;
@@ -1098,7 +1098,7 @@ static
int wlp_parse_d1_frame(struct wlp *wlp, struct sk_buff *skb,
struct wlp_uuid *uuid_e,
enum wlp_wss_sel_mthd *sel_mthd,
- struct wlp_device_info *dev_info,
+ struct wlp_device_info *wdi,
enum wlp_assc_error *assc_err)
{
struct device *dev = &wlp->rc->uwb_dev.dev;
@@ -1123,7 +1123,7 @@ int wlp_parse_d1_frame(struct wlp *wlp, struct sk_buff *skb,
goto error_parse;
}
used += result;
- result = wlp_get_dev_name(wlp, ptr + used, dev_info->name,
+ result = wlp_get_dev_name(wlp, ptr + used, wdi->name,
len - used);
if (result < 0) {
dev_err(dev, "WLP: unable to obtain Device Name from D1 "
@@ -1131,7 +1131,7 @@ int wlp_parse_d1_frame(struct wlp *wlp, struct sk_buff *skb,
goto error_parse;
}
used += result;
- result = wlp_get_variable_info(wlp, ptr + used, dev_info, len - used);
+ result = wlp_get_variable_info(wlp, ptr + used, wdi, len - used);
if (result < 0) {
dev_err(dev, "WLP: unable to obtain Device Information from "
"D1 message.\n");
@@ -1171,15 +1171,15 @@ void wlp_handle_d1_frame(struct work_struct *ws)
struct device *dev = &wlp->rc->uwb_dev.dev;
struct wlp_uuid uuid_e;
enum wlp_wss_sel_mthd sel_mthd = 0;
- struct wlp_device_info dev_info;
+ struct wlp_device_info wdi;
enum wlp_assc_error assc_err;
struct sk_buff *resp = NULL;
/* Parse D1 frame */
mutex_lock(&wss->mutex);
mutex_lock(&wlp->mutex); /* to access wlp->uuid */
- memset(&dev_info, 0, sizeof(dev_info));
- result = wlp_parse_d1_frame(wlp, skb, &uuid_e, &sel_mthd, &dev_info,
+ memset(&wdi, 0, sizeof(wdi));
+ result = wlp_parse_d1_frame(wlp, skb, &uuid_e, &sel_mthd, &wdi,
&assc_err);
if (result < 0) {
dev_err(dev, "WLP: Unable to parse incoming D1 frame.\n");
diff --git a/drivers/uwb/wlp/sysfs.c b/drivers/uwb/wlp/sysfs.c
index 6627c94..b24751c 100644
--- a/drivers/uwb/wlp/sysfs.c
+++ b/drivers/uwb/wlp/sysfs.c
@@ -333,12 +333,12 @@ ssize_t wlp_dev_##type##_show(struct wlp *wlp, char *buf) \
{ \
ssize_t result = 0; \
mutex_lock(&wlp->mutex); \
- if (wlp->dev_info == NULL) { \
+ if (wlp->wdi == NULL) { \
result = __wlp_setup_device_info(wlp); \
if (result < 0) \
goto out; \
} \
- result = scnprintf(buf, PAGE_SIZE, "%s\n", wlp->dev_info->type);\
+ result = scnprintf(buf, PAGE_SIZE, "%s\n", wlp->wdi->type); \
out: \
mutex_unlock(&wlp->mutex); \
return result; \
@@ -360,14 +360,14 @@ ssize_t wlp_dev_##type##_store(struct wlp *wlp, const char *buf, size_t size)\
ssize_t result; \
char format[10]; \
mutex_lock(&wlp->mutex); \
- if (wlp->dev_info == NULL) { \
+ if (wlp->wdi == NULL) { \
result = __wlp_alloc_device_info(wlp); \
if (result < 0) \
goto out; \
} \
- memset(wlp->dev_info->type, 0, sizeof(wlp->dev_info->type)); \
+ memset(wlp->wdi->type, 0, sizeof(wlp->wdi->type)); \
sprintf(format, "%%%uc", len); \
- result = sscanf(buf, format, wlp->dev_info->type); \
+ result = sscanf(buf, format, wlp->wdi->type); \
out: \
mutex_unlock(&wlp->mutex); \
return result < 0 ? result : size; \
@@ -409,13 +409,13 @@ ssize_t wlp_dev_prim_category_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0)
goto out;
}
result = scnprintf(buf, PAGE_SIZE, "%s\n",
- wlp_dev_category_str(wlp->dev_info->prim_dev_type.category));
+ wlp_dev_category_str(wlp->wdi->prim_dev_type.category));
out:
mutex_unlock(&wlp->mutex);
return result;
@@ -428,7 +428,7 @@ ssize_t wlp_dev_prim_category_store(struct wlp *wlp, const char *buf,
ssize_t result;
u16 cat;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_alloc_device_info(wlp);
if (result < 0)
goto out;
@@ -436,7 +436,7 @@ ssize_t wlp_dev_prim_category_store(struct wlp *wlp, const char *buf,
result = sscanf(buf, "%hu", &cat);
if ((cat >= WLP_DEV_CAT_COMPUTER && cat <= WLP_DEV_CAT_TELEPHONE)
|| cat == WLP_DEV_CAT_OTHER)
- wlp->dev_info->prim_dev_type.category = cat;
+ wlp->wdi->prim_dev_type.category = cat;
else
result = -EINVAL;
out:
@@ -449,15 +449,15 @@ ssize_t wlp_dev_prim_OUI_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0)
goto out;
}
result = scnprintf(buf, PAGE_SIZE, "%02x:%02x:%02x\n",
- wlp->dev_info->prim_dev_type.OUI[0],
- wlp->dev_info->prim_dev_type.OUI[1],
- wlp->dev_info->prim_dev_type.OUI[2]);
+ wlp->wdi->prim_dev_type.OUI[0],
+ wlp->wdi->prim_dev_type.OUI[1],
+ wlp->wdi->prim_dev_type.OUI[2]);
out:
mutex_unlock(&wlp->mutex);
return result;
@@ -469,7 +469,7 @@ ssize_t wlp_dev_prim_OUI_store(struct wlp *wlp, const char *buf, size_t size)
ssize_t result;
u8 OUI[3];
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_alloc_device_info(wlp);
if (result < 0)
goto out;
@@ -480,7 +480,7 @@ ssize_t wlp_dev_prim_OUI_store(struct wlp *wlp, const char *buf, size_t size)
result = -EINVAL;
goto out;
} else
- memcpy(wlp->dev_info->prim_dev_type.OUI, OUI, sizeof(OUI));
+ memcpy(wlp->wdi->prim_dev_type.OUI, OUI, sizeof(OUI));
out:
mutex_unlock(&wlp->mutex);
return result < 0 ? result : size;
@@ -492,13 +492,13 @@ ssize_t wlp_dev_prim_OUI_sub_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0)
goto out;
}
result = scnprintf(buf, PAGE_SIZE, "%u\n",
- wlp->dev_info->prim_dev_type.OUIsubdiv);
+ wlp->wdi->prim_dev_type.OUIsubdiv);
out:
mutex_unlock(&wlp->mutex);
return result;
@@ -512,14 +512,14 @@ ssize_t wlp_dev_prim_OUI_sub_store(struct wlp *wlp, const char *buf,
unsigned sub;
u8 max_sub = ~0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_alloc_device_info(wlp);
if (result < 0)
goto out;
}
result = sscanf(buf, "%u", &sub);
if (sub <= max_sub)
- wlp->dev_info->prim_dev_type.OUIsubdiv = sub;
+ wlp->wdi->prim_dev_type.OUIsubdiv = sub;
else
result = -EINVAL;
out:
@@ -532,13 +532,13 @@ ssize_t wlp_dev_prim_subcat_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0)
goto out;
}
result = scnprintf(buf, PAGE_SIZE, "%u\n",
- wlp->dev_info->prim_dev_type.subID);
+ wlp->wdi->prim_dev_type.subID);
out:
mutex_unlock(&wlp->mutex);
return result;
@@ -552,14 +552,14 @@ ssize_t wlp_dev_prim_subcat_store(struct wlp *wlp, const char *buf,
unsigned sub;
__le16 max_sub = ~0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_alloc_device_info(wlp);
if (result < 0)
goto out;
}
result = sscanf(buf, "%u", &sub);
if (sub <= max_sub)
- wlp->dev_info->prim_dev_type.subID = sub;
+ wlp->wdi->prim_dev_type.subID = sub;
else
result = -EINVAL;
out:
diff --git a/drivers/uwb/wlp/wlp-lc.c b/drivers/uwb/wlp/wlp-lc.c
index 13db739..530613e 100644
--- a/drivers/uwb/wlp/wlp-lc.c
+++ b/drivers/uwb/wlp/wlp-lc.c
@@ -39,9 +39,9 @@ void wlp_neighbor_init(struct wlp_neighbor_e *neighbor)
int __wlp_alloc_device_info(struct wlp *wlp)
{
struct device *dev = &wlp->rc->uwb_dev.dev;
- BUG_ON(wlp->dev_info != NULL);
- wlp->dev_info = kzalloc(sizeof(struct wlp_device_info), GFP_KERNEL);
- if (wlp->dev_info == NULL) {
+ BUG_ON(wlp->wdi != NULL);
+ wlp->wdi = kzalloc(sizeof(struct wlp_device_info), GFP_KERNEL);
+ if (wlp->wdi == NULL) {
dev_err(dev, "WLP: Unable to allocate memory for "
"device information.\n");
return -ENOMEM;
@@ -58,7 +58,7 @@ int __wlp_alloc_device_info(struct wlp *wlp)
static
void __wlp_fill_device_info(struct wlp *wlp)
{
- wlp->fill_device_info(wlp, wlp->dev_info);
+ wlp->fill_device_info(wlp, wlp->wdi);
}
/**
@@ -538,8 +538,8 @@ void wlp_remove(struct wlp *wlp)
uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler);
wlp_eda_release(&wlp->eda);
mutex_lock(&wlp->mutex);
- if (wlp->dev_info != NULL)
- kfree(wlp->dev_info);
+ if (wlp->wdi != NULL)
+ kfree(wlp->wdi);
mutex_unlock(&wlp->mutex);
wlp->rc = NULL;
}
--
1.7.0.3.311.g6a6955
^ permalink raw reply related
* [PATCH 00/11] treewide: rename dev_info variables to something else
From: Joe Perches @ 2010-04-05 19:05 UTC (permalink / raw)
To: Andrew Morton
Cc: Tony Luck, Fenghua Yu, Mark Gross, Doug Thompson, Mike Isely,
Mauro Carvalho Chehab, Martin Schwidefsky, Heiko Carstens,
linux390-tA70FqPdS9bQT0dZR+AlfA, Greg Kroah-Hartman, David Vrabel,
linux-ia64-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
bluesmoke-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
linux-media-u79uwXL29TY76Z2rM5mHXA,
linux-s390-u79uwXL29TY76Z2rM5mHXA,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20100304232928.2e45bdd1.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
There is a macro called dev_info that prints struct device specific
information. Having variables with the same name can be confusing and
prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation
to converting the dev_info macro to a function.
Joe Perches (11):
arch/ia64/hp/common/sba_iommu.c: Rename dev_info to adi
drivers/usb/host/hwa-hc.c: Rename dev_info to hdi
drivers/usb/wusbcore/wusbhc.h: Remove unused dev_info from struct wusb_port
drivers/s390/block/dcssblk.c: Rename dev_info to ddi
drivers/edac/amd: Rename dev_info to adi
drivers/edac/cpc925_edac.c: Rename dev_info to cdi
drivers/edac/e7*_edac.c: Rename dev_info to edi
drivers/staging/iio: Rename dev_info to idi
pvrusb2-v4l2: Rename dev_info to pdi
drivers/char/mem.c: Rename dev_info to bdi
drivers/uwb: Rename dev_info to wdi
arch/ia64/hp/common/sba_iommu.c | 8 +-
drivers/char/mem.c | 6 +-
drivers/edac/amd8111_edac.c | 88 ++++----
drivers/edac/amd8131_edac.c | 86 ++++----
drivers/edac/cpc925_edac.c | 122 +++++-----
drivers/edac/e752x_edac.c | 18 +-
drivers/edac/e7xxx_edac.c | 8 +-
drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 22 +-
drivers/s390/block/dcssblk.c | 328 ++++++++++++++--------------
drivers/staging/iio/accel/lis3l02dq_core.c | 4 +-
drivers/staging/iio/accel/lis3l02dq_ring.c | 20 +-
drivers/staging/iio/accel/sca3000_core.c | 24 +-
drivers/staging/iio/adc/max1363_core.c | 36 ++--
drivers/staging/iio/adc/max1363_ring.c | 6 +-
drivers/staging/iio/chrdev.h | 2 +-
drivers/staging/iio/iio.h | 54 +++---
drivers/staging/iio/industrialio-core.c | 232 ++++++++++----------
drivers/staging/iio/industrialio-ring.c | 38 ++--
drivers/staging/iio/industrialio-trigger.c | 34 ++--
drivers/staging/iio/ring_generic.h | 4 +-
drivers/staging/iio/trigger_consumer.h | 16 +-
drivers/usb/host/hwa-hc.c | 18 +-
drivers/usb/wusbcore/wusbhc.h | 10 -
drivers/uwb/i1480/i1480u-wlp/lc.c | 16 +-
drivers/uwb/wlp/messages.c | 40 ++--
drivers/uwb/wlp/sysfs.c | 46 ++--
drivers/uwb/wlp/wlp-lc.c | 12 +-
27 files changed, 644 insertions(+), 654 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: tulip_stop_rxtx() failed (CSR5 0xf0260000 CSR6 0xb3862002) on DEC Alpha Personal Workstation 433au
From: Adrian Glaubitz @ 2010-04-05 18:59 UTC (permalink / raw)
To: Joe Perches
Cc: Grant Grundler, Kyle McMartin, David S. Miller, netdev,
linux-kernel
In-Reply-To: <1270488982.31062.28.camel@Joe-Laptop.home>
Hi Joe,
On Mon, Apr 05, 2010 at 10:36:22AM -0700, Joe Perches wrote:
> On Mon, 2010-04-05 at 19:13 +0200, Adrian Glaubitz wrote:
> > Hi guys,
> >
> > I installed Debian unstable on an old digital workstation "DEC Digital
> > Personal Workstation 433au" (Miata) which has an on-board tulip
> > network controller. I'm not really using that network controller but
> > an off-board intel e1000 controller. However, I found that the tulip
> > driver produces a lot of noise in the message log, the following
> > message is repated periodically and spams the whole message log:
> >
> > 0000:00:03.0: tulip_stop_rxtx() failed (CSR5 0xf0260000 CSR6 0xb3862002)
> >
> > Do you think this is related to the fact that no cable is connected to
> > the network controller?
>
> Probably something is trying periodically to open the device.
> Maybe this helps reduce the message log noise:
Thanks for the patch. I will apply it to a current rc of 2.6.34 and
build a new kernel, probably not before tomorrow as I cannot reboot
the Alpha remotely as the "aboot" boot loader does not boot
automatically.
Thanks,
Adrian
^ permalink raw reply
* Re: [PATCHv3] drivers/net/usb: Add new driver ipheth
From: "L. Alberto Giménez" @ 2010-04-05 18:51 UTC (permalink / raw)
To: Oliver Neukum
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linville-2XuSBdqkA4R54TAoqtyWWQ, j.dumon-x9gZzRpC1QbQT0dZR+AlfA,
steve.glendinning-sdUf+H5yV5I, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
gregkh-l3A5Bk7waGM, dgiagio-Re5JQEeQqe8AvxtiuMwx3w,
dborca-/E1597aS9LQAvxtiuMwx3w
In-Reply-To: <201004040924.43949.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
On 04/04/2010 09:24 AM, Oliver Neukum wrote:
> Am Freitag, 2. April 2010 20:23:21 schrieb L. Alberto Giménez:
>> On 03/31/2010 10:33 PM, Oliver Neukum wrote:
>>> Am Mittwoch, 31. März 2010 21:42:07 schrieb L. Alberto Giménez:
>>>> +static struct usb_driver ipheth_driver = {
>>>> + .name = "ipheth",
>>>> + .probe = ipheth_probe,
>>>> + .disconnect = ipheth_disconnect,
>>>> + .id_table = ipheth_table,
>>>> + .supports_autosuspend = 0,
>>> redundant
>> Why?
>
> 0 is the default.
Heh, I thought that you meant that the whole struct was redundant, and
that puzzled me a little bit. Now everything is clear (my fault for not
realizing the redundant initialization to 0).
Regards,
--
L. Alberto Giménez
JabberID agimenez-eu7EghD4TOHJ13y34KW5H97lo5+wdyHW@public.gmane.org
GnuPG key ID 0x3BAABDE1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] [V2] Add non-Virtex5 support for LL TEMAC driver
From: Grant Likely @ 2010-04-05 18:10 UTC (permalink / raw)
To: David Miller
Cc: netdev, linuxppc-dev, jwboyer, john.williams, michal.simek,
John Tyner, John Linn
In-Reply-To: <fa686aa41003171302v46738069pae51061ba83d0818@mail.gmail.com>
David, are you going to pick up this patch, or would you like me to?
Thanks,
g
On Wed, Mar 17, 2010 at 2:02 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Fri, Mar 12, 2010 at 7:05 PM, John Linn <john.linn@xilinx.com> wrote:
>> This patch adds support for using the LL TEMAC Ethernet driver on
>> non-Virtex 5 platforms by adding support for accessing the Soft DMA
>> registers as if they were memory mapped instead of solely through the
>> DCR's (available on the Virtex 5).
>>
>> The patch also updates the driver so that it runs on the MicroBlaze.
>> The changes were tested on the PowerPC 440, PowerPC 405, and the
>> MicroBlaze platforms.
>>
>> Signed-off-by: John Tyner <jtyner@cs.ucr.edu>
>> Signed-off-by: John Linn <john.linn@xilinx.com>
>> ---
>
> I've not booted this, but it looks right, and it compiles fine. The
> issues that Michal raised need to be delt with too, but they are
> preexisting bugs unrelated to this change which you should fix up in a
> separate patch.
>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
>
>>
>> V2 - Incorporated comments from Grant and added more logic to allow the driver
>> to work on MicroBlaze.
>>
>> drivers/net/Kconfig | 1 -
>> drivers/net/ll_temac.h | 17 +++++-
>> drivers/net/ll_temac_main.c | 124 ++++++++++++++++++++++++++++++++++---------
>> 3 files changed, 113 insertions(+), 29 deletions(-)
>>
>> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
>> index 9b6efe1..5402105 100644
>> --- a/drivers/net/Kconfig
>> +++ b/drivers/net/Kconfig
>> @@ -2443,7 +2443,6 @@ config MV643XX_ETH
>> config XILINX_LL_TEMAC
>> tristate "Xilinx LL TEMAC (LocalLink Tri-mode Ethernet MAC) driver"
>> select PHYLIB
>> - depends on PPC_DCR_NATIVE
>> help
>> This driver supports the Xilinx 10/100/1000 LocalLink TEMAC
>> core used in Xilinx Spartan and Virtex FPGAs
>> diff --git a/drivers/net/ll_temac.h b/drivers/net/ll_temac.h
>> index 1af66a1..915aa34 100644
>> --- a/drivers/net/ll_temac.h
>> +++ b/drivers/net/ll_temac.h
>> @@ -5,8 +5,11 @@
>> #include <linux/netdevice.h>
>> #include <linux/of.h>
>> #include <linux/spinlock.h>
>> +
>> +#ifdef CONFIG_PPC_DCR
>> #include <asm/dcr.h>
>> #include <asm/dcr-regs.h>
>> +#endif
>>
>> /* packet size info */
>> #define XTE_HDR_SIZE 14 /* size of Ethernet header */
>> @@ -290,8 +293,12 @@ This option defaults to enabled (set) */
>>
>> #define TX_CONTROL_CALC_CSUM_MASK 1
>>
>> +/* Align the IP data in the packet on word boundaries as MicroBlaze
>> + * needs it.
>> + */
>> +
>> #define XTE_ALIGN 32
>> -#define BUFFER_ALIGN(adr) ((XTE_ALIGN - ((u32) adr)) % XTE_ALIGN)
>> +#define BUFFER_ALIGN(adr) ((34 - ((u32) adr)) % XTE_ALIGN)
>>
>> #define MULTICAST_CAM_TABLE_NUM 4
>>
>> @@ -335,9 +342,15 @@ struct temac_local {
>> struct mii_bus *mii_bus; /* MII bus reference */
>> int mdio_irqs[PHY_MAX_ADDR]; /* IRQs table for MDIO bus */
>>
>> - /* IO registers and IRQs */
>> + /* IO registers, dma functions and IRQs */
>> void __iomem *regs;
>> + void __iomem *sdma_regs;
>> +#ifdef CONFIG_PPC_DCR
>> dcr_host_t sdma_dcrs;
>> +#endif
>> + u32 (*dma_in)(struct temac_local *, int);
>> + void (*dma_out)(struct temac_local *, int, u32);
>> +
>> int tx_irq;
>> int rx_irq;
>> int emac_num;
>> diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
>> index a18e348..9aedf9b 100644
>> --- a/drivers/net/ll_temac_main.c
>> +++ b/drivers/net/ll_temac_main.c
>> @@ -20,9 +20,6 @@
>> * or rx, so this should be okay.
>> *
>> * TODO:
>> - * - Fix driver to work on more than just Virtex5. Right now the driver
>> - * assumes that the locallink DMA registers are accessed via DCR
>> - * instructions.
>> * - Factor out locallink DMA code into separate driver
>> * - Fix multicast assignment.
>> * - Fix support for hardware checksumming.
>> @@ -115,17 +112,86 @@ void temac_indirect_out32(struct temac_local *lp, int reg, u32 value)
>> temac_iow(lp, XTE_CTL0_OFFSET, CNTLREG_WRITE_ENABLE_MASK | reg);
>> }
>>
>> +/**
>> + * temac_dma_in32 - Memory mapped DMA read, this function expects a
>> + * register input that is based on DCR word addresses which
>> + * are then converted to memory mapped byte addresses
>> + */
>> static u32 temac_dma_in32(struct temac_local *lp, int reg)
>> {
>> - return dcr_read(lp->sdma_dcrs, reg);
>> + return in_be32((u32 *)(lp->sdma_regs + (reg << 2)));
>> }
>>
>> +/**
>> + * temac_dma_out32 - Memory mapped DMA read, this function expects a
>> + * register input that is based on DCR word addresses which
>> + * are then converted to memory mapped byte addresses
>> + */
>> static void temac_dma_out32(struct temac_local *lp, int reg, u32 value)
>> {
>> + out_be32((u32 *)(lp->sdma_regs + (reg << 2)), value);
>> +}
>> +
>> +/* DMA register access functions can be DCR based or memory mapped.
>> + * The PowerPC 440 is DCR based, the PowerPC 405 and MicroBlaze are both
>> + * memory mapped.
>> + */
>> +#ifdef CONFIG_PPC_DCR
>> +
>> +/**
>> + * temac_dma_dcr_in32 - DCR based DMA read
>> + */
>> +static u32 temac_dma_dcr_in(struct temac_local *lp, int reg)
>> +{
>> + return dcr_read(lp->sdma_dcrs, reg);
>> +}
>> +
>> +/**
>> + * temac_dma_dcr_out32 - DCR based DMA write
>> + */
>> +static void temac_dma_dcr_out(struct temac_local *lp, int reg, u32 value)
>> +{
>> dcr_write(lp->sdma_dcrs, reg, value);
>> }
>>
>> /**
>> + * temac_dcr_setup - If the DMA is DCR based, then setup the address and
>> + * I/O functions
>> + */
>> +static int temac_dcr_setup(struct temac_local *lp, struct of_device *op,
>> + struct device_node *np)
>> +{
>> + unsigned int dcrs;
>> +
>> + /* setup the dcr address mapping if it's in the device tree */
>> +
>> + dcrs = dcr_resource_start(np, 0);
>> + if (dcrs != 0) {
>> + lp->sdma_dcrs = dcr_map(np, dcrs, dcr_resource_len(np, 0));
>> + lp->dma_in = temac_dma_dcr_in;
>> + lp->dma_out = temac_dma_dcr_out;
>> + dev_dbg(&op->dev, "DCR base: %x\n", dcrs);
>> + return 0;
>> + }
>> + /* no DCR in the device tree, indicate a failure */
>> + return -1;
>> +}
>> +
>> +#else
>> +
>> +/*
>> + * temac_dcr_setup - This is a stub for when DCR is not supported,
>> + * such as with MicroBlaze
>> + */
>> +static int temac_dcr_setup(struct temac_local *lp, struct of_device *op,
>> + struct device_node *np)
>> +{
>> + return -1;
>> +}
>> +
>> +#endif
>> +
>> +/**
>> * temac_dma_bd_init - Setup buffer descriptor rings
>> */
>> static int temac_dma_bd_init(struct net_device *ndev)
>> @@ -172,23 +238,23 @@ static int temac_dma_bd_init(struct net_device *ndev)
>> lp->rx_bd_v[i].app0 = STS_CTRL_APP0_IRQONEND;
>> }
>>
>> - temac_dma_out32(lp, TX_CHNL_CTRL, 0x10220400 |
>> + lp->dma_out(lp, TX_CHNL_CTRL, 0x10220400 |
>> CHNL_CTRL_IRQ_EN |
>> CHNL_CTRL_IRQ_DLY_EN |
>> CHNL_CTRL_IRQ_COAL_EN);
>> /* 0x10220483 */
>> /* 0x00100483 */
>> - temac_dma_out32(lp, RX_CHNL_CTRL, 0xff010000 |
>> + lp->dma_out(lp, RX_CHNL_CTRL, 0xff010000 |
>> CHNL_CTRL_IRQ_EN |
>> CHNL_CTRL_IRQ_DLY_EN |
>> CHNL_CTRL_IRQ_COAL_EN |
>> CHNL_CTRL_IRQ_IOE);
>> /* 0xff010283 */
>>
>> - temac_dma_out32(lp, RX_CURDESC_PTR, lp->rx_bd_p);
>> - temac_dma_out32(lp, RX_TAILDESC_PTR,
>> + lp->dma_out(lp, RX_CURDESC_PTR, lp->rx_bd_p);
>> + lp->dma_out(lp, RX_TAILDESC_PTR,
>> lp->rx_bd_p + (sizeof(*lp->rx_bd_v) * (RX_BD_NUM - 1)));
>> - temac_dma_out32(lp, TX_CURDESC_PTR, lp->tx_bd_p);
>> + lp->dma_out(lp, TX_CURDESC_PTR, lp->tx_bd_p);
>>
>> return 0;
>> }
>> @@ -426,9 +492,9 @@ static void temac_device_reset(struct net_device *ndev)
>> temac_indirect_out32(lp, XTE_RXC1_OFFSET, val & ~XTE_RXC1_RXEN_MASK);
>>
>> /* Reset Local Link (DMA) */
>> - temac_dma_out32(lp, DMA_CONTROL_REG, DMA_CONTROL_RST);
>> + lp->dma_out(lp, DMA_CONTROL_REG, DMA_CONTROL_RST);
>> timeout = 1000;
>> - while (temac_dma_in32(lp, DMA_CONTROL_REG) & DMA_CONTROL_RST) {
>> + while (lp->dma_in(lp, DMA_CONTROL_REG) & DMA_CONTROL_RST) {
>> udelay(1);
>> if (--timeout == 0) {
>> dev_err(&ndev->dev,
>> @@ -436,7 +502,7 @@ static void temac_device_reset(struct net_device *ndev)
>> break;
>> }
>> }
>> - temac_dma_out32(lp, DMA_CONTROL_REG, DMA_TAIL_ENABLE);
>> + lp->dma_out(lp, DMA_CONTROL_REG, DMA_TAIL_ENABLE);
>>
>> temac_dma_bd_init(ndev);
>>
>> @@ -597,7 +663,7 @@ static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
>> lp->tx_bd_tail = 0;
>>
>> /* Kick off the transfer */
>> - temac_dma_out32(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
>> + lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
>>
>> return NETDEV_TX_OK;
>> }
>> @@ -663,7 +729,7 @@ static void ll_temac_recv(struct net_device *ndev)
>> cur_p = &lp->rx_bd_v[lp->rx_bd_ci];
>> bdstat = cur_p->app0;
>> }
>> - temac_dma_out32(lp, RX_TAILDESC_PTR, tail_p);
>> + lp->dma_out(lp, RX_TAILDESC_PTR, tail_p);
>>
>> spin_unlock_irqrestore(&lp->rx_lock, flags);
>> }
>> @@ -674,8 +740,8 @@ static irqreturn_t ll_temac_tx_irq(int irq, void *_ndev)
>> struct temac_local *lp = netdev_priv(ndev);
>> unsigned int status;
>>
>> - status = temac_dma_in32(lp, TX_IRQ_REG);
>> - temac_dma_out32(lp, TX_IRQ_REG, status);
>> + status = lp->dma_in(lp, TX_IRQ_REG);
>> + lp->dma_out(lp, TX_IRQ_REG, status);
>>
>> if (status & (IRQ_COAL | IRQ_DLY))
>> temac_start_xmit_done(lp->ndev);
>> @@ -692,8 +758,8 @@ static irqreturn_t ll_temac_rx_irq(int irq, void *_ndev)
>> unsigned int status;
>>
>> /* Read and clear the status registers */
>> - status = temac_dma_in32(lp, RX_IRQ_REG);
>> - temac_dma_out32(lp, RX_IRQ_REG, status);
>> + status = lp->dma_in(lp, RX_IRQ_REG);
>> + lp->dma_out(lp, RX_IRQ_REG, status);
>>
>> if (status & (IRQ_COAL | IRQ_DLY))
>> ll_temac_recv(lp->ndev);
>> @@ -794,7 +860,7 @@ static ssize_t temac_show_llink_regs(struct device *dev,
>> int i, len = 0;
>>
>> for (i = 0; i < 0x11; i++)
>> - len += sprintf(buf + len, "%.8x%s", temac_dma_in32(lp, i),
>> + len += sprintf(buf + len, "%.8x%s", lp->dma_in(lp, i),
>> (i % 8) == 7 ? "\n" : " ");
>> len += sprintf(buf + len, "\n");
>>
>> @@ -820,7 +886,6 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
>> struct net_device *ndev;
>> const void *addr;
>> int size, rc = 0;
>> - unsigned int dcrs;
>>
>> /* Init network device structure */
>> ndev = alloc_etherdev(sizeof(*lp));
>> @@ -870,13 +935,20 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
>> goto nodev;
>> }
>>
>> - dcrs = dcr_resource_start(np, 0);
>> - if (dcrs == 0) {
>> - dev_err(&op->dev, "could not get DMA register address\n");
>> - goto nodev;
>> + /* Setup the DMA register accesses, could be DCR or memory mapped */
>> + if (temac_dcr_setup(lp, op, np)) {
>> +
>> + /* no DCR in the device tree, try non-DCR */
>> + lp->sdma_regs = of_iomap(np, 0);
>> + if (lp->sdma_regs) {
>> + lp->dma_in = temac_dma_in32;
>> + lp->dma_out = temac_dma_out32;
>> + dev_dbg(&op->dev, "MEM base: %p\n", lp->sdma_regs);
>> + } else {
>> + dev_err(&op->dev, "unable to map DMA registers\n");
>> + goto nodev;
>> + }
>> }
>> - lp->sdma_dcrs = dcr_map(np, dcrs, dcr_resource_len(np, 0));
>> - dev_dbg(&op->dev, "DCR base: %x\n", dcrs);
>>
>> lp->rx_irq = irq_of_parse_and_map(np, 0);
>> lp->tx_irq = irq_of_parse_and_map(np, 1);
>> --
>> 1.6.2.1
>>
>>
>>
>> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>>
>>
>>
>
>
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* Re: Increased Latencies when upgrading kernel version
From: Taylor Lewick @ 2010-04-05 17:34 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, linux-kernel
In-Reply-To: <r2pd585dc4f1004011853q405eaadcq14b50a9e7a4dcf21@mail.gmail.com>
Okay, don't know what to officially file this under, as a regression
with regards to performance or what, but here is the data. Again,
I've noticed system and network latency appear to have worsened with
later kernel versions.
I was turned onto this problem via the following links:
http://www.kernel.org/pub/linux/kernel/people/christoph/ols2009/ols-2009-paper.pdf
and http://kerneltrap.org/mailarchive/linux-netdev/2009/4/16/5491284
So I set up a test on two servers with Identical hardware, servers,
nics, etc, and used hackbench, udpping, and an internally written app
to compare latency.
Here are just the hackbench results with just the averages across a 5
runs for two different hackbench tests. The 2.6.16 and 2.6.27 kernels
as set up were configured with voluntary preemption, and 250 HZ, so I
just repeated that initially for 2.6.33.1 test. I also tested no
preemption at same HZ setting of 250.
I ran 2.6.16.60 on one server, and the other kernel versions on
another server. These tests are repeatable across different servers,
as in I verified I
don't have a bad server.
Kernel Version HB1 (25 process 300) HB2 (100 process 300)
2.6.16.60 .5402 1.8946
2.6.27.19 .619 2.6268
2.6.32.3-voluntary .5636 2.3484
2.6.33.1-voluntary .5404 2.2872
2.6.33.1-nopreempt .5606 2.3466
So 2.6.16.60 is fast, 2.6.27.19 is slow, and 2.6.33.1 with voluntary
preemption is the next best, but results didn't hold up well as
Hackbench tests used larger numbers of groups., for example, 2.6.16.60
and 2.6.33.1-voluntary were basically the same for HB1, but that
didn't hold when hackebnch tests used more groups.
At this point, I'm looking for ideas in kernel build to tweak, but I'm
not a developer. So SLAB vs SLUB, sparse vs dense IRQ numbering, etc.
Running a -rt kernel isn't an option at this time. I did test that as
well, and latencies were quite a bit worse, but I wasn't adjusting
code to take advantage of a real time OS.
I can make some changes or repeat tests.
Below is some hardware comparisons betweent the two machines.
Differences I noticed was more interrupts and CPU flags on later
kernel version.
HostA 2.6.16.60
cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5
CPU6 CPU7
0: 108509762 0 0 0 0 0
0 0 IO-APIC-edge timer
8: 1 0 0 0 0 0
0 0 IO-APIC-edge rtc
9: 0 0 0 0 0 0
0 0 IO-APIC-level acpi
58: 305 0 5157735 220 2980100 5927
1187 0 IO-APIC-level libata
162: 0 0 0 0 0 0
0 0 IO-APIC-level uhci_hcd:usb1
170: 0 0 0 0 0 0
0 0 IO-APIC-level uhci_hcd:usb2
177: 6326 0 229018 0 283720 35597
367 0 IO-APIC-level megasas
178: 122 0 1784 1103 3531 20
1457 0 IO-APIC-level uhci_hcd:usb3, ehci_hcd:usb6
186: 0 0 0 0 0 0
0 0 IO-APIC-level uhci_hcd:usb4
194: 22 0 0 0 0 0
0 0 IO-APIC-level ehci_hcd:usb5
210: 1790109 577 0 0 0 0
0 0 PCI-MSI-X eth4-0
218: 233811 93 0 0 0 0
0 0 PCI-MSI-X eth4-1
NMI: 0 0 0 0 0 0
0 0
LOC: 108509683 108509662 108509637 108509614 108509588 108509566
108509541 108509516
ERR: 7
MIS: 0
lspci
00:00.0 Host bridge: Intel Corporation QuickPath Architecture I/O Hub
to ESI Port (rev 13)
00:01.0 PCI bridge: Intel Corporation QuickPath Architecture I/O Hub
PCI Express Root Port 1 (rev 13)
00:03.0 PCI bridge: Intel Corporation QuickPath Architecture I/O Hub
PCI Express Root Port 3 (rev 13)
00:07.0 PCI bridge: Intel Corporation QuickPath Architecture I/O Hub
PCI Express Root Port 7 (rev 13)
00:09.0 PCI bridge: Intel Corporation QuickPath Architecture I/O Hub
PCI Express Root Port 9 (rev 13)
00:14.0 PIC: Intel Corporation QuickPath Architecture I/O Hub System
Management Registers (rev 13)
00:14.1 PIC: Intel Corporation QuickPath Architecture I/O Hub GPIO and
Scratch Pad Registers (rev 13)
00:14.2 PIC: Intel Corporation QuickPath Architecture I/O Hub Control
Status and RAS Registers (rev 13)
00:16.0 System peripheral: Intel Corporation DMA Engine (rev 13)
00:16.1 System peripheral: Intel Corporation DMA Engine (rev 13)
00:16.2 System peripheral: Intel Corporation DMA Engine (rev 13)
00:16.3 System peripheral: Intel Corporation DMA Engine (rev 13)
00:16.4 System peripheral: Intel Corporation DMA Engine (rev 13)
00:16.5 System peripheral: Intel Corporation DMA Engine (rev 13)
00:16.6 System peripheral: Intel Corporation DMA Engine (rev 13)
00:16.7 System peripheral: Intel Corporation DMA Engine (rev 13)
00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB
UHCI Controller #4 (rev 02)
00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB
UHCI Controller #5 (rev 02)
00:1a.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2
EHCI Controller #2 (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express
Port 1 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB
UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB
UHCI Controller #2 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2
EHCI Controller #1 (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92)
00:1f.0 ISA bridge: Intel Corporation 82801IB (ICH9) LPC Interface
Controller (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801IB (ICH9) 2 port SATA
IDE Controller (rev 02)
03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS
1078 (rev 04)
04:00.0 PCI bridge: Integrated Device Technology, Inc. Unknown device
8018 (rev 0e)
05:02.0 PCI bridge: Integrated Device Technology, Inc. Unknown device
8018 (rev 0e)
05:04.0 PCI bridge: Integrated Device Technology, Inc. Unknown device
8018 (rev 0e)
06:00.0 Ethernet controller: Intel Corporation 82575GB Gigabit Network
Connection (rev 02)
06:00.1 Ethernet controller: Intel Corporation 82575GB Gigabit Network
Connection (rev 02)
07:00.0 Ethernet controller: Intel Corporation 82575GB Gigabit Network
Connection (rev 02)
07:00.1 Ethernet controller: Intel Corporation 82575GB Gigabit Network
Connection (rev 02)
08:00.0 Ethernet controller: Solarflare Communications Unknown device
0710 (rev 02)
09:03.0 VGA compatible controller: Matrox Graphics, Inc. Unknown
device 0532 (rev 0a)
cat /proc/cpuinfo (just showing first CPU for brevity)
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 26
model name : Intel(R) Xeon(R) CPU X5570 @ 2.93GHz
stepping : 5
cpu MHz : 2926.090
cache size : 8192 KB
physical id : 1
siblings : 4
core id : 0
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall
nx rdtscp lm constant_tsc pni monitor d
s_cpl vmx est tm2 cx16 xtpr dca popcnt lahf_lm
bogomips : 5857.34
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
ethtool -c eth4
Coalesce parameters for eth4:
Adaptive RX: on TX: off
stats-block-usecs: 0
sample-interval: 0
pkt-rate-low: 0
pkt-rate-high: 0
rx-usecs: 0
rx-frames: 0
rx-usecs-irq: 60
rx-frames-irq: 0
tx-usecs: 0
tx-frames: 0
tx-usecs-irq: 0
tx-frames-irq: 0
rx-usecs-low: 0
rx-frame-low: 0
tx-usecs-low: 0
tx-frame-low: 0
rx-usecs-high: 0
rx-frame-high: 0
tx-usecs-high: 0
tx-frame-high: 0
HostB 2.6.33.1
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5
CPU6 CPU7
0: 8637 0 0 0 0
0 0 0 IO-APIC-edge timer
1: 2 0 0 0 0
0 0 0 IO-APIC-edge i8042
3: 2 0 0 0 0
0 0 0 IO-APIC-edge
4: 2 0 0 0 0
0 0 0 IO-APIC-edge
8: 1 0 0 0 0
0 0 0 IO-APIC-edge rtc0
9: 0 0 0 0 0
0 0 0 IO-APIC-fasteoi acpi
12: 4 0 0 0 0
0 0 0 IO-APIC-edge i8042
16: 7434 683 0 0 0
0 0 0 IO-APIC-fasteoi megasas
17: 0 0 0 0 0
0 0 0 IO-APIC-fasteoi uhci_hcd:usb3
18: 0 0 0 0 0
0 0 0 IO-APIC-fasteoi uhci_hcd:usb4
19: 23 0 0 0 0
0 0 0 IO-APIC-fasteoi ehci_hcd:usb1
20: 0 0 0 0 0
0 0 0 IO-APIC-fasteoi uhci_hcd:usb6
21: 129 0 15 0 0
0 0 0 IO-APIC-fasteoi ehci_hcd:usb2,
uhci_hcd:usb5
23: 369 0 0 0 0
0 0 0 IO-APIC-fasteoi ata_piix
67: 2346 731 0 0 0
0 0 0 PCI-MSI-edge eth4-0
68: 1809 404 0 0 0
0 0 0 PCI-MSI-edge eth4-1
NMI: 0 0 0 0 0
0 0 0 Non-maskable interrupts
LOC: 33071 38348 47397 23246 15715
11065 9004 10391 Local timer interrupts
SPU: 0 0 0 0 0
0 0 0 Spurious interrupts
PMI: 0 0 0 0 0
0 0 0 Performance monitoring interrupts
PND: 0 0 0 0 0
0 0 0 Performance pending work
RES: 2490 2124 4187 4974 1724
5548 1892 2871 Rescheduling interrupts
CAL: 497 2166 141 115 133
144 140 144 Function call interrupts
TLB: 243 244 928 945 289
187 134 93 TLB shootdowns
TRM: 0 0 0 0 0
0 0 0 Thermal event interrupts
THR: 0 0 0 0 0
0 0 0 Threshold APIC interrupts
MCE: 0 0 0 0 0
0 0 0 Machine check exceptions
MCP: 2 2 2 2 2
2 2 2 Machine check polls
ERR: 7
MIS: 0
lspci
00:00.0 Host bridge: Intel Corporation X58 I/O Hub to ESI Port (rev 13)
00:01.0 PCI bridge: Intel Corporation X58 I/O Hub PCI Express Root
Port 1 (rev 13)
00:03.0 PCI bridge: Intel Corporation X58 I/O Hub PCI Express Root
Port 3 (rev 13)
00:07.0 PCI bridge: Intel Corporation X58 I/O Hub PCI Express Root
Port 7 (rev 13)
00:09.0 PCI bridge: Intel Corporation X58 I/O Hub PCI Express Root
Port 9 (rev 13)
00:14.0 PIC: Intel Corporation X58 I/O Hub System Management Registers (rev 13)
00:14.1 PIC: Intel Corporation X58 I/O Hub GPIO and Scratch Pad
Registers (rev 13)
00:14.2 PIC: Intel Corporation X58 I/O Hub Control Status and RAS
Registers (rev 13)
00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB
UHCI Controller #4 (rev 02)
00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB
UHCI Controller #5 (rev 02)
00:1a.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2
EHCI Controller #2 (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express
Port 1 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB
UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB
UHCI Controller #2 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2
EHCI Controller #1 (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92)
00:1f.0 ISA bridge: Intel Corporation 82801IB (ICH9) LPC Interface
Controller (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801IB (ICH9) 2 port SATA
IDE Controller (rev 02)
03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS
1078 (rev 04)
04:00.0 PCI bridge: Integrated Device Technology, Inc. PES12N3A PCI
Express Switch (rev 0e)
05:02.0 PCI bridge: Integrated Device Technology, Inc. PES12N3A PCI
Express Switch (rev 0e)
05:04.0 PCI bridge: Integrated Device Technology, Inc. PES12N3A PCI
Express Switch (rev 0e)
06:00.0 Ethernet controller: Intel Corporation 82575GB Gigabit Network
Connection (rev 02)
06:00.1 Ethernet controller: Intel Corporation 82575GB Gigabit Network
Connection (rev 02)
07:00.0 Ethernet controller: Intel Corporation 82575GB Gigabit Network
Connection (rev 02)
07:00.1 Ethernet controller: Intel Corporation 82575GB Gigabit Network
Connection (rev 02)
08:00.0 Ethernet controller: Solarflare Communications SFC4000 rev B
[Solarstorm] (rev 02)
09:03.0 VGA compatible controller: Matrox Graphics, Inc. MGA G200eW
WPCM450 (rev 0a)
cat /proc/cpuinfo (just showing first CPU for brevity)
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 26
model name : Intel(R) Xeon(R) CPU X5570 @ 2.93GHz
stepping : 5
cpu MHz : 2925.888
cache size : 8192 KB
physical id : 1
siblings : 4
core id : 0
cpu cores : 4
apicid : 16
initial apicid : 16
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe
syscall nx rdtscp lm constant_tsc arch_perfmon pebs bt
s rep_good xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl
vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm ida
tpr_shadow vnmi flexpriority ept vpid
bogomips : 5851.77
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
ethtool -c eth4
Coalesce parameters for eth4:
Adaptive RX: on TX: off
stats-block-usecs: 0
sample-interval: 0
pkt-rate-low: 0
pkt-rate-high: 0
rx-usecs: 0
rx-frames: 0
rx-usecs-irq: 60
rx-frames-irq: 0
tx-usecs: 0
tx-frames: 0
tx-usecs-irq: 0
tx-frames-irq: 0
rx-usecs-low: 0
rx-frame-low: 0
tx-usecs-low: 0
tx-frame-low: 0
rx-usecs-high: 0
rx-frame-high: 0
tx-usecs-high: 0
tx-frame-high: 0
On Thu, Apr 1, 2010 at 8:53 PM, Taylor Lewick <taylor.lewick@gmail.com> wrote:
> Okay. I will get this info out to the list Monday. Briefly, I'm
> using identical hardware (server), identical NICs, same drivers,
> connected to same switch, and using udpping, hackbench, and an
> internall written app to test latency. Without exception the
> evolution has looked like the following.
>
> 2.6.16.60 latencies for system and network are fast. Meaning
> hackbench and udpping win, and win by quite a bit.
>
> 2.6.27.19 was awful. 2.6.32.1 and 2.6.331. were better for networking
> (with some tweaks, i.e. disable netfilter, etc), and I was able to get
> networking latencies to within 1-3 microseconds of 2.6.16.60
> latencies, but the hackbench results are still pretty bad.
>
> Again, I'll post numbers and more detailed hardware info on Monday
> when I'm back at office...
>
> On Thu, Apr 1, 2010 at 4:19 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> Le jeudi 01 avril 2010 à 14:12 -0500, Taylor Lewick a écrit :
>>> For some time now we've been running an older kernel, 2.6.16.60. When
>>> we tried to upgrade, first going to 2.6.27.19 and then to 2.6.32.1 and
>>> 2.6.33.1 we noticed that latencies increased. At first we noticed it
>>> by doing network tests via udpping, netperf, etc. We made some
>>> tweaks, and were able to get network latency to within 1 to 2
>>> microseconds of where we were previously on 2.6.16.60. Then we did
>>> some more testing, and noticed that system latency also seems higher.
>>>
>>> We've done our tests on identical hardware servers, same NICs,
>>> connected through same network gear. Basically, we've tried to keep
>>> everything identical except the kernel versions, and we are unable to
>>> achieve the same performance for system latency on the newer kernels,
>>> despite adjusting various kernel settings and recompiling.
>>>
>>> The latency differences are about 15 microseconds per transaction.
>>>
>>> At this point, I don't know what else to try. I haven't played around
>>> with the /proc/sys/kernel/sched_* paramaters under the newer kernels
>>> yet. Have tried changing pre-emption modes with little effect, in
>>> fact, voluntary preemption seems to be peforming the best for us.
>>>
>>> At this time the realtime patch isn't really an option for us to
>>> consider, at least not yet.
>>>
>>> Any suggestions? Is this a known issue when upgrading to more recent
>>> kernel versions?
>>>
>>
>> Hi Taylor
>>
>> Well, this is bit difficult to generically answer to your generic
>> question. 15 us more latency per transaction seems pretty bad.
>>
>> Some inputs would be nice, describing your workload and
>> software/hardware architecture.
>>
>> lspci
>> cat /proc/cpuinfo
>> cat /proc/interrupts
>> dmesg
>> ethtool -S eth0
>> ethtool -c eth0
>>
>>
>>
>>
>
^ permalink raw reply
* tulip_stop_rxtx() failed (CSR5 0xf0260000 CSR6 0xb3862002) on DEC Alpha Personal Workstation 433au
From: Adrian Glaubitz @ 2010-04-05 17:13 UTC (permalink / raw)
To: Grant Grundler, Kyle McMartin, David S. Miller, Joe Perches
Cc: netdev, linux-kernel
Hi guys,
I installed Debian unstable on an old digital workstation "DEC Digital
Personal Workstation 433au" (Miata) which has an on-board tulip
network controller. I'm not really using that network controller but
an off-board intel e1000 controller. However, I found that the tulip
driver produces a lot of noise in the message log, the following
message is repated periodically and spams the whole message log:
0000:00:03.0: tulip_stop_rxtx() failed (CSR5 0xf0260000 CSR6 0xb3862002)
Do you think this is related to the fact that no cable is connected to
the network controller?
The lspci output of the hardware looks like this:
test-adrian1:~# lspci
00:03.0 Ethernet controller: Digital Equipment Corporation DECchip 21142/43 (rev 30)
00:07.0 ISA bridge: Contaq Microsystems 82c693
00:07.1 IDE interface: Contaq Microsystems 82c693
00:07.2 IDE interface: Contaq Microsystems 82c693
00:07.3 USB Controller: Contaq Microsystems 82c693
00:0b.0 VGA compatible controller: Matrox Graphics, Inc. MGA 2064W [Millennium] (rev 01)
00:14.0 PCI bridge: Digital Equipment Corporation DECchip 21152 (rev 03)
01:04.0 SCSI storage controller: QLogic Corp. ISP1020 Fast-wide SCSI (rev 05)
01:09.0 Ethernet controller: Intel Corporation 82541GI Gigabit Ethernet Controller
If you need anymore verbose or debug output, please let me know.
Adrian
^ permalink raw reply
* Re: tulip_stop_rxtx() failed (CSR5 0xf0260000 CSR6 0xb3862002) on DEC Alpha Personal Workstation 433au
From: Joe Perches @ 2010-04-05 17:36 UTC (permalink / raw)
To: Adrian Glaubitz
Cc: Grant Grundler, Kyle McMartin, David S. Miller, netdev,
linux-kernel
In-Reply-To: <20100405171318.GA18915@physik.fu-berlin.de>
On Mon, 2010-04-05 at 19:13 +0200, Adrian Glaubitz wrote:
> Hi guys,
>
> I installed Debian unstable on an old digital workstation "DEC Digital
> Personal Workstation 433au" (Miata) which has an on-board tulip
> network controller. I'm not really using that network controller but
> an off-board intel e1000 controller. However, I found that the tulip
> driver produces a lot of noise in the message log, the following
> message is repated periodically and spams the whole message log:
>
> 0000:00:03.0: tulip_stop_rxtx() failed (CSR5 0xf0260000 CSR6 0xb3862002)
>
> Do you think this is related to the fact that no cable is connected to
> the network controller?
Probably something is trying periodically to open the device.
Maybe this helps reduce the message log noise:
Signed-off-by: Joe Perches <joe@perches.com>
---
diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h
index 0afa2d4..8c675aa 100644
--- a/drivers/net/tulip/tulip.h
+++ b/drivers/net/tulip/tulip.h
@@ -515,12 +515,11 @@ static inline void tulip_stop_rxtx(struct tulip_private *tp)
while (--i && (ioread32(ioaddr + CSR5) & (CSR5_TS|CSR5_RS)))
udelay(10);
- if (!i)
- printk(KERN_DEBUG "%s: tulip_stop_rxtx() failed"
- " (CSR5 0x%x CSR6 0x%x)\n",
- pci_name(tp->pdev),
- ioread32(ioaddr + CSR5),
- ioread32(ioaddr + CSR6));
+ if (!i && tulip_debug > 1)
+ printk(KERN_DEBUG "%s: tulip_stop_rxtx() failed (CSR5 0x%x CSR6 0x%x)\n",
+ pci_name(tp->pdev),
+ ioread32(ioaddr + CSR5),
+ ioread32(ioaddr + CSR6));
}
}
^ permalink raw reply related
* Re: [PATCH] vhost: Make it more scalable by creating a vhost thread per device.
From: Sridhar Samudrala @ 2010-04-05 17:35 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Tom Lendacky, netdev, kvm@vger.kernel.org
In-Reply-To: <20100404111433.GD3189@redhat.com>
On Sun, 2010-04-04 at 14:14 +0300, Michael S. Tsirkin wrote:
> On Fri, Apr 02, 2010 at 10:31:20AM -0700, Sridhar Samudrala wrote:
> > Make vhost scalable by creating a separate vhost thread per vhost
> > device. This provides better scaling across multiple guests and with
> > multiple interfaces in a guest.
>
> Thanks for looking into this. An alternative approach is
> to simply replace create_singlethread_workqueue with
> create_workqueue which would get us a thread per host CPU.
>
> It seems that in theory this should be the optimal approach
> wrt CPU locality, however, in practice a single thread
> seems to get better numbers. I have a TODO to investigate this.
> Could you try looking into this?
Yes. I tried using create_workqueue(), but the results were not good
atleast when the number of guest interfaces is less than the number
of CPUs. I didn't try more than 8 guests.
Creating a separate thread per guest interface seems to be more
scalable based on the testing i have done so far.
I will try some more tests and get some numbers to compare the following
3 options.
- single vhost thread
- vhost thread per cpu
- vhost thread per guest virtio interface
Thanks
Sridhar
>
> >
> > I am seeing better aggregated througput/latency when running netperf
> > across multiple guests or multiple interfaces in a guest in parallel
> > with this patch.
>
> Any numbers? What happens to CPU utilization?
>
> > Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
> >
> > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> > index a6a88df..29aa80f 100644
> > --- a/drivers/vhost/net.c
> > +++ b/drivers/vhost/net.c
> > @@ -339,8 +339,10 @@ static int vhost_net_open(struct inode *inode, struct file *f)
> > return r;
> > }
> >
> > - vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT);
> > - vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN);
> > + vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT,
> > + &n->dev);
> > + vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN,
> > + &n->dev);
> > n->tx_poll_state = VHOST_NET_POLL_DISABLED;
> >
> > f->private_data = n;
> > @@ -643,25 +645,14 @@ static struct miscdevice vhost_net_misc = {
> >
> > int vhost_net_init(void)
> > {
> > - int r = vhost_init();
> > - if (r)
> > - goto err_init;
> > - r = misc_register(&vhost_net_misc);
> > - if (r)
> > - goto err_reg;
> > - return 0;
> > -err_reg:
> > - vhost_cleanup();
> > -err_init:
> > - return r;
> > -
> > + return misc_register(&vhost_net_misc);
> > }
> > +
> > module_init(vhost_net_init);
> >
> > void vhost_net_exit(void)
> > {
> > misc_deregister(&vhost_net_misc);
> > - vhost_cleanup();
> > }
> > module_exit(vhost_net_exit);
> >
> > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> > index 7bd7a1e..243f4d3 100644
> > --- a/drivers/vhost/vhost.c
> > +++ b/drivers/vhost/vhost.c
> > @@ -36,8 +36,6 @@ enum {
> > VHOST_MEMORY_F_LOG = 0x1,
> > };
> >
> > -static struct workqueue_struct *vhost_workqueue;
> > -
> > static void vhost_poll_func(struct file *file, wait_queue_head_t *wqh,
> > poll_table *pt)
> > {
> > @@ -56,18 +54,19 @@ static int vhost_poll_wakeup(wait_queue_t *wait, unsigned mode, int sync,
> > if (!((unsigned long)key & poll->mask))
> > return 0;
> >
> > - queue_work(vhost_workqueue, &poll->work);
> > + queue_work(poll->dev->wq, &poll->work);
> > return 0;
> > }
> >
> > /* Init poll structure */
> > void vhost_poll_init(struct vhost_poll *poll, work_func_t func,
> > - unsigned long mask)
> > + unsigned long mask, struct vhost_dev *dev)
> > {
> > INIT_WORK(&poll->work, func);
> > init_waitqueue_func_entry(&poll->wait, vhost_poll_wakeup);
> > init_poll_funcptr(&poll->table, vhost_poll_func);
> > poll->mask = mask;
> > + poll->dev = dev;
> > }
> >
> > /* Start polling a file. We add ourselves to file's wait queue. The caller must
> > @@ -96,7 +95,7 @@ void vhost_poll_flush(struct vhost_poll *poll)
> >
> > void vhost_poll_queue(struct vhost_poll *poll)
> > {
> > - queue_work(vhost_workqueue, &poll->work);
> > + queue_work(poll->dev->wq, &poll->work);
> > }
> >
> > static void vhost_vq_reset(struct vhost_dev *dev,
> > @@ -128,6 +127,11 @@ long vhost_dev_init(struct vhost_dev *dev,
> > struct vhost_virtqueue *vqs, int nvqs)
> > {
> > int i;
> > +
> > + dev->wq = create_singlethread_workqueue("vhost");
> > + if (!dev->wq)
> > + return -ENOMEM;
> > +
> > dev->vqs = vqs;
> > dev->nvqs = nvqs;
> > mutex_init(&dev->mutex);
> > @@ -143,7 +147,7 @@ long vhost_dev_init(struct vhost_dev *dev,
> > if (dev->vqs[i].handle_kick)
> > vhost_poll_init(&dev->vqs[i].poll,
> > dev->vqs[i].handle_kick,
> > - POLLIN);
> > + POLLIN, dev);
> > }
> > return 0;
> > }
> > @@ -216,6 +220,8 @@ void vhost_dev_cleanup(struct vhost_dev *dev)
> > if (dev->mm)
> > mmput(dev->mm);
> > dev->mm = NULL;
> > +
> > + destroy_workqueue(dev->wq);
> > }
> >
> > static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz)
> > @@ -1095,16 +1101,3 @@ void vhost_disable_notify(struct vhost_virtqueue *vq)
> > vq_err(vq, "Failed to enable notification at %p: %d\n",
> > &vq->used->flags, r);
> > }
> > -
> > -int vhost_init(void)
> > -{
> > - vhost_workqueue = create_singlethread_workqueue("vhost");
> > - if (!vhost_workqueue)
> > - return -ENOMEM;
> > - return 0;
> > -}
> > -
> > -void vhost_cleanup(void)
> > -{
> > - destroy_workqueue(vhost_workqueue);
> > -}
> > diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> > index 44591ba..60fefd0 100644
> > --- a/drivers/vhost/vhost.h
> > +++ b/drivers/vhost/vhost.h
> > @@ -29,10 +29,11 @@ struct vhost_poll {
> > /* struct which will handle all actual work. */
> > struct work_struct work;
> > unsigned long mask;
> > + struct vhost_dev *dev;
> > };
> >
> > void vhost_poll_init(struct vhost_poll *poll, work_func_t func,
> > - unsigned long mask);
> > + unsigned long mask, struct vhost_dev *dev);
> > void vhost_poll_start(struct vhost_poll *poll, struct file *file);
> > void vhost_poll_stop(struct vhost_poll *poll);
> > void vhost_poll_flush(struct vhost_poll *poll);
> > @@ -110,6 +111,7 @@ struct vhost_dev {
> > int nvqs;
> > struct file *log_file;
> > struct eventfd_ctx *log_ctx;
> > + struct workqueue_struct *wq;
> > };
> >
> > long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue *vqs, int nvqs);
> > @@ -136,9 +138,6 @@ bool vhost_enable_notify(struct vhost_virtqueue *);
> > int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log,
> > unsigned int log_num, u64 len);
> >
> > -int vhost_init(void);
> > -void vhost_cleanup(void);
> > -
> > #define vq_err(vq, fmt, ...) do { \
> > pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
> > if ((vq)->error_ctx) \
> >
> >
> >
^ permalink raw reply
* Re: [PATCH] ethtool: add names of newer Marvell chips
From: Stephen Hemminger @ 2010-04-05 17:34 UTC (permalink / raw)
To: Mark Ryden; +Cc: Jeff Garzik, netdev
In-Reply-To: <q2sdac45061004030020n28a1ad17p71ed2c074ebb6450@mail.gmail.com>
On Sat, 3 Apr 2010 10:20:40 +0300
Mark Ryden <markryde@gmail.com> wrote:
> Hi,
>
> > + case 0xba: printf("Yukon Ultra 2"); break;
> > + case 0xbc: printf("Yukon Optima"); break;
>
> What about 0xbb?
> Is there ant reason for not using 0xbb for Yukon Optima?
>
> Is it something with blackberry (bb)? :-)
The value comes from a chip register.
The vendor hardware engineers didn't choose to use that version
yet.
^ permalink raw reply
* [PATCH 1/4] flow: virtualize flow cache entry methods
From: Timo Teras @ 2010-04-05 17:01 UTC (permalink / raw)
To: Herbert Xu; +Cc: netdev, Timo Teras
In-Reply-To: <20100405091228.GA17059@gondor.apana.org.au>
This allows to validate the cached object before returning it.
It also allows to destruct object properly, if the last reference
was held in flow cache. This is also a prepartion for caching
bundles in the flow cache.
In return for virtualizing the methods, we save on:
- not having to regenerate the whole flow cache on policy removal:
each flow matching a killed policy gets refreshed as the getter
function notices it smartly.
- we do not have to call flow_cache_flush from policy gc, since the
flow cache now properly deletes the object if it had any references
Signed-off-by: Timo Teras <timo.teras@iki.fi>
---
include/net/flow.h | 23 +++++++--
include/net/xfrm.h | 2 +
net/core/flow.c | 122 +++++++++++++++++++++++++-----------------------
net/xfrm/xfrm_policy.c | 112 +++++++++++++++++++++++++++++---------------
4 files changed, 158 insertions(+), 101 deletions(-)
diff --git a/include/net/flow.h b/include/net/flow.h
index 809970b..bb08692 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -86,11 +86,26 @@ struct flowi {
struct net;
struct sock;
-typedef int (*flow_resolve_t)(struct net *net, struct flowi *key, u16 family,
- u8 dir, void **objp, atomic_t **obj_refp);
+struct flow_cache_ops;
+
+struct flow_cache_object {
+ const struct flow_cache_ops *ops;
+};
+
+struct flow_cache_ops {
+ struct flow_cache_object *(*get)(struct flow_cache_object *);
+ int (*check)(struct flow_cache_object *);
+ void (*delete)(struct flow_cache_object *);
+};
+
+typedef struct flow_cache_object *(*flow_resolve_t)(
+ struct net *net, struct flowi *key, u16 family,
+ u8 dir, struct flow_cache_object *oldobj, void *ctx);
+
+extern struct flow_cache_object *flow_cache_lookup(
+ struct net *net, struct flowi *key, u16 family,
+ u8 dir, flow_resolve_t resolver, void *ctx);
-extern void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family,
- u8 dir, flow_resolve_t resolver);
extern void flow_cache_flush(void);
extern atomic_t flow_cache_genid;
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index d74e080..35396e2 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -19,6 +19,7 @@
#include <net/route.h>
#include <net/ipv6.h>
#include <net/ip6_fib.h>
+#include <net/flow.h>
#include <linux/interrupt.h>
@@ -481,6 +482,7 @@ struct xfrm_policy {
atomic_t refcnt;
struct timer_list timer;
+ struct flow_cache_object flo;
u32 priority;
u32 index;
struct xfrm_mark mark;
diff --git a/net/core/flow.c b/net/core/flow.c
index 1d27ca6..4e9fd37 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -26,17 +26,16 @@
#include <linux/security.h>
struct flow_cache_entry {
- struct flow_cache_entry *next;
- u16 family;
- u8 dir;
- u32 genid;
- struct flowi key;
- void *object;
- atomic_t *object_ref;
+ struct flow_cache_entry *next;
+ u16 family;
+ u8 dir;
+ u32 genid;
+ struct flowi key;
+ struct flow_cache_object *object;
};
struct flow_cache_percpu {
- struct flow_cache_entry ** hash_table;
+ struct flow_cache_entry **hash_table;
int hash_count;
u32 hash_rnd;
int hash_rnd_recalc;
@@ -44,7 +43,7 @@ struct flow_cache_percpu {
};
struct flow_flush_info {
- struct flow_cache * cache;
+ struct flow_cache *cache;
atomic_t cpuleft;
struct completion completion;
};
@@ -52,7 +51,7 @@ struct flow_flush_info {
struct flow_cache {
u32 hash_shift;
unsigned long order;
- struct flow_cache_percpu * percpu;
+ struct flow_cache_percpu *percpu;
struct notifier_block hotcpu_notifier;
int low_watermark;
int high_watermark;
@@ -78,12 +77,21 @@ static void flow_cache_new_hashrnd(unsigned long arg)
add_timer(&fc->rnd_timer);
}
+static int flow_entry_valid(struct flow_cache_entry *fle)
+{
+ if (atomic_read(&flow_cache_genid) != fle->genid)
+ return 0;
+ if (fle->object && !fle->object->ops->check(fle->object))
+ return 0;
+ return 1;
+}
+
static void flow_entry_kill(struct flow_cache *fc,
struct flow_cache_percpu *fcp,
struct flow_cache_entry *fle)
{
if (fle->object)
- atomic_dec(fle->object_ref);
+ fle->object->ops->delete(fle->object);
kmem_cache_free(flow_cachep, fle);
fcp->hash_count--;
}
@@ -96,16 +104,18 @@ static void __flow_cache_shrink(struct flow_cache *fc,
int i;
for (i = 0; i < flow_cache_hash_size(fc); i++) {
- int k = 0;
+ int saved = 0;
flp = &fcp->hash_table[i];
- while ((fle = *flp) != NULL && k < shrink_to) {
- k++;
- flp = &fle->next;
- }
while ((fle = *flp) != NULL) {
- *flp = fle->next;
- flow_entry_kill(fc, fcp, fle);
+ if (saved < shrink_to &&
+ flow_entry_valid(fle)) {
+ saved++;
+ flp = &fle->next;
+ } else {
+ *flp = fle->next;
+ flow_entry_kill(fc, fcp, fle);
+ }
}
}
}
@@ -166,18 +176,21 @@ static int flow_key_compare(struct flowi *key1, struct flowi *key2)
return 0;
}
-void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family, u8 dir,
- flow_resolve_t resolver)
+struct flow_cache_object *
+flow_cache_lookup(struct net *net, struct flowi *key, u16 family, u8 dir,
+ flow_resolve_t resolver, void *ctx)
{
struct flow_cache *fc = &flow_cache_global;
struct flow_cache_percpu *fcp;
struct flow_cache_entry *fle, **head;
+ struct flow_cache_object *flo;
unsigned int hash;
local_bh_disable();
fcp = per_cpu_ptr(fc->percpu, smp_processor_id());
fle = NULL;
+ flo = NULL;
/* Packet really early in init? Making flow_cache_init a
* pre-smp initcall would solve this. --RR */
if (!fcp->hash_table)
@@ -185,24 +198,14 @@ void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family, u8 dir,
if (fcp->hash_rnd_recalc)
flow_new_hash_rnd(fc, fcp);
- hash = flow_hash_code(fc, fcp, key);
+ hash = flow_hash_code(fc, fcp, key);
head = &fcp->hash_table[hash];
for (fle = *head; fle; fle = fle->next) {
if (fle->family == family &&
fle->dir == dir &&
- flow_key_compare(key, &fle->key) == 0) {
- if (fle->genid == atomic_read(&flow_cache_genid)) {
- void *ret = fle->object;
-
- if (ret)
- atomic_inc(fle->object_ref);
- local_bh_enable();
-
- return ret;
- }
+ flow_key_compare(key, &fle->key) == 0)
break;
- }
}
if (!fle) {
@@ -219,33 +222,35 @@ void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family, u8 dir,
fle->object = NULL;
fcp->hash_count++;
}
+ } else if (fle->genid == atomic_read(&flow_cache_genid)) {
+ flo = fle->object;
+ if (!flo)
+ goto ret_object;
+ flo = flo->ops->get(flo);
+ if (flo)
+ goto ret_object;
}
nocache:
- {
- int err;
- void *obj;
- atomic_t *obj_ref;
-
- err = resolver(net, key, family, dir, &obj, &obj_ref);
-
- if (fle && !err) {
- fle->genid = atomic_read(&flow_cache_genid);
-
- if (fle->object)
- atomic_dec(fle->object_ref);
-
- fle->object = obj;
- fle->object_ref = obj_ref;
- if (obj)
- atomic_inc(fle->object_ref);
- }
- local_bh_enable();
-
- if (err)
- obj = ERR_PTR(err);
- return obj;
+ flo = NULL;
+ if (fle) {
+ flo = fle->object;
+ fle->object = NULL;
+ }
+ flo = resolver(net, key, family, dir, flo, ctx);
+ if (fle) {
+ fle->genid = atomic_read(&flow_cache_genid);
+ if (!IS_ERR(flo))
+ fle->object = flo;
+ else
+ fle->genid--;
+ } else {
+ if (flo && !IS_ERR(flo))
+ flo->ops->delete(flo);
}
+ret_object:
+ local_bh_enable();
+ return flo;
}
static void flow_cache_flush_tasklet(unsigned long data)
@@ -261,13 +266,12 @@ static void flow_cache_flush_tasklet(unsigned long data)
fle = fcp->hash_table[i];
for (; fle; fle = fle->next) {
- unsigned genid = atomic_read(&flow_cache_genid);
-
- if (!fle->object || fle->genid == genid)
+ if (flow_entry_valid(fle))
continue;
+ if (fle->object)
+ fle->object->ops->delete(fle->object);
fle->object = NULL;
- atomic_dec(fle->object_ref);
}
}
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 82789cf..7722bae 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -216,6 +216,35 @@ expired:
xfrm_pol_put(xp);
}
+static struct flow_cache_object *xfrm_policy_flo_get(struct flow_cache_object *flo)
+{
+ struct xfrm_policy *pol = container_of(flo, struct xfrm_policy, flo);
+
+ if (unlikely(pol->walk.dead))
+ flo = NULL;
+ else
+ xfrm_pol_hold(pol);
+
+ return flo;
+}
+
+static int xfrm_policy_flo_check(struct flow_cache_object *flo)
+{
+ struct xfrm_policy *pol = container_of(flo, struct xfrm_policy, flo);
+
+ return !pol->walk.dead;
+}
+
+static void xfrm_policy_flo_delete(struct flow_cache_object *flo)
+{
+ xfrm_pol_put(container_of(flo, struct xfrm_policy, flo));
+}
+
+static const struct flow_cache_ops xfrm_policy_fc_ops = {
+ .get = xfrm_policy_flo_get,
+ .check = xfrm_policy_flo_check,
+ .delete = xfrm_policy_flo_delete,
+};
/* Allocate xfrm_policy. Not used here, it is supposed to be used by pfkeyv2
* SPD calls.
@@ -236,6 +265,7 @@ struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp)
atomic_set(&policy->refcnt, 1);
setup_timer(&policy->timer, xfrm_policy_timer,
(unsigned long)policy);
+ policy->flo.ops = &xfrm_policy_fc_ops;
}
return policy;
}
@@ -269,9 +299,6 @@ static void xfrm_policy_gc_kill(struct xfrm_policy *policy)
if (del_timer(&policy->timer))
atomic_dec(&policy->refcnt);
- if (atomic_read(&policy->refcnt) > 1)
- flow_cache_flush();
-
xfrm_pol_put(policy);
}
@@ -661,10 +688,8 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark, u8 type,
}
write_unlock_bh(&xfrm_policy_lock);
- if (ret && delete) {
- atomic_inc(&flow_cache_genid);
+ if (ret && delete)
xfrm_policy_kill(ret);
- }
return ret;
}
EXPORT_SYMBOL(xfrm_policy_bysel_ctx);
@@ -703,10 +728,8 @@ struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8 type,
}
write_unlock_bh(&xfrm_policy_lock);
- if (ret && delete) {
- atomic_inc(&flow_cache_genid);
+ if (ret && delete)
xfrm_policy_kill(ret);
- }
return ret;
}
EXPORT_SYMBOL(xfrm_policy_byid);
@@ -822,7 +845,6 @@ int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info)
}
if (!cnt)
err = -ESRCH;
- atomic_inc(&flow_cache_genid);
out:
write_unlock_bh(&xfrm_policy_lock);
return err;
@@ -976,32 +998,35 @@ fail:
return ret;
}
-static int xfrm_policy_lookup(struct net *net, struct flowi *fl, u16 family,
- u8 dir, void **objp, atomic_t **obj_refp)
+static struct flow_cache_object *
+xfrm_policy_lookup(struct net *net, struct flowi *fl, u16 family,
+ u8 dir, struct flow_cache_object *old_obj, void *ctx)
{
struct xfrm_policy *pol;
- int err = 0;
+
+ if (old_obj)
+ xfrm_pol_put(container_of(old_obj, struct xfrm_policy, flo));
#ifdef CONFIG_XFRM_SUB_POLICY
pol = xfrm_policy_lookup_bytype(net, XFRM_POLICY_TYPE_SUB, fl, family, dir);
- if (IS_ERR(pol)) {
- err = PTR_ERR(pol);
- pol = NULL;
- }
- if (pol || err)
- goto end;
+ if (IS_ERR(pol))
+ return ERR_CAST(pol);
+ if (pol)
+ goto found;
#endif
pol = xfrm_policy_lookup_bytype(net, XFRM_POLICY_TYPE_MAIN, fl, family, dir);
- if (IS_ERR(pol)) {
- err = PTR_ERR(pol);
- pol = NULL;
- }
-#ifdef CONFIG_XFRM_SUB_POLICY
-end:
-#endif
- if ((*objp = (void *) pol) != NULL)
- *obj_refp = &pol->refcnt;
- return err;
+ if (IS_ERR(pol))
+ return ERR_CAST(pol);
+ if (pol)
+ goto found;
+ return NULL;
+
+found:
+ /* Resolver returns two references:
+ * one for cache and one for caller of flow_cache_lookup() */
+ xfrm_pol_hold(pol);
+
+ return &pol->flo;
}
static inline int policy_to_flow_dir(int dir)
@@ -1091,8 +1116,6 @@ int xfrm_policy_delete(struct xfrm_policy *pol, int dir)
pol = __xfrm_policy_unlink(pol, dir);
write_unlock_bh(&xfrm_policy_lock);
if (pol) {
- if (dir < XFRM_POLICY_MAX)
- atomic_inc(&flow_cache_genid);
xfrm_policy_kill(pol);
return 0;
}
@@ -1578,18 +1601,24 @@ restart:
}
if (!policy) {
+ struct flow_cache_object *flo;
+
/* To accelerate a bit... */
if ((dst_orig->flags & DST_NOXFRM) ||
!net->xfrm.policy_count[XFRM_POLICY_OUT])
goto nopol;
- policy = flow_cache_lookup(net, fl, dst_orig->ops->family,
- dir, xfrm_policy_lookup);
- err = PTR_ERR(policy);
- if (IS_ERR(policy)) {
+ flo = flow_cache_lookup(net, fl, dst_orig->ops->family,
+ dir, xfrm_policy_lookup, NULL);
+ err = PTR_ERR(flo);
+ if (IS_ERR(flo)) {
XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
goto dropdst;
}
+ if (flo)
+ policy = container_of(flo, struct xfrm_policy, flo);
+ else
+ policy = NULL;
}
if (!policy)
@@ -1939,9 +1968,16 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,
}
}
- if (!pol)
- pol = flow_cache_lookup(net, &fl, family, fl_dir,
- xfrm_policy_lookup);
+ if (!pol) {
+ struct flow_cache_object *flo;
+
+ flo = flow_cache_lookup(net, &fl, family, fl_dir,
+ xfrm_policy_lookup, NULL);
+ if (IS_ERR_OR_NULL(flo))
+ pol = ERR_CAST(flo);
+ else
+ pol = container_of(flo, struct xfrm_policy, flo);
+ }
if (IS_ERR(pol)) {
XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLERROR);
--
1.6.3.3
^ permalink raw reply related
* Re: Undefined behaviour of connect(fd, NULL, 0);
From: Andreas Schwab @ 2010-04-05 16:25 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Changli Gao, David Miller, neilb, shemminger, netdev
In-Reply-To: <1270483012.4722.161.camel@edumazet-laptop>
Eric Dumazet <eric.dumazet@gmail.com> writes:
> Solaris man page extract :
>
> "Datagram sockets can dissolve the association by connecting to a null
> address."
>
> What is a null address ?
>
> 1) A null pointer ?
> 2) a pointer to a zone, but length of this zone is 0
> 3) Or a pointer to a zone filled with NULL bytes ?
Btw., POSIX.1 has changed the description from "If address is a null
address for the protocol, the socket's peer address shall be reset" in
the 2004 edition to "If the sa_family member of address is AF_UNSPEC,
the socket's peer address shall be reset" in the 2009 edition.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply
* Re: [PATCH] sky2: rx hash offload
From: Eric Dumazet @ 2010-04-05 16:14 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20100405084800.3bcec66a@nehalam>
Le lundi 05 avril 2010 à 08:48 -0700, Stephen Hemminger a écrit :
> Marvell Yukon 2 hardware supports hardware receive hash calculation.
> Now that Receive Packet Steering is available, add support
> to enable it.
>
> Note: still experimental, tested on only a few variants.
> No performance testing has been done.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> ---
> drivers/net/sky2.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++--
> drivers/net/sky2.h | 23 ++++++++++++++++
> 2 files changed, 96 insertions(+), 2 deletions(-)
>
Cool :)
I believe some bits are needed in receive_copy() to transfert rxhash to
new skb ?
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index d8ec4c1..f420255 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -2295,6 +2295,8 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2,
skb_copy_from_linear_data(re->skb, skb->data, length);
skb->ip_summed = re->skb->ip_summed;
skb->csum = re->skb->csum;
+ skb->rxhash = re->skb->rxhash;
+ re->skb->rxhash = 0;
pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr,
length, PCI_DMA_FROMDEVICE);
re->skb->ip_summed = CHECKSUM_NONE;
^ permalink raw reply related
* Re: Undefined behaviour of connect(fd, NULL, 0);
From: Eric Dumazet @ 2010-04-05 15:56 UTC (permalink / raw)
To: Changli Gao; +Cc: David Miller, neilb, shemminger, netdev
In-Reply-To: <w2n412e6f7f1004050223j3e15df91tcdf133670c636a85@mail.gmail.com>
Le lundi 05 avril 2010 à 17:23 +0800, Changli Gao a écrit :
> I found this from the man page of FreeBSD's connect(2).
>
> Generally, stream sockets may successfully connect() only
> once; datagram sockets may use connect() multiple times to change their
> association. Datagram sockets may dissolve the association by connecting
> to an invalid address, such as a null address.
>
> And this from the man page of Darwin's connect(2).
>
> Datagram sockets may dissolve the association by connecting to an
> invalid address, such as a null address or an address with the address
> family set to AF_UNSPEC (the error EAFNOSUPPORT will be harmlessly
> returned).
>
> Since null address behavior has been defined by the others. I think
> Linux should be compatible with the others. So the patch submitted on
> this by me should not been applied. I'll work out another patch later.
>
As pointed by David, no sane application would use this facility until a
decade, I wonder why you insist so much for this minor detail.
Solaris man page extract :
"Datagram sockets can dissolve the association by connecting to a null
address."
What is a null address ?
1) A null pointer ?
2) a pointer to a zone, but length of this zone is 0
3) Or a pointer to a zone filled with NULL bytes ?
Linux implements the later interpretation. Its more than enough.
If a NULL pointer was implemented, man pages would use the following
words : "Datagram sockets can dissolve the association by connecting to
a NULL pointer (NULL second argument to connect())."
If you submit a patch to change connect() behavior, dont forget to send
appropriate changes to Michael, because in the end, nobody but you knows
how things are supposed to work if not documented.
MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
M: Michael Kerrisk <mtk.manpages@gmail.com>
W: http://www.kernel.org/doc/man-pages
^ permalink raw reply
* [PATCH] sky2: rx hash offload
From: Stephen Hemminger @ 2010-04-05 15:48 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Marvell Yukon 2 hardware supports hardware receive hash calculation.
Now that Receive Packet Steering is available, add support
to enable it.
Note: still experimental, tested on only a few variants.
No performance testing has been done.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
drivers/net/sky2.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++--
drivers/net/sky2.h | 23 ++++++++++++++++
2 files changed, 96 insertions(+), 2 deletions(-)
--- a/drivers/net/sky2.c 2010-04-04 15:04:22.582288437 -0700
+++ b/drivers/net/sky2.c 2010-04-05 08:37:47.924236795 -0700
@@ -1195,6 +1195,39 @@ static void rx_set_checksum(struct sky2_
? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM);
}
+/* Enable/disable receive hash calculation (RSS) */
+static void rx_set_rss(struct net_device *dev)
+{
+ struct sky2_port *sky2 = netdev_priv(dev);
+ struct sky2_hw *hw = sky2->hw;
+ int i, nkeys = 4;
+
+ /* Supports IPv6 and other modes */
+ if (hw->flags & SKY2_HW_NEW_LE) {
+ nkeys = 10;
+ sky2_write32(hw, SK_REG(sky2->port, RSS_CFG), HASH_ALL);
+ }
+
+ /* Program RSS initial values */
+ if (dev->features & NETIF_F_RXHASH) {
+ u32 key[nkeys];
+
+ get_random_bytes(key, nkeys * sizeof(u32));
+ for (i = 0; i < nkeys; i++)
+ sky2_write32(hw, SK_REG(sky2->port, RSS_KEY + i * 4),
+ key[i]);
+
+ /* Need to turn on (undocumented) flag to make hashing work */
+ sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T),
+ RX_STFW_ENA);
+
+ sky2_write32(hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR),
+ BMU_ENA_RX_RSS_HASH);
+ } else
+ sky2_write32(hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR),
+ BMU_DIS_RX_RSS_HASH);
+}
+
/*
* The RX Stop command will not work for Yukon-2 if the BMU does not
* reach the end of packet and since we can't make sure that we have
@@ -1427,6 +1460,9 @@ static void sky2_rx_start(struct sky2_po
if (!(hw->flags & SKY2_HW_NEW_LE))
rx_set_checksum(sky2);
+ if (!(hw->flags & SKY2_HW_RSS_BROKEN))
+ rx_set_rss(sky2->netdev);
+
/* submit Rx ring */
for (i = 0; i < sky2->rx_pending; i++) {
re = sky2->rx_ring + i;
@@ -2536,6 +2572,14 @@ static void sky2_rx_checksum(struct sky2
}
}
+static void sky2_rx_hash(struct sky2_port *sky2, u32 status)
+{
+ struct sk_buff *skb;
+
+ skb = sky2->rx_ring[sky2->rx_next].skb;
+ skb->rxhash = le32_to_cpu(status);
+}
+
/* Process status response ring */
static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
{
@@ -2608,6 +2652,10 @@ static int sky2_status_intr(struct sky2_
sky2_rx_checksum(sky2, status);
break;
+ case OP_RSS_HASH:
+ sky2_rx_hash(sky2, status);
+ break;
+
case OP_TXINDEXLE:
/* TX index reports status for both ports */
sky2_tx_done(hw->dev[0], status & 0xfff);
@@ -2962,6 +3010,8 @@ static int __devinit sky2_init(struct sk
switch(hw->chip_id) {
case CHIP_ID_YUKON_XL:
hw->flags = SKY2_HW_GIGABIT | SKY2_HW_NEWER_PHY;
+ if (hw->chip_rev < CHIP_REV_YU_XL_A2)
+ hw->flags |= SKY2_HW_RSS_BROKEN;
break;
case CHIP_ID_YUKON_EC_U:
@@ -2987,10 +3037,11 @@ static int __devinit sky2_init(struct sk
dev_err(&hw->pdev->dev, "unsupported revision Yukon-EC rev A1\n");
return -EOPNOTSUPP;
}
- hw->flags = SKY2_HW_GIGABIT;
+ hw->flags = SKY2_HW_GIGABIT | SKY2_HW_RSS_BROKEN;
break;
case CHIP_ID_YUKON_FE:
+ hw->flags = SKY2_HW_RSS_BROKEN;
break;
case CHIP_ID_YUKON_FE_P:
@@ -4114,6 +4165,28 @@ static int sky2_set_eeprom(struct net_de
return sky2_vpd_write(sky2->hw, cap, data, eeprom->offset, eeprom->len);
}
+static int sky2_set_flags(struct net_device *dev, u32 data)
+{
+ struct sky2_port *sky2 = netdev_priv(dev);
+
+ if (data & ETH_FLAG_LRO)
+ return -EOPNOTSUPP;
+
+ if (data & ETH_FLAG_NTUPLE)
+ return -EOPNOTSUPP;
+
+ if (data & ETH_FLAG_RXHASH) {
+ if (sky2->hw->flags & SKY2_HW_RSS_BROKEN)
+ return -EINVAL;
+
+ dev->features |= NETIF_F_RXHASH;
+ } else
+ dev->features &= ~NETIF_F_RXHASH;
+
+ rx_set_rss(dev);
+
+ return 0;
+}
static const struct ethtool_ops sky2_ethtool_ops = {
.get_settings = sky2_get_settings,
@@ -4145,6 +4218,7 @@ static const struct ethtool_ops sky2_eth
.phys_id = sky2_phys_id,
.get_sset_count = sky2_get_sset_count,
.get_ethtool_stats = sky2_get_ethtool_stats,
+ .set_flags = sky2_set_flags,
};
#ifdef CONFIG_SKY2_DEBUG
@@ -4497,6 +4571,11 @@ static __devinit struct net_device *sky2
if (highmem)
dev->features |= NETIF_F_HIGHDMA;
+#ifdef CONFIG_RPS
+ if (!(hw->flags & SKY2_HW_RSS_BROKEN))
+ dev->features |= NETIF_F_RXHASH;
+#endif
+
#ifdef SKY2_VLAN_TAG_USED
/* The workaround for FE+ status conflicts with VLAN tag detection. */
if (!(sky2->hw->chip_id == CHIP_ID_YUKON_FE_P &&
--- a/drivers/net/sky2.h 2010-04-02 15:18:00.289206825 -0700
+++ b/drivers/net/sky2.h 2010-04-04 15:05:22.161352031 -0700
@@ -694,8 +694,21 @@ enum {
TXA_CTRL = 0x0210,/* 8 bit Tx Arbiter Control Register */
TXA_TEST = 0x0211,/* 8 bit Tx Arbiter Test Register */
TXA_STAT = 0x0212,/* 8 bit Tx Arbiter Status Register */
+
+ RSS_KEY = 0x0220, /* RSS Key setup */
+ RSS_CFG = 0x0248, /* RSS Configuration */
};
+enum {
+ HASH_TCP_IPV6_EX_CTRL = 1<<5,
+ HASH_IPV6_EX_CTRL = 1<<4,
+ HASH_TCP_IPV6_CTRL = 1<<3,
+ HASH_IPV6_CTRL = 1<<2,
+ HASH_TCP_IPV4_CTRL = 1<<1,
+ HASH_IPV4_CTRL = 1<<0,
+
+ HASH_ALL = 0x3f,
+};
enum {
B6_EXT_REG = 0x0300,/* External registers (GENESIS only) */
@@ -2261,6 +2274,7 @@ struct sky2_hw {
#define SKY2_HW_NEW_LE 0x00000020 /* new LSOv2 format */
#define SKY2_HW_AUTO_TX_SUM 0x00000040 /* new IP decode for Tx */
#define SKY2_HW_ADV_POWER_CTL 0x00000080 /* additional PHY power regs */
+#define SKY2_HW_RSS_BROKEN 0x00000100
u8 chip_id;
u8 chip_rev;
^ permalink raw reply
* RE: CAIF device
From: Sjur BRENDELAND @ 2010-04-05 11:19 UTC (permalink / raw)
To: Alan, netdev@vger.kernel.org
In-Reply-To: <20100401160916.2a2574f4@lxorguk.ukuu.org.uk>
Hi Alan.
Alan wrote:
> I was reading through the CAIF code and I noticed a couple of bugs
>
> Doesn't check there is a write method so set on a read only
> device it's not good news (doubly so as there seem to be no
> permission checks ?) plus no permissions checks and also the
> following which looks unsafe
>
> dev_close(ser->dev);
> unregister_netdevice(ser->dev);
> list_del(&ser->node);
> debugfs_deinit(ser);
>
> Now ser is the netdev private data so what stops it going away when
> unregister_netdev is called ?
I think this should work fine as the unregistration of the ser->dev is done after rtnl_lock,
this delays the freeing of the device until rtnl_unlock.
>
> Secondly tty devices are ref counted and this for some reason didn't
> get fixed in the driver yet.
>
> [Patches to follow for the write and kref bugs, the others need the
> authors and someone who knows the netdev code these days to fix]
Thanks, looking forward to review your patches.
BR/Sjur
^ 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