* Disabling "TCP Treason uncloaked"
From: Just Marc @ 2006-05-02 16:19 UTC (permalink / raw)
To: netdev
Hi everyone,
Looking at mailing list archives there has been much talk of this print
in the past, given the fact that this check/print is surrounded by an
#ifdef TCP_DEBUG
#ifdef TCP_DEBUG
if (net_ratelimit()) {
struct inet_sock *inet = inet_sk(sk);
printk(KERN_DEBUG "TCP: Treason uncloaked! Peer
%u.%u.%u.%u:%u/%u shrinks window %u:%u. Repaired.\n",
NIPQUAD(inet->daddr), htons(inet->dport),
inet->num, tp->snd_una, tp->snd_nxt);
}
#endif
I thought that maybe it's time to either set TCP_DEBUG to 0 or
alternatively allow an admin to toggle the printing of this message
off/on? On a few busy web servers running usually latest versions of
2.6 I have this message displaying hundreds (if not more) times a day,
completely clogging the kernel log and making it harder to see if there
are more interesting messages being printed. TCP_DEBUG is being used
in one more place that may also not require it anymore and or have it
always enabled.
So, is it time to disable this print altogether? Is it time to allow an
admin to toggle printing of this thing off?
Thanks for your time
^ permalink raw reply
* Re: [PATCH] au1000_eth.c Power Management, driver registration and module support
From: Rodolfo Giometti @ 2006-05-02 15:09 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: jgarzik, netdev, Linux-MIPS
In-Reply-To: <4446857D.90507@ru.mvista.com>
[-- Attachment #1: Type: text/plain, Size: 1492 bytes --]
Hello,
here:
http://ftp.enneenne.com/pub/misc/au1100-patches/linux/patch-au1000_eth-pm-and-registration
the new version of my patch for au1000_eth.c who should implement:
* Module support.
- bool "MIPS AU1000 Ethernet support"
+ tristate "MIPS AU1000 Ethernet support"
* Driver registration.
+static int __init au1000_eth_init(void)
+{
+ return driver_register(&au1000_driver);
+}
+
+static void __exit au1000_eth_cleanup(void)
+{
+ driver_unregister(&au1000_driver);
+}
* Power Management.
+#ifdef CONFIG_PM
+ .suspend = au1000_drv_suspend,
+ .resume = au1000_drv_resume,
+#endif
Also, as suggested by Sergei it:
* uses physical addresses and not KSEG1-based virtual anymore and
claims/releases the 4-byte MAC enable registers:
wwpc:~# cat /proc/iomem
10500000-1050ffff : eth-base
10520000-10520003 : eth-mac
* assigns to the Ethernet ports two consecutive MAC addresses:
- dev->dev_addr[4] += 0x10;
+ ((unsigned long) macen_addr);
+ memcpy(ndev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
+ ndev->dev_addr[5] += 0x01;
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@gnudd.com
Embedded Systems giometti@linux.it
UNIX programming phone: +39 349 2432127
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* [Bug 6480] Transmitter of CK804 hangs hard, needs power cycle to recover
From: Ingo Oeser @ 2006-05-02 13:49 UTC (permalink / raw)
To: Manfred Spraul; +Cc: Stephen Hemminger, netdev, bugme-daemon
Hi Manfred,
I filed BUG 6480 describing the problem and providing lots
of info. If you need more info, just ask.
At the moment I have no idea about the reasons.
Except Crossover-Cabling vs. using a switch.
The machine is a production machine, so I cannot test
kernels and patches.
But I have several machines with identical hardware where
I can test this.
Once we can reproduce it without a Sonicwall, I can build a
test setup using any kernel hackery required to resolve the issue :-)
Could you please contact the right nVIDIA people, if needed?
PS: Stephen, you are not CC'ed from bugzilla and
"agreed to help out with net driver maintenance"
so I CC'ed you here manually.
Regards
Ingo Oeser
^ permalink raw reply
* Re: Van Jacobson's net channels and real-time
From: Vojtech Pavlik @ 2006-05-02 12:41 UTC (permalink / raw)
To: linux-os (Dick Johnson)
Cc: Auke Kok, Auke Kok, Ingo Oeser, Jörn Engel, Ingo Oeser,
David S. Miller, simlo, linux-kernel, mingo, netdev
In-Reply-To: <Pine.LNX.4.61.0604250717590.28279@chaos.analogic.com>
On Tue, Apr 25, 2006 at 07:29:40AM -0400, linux-os (Dick Johnson) wrote:
> >> Message signaled interrupts are just a kudge to save a trace on a
> >> PC board (read make junk cheaper still).
> >
> > yes. Also in PCI-Express there is no physical interrupt line anymore due to
> > the architecture, so even classical interrupts are sent as "message" over the bus.
> >
> >> They are not faster and may even be slower.
> >
> > thus in the case of PCI-Express, MSI interrupts are just as fast as the
> > ordinary ones. I have no numbers on whether MSI is faster or not then e.g.
> > interrupts on PCI-X, but generally speaking, the PCI-Express bus is not
> > designed to be "low latency" at all, at best it gives you X latency, where X
> > is something like microseconds. The MSI message itself only takes 10-20
> > nanoseconds though, but all the handling probably adds a large factor to that
> > (1000 or so). No clue on classical interrupt line latency - anyone?
>
> About 9 nanosecond per foot of FR-4 (G10) trace, plus the access time
> through the gate-arrays (about 20 ns) so, from the time a device needs
> the CPU, until it hits the interrupt pin, you have typically 30 to
> 50 nanoseconds. Of course the CPU is __much__ slower. However, these
> physical latencies are in series, cannot be compensated for because
> the CPU can't see into the future.
You seem to be missing the fact that most of todays interrupts are
delivered through the APIC bus, which isn't fast at all.
--
Vojtech Pavlik
Director SuSE Labs
^ permalink raw reply
* Re: [PATCH] bcm43xx-d80211: proper implementation of virtual interface support
From: Jiri Benc @ 2006-05-02 11:20 UTC (permalink / raw)
To: Michael Buesch; +Cc: John W. Linville, bcm43xx-dev, netdev
In-Reply-To: <200605012135.00895.mb@bu3sch.de>
On Mon, 1 May 2006 21:35:00 +0200, Michael Buesch wrote:
> --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h 2006-04-28 16:13:40.000000000 +0200
> +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h 2006-05-01 20:25:31.000000000 +0200
> @@ -626,10 +626,34 @@
> u8 algorithm;
> };
>
> +struct bcm43xx_interface {
> + struct list_head list;
> + /* Interface type (IEEE80211_IF_TYPE_XXX). */
> + int type;
> + /* Opaque ID from the ieee80211 subsystem. Do not modify. */
> + int if_id;
> + /* MAC address for this interface. */
> + u8 *mac_addr;
> + /* BSSID (if any). */
> + u8 *bssid;
> +};
> +
> +struct bcm43xx_interface_list {
> + /* Linked list of active interfaces. */
> + struct list_head list;
> + /* Shortcut pointer to the AP interface (if any). */
> + struct bcm43xx_interface *ap_if;
> +
> + /* Usage counters of the internal operation modes. */
> + u16 opmode_ap;
> + u16 opmode_adhoc;
> + u16 opmode_monitor;
> + u16 opmode_promisc;
> +};
> +
This is unnecessary. AFAIK bcm43xx hardware doesn't support more than one
interface at a time (not counting monitor interfaces as those are somewhat
special). There is no need for the linked list.
Instead of those structures above, use something like this:
struct bcm43xx_interface {
/* Interface type (IEEE80211_IF_TYPE_XXX). */
int type;
/* MAC address for this interface. */
u8 *mac_addr;
/* BSSID (if any). */
u8 *bssid;
/* Number of monitor interfaces. */
int monitors;
/* STA, IBSS, AP or WDS running? */
int oper;
}
You need this structure just once per hw card.
In add_interface callback:
- If conf->type is MNTR:
- If bcm43xx_interface->oper is FALSE and
bcm43xx_interface->monitors is 0, initialize the card.
- If bcm43xx_interface->monitors is 0, switch the card to monitor
mode (enable promisc mode, enable receiving of control frames,
etc.)
- Increase bcm43xx_interface->monitors.
- If conf->type != MNTR:
- If bcm43xx_interface->oper is TRUE, return error.
- Set bcm43xx_interface->oper to TRUE.
- Set bcm43xx_interface->type to conf->type.
- Set hw MAC address according to conf->mac_addr.
- If bcm43xx_interface->monitors is 0, initialize the card.
In remove_interface callback:
- If conf->type is MNTR:
- Decrease bcm43xx_interface->monitors.
- If bcm43xx_interface->monitors is 0, switch the card from monitor
mode (disable promisc mode if not forced by set_multicast_list,
disable receiving of control frames, etc.)
- If bcm43xx_interface->oper is FALSE and
bcm43xx_interface->monitors is 0, deinitialize the card.
- If conf->type != MNTR:
- Set bcm43xx_interface->oper to FALSE.
- If bcm43xx_interface->monitors is 0, deinitialize the card.
In config_interface callback:
- If conf->type is MNTR, please report a bug :-)
- Assume you are configuring the only interface you have running.
> [...]
> + iface = kzalloc(sizeof(*iface), GFP_KERNEL);
> + if (!iface)
> + return -ENOMEM;
> + INIT_LIST_HEAD(&iface->list);
> + iface->type = conf->type;
> + iface->if_id = conf->if_id;
> + iface->mac_addr = conf->mac_addr;
> +
> + bcm43xx_lock_mmio(bcm, flags);
> + switch (conf->type) {
> + case IEEE80211_IF_TYPE_AP:
> + /* Cannot run more than one AP or concurrently
> + * with IBSS mode.
> + */
> + if (bcm->interfaces.opmode_ap)
> + break;
> + if (bcm->interfaces.opmode_adhoc)
> + break;
> + bcm->interfaces.opmode_ap++;
> + bcm->interfaces.ap_if = iface;
> + err = 0;
> + break;
> + case IEEE80211_IF_TYPE_STA:
> + /* Cannot run STA and AP or IBSS mode concurrently. */
> + if (bcm->interfaces.opmode_ap)
> + break;
> + if (bcm->interfaces.opmode_adhoc)
> + break;
> + err = 0;
> + break;
"ifconfig ap up ; ifconfig sta up" will succeed, while
"ifconfig sta up ; ifconfig ap up" won't.
Also, you cannot allow multiple STA interfaces, unless you can configure the
card to ack frames destined to several MAC addresses.
Nevertheless, this is all addressed by the solution suggested above.
> + case IEEE80211_IF_TYPE_IBSS:
> + /* Cannot run more than one IBSS or concurrently
> + * with AP mode.
> + */
> + if (bcm->interfaces.opmode_ap)
> + break;
> + if (bcm->interfaces.opmode_adhoc)
> + break;
> + bcm->interfaces.opmode_adhoc++;
> + err = 0;
> + break;
> + case IEEE80211_IF_TYPE_MNTR:
> + bcm->interfaces.opmode_monitor++;
> + err = 0;
> + break;
> + case IEEE80211_IF_TYPE_WDS:
> + //TODO: Uhm..., well.
> + break;
Please return more appropriate error code (-EINVAL perhaps?).
> + default:
> + assert(0);
> }
Thanks,
--
Jiri Benc
SUSE Labs
^ permalink raw reply
* [1/1] Kevent subsystem.
From: Evgeniy Polyakov @ 2006-05-02 8:10 UTC (permalink / raw)
To: David S. Miller; +Cc: shemminger, caitlinb, kelly, rusty, netdev
In-Reply-To: <20060501.143246.112559350.davem@davemloft.net>
[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]
Kevent subsystem incorporates several AIO/kqueue design notes and
ideas. Kevent can be used both for edge and level triggered notifications.
It supports:
o socket notifications (accept, receiving and sending)
o network AIO (aio_send(), aio_recv() and aio_sendfile()) [3]
o inode notifications (create/remove)
o generic poll()/select() notifications
o timer notifications
More info, design notes, benchmarks (web server based on epoll, kevent,
kevent_poll; naio_send() vs. send(), naio_recv() vs. recv() with different number
of sending/receiving users) can be found on project's homepage [1].
Userspace interface was greatly described in LWN article [2].
1. kevent homepage.
http://tservice.net.ru/~s0mbre/old/?section=projects&item=kevent
2. LWN article about kevent.
http://lwn.net/Articles/172844/
3. Network AIO (aio_send(), aio_recv(), aio_sendfile()).
http://tservice.net.ru/~s0mbre/old/?section=projects&item=naio
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
--
Evgeniy Polyakov
[-- Attachment #2: kevent_full.diff.3.gz --]
[-- Type: application/x-gunzip, Size: 24072 bytes --]
^ permalink raw reply
* Re: [PATCH 1/3] Rough VJ Channel Implementation - vj_core.patch
From: Evgeniy Polyakov @ 2006-05-02 7:08 UTC (permalink / raw)
To: David S. Miller; +Cc: shemminger, caitlinb, kelly, rusty, netdev
In-Reply-To: <20060501.143246.112559350.davem@davemloft.net>
On Mon, May 01, 2006 at 02:32:46PM -0700, David S. Miller (davem@davemloft.net) wrote:
> From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
> Date: Sat, 29 Apr 2006 16:44:51 +0400
>
> > Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
>
> I understand how in some ways this is work in progress,
> but direct calls into ext3 from the kevent code? I'd
> like stuff like that cleaned up before reviewing :-)
Well, this only requires per address space ->get_block() callback,
which is what ext3_get_block() is.
I will update and resend patchset today.
Thank you.
--
Evgeniy Polyakov
^ permalink raw reply
* Re: [PATCH 3/3] ipg: plug leaks in the error path of ipg_nic_open
From: Pekka J Enberg @ 2006-05-02 6:45 UTC (permalink / raw)
To: Francois Romieu; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <20060501231206.GD7419@electric-eye.fr.zoreil.com>
On Tue, 2 May 2006, Francois Romieu wrote:
> Added ipg_{rx/tx}_clear() to factor out some code.
>
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Applied. Thanks!
Pekka
^ permalink raw reply
* Re: [PATCH 2/3] ipg: leaks in ipg_probe
From: Pekka J Enberg @ 2006-05-02 6:41 UTC (permalink / raw)
To: Francois Romieu; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <20060501231050.GC7419@electric-eye.fr.zoreil.com>
On Tue, 2 May 2006, Francois Romieu wrote:
> The error paths are badly broken.
>
> Bonus:
> - remove duplicate initialization of sp;
> - remove useless NULL initialization of dev;
> - USE_IO_OPS is not used (and the driver does not seem to care about
> posted writes, rejoice).
>
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Applied. Thanks! One comment below.
On Tue, 2 May 2006, Francois Romieu wrote:
> - err = pci_request_regions(pdev, DRV_NAME);
> - if (err)
> - goto out;
> -
> - pio_start = pci_resource_start(pdev, 0) & 0xffffff80;
> - pio_len = pci_resource_len(pdev, 0);
> - mmio_start = pci_resource_start(pdev, 1) & 0xffffff80;
> + rc = pci_request_regions(pdev, DRV_NAME);
> + if (rc)
> + goto err_free_dev_1;
Is this tested with hardware? Alignment of the start address looks bogus
for sure, but any idea why they had it in the first place?
Pekka
^ permalink raw reply
* Re: [PATCH 1/3] ipg: removal of unreachable code
From: Pekka J Enberg @ 2006-05-02 6:36 UTC (permalink / raw)
To: Francois Romieu; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <20060501231007.GB7419@electric-eye.fr.zoreil.com>
On Tue, 2 May 2006, Francois Romieu wrote:
> map/unmap is done in ipg_{probe/remove}
Applied. Thanks!
Pekka
^ permalink raw reply
* [Patch 4/8] Utilities for genetlink usage
From: Balbir Singh @ 2006-05-02 6:16 UTC (permalink / raw)
To: linux-kernel; +Cc: lse-tech, jlan, Jamal, Thomas Graf, netdev
genetlink-utils.patch
Two utilities for simplifying usage of NETLINK_GENERIC
interface.
Signed-off-by: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Shailabh Nagar <nagar@watson.ibm.com>
---
include/net/genetlink.h | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+)
diff -puN include/net/genetlink.h~genetlink-utils include/net/genetlink.h
--- linux-2.6.17-rc3/include/net/genetlink.h~genetlink-utils 2006-05-02 07:35:15.000000000 +0530
+++ linux-2.6.17-rc3-balbir/include/net/genetlink.h 2006-05-02 07:35:52.000000000 +0530
@@ -150,4 +150,24 @@ static inline int genlmsg_unicast(struct
return nlmsg_unicast(genl_sock, skb, pid);
}
+/**
+ * gennlmsg_data - head of message payload
+ * @gnlh: genetlink messsage header
+ */
+static inline void *genlmsg_data(const struct genlmsghdr *gnlh)
+{
+ return ((unsigned char *) gnlh + GENL_HDRLEN);
+}
+
+/**
+ * genlmsg_len - length of message payload
+ * @gnlh: genetlink message header
+ */
+static inline int genlmsg_len(const struct genlmsghdr *gnlh)
+{
+ struct nlmsghdr *nlh = (struct nlmsghdr *)((unsigned char *)gnlh -
+ NLMSG_HDRLEN);
+ return (nlh->nlmsg_len - GENL_HDRLEN - NLMSG_HDRLEN);
+}
+
#endif /* __NET_GENERIC_NETLINK_H */
_
^ permalink raw reply
* Re: IP1000 gigabit nic driver
From: David Vrabel @ 2006-05-02 0:36 UTC (permalink / raw)
To: Lennert Buytenhek
Cc: Francois Romieu, Pekka Enberg, linux-kernel, netdev, david
In-Reply-To: <20060501204150.GC1450@xi.wantstofly.org>
Lennert Buytenhek wrote:
> On Mon, May 01, 2006 at 10:38:47PM +0200, Francois Romieu wrote:
>
>
>>>-/* Minimum number of miliseconds used to toggle MDC clock during
>>>+/* Minimum number of nanoseconds used to toggle MDC clock during
>>> * MII/GMII register access.
>>> */
>>>-#define IPG_PC_PHYCTRLWAIT 0x01
>>>+#define IPG_PC_PHYCTRLWAIT_NS 200
>>
>>I would have expected a cycle of 400 ns (p.72/77 of the datasheet)
>>for a 2.5 MHz clock. Why is it cut by a two factor ?
>
>
> 200 ns high + 200 ns low = 400 ns clock period?
Yes.
David
^ permalink raw reply
* Net driver maintenance through May 12
From: Jeff Garzik @ 2006-05-02 0:16 UTC (permalink / raw)
To: Netdev List
Cc: Linux Kernel, Stephen Hemminger, Andrew Morton, Linus Torvalds
Stephen Hemminger has agreed to help out with net driver maintenance
through May 12, when I return from honeymoon. Thanks, Stephen!
I've got a few patches for 2.6.17-rc that I'll push in the next 24
hours, then I'm unplugged until May 12. Already unsubscribed from LKML,
even <sniff>.
netdev-2.6.git#upstream is what I have queued for 2.6.18 so far.
Jeff
^ permalink raw reply
* Re: [PATCH 2/3] Eleminate HZ from NET/ROM kernel interfaces
From: Ralf Baechle @ 2006-05-01 23:52 UTC (permalink / raw)
To: David S. Miller; +Cc: pidoux, netdev, linux-hams
In-Reply-To: <20060430.172136.99531184.davem@davemloft.net>
On Sun, Apr 30, 2006 at 05:21:36PM -0700, David S. Miller wrote:
> > With such extensive patches for netrom and rose modules that will go
> > into a future 2.6.x kernel, I think it would be justified to update the
> > following banners in af_rose.c and af_netrom.c respectively for they
> > appear during boot :
>
> It might be worthwhile to remove the messages altogether.
>
> IPV4 and the core networking used to output similar initialization
> log messages and it really doesn't really add anything but pollute
> the already voluminous kernel log.
>
> So I say we just remove it.
Agreed, patch to remove the messages is below.
Ralf
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
net/netrom/af_netrom.c | 3 ---
net/rose/af_rose.c | 3 ---
2 files changed, 6 deletions(-)
Index: linux-net.git/net/netrom/af_netrom.c
===================================================================
--- linux-net.git.orig/net/netrom/af_netrom.c 2006-04-30 10:28:32.000000000 +0100
+++ linux-net.git/net/netrom/af_netrom.c 2006-05-02 00:48:59.000000000 +0100
@@ -1370,8 +1370,6 @@ static struct notifier_block nr_dev_noti
static struct net_device **dev_nr;
-static char banner[] __initdata = KERN_INFO "G4KLX NET/ROM for Linux. Version 0.7 for AX25.037 Linux 2.4\n";
-
static int __init nr_proto_init(void)
{
int i;
@@ -1419,7 +1417,6 @@ static int __init nr_proto_init(void)
}
register_netdevice_notifier(&nr_dev_notifier);
- printk(banner);
ax25_protocol_register(AX25_P_NETROM, nr_route_frame);
ax25_linkfail_register(nr_link_failed);
Index: linux-net.git/net/rose/af_rose.c
===================================================================
--- linux-net.git.orig/net/rose/af_rose.c 2006-04-30 13:29:58.000000000 +0100
+++ linux-net.git/net/rose/af_rose.c 2006-05-02 00:48:28.000000000 +0100
@@ -1469,8 +1469,6 @@ static struct notifier_block rose_dev_no
static struct net_device **dev_rose;
-static const char banner[] = KERN_INFO "F6FBB/G4KLX ROSE for Linux. Version 0.62 for AX25.037 Linux 2.4\n";
-
static int __init rose_proto_init(void)
{
int i;
@@ -1519,7 +1517,6 @@ static int __init rose_proto_init(void)
sock_register(&rose_family_ops);
register_netdevice_notifier(&rose_dev_notifier);
- printk(banner);
ax25_protocol_register(AX25_P_ROSE, rose_route_frame);
ax25_linkfail_register(rose_link_failed);
^ permalink raw reply
* [PATCH] vlan: sysfs support
From: Stephen Hemminger @ 2006-05-01 23:28 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Ben Greear, David S. Miller, netdev, vlan
In-Reply-To: <20060501140834.43a006fd@localhost.localdomain>
Here is a more complete version of vlan sysfs support. Sysfs support is
good because it means scripts don't have to depend on parsing interface
names that may change.
Assuming there is a vlan 5 added to eth0 then the following links are added:
/sys/class/net/eth0/vlan_group/5 -> ../../../../class/net/eth0.5
/sys/class/net/eth0.5/vlan_device -> ../../../class/net/eth0
and one file /sys/class/net/eth0/vlan_id that contains "5\n"
It handles the reference counts on the vlan_groups properly, but still
has a race between hotplug and creating these sysfs objects because
of the chicken/egg problem with register_netdevice interface.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
--- vlan.orig/net/8021q/Makefile 2006-05-01 12:50:58.000000000 -0700
+++ vlan/net/8021q/Makefile 2006-05-01 15:27:55.000000000 -0700
@@ -4,9 +4,7 @@
obj-$(CONFIG_VLAN_8021Q) += 8021q.o
-8021q-objs := vlan.o vlan_dev.o
-
-ifeq ($(CONFIG_PROC_FS),y)
-8021q-objs += vlanproc.o
-endif
+8021q-y := vlan.o vlan_dev.o
+8021q-$(CONFIG_PROC_FS) += vlanproc.o
+8021q-$(CONFIG_SYSFS) += vlan_sysfs.o
--- vlan.orig/net/8021q/vlan.c 2006-05-01 12:50:58.000000000 -0700
+++ vlan/net/8021q/vlan.c 2006-05-01 16:17:12.000000000 -0700
@@ -193,9 +193,21 @@
return NULL;
}
+/* Callback after last packet and any open sysfs handles are gone. */
+static void vlan_grp_release(struct kobject *kobj)
+{
+ kfree(container_of(kobj, struct vlan_group, kobj));
+}
+
+static struct kobj_type vlan_grp_ktype = {
+ .release = vlan_grp_release,
+};
+
+/* Callback after last packet in flight has passed. */
static void vlan_rcu_free(struct rcu_head *rcu)
{
- kfree(container_of(rcu, struct vlan_group, rcu));
+ struct vlan_group *grp = container_of(rcu, struct vlan_group, rcu);
+ kobject_put(&grp->kobj);
}
@@ -232,6 +244,8 @@
/* Remove proc entry */
vlan_proc_rem_dev(dev);
+ vlan_sysfs_remove(dev, real_dev, grp, vlan_id);
+
/* Take it out of our own structures, but be sure to
* interlock with HW accelerating devices or SW vlan
* input packet processing.
@@ -265,6 +279,8 @@
hlist_del_rcu(&grp->hlist);
/* Free the group, after all cpu's are done. */
+ kobject_uevent(&grp->kobj, KOBJ_REMOVE);
+ kobject_del(&grp->kobj);
call_rcu(&grp->rcu, vlan_rcu_free);
grp = NULL;
@@ -531,13 +547,17 @@
* so it cannot "appear" on us.
*/
if (!grp) { /* need to add a new group */
- grp = kmalloc(sizeof(struct vlan_group), GFP_KERNEL);
+ grp = kzalloc(sizeof(struct vlan_group), GFP_KERNEL);
if (!grp)
goto out_free_unregister;
/* printk(KERN_ALERT "VLAN REGISTER: Allocated new group.\n"); */
- memset(grp, 0, sizeof(struct vlan_group));
grp->real_dev_ifindex = real_dev->ifindex;
+ kobject_init(&grp->kobj);
+ kobject_set_name(&grp->kobj, "vlan_group");
+ grp->kobj.parent = &real_dev->class_dev.kobj;
+ grp->kobj.ktype = &vlan_grp_ktype;
+ kobject_register(&grp->kobj);
hlist_add_head_rcu(&grp->hlist,
&vlan_group_hash[vlan_grp_hashfn(real_dev->ifindex)]);
@@ -557,6 +577,9 @@
rtnl_unlock();
+ if (vlan_sysfs_add(new_dev, real_dev, grp, VLAN_ID))
+ printk(KERN_WARNING "VLAN: failed to create sysfs entry for %s\n",
+ new_dev->name);
#ifdef VLAN_DEBUG
printk(VLAN_DBG "Allocated new device successfully, returning.\n");
--- vlan.orig/net/8021q/vlan.h 2006-05-01 12:50:58.000000000 -0700
+++ vlan/net/8021q/vlan.h 2006-05-01 16:08:18.000000000 -0700
@@ -69,4 +69,15 @@
int vlan_dev_get_vid(const char* dev_name, unsigned short* result);
void vlan_dev_set_multicast_list(struct net_device *vlan_dev);
+#ifdef CONFIG_SYSFS
+int vlan_sysfs_add(struct net_device *dev, struct net_device *real_dev,
+ struct vlan_group *grp, unsigned short tag);
+void vlan_sysfs_remove(struct net_device *dev, struct net_device *real_dev,
+ struct vlan_group *grp, unsigned short tag);
+#else
+#define vlan_sysfs_add(dev, realdev, grp, tag) (0)
+#define vlan_sysfs_remove(dev, realdev, grp, tag) do { } while (0)
+#endif
+
+
#endif /* !(__BEN_VLAN_802_1Q_INC__) */
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ vlan/net/8021q/vlan_sysfs.c 2006-05-01 16:08:18.000000000 -0700
@@ -0,0 +1,59 @@
+/*
+ * VLAN sysfs interface.
+ *
+ * Basic access to vlan information via sysfs.
+ * Authors:
+ * Stephen Hemminger <shemminger@osdl.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include "vlan.h"
+
+static ssize_t show_vlan_id(struct class_device *cd, char *buf)
+{
+ struct net_device *vlandev = container_of(cd, struct net_device, class_dev);
+
+ return sprintf(buf, "%d\n", VLAN_DEV_INFO(vlandev)->vlan_id);
+}
+
+static CLASS_DEVICE_ATTR(vlan_id, S_IRUGO, show_vlan_id, NULL);
+
+int vlan_sysfs_add(struct net_device *dev, struct net_device *real_dev,
+ struct vlan_group *grp, unsigned short tag)
+{
+ int ret;
+ char buf[IFNAMSIZ];
+
+ ret = sysfs_create_link(&dev->class_dev.kobj,
+ &real_dev->class_dev.kobj, "vlan_device");
+ if (ret)
+ goto out;
+
+ sprintf(buf, "%d", tag);
+ ret = sysfs_create_link(&grp->kobj, &dev->class_dev.kobj, buf);
+ if (ret)
+ goto out;
+
+ ret = class_device_create_file(&dev->class_dev, &class_device_attr_vlan_id);
+ out:
+ return ret;
+}
+
+void vlan_sysfs_remove(struct net_device *dev, struct net_device *real_dev,
+ struct vlan_group *grp, unsigned short id)
+{
+ char buf[IFNAMSIZ];
+
+ sprintf(buf, "%d", id);
+ sysfs_remove_link(&grp->kobj, buf);
+ sysfs_remove_link(&dev->class_dev.kobj, "vlan_device");
+
+ return class_device_remove_file(&dev->class_dev,
+ &class_device_attr_vlan_id);
+}
--- vlan.orig/include/linux/if_vlan.h 2006-05-01 16:07:16.000000000 -0700
+++ vlan/include/linux/if_vlan.h 2006-05-01 16:08:18.000000000 -0700
@@ -77,6 +77,7 @@
struct hlist_node hlist; /* linked list */
struct net_device *vlan_devices[VLAN_GROUP_ARRAY_LEN];
struct rcu_head rcu;
+ struct kobject kobj;
};
struct vlan_priority_tci_mapping {
^ permalink raw reply
* [PATCH 3/3] ipg: plug leaks in the error path of ipg_nic_open
From: Francois Romieu @ 2006-05-01 23:12 UTC (permalink / raw)
To: Pekka Enberg; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <1146506939.23931.2.camel@localhost>
Added ipg_{rx/tx}_clear() to factor out some code.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/ipg.c | 161 +++++++++++++++++++++++++++++++----------------------
1 files changed, 93 insertions(+), 68 deletions(-)
96f29e9d57f503f1275757f4bbec76c0f7f421fc
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index da0fa22..393b617 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -16,6 +16,9 @@
*/
#include <linux/crc32.h>
+#define IPG_RX_RING_BYTES (sizeof(struct RFD) * IPG_RFDLIST_LENGTH)
+#define IPG_TX_RING_BYTES (sizeof(struct TFD) * IPG_TFDLIST_LENGTH)
+
#define JUMBO_FRAME_4k_ONLY
enum {
netdev_io_size = 128
@@ -1485,15 +1488,46 @@ static void ipg_nic_txfree(struct net_de
} while (maxtfdcount != 0);
}
-static int ipg_nic_open(struct net_device *dev)
+static void ipg_rx_clear(struct ipg_nic_private *sp)
{
- /* The IPG NIC Ethernet interface is opened when activated
- * by ifconfig.
- */
+ struct pci_dev *pdev = sp->pdev;
+ unsigned int i;
- int error = 0;
- void __iomem *ioaddr = ipg_ioaddr(dev);
+ for (i = 0; i < IPG_RFDLIST_LENGTH; i++) {
+ if (sp->RxBuff[i]) {
+ struct ipg_dmabuff *desc = sp->RxBuffDMAhandle + i;
+
+ IPG_DEV_KFREE_SKB(sp->RxBuff[i]);
+ sp->RxBuff[i] = NULL;
+ pci_unmap_single(pdev, desc->dmahandle, desc->len,
+ PCI_DMA_FROMDEVICE);
+ }
+ }
+}
+
+static void ipg_tx_clear(struct ipg_nic_private *sp)
+{
+ struct pci_dev *pdev = sp->pdev;
+ unsigned int i;
+
+ for (i = 0; i < IPG_TFDLIST_LENGTH; i++) {
+ if (sp->TxBuff[i]) {
+ struct ipg_dmabuff *desc = sp->TxBuffDMAhandle + i;
+
+ IPG_DEV_KFREE_SKB(sp->TxBuff[i]);
+ sp->TxBuff[i] = NULL;
+ pci_unmap_single(pdev, desc->dmahandle, desc->len,
+ PCI_DMA_TODEVICE);
+ }
+ }
+}
+
+static int ipg_nic_open(struct net_device *dev)
+{
struct ipg_nic_private *sp = netdev_priv(dev);
+ void __iomem *ioaddr = ipg_ioaddr(dev);
+ struct pci_dev *pdev = sp->pdev;
+ int rc;
IPG_DEBUG_MSG("_nic_open\n");
@@ -1508,59 +1542,53 @@ static int ipg_nic_open(struct net_devic
/* Register the interrupt line to be used by the IPG within
* the Linux system.
*/
- if ((error = request_irq(sp->pdev->irq,
- &ipg_interrupt_handler,
- SA_SHIRQ, dev->name, dev)) < 0) {
+ rc = request_irq(pdev->irq, &ipg_interrupt_handler, SA_SHIRQ,
+ dev->name, dev);
+ if (rc < 0) {
printk(KERN_INFO "%s: Error when requesting interrupt.\n",
dev->name);
- return error;
+ goto out;
}
- dev->irq = sp->pdev->irq;
+ dev->irq = pdev->irq;
- sp->RFDList = pci_alloc_consistent(sp->pdev,
- (sizeof(struct RFD) *
- IPG_RFDLIST_LENGTH),
+ rc = -ENOMEM;
+
+ sp->RFDList = pci_alloc_consistent(pdev, IPG_RX_RING_BYTES,
&sp->RFDListDMAhandle);
+ if (!sp->RFDList)
+ goto err_free_irq_0;
- sp->TFDList = pci_alloc_consistent(sp->pdev,
- (sizeof(struct TFD) *
- IPG_TFDLIST_LENGTH),
+ sp->TFDList = pci_alloc_consistent(pdev, IPG_TX_RING_BYTES,
&sp->TFDListDMAhandle);
+ if (!sp->TFDList)
+ goto err_free_rx_1;
- if ((sp->RFDList == NULL) || (sp->TFDList == NULL)) {
- printk(KERN_INFO
- "%s: No memory available for IP1000 RFD and/or TFD lists.\n",
- dev->name);
- return -ENOMEM;
- }
-
- error = init_rfdlist(dev);
- if (error < 0) {
+ rc = init_rfdlist(dev);
+ if (rc < 0) {
printk(KERN_INFO "%s: Error during configuration.\n",
dev->name);
- return error;
+ goto err_free_tx_2;
}
- error = init_tfdlist(dev);
- if (error < 0) {
+ rc = init_tfdlist(dev);
+ if (rc < 0) {
printk(KERN_INFO "%s: Error during configuration.\n",
dev->name);
- return error;
+ goto err_release_rfdlist_3;
}
- /* Configure IPG I/O registers. */
- error = ipg_io_config(dev);
- if (error < 0) {
+ rc = ipg_io_config(dev);
+ if (rc < 0) {
printk(KERN_INFO "%s: Error during configuration.\n",
dev->name);
- return error;
+ goto err_release_tfdlist_4;
}
/* Resolve autonegotiation. */
- if (ipg_config_autoneg(dev) < 0) {
+ if (ipg_config_autoneg(dev) < 0)
printk(KERN_INFO "%s: Auto-negotiation error.\n", dev->name);
- }
+
#ifdef JUMBO_FRAME
/* initialize JUMBO Frame control variable */
sp->Jumbo.FoundStart = 0;
@@ -1575,8 +1603,22 @@ #endif
IPG_MC_TX_ENABLE), ioaddr + IPG_MACCTRL);
netif_start_queue(dev);
+out:
+ return rc;
- return 0;
+err_release_tfdlist_4:
+ ipg_tx_clear(sp);
+err_release_rfdlist_3:
+ ipg_rx_clear(sp);
+err_free_tx_2:
+ pci_free_consistent(pdev, IPG_TX_RING_BYTES, sp->TFDList,
+ sp->TFDListDMAhandle);
+err_free_rx_1:
+ pci_free_consistent(pdev, IPG_RX_RING_BYTES, sp->RFDList,
+ sp->RFDListDMAhandle);
+err_free_irq_0:
+ free_irq(pdev->irq, dev);
+ goto out;
}
static int init_rfdlist(struct net_device *dev)
@@ -1593,13 +1635,16 @@ static int init_rfdlist(struct net_devic
sp->RxBuffNotReady = 0;
for (i = 0; i < IPG_RFDLIST_LENGTH; i++) {
+ if (!sp->RxBuff[i])
+ continue;
+
/* Free any allocated receive buffers. */
pci_unmap_single(sp->pdev,
sp->RxBuffDMAhandle[i].dmahandle,
sp->RxBuffDMAhandle[i].len,
PCI_DMA_FROMDEVICE);
- if (sp->RxBuff[i] != NULL)
- IPG_DEV_KFREE_SKB(sp->RxBuff[i]);
+
+ IPG_DEV_KFREE_SKB(sp->RxBuff[i]);
sp->RxBuff[i] = NULL;
/* Clear out the RFS field. */
@@ -1727,11 +1772,11 @@ static int ipg_get_rxbuff(struct net_dev
static int ipg_nic_stop(struct net_device *dev)
{
- /* Release resources requested by driver open function. */
+ struct ipg_nic_private *sp = netdev_priv(dev);
+ struct pci_dev *pdev = sp->pdev;
int i;
int error;
- struct ipg_nic_private *sp = netdev_priv(dev);
IPG_DEBUG_MSG("_nic_stop\n");
@@ -1752,40 +1797,20 @@ static int ipg_nic_stop(struct net_devic
error = ipg_reset(dev, i);
if (error < 0) {
+ // FIXME FIXME FIXME: giant leak alert
return error;
}
- /* Free all receive buffers. */
- for (i = 0; i < IPG_RFDLIST_LENGTH; i++) {
- pci_unmap_single(sp->pdev,
- sp->RxBuffDMAhandle[i].dmahandle,
- sp->RxBuffDMAhandle[i].len,
- PCI_DMA_FROMDEVICE);
- if (sp->RxBuff[i] != NULL)
- IPG_DEV_KFREE_SKB(sp->RxBuff[i]);
- sp->RxBuff[i] = NULL;
- }
+ ipg_rx_clear(sp);
- /* Free all transmit buffers. */
- for (i = 0; i < IPG_TFDLIST_LENGTH; i++) {
- if (sp->TxBuff[i] != NULL)
- IPG_DEV_KFREE_SKB(sp->TxBuff[i]);
- sp->TxBuff[i] = NULL;
- }
+ ipg_tx_clear(sp);
netif_stop_queue(dev);
- /* Free memory associated with the RFDList. */
- pci_free_consistent(sp->pdev,
- (sizeof(struct RFD) *
- IPG_RFDLIST_LENGTH),
- sp->RFDList, sp->RFDListDMAhandle);
-
- /* Free memory associated with the TFDList. */
- pci_free_consistent(sp->pdev,
- (sizeof(struct TFD) *
- IPG_TFDLIST_LENGTH),
- sp->TFDList, sp->TFDListDMAhandle);
+ pci_free_consistent(pdev, IPG_RX_RING_BYTES, sp->RFDList,
+ sp->RFDListDMAhandle);
+ pci_free_consistent(pdev, IPG_TX_RING_BYTES, sp->TFDList,
+ sp->TFDListDMAhandle);
/* Release interrupt line. */
free_irq(dev->irq, dev);
--
1.3.1
^ permalink raw reply related
* [PATCH 2/3] ipg: leaks in ipg_probe
From: Francois Romieu @ 2006-05-01 23:10 UTC (permalink / raw)
To: Pekka Enberg; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <1146506939.23931.2.camel@localhost>
The error paths are badly broken.
Bonus:
- remove duplicate initialization of sp;
- remove useless NULL initialization of dev;
- USE_IO_OPS is not used (and the driver does not seem to care about
posted writes, rejoice).
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/ipg.c | 93 ++++++++++++++++++++++++-----------------------------
1 files changed, 42 insertions(+), 51 deletions(-)
5ea54e95a2319311aaae857ecf2adb7fbe068c92
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 42396ca..da0fa22 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -2914,11 +2914,8 @@ static void ipg_remove(struct pci_dev *p
/* Un-register Ethernet device. */
unregister_netdev(dev);
-#ifdef USE_IO_OPS
- ioport_unmap(ioaddr);
-#else
- iounmap(sp->ioaddr);
-#endif
+ pci_iounmap(pdev, sp->ioaddr);
+
pci_release_regions(pdev);
free_netdev(dev);
@@ -2929,19 +2926,15 @@ #endif
static int __devinit ipg_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
- int err, i;
- struct net_device *dev = NULL;
+ unsigned int i = id->driver_data;
struct ipg_nic_private *sp;
+ struct net_device *dev;
void __iomem *ioaddr;
- unsigned long pio_start, pio_len;
- unsigned long mmio_start;
+ int rc;
- err = pci_enable_device(pdev);
- if (err)
- return err;
-
- /* Get the index for the driver description string. */
- i = id->driver_data;
+ rc = pci_enable_device(pdev);
+ if (rc < 0)
+ goto out;
printk(KERN_INFO "%s found.\n", nics_supported[i].NICname);
printk(KERN_INFO "Bus %x Slot %x\n",
@@ -2949,10 +2942,14 @@ static int __devinit ipg_probe(struct pc
pci_set_master(pdev);
- if (!pci_dma_supported(pdev, 0xFFFFFFFF)) {
- printk(KERN_INFO "pci_dma_supported out.\n");
- err = -ENODEV;
- goto out;
+ rc = pci_set_dma_mask(pdev, DMA_40BIT_MASK);
+ if (rc < 0) {
+ rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
+ if (rc < 0) {
+ printk(KERN_ERR "%s: DMA config failed.\n",
+ pci_name(pdev));
+ goto err_disable_0;
+ }
}
/*
@@ -2960,9 +2957,9 @@ static int __devinit ipg_probe(struct pc
*/
dev = alloc_etherdev(sizeof(struct ipg_nic_private));
if (!dev) {
- printk(KERN_ERR "ipg: alloc_etherdev failed\n");
- err = -ENOMEM;
- goto out;
+ printk(KERN_ERR "%s: alloc_etherdev failed\n", pci_name(pdev));
+ rc = -ENOMEM;
+ goto err_disable_0;
}
sp = netdev_priv(dev);
@@ -2981,50 +2978,44 @@ static int __devinit ipg_probe(struct pc
SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, &pdev->dev);
- err = pci_request_regions(pdev, DRV_NAME);
- if (err)
- goto out;
-
- pio_start = pci_resource_start(pdev, 0) & 0xffffff80;
- pio_len = pci_resource_len(pdev, 0);
- mmio_start = pci_resource_start(pdev, 1) & 0xffffff80;
+ rc = pci_request_regions(pdev, DRV_NAME);
+ if (rc)
+ goto err_free_dev_1;
-#ifdef USE_IO_OPS
- ioaddr = ioport_map(pio_start, pio_len);
- if (!ioaddr) {
- printk(KERN_ERR "%s cannot map PIO\n", pci_name(pdev));
- err = -EIO;
- goto out;
- }
-#else
- ioaddr = ioremap(mmio_start, netdev_io_size);
+ ioaddr = pci_iomap(pdev, 1, pci_resource_len(pdev, 1));
if (!ioaddr) {
printk(KERN_ERR "%s cannot map MMIO\n", pci_name(pdev));
- err = -EIO;
- goto out;
+ rc = -EIO;
+ goto err_release_regions_2;
}
-#endif
- sp = netdev_priv(dev);
+
/* Save the pointer to the PCI device information. */
sp->ioaddr = ioaddr;
sp->pdev = pdev;
pci_set_drvdata(pdev, dev);
- err = ipg_hw_init(dev);
- if (err)
- goto out;
+ rc = ipg_hw_init(dev);
+ if (rc < 0)
+ goto err_unmap_3;
- err = register_netdev(dev);
- if (err)
- goto out;
+ rc = register_netdev(dev);
+ if (rc < 0)
+ goto err_unmap_3;
printk(KERN_INFO "Ethernet device registered as: %s\n", dev->name);
- return 0;
+out:
+ return rc;
- out:
+err_unmap_3:
+ pci_iounmap(pdev, ioaddr);
+err_release_regions_2:
+ pci_release_regions(pdev);
+err_free_dev_1:
+ free_netdev(dev);
+err_disable_0:
pci_disable_device(pdev);
- return err;
+ goto out;
}
static void ipg_set_phy_default_param(unsigned char rev,
--
1.3.1
^ permalink raw reply related
* [PATCH 1/3] ipg: removal of unreachable code
From: Francois Romieu @ 2006-05-01 23:10 UTC (permalink / raw)
To: Pekka Enberg; +Cc: David Vrabel, linux-kernel, netdev, david
In-Reply-To: <1146506939.23931.2.camel@localhost>
map/unmap is done in ipg_{probe/remove}
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/ipg.c | 18 ------------------
1 files changed, 0 insertions(+), 18 deletions(-)
2b14ddef0c29f43c07ffd33c3d1d9e652db3a571
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 5d4d023..42396ca 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -1790,24 +1790,6 @@ static int ipg_nic_stop(struct net_devic
/* Release interrupt line. */
free_irq(dev->irq, dev);
return 0;
-
-#ifdef USE_IO_OPS
-
- /* Release I/O range reserved for IPG registers. */
- release_region(dev->base_addr, IPG_IO_REG_RANGE);
-
-#else /* Not using I/O space. */
-
- /* Unmap memory used for IPG registers. */
-
- /* The following line produces strange results unless
- * unregister_netdev precedes it.
- */
- iounmap(sp->ioaddr);
-
-#endif
-
- return 0;
}
static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
--
1.3.1
^ permalink raw reply related
* Re: [PATCH] irda-usb: use NULL instead of 0
From: Randy.Dunlap @ 2006-05-01 22:31 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: netdev, jgarzik
In-Reply-To: <200605020019.25382.IvDoorn@gmail.com>
> I could be mistaken, but wasn't the usb_control_msg timeout type changed in kernel 2.6.12?
> The timeout value is no longer in jiffies but in msecs.
ugh, correct. Here's a new patch.
Thanks.
---
From: Randy Dunlap <rdunlap@xenotime.net>
Use NULL instead of 0 for a null pointer value (sparse warning):
drivers/net/irda/irda-usb.c:1781:30: warning: Using plain integer as NULL pointer
Correct timeout argument to use milliseconds instead of jiffies.
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
---
drivers/net/irda/irda-usb.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
--- linux-2617-rc3.orig/drivers/net/irda/irda-usb.c
+++ linux-2617-rc3/drivers/net/irda/irda-usb.c
@@ -1778,7 +1778,7 @@ static int irda_usb_probe(struct usb_int
if (self->needspatch) {
ret = usb_control_msg (self->usbdev, usb_sndctrlpipe (self->usbdev, 0),
- 0x02, 0x40, 0, 0, 0, 0, msecs_to_jiffies(500));
+ 0x02, 0x40, 0, 0, NULL, 0, 500);
if (ret < 0) {
IRDA_DEBUG (0, "usb_control_msg failed %d\n", ret);
goto err_out_3;
^ permalink raw reply
* Re: [RFC] vlan: add sysfs support
From: Stephen Hemminger @ 2006-05-01 22:26 UTC (permalink / raw)
To: Ben Greear; +Cc: David S. Miller, netdev, vlan
In-Reply-To: <44568692.6020409@candelatech.com>
On Mon, 01 May 2006 15:07:14 -0700
Ben Greear <greearb@candelatech.com> wrote:
> Stephen Hemminger wrote:
> > Add basic sysfs support for vlan device. It creates an entry in the
> > vlan pseudo-device to display tag.
> > /sys/class/net/eth0.5/vlan_id
>
> Looks fine to me, though I don't know enough about sysfs to notice
> any bugs with it...
>
> I do have a question: Will this work for > 256 vlans?
>
> /proc had a limit of around 256 directories last I
> checked, so just curious.
>
> Thanks,
> Ben
>
There should be no limits caused by sysfs...
^ permalink raw reply
* Re: [PATCH] irda-usb: use NULL instead of 0
From: Ivo van Doorn @ 2006-05-01 22:19 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: netdev, jgarzik
In-Reply-To: <20060501150807.b05fe450.rdunlap@xenotime.net>
[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]
On Tuesday 2 May 2006 00:08, Randy.Dunlap wrote:
> From: Randy Dunlap <rdunlap@xenotime.net>
>
> Use NULL instead of 0 for a null pointer value (sparse warning):
> drivers/net/irda/irda-usb.c:1781:30: warning: Using plain integer as NULL pointer
>
> Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
> ---
> drivers/net/irda/irda-usb.c | 2 +-
> 1 files changed, 1 insertion(+), 1 deletion(-)
>
> --- linux-2617-rc3.orig/drivers/net/irda/irda-usb.c
> +++ linux-2617-rc3/drivers/net/irda/irda-usb.c
> @@ -1778,7 +1778,7 @@ static int irda_usb_probe(struct usb_int
>
> if (self->needspatch) {
> ret = usb_control_msg (self->usbdev, usb_sndctrlpipe (self->usbdev, 0),
> - 0x02, 0x40, 0, 0, 0, 0, msecs_to_jiffies(500));
> + 0x02, 0x40, 0, 0, NULL, 0, msecs_to_jiffies(500));
I could be mistaken, but wasn't the usb_control_msg timeout type changed in kernel 2.6.12?
The timeout value is no longer in jiffies but in msecs.
> if (ret < 0) {
> IRDA_DEBUG (0, "usb_control_msg failed %d\n", ret);
> goto err_out_3;
IvD
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: e1000 TX hang problems
From: Jesse Brandeburg @ 2006-05-01 22:15 UTC (permalink / raw)
To: gerhard.dejager; +Cc: netdev
In-Reply-To: <1146211982.10106.7.camel@tux.co.za>
On 4/28/06, Gerhard de Jeger <gerhard.dejager@ss-online.co.za> wrote:
> I'm also experiencing TX hang problems with the e1000 driver.
>
> I was using the 6.0.60-k2 version previously which shipped with the
> 2.6.14.2 kernel.
>
> I had no problems with this driver, but after my issues with the 7.0.33
> driver I tried to go back to the 6.0.60-k driver. Now when I load the
> module, there is an error saying that the EEPROM is corrupt - so I
> cannot use the old driver which used to work.
so what kernel are you using now? what kind of hardware do you have?
we need a decent bug report in order to make some progress.
> Why is it that I now get the EEPROM error with the older driver?
did you change the kernel?
> Any ideas on how to fix the problem (with either the old driver or the
> new one)?
it sounds like you may have had a hardware failure? Or maybe a kernel
problem. Did you go back to 2.6.14.2 and try it?
It is highly unusual for the driver to be able to change the eeprom
through regular usage.
Please reply with more specifics
^ permalink raw reply
* Re: [RFC] vlan: add sysfs support
From: Ben Greear @ 2006-05-01 22:07 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David S. Miller, netdev, vlan
In-Reply-To: <20060501140834.43a006fd@localhost.localdomain>
Stephen Hemminger wrote:
> Add basic sysfs support for vlan device. It creates an entry in the
> vlan pseudo-device to display tag.
> /sys/class/net/eth0.5/vlan_id
Looks fine to me, though I don't know enough about sysfs to notice
any bugs with it...
I do have a question: Will this work for > 256 vlans?
/proc had a limit of around 256 directories last I
checked, so just curious.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* [PATCH] irda-usb: use NULL instead of 0
From: Randy.Dunlap @ 2006-05-01 22:08 UTC (permalink / raw)
To: netdev; +Cc: jgarzik
From: Randy Dunlap <rdunlap@xenotime.net>
Use NULL instead of 0 for a null pointer value (sparse warning):
drivers/net/irda/irda-usb.c:1781:30: warning: Using plain integer as NULL pointer
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
---
drivers/net/irda/irda-usb.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
--- linux-2617-rc3.orig/drivers/net/irda/irda-usb.c
+++ linux-2617-rc3/drivers/net/irda/irda-usb.c
@@ -1778,7 +1778,7 @@ static int irda_usb_probe(struct usb_int
if (self->needspatch) {
ret = usb_control_msg (self->usbdev, usb_sndctrlpipe (self->usbdev, 0),
- 0x02, 0x40, 0, 0, 0, 0, msecs_to_jiffies(500));
+ 0x02, 0x40, 0, 0, NULL, 0, msecs_to_jiffies(500));
if (ret < 0) {
IRDA_DEBUG (0, "usb_control_msg failed %d\n", ret);
goto err_out_3;
---
^ permalink raw reply
* [PATCH resend] softmac: suggest per-frame-type TX rate
From: Daniel Drake @ 2006-05-01 21:45 UTC (permalink / raw)
To: linville; +Cc: netdev, johannes, softmac-dev
This patch is the first step towards rate control inside softmac.
The txrates substructure has been extended to provide different fields for
different types of packets (management/data, unicast/multicast). These fields
are updated on association to values compatible with the access point we are
associating to.
Drivers can then use the new ieee80211softmac_suggest_txrate() function call
when deciding which rate to transmit each frame at. This is immensely useful
for ZD1211, and bcm can use it too.
The user can still specify a rate through iwconfig, which is matched for all
transmissions (assuming the rate they have specified is in the rate set
required by the AP).
At a later date, we can incorporate automatic rate management into the
ieee80211softmac_recalc_txrates() function.
This patch also removes the mcast_fallback field. Sam Leffler pointed out that
this field is meaningless, because no driver will ever be retransmitting mcast
frames (they are not acked).
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
--
Rediffed against my other recent patches.
Also, even though this patch modifies the softmac API
(ieee80211softmac_txrates), this should not cause any breakage because nobody
uses that yet.
Index: linux-2.6.17-rc3/include/net/ieee80211softmac.h
===================================================================
--- linux-2.6.17-rc3.orig/include/net/ieee80211softmac.h
+++ linux-2.6.17-rc3/include/net/ieee80211softmac.h
@@ -86,6 +86,9 @@ struct ieee80211softmac_assoc_info {
/* BSSID we're trying to associate to */
char bssid[ETH_ALEN];
+
+ /* Rates supported by the network */
+ struct ieee80211softmac_ratesinfo supported_rates;
/* some flags.
* static_essid is valid if the essid is constant,
@@ -132,23 +135,26 @@ enum {
struct ieee80211softmac_txrates {
/* The Bit-Rate to be used for multicast frames. */
u8 mcast_rate;
- /* The Bit-Rate to be used for multicast fallback
- * (If the device supports fallback and hardware-retry)
- */
- u8 mcast_fallback;
+
+ /* The Bit-Rate to be used for multicast management frames. */
+ u8 mgt_mcast_rate;
+
/* The Bit-Rate to be used for any other (normal) data packet. */
u8 default_rate;
/* The Bit-Rate to be used for default fallback
* (If the device supports fallback and hardware-retry)
*/
u8 default_fallback;
+
+ /* This is the rate that the user asked for */
+ u8 user_rate;
};
/* Bits for txrates_change callback. */
#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT (1 << 0) /* default_rate */
#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK (1 << 1) /* default_fallback */
#define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */
-#define IEEE80211SOFTMAC_TXRATECHG_MCAST_FBACK (1 << 3) /* mcast_fallback */
+#define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */
struct ieee80211softmac_device {
/* 802.11 structure for data stuff */
@@ -250,6 +256,28 @@ extern void ieee80211softmac_fragment_lo
* Note that the rates need to be sorted. */
extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates);
+/* Helper function which advises you the rate at which a frame should be
+ * transmitted at. */
+static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac,
+ int is_multicast,
+ int is_mgt)
+{
+ struct ieee80211softmac_txrates *txrates = &mac->txrates;
+
+ if (!mac->associated)
+ return txrates->mgt_mcast_rate;
+
+ /* We are associated, sending unicast frame */
+ if (!is_multicast)
+ return txrates->default_rate;
+
+ /* We are associated, sending multicast frame */
+ if (is_mgt)
+ return txrates->mgt_mcast_rate;
+ else
+ return txrates->mcast_rate;
+}
+
/* Start the SoftMAC. Call this after you initialized the device
* and it is ready to run.
*/
Index: linux-2.6.17-rc3/net/ieee80211/softmac/ieee80211softmac_assoc.c
===================================================================
--- linux-2.6.17-rc3.orig/net/ieee80211/softmac/ieee80211softmac_assoc.c
+++ linux-2.6.17-rc3/net/ieee80211/softmac/ieee80211softmac_assoc.c
@@ -96,6 +96,7 @@ ieee80211softmac_disassoc(struct ieee802
mac->associated = 0;
mac->associnfo.bssvalid = 0;
mac->associnfo.associating = 0;
+ ieee80211softmac_init_txrates(mac);
ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL);
spin_unlock_irqrestore(&mac->lock, flags);
}
@@ -118,24 +119,15 @@ ieee80211softmac_send_disassoc_req(struc
static inline int
we_support_all_basic_rates(struct ieee80211softmac_device *mac, u8 *from, u8 from_len)
{
- int idx, search, found;
- u8 rate, search_rate;
+ int idx;
+ u8 rate;
for (idx = 0; idx < (from_len); idx++) {
rate = (from)[idx];
if (!(rate & IEEE80211_BASIC_RATE_MASK))
continue;
- found = 0;
rate &= ~IEEE80211_BASIC_RATE_MASK;
- for (search = 0; search < mac->ratesinfo.count; search++) {
- search_rate = mac->ratesinfo.rates[search];
- search_rate &= ~IEEE80211_BASIC_RATE_MASK;
- if (rate == search_rate) {
- found = 1;
- break;
- }
- }
- if (!found)
+ if (!ieee80211softmac_ratesinfo_rate_supported(&mac->ratesinfo, rate))
return 0;
}
return 1;
@@ -310,6 +302,9 @@ ieee80211softmac_associated(struct ieee8
struct ieee80211softmac_network *net)
{
mac->associnfo.associating = 0;
+ mac->associnfo.supported_rates = net->supported_rates;
+ ieee80211softmac_recalc_txrates(mac);
+
mac->associated = 1;
if (mac->set_bssid_filter)
mac->set_bssid_filter(mac->dev, net->bssid);
Index: linux-2.6.17-rc3/net/ieee80211/softmac/ieee80211softmac_module.c
===================================================================
--- linux-2.6.17-rc3.orig/net/ieee80211/softmac/ieee80211softmac_module.c
+++ linux-2.6.17-rc3/net/ieee80211/softmac/ieee80211softmac_module.c
@@ -26,6 +26,7 @@
#include "ieee80211softmac_priv.h"
#include <linux/sort.h>
+#include <linux/etherdevice.h>
struct net_device *alloc_ieee80211softmac(int sizeof_priv)
{
@@ -61,14 +62,6 @@ struct net_device *alloc_ieee80211softma
softmac->wait_for_scan = ieee80211softmac_wait_for_scan_implementation;
softmac->stop_scan = ieee80211softmac_stop_scan_implementation;
- //TODO: The mcast rate has to be assigned dynamically somewhere (in scanning, association. Not sure...)
- // It has to be set to the highest rate all stations in the current network can handle.
- softmac->txrates.mcast_rate = IEEE80211_CCK_RATE_1MB;
- softmac->txrates.mcast_fallback = IEEE80211_CCK_RATE_1MB;
- /* This is reassigned in ieee80211softmac_start to sane values. */
- softmac->txrates.default_rate = IEEE80211_CCK_RATE_1MB;
- softmac->txrates.default_fallback = IEEE80211_CCK_RATE_1MB;
-
/* to start with, we can't send anything ... */
netif_carrier_off(dev);
@@ -170,15 +163,82 @@ static void ieee80211softmac_start_check
}
}
-void ieee80211softmac_start(struct net_device *dev)
+int ieee80211softmac_ratesinfo_rate_supported(struct ieee80211softmac_ratesinfo *ri, u8 rate)
+{
+ int search;
+ u8 search_rate;
+
+ for (search = 0; search < ri->count; search++) {
+ search_rate = ri->rates[search];
+ search_rate &= ~IEEE80211_BASIC_RATE_MASK;
+ if (rate == search_rate)
+ return 1;
+ }
+
+ return 0;
+}
+
+/* Finds the highest rate which is:
+ * 1. Present in ri (optionally a basic rate)
+ * 2. Supported by the device
+ * 3. Less than or equal to the user-defined rate
+ */
+static u8 highest_supported_rate(struct ieee80211softmac_device *mac,
+ struct ieee80211softmac_ratesinfo *ri, int basic_only)
+{
+ u8 user_rate = mac->txrates.user_rate;
+ int i;
+
+ if (ri->count == 0) {
+ dprintk(KERN_ERR PFX "empty ratesinfo?\n");
+ return IEEE80211_CCK_RATE_1MB;
+ }
+
+ for (i = ri->count - 1; i >= 0; i--) {
+ u8 rate = ri->rates[i];
+ if (basic_only && !(rate & IEEE80211_BASIC_RATE_MASK))
+ continue;
+ rate &= ~IEEE80211_BASIC_RATE_MASK;
+ if (rate > user_rate)
+ continue;
+ if (ieee80211softmac_ratesinfo_rate_supported(&mac->ratesinfo, rate))
+ return rate;
+ }
+
+ /* If we haven't found a suitable rate by now, just trust the user */
+ return user_rate;
+}
+
+void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac)
+{
+ struct ieee80211softmac_txrates *txrates = &mac->txrates;
+ struct ieee80211softmac_txrates oldrates;
+ u32 change = 0;
+
+ if (mac->txrates_change)
+ oldrates = mac->txrates;
+
+ change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT;
+ txrates->default_rate = highest_supported_rate(mac, &mac->associnfo.supported_rates, 0);
+
+ change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK;
+ txrates->default_fallback = lower_rate(mac, txrates->default_rate);
+
+ change |= IEEE80211SOFTMAC_TXRATECHG_MCAST;
+ txrates->mcast_rate = highest_supported_rate(mac, &mac->associnfo.supported_rates, 1);
+
+ if (mac->txrates_change)
+ mac->txrates_change(mac->dev, change, &oldrates);
+
+}
+
+void ieee80211softmac_init_txrates(struct ieee80211softmac_device *mac)
{
- struct ieee80211softmac_device *mac = ieee80211_priv(dev);
struct ieee80211_device *ieee = mac->ieee;
u32 change = 0;
+ struct ieee80211softmac_txrates *txrates = &mac->txrates;
struct ieee80211softmac_txrates oldrates;
- ieee80211softmac_start_check_rates(mac);
-
/* TODO: We need some kind of state machine to lower the default rates
* if we loose too many packets.
*/
@@ -193,22 +253,37 @@ void ieee80211softmac_start(struct net_d
more reliable. Note similar logic in
ieee80211softmac_wx_set_rate() */
if (ieee->modulation & IEEE80211_CCK_MODULATION) {
- mac->txrates.default_rate = IEEE80211_CCK_RATE_11MB;
- change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT;
- mac->txrates.default_fallback = IEEE80211_CCK_RATE_5MB;
- change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK;
+ txrates->user_rate = IEEE80211_CCK_RATE_11MB;
} else if (ieee->modulation & IEEE80211_OFDM_MODULATION) {
- mac->txrates.default_rate = IEEE80211_OFDM_RATE_54MB;
- change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT;
- mac->txrates.default_fallback = IEEE80211_OFDM_RATE_24MB;
- change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK;
+ txrates->user_rate = IEEE80211_OFDM_RATE_54MB;
} else
assert(0);
+
+ txrates->default_rate = IEEE80211_CCK_RATE_1MB;
+ change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT;
+
+ txrates->default_fallback = IEEE80211_CCK_RATE_1MB;
+ change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK;
+
+ txrates->mcast_rate = IEEE80211_CCK_RATE_1MB;
+ change |= IEEE80211SOFTMAC_TXRATECHG_MCAST;
+
+ txrates->mgt_mcast_rate = IEEE80211_CCK_RATE_1MB;
+ change |= IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST;
+
if (mac->txrates_change)
- mac->txrates_change(dev, change, &oldrates);
+ mac->txrates_change(mac->dev, change, &oldrates);
mac->running = 1;
}
+
+void ieee80211softmac_start(struct net_device *dev)
+{
+ struct ieee80211softmac_device *mac = ieee80211_priv(dev);
+
+ ieee80211softmac_start_check_rates(mac);
+ ieee80211softmac_init_txrates(mac);
+}
EXPORT_SYMBOL_GPL(ieee80211softmac_start);
void ieee80211softmac_stop(struct net_device *dev)
Index: linux-2.6.17-rc3/net/ieee80211/softmac/ieee80211softmac_wx.c
===================================================================
--- linux-2.6.17-rc3.orig/net/ieee80211/softmac/ieee80211softmac_wx.c
+++ linux-2.6.17-rc3/net/ieee80211/softmac/ieee80211softmac_wx.c
@@ -211,8 +211,8 @@ ieee80211softmac_wx_set_rate(struct net_
if (is_ofdm && !(ieee->modulation & IEEE80211_OFDM_MODULATION))
goto out_unlock;
- mac->txrates.default_rate = rate;
- mac->txrates.default_fallback = lower_rate(mac, rate);
+ mac->txrates.user_rate = rate;
+ ieee80211softmac_recalc_txrates(mac);
err = 0;
out_unlock:
Index: linux-2.6.17-rc3/net/ieee80211/softmac/ieee80211softmac_priv.h
===================================================================
--- linux-2.6.17-rc3.orig/net/ieee80211/softmac/ieee80211softmac_priv.h
+++ linux-2.6.17-rc3/net/ieee80211/softmac/ieee80211softmac_priv.h
@@ -116,7 +116,10 @@ ieee80211softmac_get_network_by_essid(st
struct ieee80211softmac_essid *essid);
/* Rates related */
+int ieee80211softmac_ratesinfo_rate_supported(struct ieee80211softmac_ratesinfo *ri, u8 rate);
u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rate, int delta);
+void ieee80211softmac_init_txrates(struct ieee80211softmac_device *mac);
+void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac);
static inline u8 lower_rate(struct ieee80211softmac_device *mac, u8 rate) {
return ieee80211softmac_lower_rate_delta(mac, rate, 1);
}
^ 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