Re: [PATCH] Fix race condition about network device name allocation
On Wed, Jun 13, 2007 at 09:36:31AM -0700, Stephen Hemminger wrote: > On Wed, 13 Jun 2007 12:45:21 +0300 > Dan Aloni <[EMAIL PROTECTED]> wrote: > > > On Mon, May 14, 2007 at 08:58:40AM -0700, Stephen Hemminger wrote: > > > Kenji Kaneshige found this race between device removal and > > > registration. On unregister it is possible for the old device to > > > exist, because sysfs file is still open. A new device with 'eth%d' > > > will select the same name, but sysfs kobject register will fial. > > > > > > The following changes the shutdown order slightly. It hold a removes the > > > sysfs > > > entries earlier (on unregister_netdevice), but holds a kobject reference. > > > Then when todo runs the actual last put free happens. > > > > > > Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]> > > > > That patch breaks the bonding driver. After reverting it I avoid this crash: > > >[..] > > > > I assume this happens when bonded slave device is removed? Yes, it's just a simple removal via sysfs. > Which kernel version? 2.6.21.5 -- Dan Aloni XIV LTD, http://www.xivstorage.com da-x (at) monatomic.org, dan (at) xiv.co.il - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH UPDATED] bonding: Fix 802.3ad no carrier on "no partner found" instance
Modify carrier state determination for 802.3ad mode to comply with section 43.3.9 of IEEE 802.3, which requires that "Links that are not successful candidates for aggregation (e.g., links that are attached to other devices that cannot perform aggregation or links that have been manually configured to be non-aggregatable) are enabled to operate as individual IEEE 802.3 links." Bug reported by Laurent Chavey <[EMAIL PROTECTED]>. This patch is an updated version of his patch that changes the wording of commentary and adds an update to the driver version. Signed-off-by: Jay Vosburgh <[EMAIL PROTECTED]> Signed-off-by: Laurent Chavey <[EMAIL PROTECTED]> diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 7e03f41..f829e4a 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c @@ -2303,19 +2303,18 @@ void bond_3ad_handle_link_change(struct slave *slave, char link) } /* - * set link state for bonding master: if we have an active partnered + * set link state for bonding master: if we have an active * aggregator, we're up, if not, we're down. Presumes that we cannot * have an active aggregator if there are no slaves with link up. * + * This behavior complies with IEEE 802.3 section 43.3.9. + * * Called by bond_set_carrier(). Return zero if carrier state does not * change, nonzero if it does. */ int bond_3ad_set_carrier(struct bonding *bond) { - struct aggregator *agg; - - agg = __get_active_agg(&(SLAVE_AD_INFO(bond->first_slave).aggregator)); - if (agg && MAC_ADDRESS_COMPARE(&agg->partner_system, &null_mac_addr)) { + if (__get_active_agg(&(SLAVE_AD_INFO(bond->first_slave).aggregator))) { if (!netif_carrier_ok(bond->dev)) { netif_carrier_on(bond->dev); return 1; diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 41aa78b..a891021 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h @@ -22,8 +22,8 @@ #include "bond_3ad.h" #include "bond_alb.h" -#define DRV_VERSION"3.1.2" -#define DRV_RELDATE"January 20, 2007" +#define DRV_VERSION"3.1.3" +#define DRV_RELDATE"June 13, 2007" #define DRV_NAME "bonding" #define DRV_DESCRIPTION"Ethernet Channel Bonding Driver" - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Fix race condition about network device name allocation
The following patch (based on a patch from Stephen Hemminger <[EMAIL PROTECTED]>) removes use after free conditions in the unregister path for the bonding master. Without this patch, an operation of the form "echo -bond0 > /sys/class/net/bonding_masters" would trigger a NULL pointer dereference in sysfs. I was not able to induce the failure with the non-sysfs code path, but for consistency I updated that code as well. I also did some testing of the bonding /proc file being open while the bond is being deleted, and didn't see any problems there. Signed-off-by: Jay Vosburgh <[EMAIL PROTECTED]> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 223517d..6287ffb 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -4345,8 +4345,8 @@ static void bond_free_all(void) bond_mc_list_destroy(bond); /* Release the bonded slaves */ bond_release_all(bond_dev); - unregister_netdevice(bond_dev); bond_deinit(bond_dev); + unregister_netdevice(bond_dev); } #ifdef CONFIG_PROC_FS diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index a122baa..60cccf2 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -164,9 +164,9 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t printk(KERN_INFO DRV_NAME ": %s is being deleted...\n", bond->dev->name); - unregister_netdevice(bond->dev); bond_deinit(bond->dev); bond_destroy_sysfs_entry(bond); + unregister_netdevice(bond->dev); rtnl_unlock(); goto out; } - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 2/2] qdisc_restart - couple of optimizations.
Hi Peter, Thanks for your feedback. > > - netif_queue_stopped need not be called inside qdisc_restart as > > it has been called already in qdisc_run() before the first skb > > is sent, and in __qdisc_run() after each intermediate skb is > > sent (note : we are the only sender, so the queue cannot get > > stopped while the tx lock was got in the ~LLTX case). > > I somewhat disagree here. The underlying driver can conceivably stop > the device queue even if the stack holds the queue lock during an > interrupt to clean Tx descriptors, and it finds it's out of them or > needs to grab the device for whatever reason. Granted this is a corner > case, and the net effect would be a simple requeue of the skb, but > checking the status of the queue at the last possible moment before > entering the driver could alleviate the requeue in the time between > ->dequeue() from the qdisc, and hard_start_xmit() if an event like I > mentioned happened. After seeing a few drivers, I understand that the rx intr (to clean TX descriptors) can only enable the queue and not stop the queue (as it will normally not queue any packets and only clean up the sent ones). I don't find any way that the driver can stop the queue once the top layer determines it is OK to send and is enqueing. It is a wasted check for almost every packet (and IMHO opinion, for every packet). And as you said - if a driver were written differently to stop the queue even in the clean path, then that rare event (should be very rare as we checked for stop_queue just a few instrutions earlier) will result in a requeue, but the normal path is not penalized. Thanks, - KK > I'm ok with it either way, especially since this is a corner case. But > it does need to be considered that it can happen. - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] TCP: remove initial_ssthresh from Cubic
On Wed, 13 Jun 2007, David Miller wrote: > From: Stephen Hemminger <[EMAIL PROTECTED]> > Date: Wed, 13 Jun 2007 11:31:49 -0700 > > > Maybe it is time to remove BIC? > > I don't see any compelling reason, the same could be said > of the other experimental protocols we include in the tree. I agree bic should be kept. As I pointed out, if someone did want to set the bic/cubic initial_ssthresh to 100 globally, my tests showed bic's performance during the initial slow start phase was far superior to cubic's. I don't know if this is a bug or a feature with cubic. -Bill - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: cannot set IP for ethernet
From: Herbert Xu <[EMAIL PROTECTED]> Date: Thu, 14 Jun 2007 13:53:41 +1000 > Actually in his case it's because 2.6.22-rc4-git2 doesn't have the > following changeset. It's on the way, it just hasn't been picked up yet. - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: cannot set IP for ethernet
On Tue, Jun 12, 2007 at 04:06:25PM +0200, Patrick McHardy wrote: > Oliver Neukum wrote: > > with 2.6.22-rc4-git2 I am getting errors when setting IP for ethernet > > interfaces: > > > > ioctl(4, SIOCSIFADDR, 0x7fff94931600) = -1 ENOBUFS (No buffer space > > available) > > > > The error is independant of the interface. It happens to all interfaces. > > There's nothing in the syslog. > > > > valisk:/home/oliver # uname -a > > Linux valisk 2.6.22-rc4-git2-default #3 SMP Tue Jun 12 13:27:54 CEST 2007 > > x86_64 x86_64 x86_64 GNU/Linux > > This can happen if the initial inetdev allocation when the netdevice is > registered fails. I think it would make sense to try to allocate again > when adding addresses in that case, otherwise there is no way of > recovery other than unregistering and registering the device again. Actually in his case it's because 2.6.22-rc4-git2 doesn't have the following changeset. Let me have a think about your approach too. Thanks, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- commit 6363097cc4d182f93788131b5d8f72aa91d950a0 Author: Herbert Xu <[EMAIL PROTECTED]> Date: Thu Jun 7 18:35:38 2007 -0700 [IPV4]: Do not remove idev when addresses are cleared Now that we create idev before addresses are added, it no longer makes sense to remove them when addresses are all deleted. Signed-off-by: Herbert Xu <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> 6363097cc4d182f93788131b5d8f72aa91d950a0 diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index fa97b96..abf6352 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -327,12 +327,8 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, } } - if (destroy) { + if (destroy) inet_free_ifa(ifa1); - - if (!in_dev->ifa_list) - inetdev_destroy(in_dev); - } } static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] NET: Multiqueue network device support.
On Wed, 2007-06-13 at 08:32 -0400, jamal wrote: > The key arguement i make (from day one actually) is to leave the > majority of the work to the driver. But it seems not feasible the Qdisc needs to know nothing about the hardware rings. > My view of wireless WMM etc is it is a different media behavior > (compared to wired ethernet) which means a different view of strategy > for when it opens the valve to allow in more packets. 802.11 media has > embedded signalling which is usable. Guy Cohen gave a good use case > which i responded to. Do you wanna look at that and respond? The key to support multi-ring hardware for software is to put packets into hardware as much/early as possible. Guy gave a good VO vs. BK example. To achieve this in your model, you have to keep the TX ring running (in the case of PHL full) and requeue. But when there are only BK packets coming, you do want to stop the ring, right? AFAICS, the driver is not the best place to make the decision (it only knows the current and previous packets, but not the _next_), the Qdisc is the best place. Thanks, -yi - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: IC Plus Corp IC Plus IP1000
The following hacks to bring it up to date got the vendor-supplied driver working for me. This is just fixing the things the compiler complained about; there may be other issues, but they don't seem to interfere with basic funtionality. diff --git a/Makefile b/Makefile index c91b384..31e4172 100644 --- a/Makefile +++ b/Makefile @@ -77,10 +77,10 @@ ifeq ($(kernelFlag26),kernel26x) EXTRA_CFLAGS+=$(MAPPING_MODE) all: - $(MAKE) -C $(KernelBuildDir) SUBDIRS=$(PWD) modules + $(MAKE) -C $(KernelBuildDir) M=$(PWD) install: - install -m 644 -c ipg.$(kernelExtension) $(kernelMisc) + $(MAKE) -C $(KernelBuildDir) M=$(PWD) modules_install ipg-objs:=$(OBJS) obj-m+=$(TARGET) diff --git a/ipg.h b/ipg.h index 2d184d4..cefe5c8 100644 --- a/ipg.h +++ b/ipg.h @@ -98,8 +98,8 @@ */ -#include #include +#include #include #if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)) && defined(MODVERSIONS)) diff --git a/ipg_main.c b/ipg_main.c index c39ff4a..3a0dfd4 100644 --- a/ipg_main.c +++ b/ipg_main.c @@ -172,9 +172,11 @@ int ipg_io_config(IPG_DEVICE_TYPE *ipg_ethernet_device); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) voidipg_interrupt_handler(int ipg_irq, void *device_instance, struct pt_regs *regs); -#else +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) static irqreturn_t ipg_interrupt_handler(int ipg_irq, void *device_instance, struct pt_regs *regs); +#else +static irqreturn_t ipg_interrupt_handler(int ipg_irq, void *device_instance); #endif voidipg_nic_txcleanup(IPG_DEVICE_TYPE *ipg_ethernet_device); @@ -1425,9 +1427,11 @@ int ipg_io_config(IPG_DEVICE_TYPE *ipg_ethernet_device) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) void ipg_interrupt_handler(int ipg_irq, void *device_instance, struct pt_regs *regs) -#else +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) static irqreturn_t ipg_interrupt_handler(int ipg_irq, void *device_instance, struct pt_regs *regs) +#else +static irqreturn_t ipg_interrupt_handler(int ipg_irq, void *device_instance) #endif { int error; @@ -1957,7 +1961,7 @@ int ipg_nic_open(IPG_DEVICE_TYPE *ipg_ethernet_device) */ if ((error = request_irq(sp->ipg_pci_device->irq, &ipg_interrupt_handler, -SA_SHIRQ, +IRQF_SHARED, ipg_ethernet_device->name, ipg_ethernet_device)) < 0) { @@ -4041,7 +4045,10 @@ int init_module(void) #endif IPG_DEBUG_MSG("init_module\n"); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) + return pci_register_driver(&ipg_pci_driver); +#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) return pci_module_init(&ipg_pci_driver); #else - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2/2] 2.6.22-rc4: known regressions v3
On Wed, Jun 13, 2007 at 11:25:20PM +0100, Mark Fortescue wrote: > The random seg faults on x86_64 is interesting as I have been getting > random illegal instruction faults on sparc (sun4c) with 2.6.22-rc3. I have > not yet tried to track it down. All I know at present is that it is not a > problem on 2.6.20.9. Very interesting. Any hints as to how to test or how long to wait before the illegal instructions happen? -- wli - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] NET: Multiqueue network device support.
On Wed, 2007-06-13 at 13:34 +0200, Patrick McHardy wrote: > > The key argument for Jamal's solution is the NIC will send out 32 > > packets in the full PHL in a reasonably short time (a few microsecs > per > > Jamal's calculation). But for wireless, the PHL hardware has low > > probability to seize the wireless medium when there are full of high > > priority frames in the air. That is, the chance for transmission in > PHL > > and PHH is not equal. Queuing packets in software will starve high > > priority packets than putting them to PHH as early as possible. > > > Well, the key result of our discussion was that it makes no difference > wrt. queuing behaviour if the queue wakeup strategy is suitable chosen > for the specific queueing discipline, but it might add some overhead. My point is the overhead is hugh for the wireless case which causes it unacceptable. Given the above example in wireless medium, which queue wakeup strategy will you choose? I guess it might be the "not stop tx ring + requeue"? If this is selected, when there is a low priority packet coming (PHL is full), the Qdisc will keep dequeue and requeue for the same packet for a long time (given the fact of wireless medium) and chew tons of CPU. We met this problem before in our driver and this (not stop tx ring + requeue) is not a good thing to do. Thanks, -yi - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [ANNOUNCE] new driver ixgbe for Intel(R) 10GbE PCI Express adapters.
On 6/13/07, Francois Romieu <[EMAIL PROTECTED]> wrote: Please ignore my previous response. Forgot to reply_all.. o ixgbe_clean_tx_irq() is issued from the NAPI poll handler (as the name suggests...). Its locking will probably cause a deadlock if it is interrupted and a call to netpoll_send_skb follows. netpoll_send_skb should not deadlock because ixgbe_xmit_frame should bail out because of this... if (!spin_trylock_irqsave(&tx_ring->tx_lock, flags)) /* Collision - tell upper layer to requeue */ return NETDEV_TX_LOCKED; Right? The LLTX and tx_lock handling in the driver is not clean and I am working on to fix it. Also will make sure we are handling the net_poll case correctly... Thanks for the feedback.. Ayyappan - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Cbe-oss-dev] [PATCH 0/15] spidernet driver bug fixes
On Wed, 2007-06-13 at 21:01 +0200, Segher Boessenkool wrote: > > I wish there was a git option to "just make my shit look like the > > remote, dammit!" The above is the "easiest" way I know how to do that. > > git-fetch -f remote:local ? There's always "git reset --hard " cheers -- Michael Ellerman OzLabs, IBM Australia Development Lab wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person signature.asc Description: This is a digitally signed message part
Re: [2/2] 2.6.22-rc4: known regressions v3
Hi all, The random seg faults on x86_64 is interesting as I have been getting random illegal instruction faults on sparc (sun4c) with 2.6.22-rc3. I have not yet tried to track it down. All I know at present is that it is not a problem on 2.6.20.9. Regards Mark Fortescue. On Wed, 13 Jun 2007, Michal Piotrowski wrote: Hi all, Here is a list of some known regressions in 2.6.22-rc4. Feel free to add new regressions/remove fixed etc. http://kernelnewbies.org/known_regressions Networking Subject: commit 9093bbb2d96d0184f037cea9b4e952a44ebe7c32 broke the bonding driver References : http://lkml.org/lkml/2007/6/13/65 Submitter : Dan Aloni <[EMAIL PROTECTED]> Handled-By : Stephen Hemminger <[EMAIL PROTECTED]> Status : Unknown Sparc64 Subject: 2.6.22-rc broke X on Ultra5 References : http://lkml.org/lkml/2007/5/22/78 Submitter : Mikael Pettersson <[EMAIL PROTECTED]> Handled-By : David Miller <[EMAIL PROTECTED]> Status : problem is being debugged Suspend Subject: hibernate(?) fails totally - regression References : http://lkml.org/lkml/2007/6/1/401 Submitter : David Greaves <[EMAIL PROTECTED]> Handled-By : Rafael J. Wysocki <[EMAIL PROTECTED]> Caused-By : Tejun Heo <[EMAIL PROTECTED]> commit 9666f4009c22f6520ac3fb8a19c9e32ab973e828 Status : problem is being debugged TTY Subject: OOPS (NULL pointer dereference) in v2.6.22-rc3 References : http://lkml.org/lkml/2007/6/1/389 http://bugzilla.kernel.org/show_bug.cgi?id=8473 http://bugzilla.kernel.org/show_bug.cgi?id=8574 Submitter : Alex Riesen <[EMAIL PROTECTED]> Status : problem is being debugged x86-64 Subject: x86-64 2.6.22-rc2 random segfaults References : http://lkml.org/lkml/2007/5/24/275 Submitter : Ioan Ionita <[EMAIL PROTECTED]> Status : Unknown Regards, Michal -- LOG http://www.stardust.webpages.pl/log/ - To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [ANNOUNCE] new driver ixgbe for Intel(R) 10GbE PCI Express adapters.
Francois Romieu wrote: [EMAIL PROTECTED] <[EMAIL PROTECTED]> : [...] Please review and provide comments. o ixgbe_call_func and the ton of wrappers which go along with it should go. hmmm good point, this is a bit too verbose perhaps ;) o boolean_t duplicates the existing 'bool' yes, that's definately on the TODO list did I mention that sparse really doesn't like bool yet? :) o The options below {should be/are} handled through ethtool: - TxDescriptors - RxDescriptors - XsumRX I have been putting this on the todo list as well, but we kept it in for convenience reasons... not to mention that we've been keeping these options around in the other drivers, is there really a pressing need to remove them? I'll put it on the todo list for sure tho. o No __iomem annotations ? Ack! that slipped through the cracks... DOH o pci_alloc_consistent() returns a zeroed area: no need for memset. that is good to know, I didn't know that o ixgbe_clean_tx_irq() is issued from the NAPI poll handler (as the name suggests...). Its locking will probably cause a deadlock if it is interrupted and a call to netpoll_send_skb follows. OK, we'll look into that. I'm not sure this is an issue tho. Thanks for the feedback! Auke Auke - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Realtek r8168 slow outbound transfer - potential fix/workaround
David Gundersen <[EMAIL PROTECTED]> : [...] > I've been doing a bit of investigation work into a problem that I've > been experiencing with the latest available r8168 driver from realtek > ('r8168-8.001.00') & linux kernel 2.6.21.1. > > I have been experiencing wierd problems with slow outbound traffic that > seem to go away if there's traffic coming into the device. Googling > seen reports of this in a number of places on the web so I get the > feeling I'm not alone. What is the value of the MTU for your 8168 device ? -- Ueimor - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [ANNOUNCE] new driver ixgbe for Intel(R) 10GbE PCI Express adapters.
[EMAIL PROTECTED] <[EMAIL PROTECTED]> : [...] > Please review and provide comments. o ixgbe_call_func and the ton of wrappers which go along with it should go. o boolean_t duplicates the existing 'bool' o The options below {should be/are} handled through ethtool: - TxDescriptors - RxDescriptors - XsumRX o No __iomem annotations ? o pci_alloc_consistent() returns a zeroed area: no need for memset. o ixgbe_clean_tx_irq() is issued from the NAPI poll handler (as the name suggests...). Its locking will probably cause a deadlock if it is interrupted and a call to netpoll_send_skb follows. -- Ueimor - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Fix race condition about network device name allocation
Bonding refers to device after unregistering. This has always been a dangerous thing. The following UNTESTED should fix the problem. --- a/drivers/net/bonding/bond_sysfs.c 2007-06-13 15:48:37.0 -0700 +++ b/drivers/net/bonding/bond_sysfs.c 2007-06-13 15:49:17.0 -0700 @@ -164,9 +164,10 @@ static ssize_t bonding_store_bonds(struc printk(KERN_INFO DRV_NAME ": %s is being deleted...\n", bond->dev->name); - unregister_netdevice(bond->dev); + bond_deinit(bond->dev); bond_destroy_sysfs_entry(bond); + unregister_netdevice(bond->dev); rtnl_unlock(); goto out; } - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] NET: Multiqueue network device support.
On Wed, 2007-13-06 at 11:20 -0700, David Miller wrote: > From: jamal <[EMAIL PROTECTED]> > Date: Wed, 13 Jun 2007 09:33:22 -0400 > > > So in such a case (assuming 8 rings), One model is creating 4 netdev > > devices each based on single tx/rx ring and register set and then > > having a mother netdev (what you call the bond) that feeds these > > children netdev based on some qos parametrization is very sensible. > > Why all of this layering and overhead for something so > BLOODY SIMPLE?!?!? Are we still talking about the same thing?;-> This was about NICs which have multi register sets, tx/rx rings; the only shared resource is the bus and the wire. The e1000 cant do that. The thread is too long, so you may be talking about the same thing. cheers, jamal - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PATCHES] SCTP bugfixes
David Please pull the following SCTP patches from master.kernel.org:/pub/scm/linux/kernel/git/vxy/lksctp-dev.git Thanks -vlad The following changes since commit 66e1e3b20cbbf99da63e6c1af0fc6d39c2ed099a: David S. Miller (1): [TCP]: Set initial_ssthresh default to zero in Cubic and BIC. are found in the git repository at: master.kernel.org:/pub/scm/linux/kernel/git/vxy/lksctp-dev.git Vlad Yasevich (6): [SCTP]: Correctly set daddr for IPv6 sockets during peeloff [SCTP]: Allow unspecified port in sctp_bindx() [SCTP] Fix leak in sctp_getsockopt_local_addrs when copy_to_user fails [SCTP] Update pmtu handling to be similar to tcp [SCTP] Flag a pmtu change request [SCTP] Don't disable PMTU discovery when mtu is small include/net/sctp/sctp.h|7 +++ include/net/sctp/structs.h |7 +++ net/sctp/associola.c |4 net/sctp/input.c | 24 +--- net/sctp/socket.c | 31 ++- net/sctp/transport.c | 39 +++ 6 files changed, 88 insertions(+), 24 deletions(-) commit 06ad391919b2078ec2e012f0593014b88e7a6c4e Author: Vlad Yasevich <[EMAIL PROTECTED]> Date: Tue Jun 12 15:26:22 2007 -0400 [SCTP] Don't disable PMTU discovery when mtu is small Right now, when we receive a mtu estimate smaller then minim threshold in the ICMP message, we disable the path mtu discovery on the transport. This leads to the never increasing sctp fragmentation point even when the real path mtu has increased. Signed-off-by: Vlad Yasevich <[EMAIL PROTECTED]> commit 8a4794914f9cf2681235ec2311e189fe307c28c7 Author: Vlad Yasevich <[EMAIL PROTECTED]> Date: Thu Jun 7 14:21:05 2007 -0400 [SCTP] Flag a pmtu change request Currently, if the socket is owned by the user, we drop the ICMP message. As a result SCTP forgets that path MTU changed and never adjusting it's estimate. This causes all subsequent packets to be fragmented. With this patch, we'll flag the association that it needs to udpate it's estimate based on the already updated routing information. Signed-off-by: Vlad Yasevich <[EMAIL PROTECTED]> Acked-by: Sridhar Samudrala <[EMAIL PROTECTED]> commit c910b47e1811b3f8b184108c48de3d7af3e2999b Author: Vlad Yasevich <[EMAIL PROTECTED]> Date: Thu Jun 7 13:47:03 2007 -0400 [SCTP] Update pmtu handling to be similar to tcp Introduce new function sctp_transport_update_pmtu that updates the transports and destination caches view of the path mtu. Signed-off-by: Vlad Yasevich <[EMAIL PROTECTED]> Acked-by: Sridhar Samudrala <[EMAIL PROTECTED]> commit fe979ac169970b3d12facd6565766735862395c5 Author: Vlad Yasevich <[EMAIL PROTECTED]> Date: Wed May 23 11:11:37 2007 -0400 [SCTP] Fix leak in sctp_getsockopt_local_addrs when copy_to_user fails If the copy_to_user or copy_user calls fail in sctp_getsockopt_local_addrs(), the function should free locally allocated storage before returning error. Spotted by Coverity. Signed-off-by: Vlad Yasevich <[EMAIL PROTECTED]> Acked-by: Sridhar Samudrala <[EMAIL PROTECTED]> commit 8b35805693e1915829355723537f99f1b8bc9cc0 Author: Vlad Yasevich <[EMAIL PROTECTED]> Date: Tue May 15 17:14:58 2007 -0400 [SCTP]: Allow unspecified port in sctp_bindx() Allow sctp_bindx() to accept multiple address with unspecified port. In this case, all addresses inherit the first bound port. We still catch full mis-matches. Signed-off-by: Vlad Yasevich <[EMAIL PROTECTED]> Acked-by: Sridhar Samudrala <[EMAIL PROTECTED]> commit d570ee490fb18220262cfe41284d7aede797ed4f Author: Vlad Yasevich <[EMAIL PROTECTED]> Date: Tue May 15 16:32:39 2007 -0400 [SCTP]: Correctly set daddr for IPv6 sockets during peeloff During peeloff of AF_INET6 socket, the inet6_sk(sk)->daddr wasn't set correctly since the code was assuming IPv4 only. Now we use a correct call to set the destination address. Signed-off-by: Vlad Yasevich <[EMAIL PROTECTED]> Acked-by: Sridhar Samudrala <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: r8169 tx problem (1s pause with ping)
Benjamin LaHaise <[EMAIL PROTECTED]> : [...] > I'm seeing something odd with r8169 on FC7: doing a ping -s 1600 alternates > between a 1s latency and sub 1ms. Has anyone else seen anything like this? > The system in question is an Asus M2A-VM with an onboard RTL8111 (I think). > NAPI doesn't seem to make a difference. The kernel in question is currently > a vanilla 2.6.21.5. Sub-mtu sized packets behave normally. Same thing here for my 8168 rev 01 (asrock 945G dvi LOM) with 2.6.22-rc4 and 2.6.22-rc3 + r816x patchkit. Wonderful. -- Ueimor - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Cbe-oss-dev] [PATCH 0/15] spidernet driver bug fixes
On Wednesday 13 June 2007, Jeff Garzik wrote: > Segher Boessenkool wrote: > >> I wish there was a git option to "just make my shit look like the > >> remote, dammit!" The above is the "easiest" way I know how to do that. > > > > git-fetch -f remote:local ? > > If that works... great :) Much better than what I described. It works as long as you are not on branch 'local', but in that case you can do 'git-fetch -f remote:local2' or something. Arnd <>< - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2/2] 2.6.22-rc4: known regressions v3
On 13/06/07, Björn Steinbrink <[EMAIL PROTECTED]> wrote: On 2007.06.13 21:57:56 +0200, Michal Piotrowski wrote: > TTY > > Subject: OOPS (NULL pointer dereference) in v2.6.22-rc3 > References : http://lkml.org/lkml/2007/6/1/389 > http://bugzilla.kernel.org/show_bug.cgi?id=8473 > http://bugzilla.kernel.org/show_bug.cgi?id=8574 > Submitter : Alex Riesen <[EMAIL PROTECTED]> > Status : problem is being debugged Patch available at: http://lkml.org/lkml/2007/6/8/490 Thanks for letting me know. Regards, Michal -- LOG http://www.stardust.webpages.pl/log/ - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Cbe-oss-dev] [PATCH 12/15] spidernet: increase the NAPI weight
On Wednesday 13 June 2007, Jeff Garzik wrote: > > +/* We really really want to empty the ring buffer every time, > > + * so as to avoid the RX ram full bug. So set te napi wieght > > + * to the ring size. > > + */ > > +#define SPIDER_NET_NAPI_WEIGHT SPIDER_NET_RX_DESCRIPTORS_DEFAULT > > I don't see why spider_net should have a different NAPI weight from > other drivers > Would it help to do it the other way round, as in #define SPIDER_NET_RX_DESCRIPTORS_DEFAULT SPIDER_NET_NAPI_WEIGHT and leave that at 64 instead of 256? Arnd <>< - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: IC Plus Corp IC Plus IP1000
Thank you for your suggestion. I do however, have the following issues, which is also why I searched Google for help on it. 1.The Sundance driver is in the 100mbit section, implying that it won't work with 1gbit. 2.When I first started up the server I am using with the ethernet device, it didn't detect it, even with the Sundance driver compiled in to the kernel, so I gave up on it. 3.Now I would like to extend the server with another ethernet device, and I would prefer to use what is already installed instead of having to buy another additonal ethernet board. 4.While searching for the driver code with Google, it seemed that several people would like to see a IC Plus Corp IC Plus IP1000 driver in the kernel, and nowhere did I see that using the present Sundance driver was adequate. 5.I am not able to reboot this server too often (it is a live web server) so I would like to prepare as much as possible before rebooting it. So, does your suggestion include: 1.The possibility to use the device in gigabit mode? 2.How to tweak the present Sundance driver to better detect a "IC Plus Corp IC Plus IP1000" board? 3.Or *is* the Sundance driver supposed to be a generic driver for all their boards, including >100mbit? If you can tell me about that, or give me pointers to figure it out, I'd be much obliged! Thanks, Peter Jeff Garzik wrote: Peter Rasmussen wrote: I am not on this list, but found this address on: http://linux-net.osdl.org/index.php/Mailing_Lists. My question is regarding the ethernet controller (from lspci): Sundance Technology Inc / IC Plus Corp IC Plus IP1000 Family Gigabit Ethernet (rev 41) that seems to have a driver for it published on: http://www.icplus.com.tw/driver-pp-IP1000A.html Unfortunately I am not able to build it as described. I wonder if it at some time will be included in the standard Linux kernel? I am of course interested because my main board has it built in, so I would be willing to test it. Use the 'sundance' driver that's been in the kernel for quite a while. Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/7] sky2: avoid reserved regions on ethtool reg dump
Stephen Hemminger wrote: On Yukon EX reading some of the undocumented places in the memory space will cause a hang. Since they don't provide useful information, just skip the reserved areas. Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]> --- drivers/net/sky2.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) applied 1-7 to #upstream (2.6.23) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH -mm take5 6/7] add ioctls for adding/removing target
Hi Keiichi, On 6/13/07, Keiichi KII <[EMAIL PROTECTED]> wrote: From: Keiichi KII <[EMAIL PROTECTED]> We add ioctls for adding/removing target. If we use NETCONSOLE_ADD_TARGET ioctl, we can dynamically add netconsole target. If we use NETCONSOLE_REMOVE_TARGET ioctl, we can dynamically remoe netconsole target. *ugh*. I was wondering what a show-stopper this particular patch was -- introduces a couple of ioctl()'s, exports a new structure to userspace, adds a hitherto-unneeded header file, brings in tty_struct/tty_operations and ends up adding so much complexity/ bloat to netconsole.c. Not only that, it must live together (and side-by-side) with the sysfs interface also, because the two of them do different things: sysfs to be able to modify target parameters at run-time and the ioctl()'s to dynamically add/remove targets. We can't really mkdir(2) or rmdir(2) in sysfs so the ioctl()'s are needed. So may I suggest: Just lose *both* the sysfs and ioctl() interfaces and use _configfs_. It is *precisely* the thing you need in your driver here -- the ability to create / destroy kernel objects (or config_items in configfs lingo) from _userspace_ via simple mkdir(2) and rmdir(2). And configfs makes changing multiple configurable parameters atomically trivial too, via rename(2) ... not to mention a sysfs+ioctls -> configfs conversion would help your patchset lose some weight too :-) Satyam - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: small forcedeth WoL fix
Tim Mann wrote: I happened to notice that a system with an NVidia NIC using the forcedeth driver won't wake-on-LAN if the interface was in promiscuous mode when you power off. By experiment, it looks like the hardware needs to have NvRegPacketFilterFlags set to NVREG_PFF_ALWAYS|NVREG_PFF_MYADDR (i.e., receive unicast packets to my address) in order for WoL to work. At any rate, the attached patch fixes the problem for me. --- forcedeth-git-netdev.c 2007-06-01 16:43:19.971507000 -0700 +++ forcedeth-git-netdev-fixed.c2007-06-01 16:46:53.389713000 -0700 @@ -4830,8 +4830,10 @@ drain_ring(dev); - if (np->wolenabled) + if (np->wolenabled) { + writel(NVREG_PFF_ALWAYS|NVREG_PFF_MYADDR, base + NvRegPacketFilterFlags); nv_start_rx(dev); + } Please resend as a proper Linux patch[1], apply-able using "patch -sp1", and including a signed-off-by line. NVIDIA says the patch looks OK. Jeff [1] Documentation/SubmittingPatches or http://linux.yyz.us/patch-format.html - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/7] sky2 version 1.15 (88e8071) support
On Wed, 13 Jun 2007 16:05:23 -0400 Jeff Garzik <[EMAIL PROTECTED]> wrote: > Stephen Hemminger wrote: > > These changes are to enable the Yukon Extreme (88e8071) > > chipset. This chip is similar to earlier chip but has a different > > set of offloading operations and some other minor quirks. > > > > Marvell has given me some evaluation boards with the 88e8071 > > chip set. The chip is available now, but haven't seen a systems > > with the hardware yet. The support fot this is exprerimental > > at this point, but haven't encountered any new problems. > > Just to confirm... these are all for #upstream (2.6.23), correct? > > Yes, given that the hardware is not available on common platforms yet, it should go into 2.6.23 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2/2] 2.6.22-rc4: known regressions with patches v3
On Wed, Jun 13, 2007 at 09:58:05PM +0200, Michal Piotrowski wrote: > USB > > Subject: list_add corruption. prev->next should be next (f7d28794), but > was f0df8ed4 (prev=f0df8ed4) Kernel Bug at lib/list_debug.c:33 > References : http://bugzilla.kernel.org/show_bug.cgi?id=8561 > Submitter : Paulo Pereira <[EMAIL PROTECTED]> > Handled-By : Alan Stern <[EMAIL PROTECTED]> > Patch : http://bugzilla.kernel.org/show_bug.cgi?id=8561#c8 > Status : patch was suggested I'm pretty sure this wasn't a "regression" and was always there, and that the proposed patch did fix the solution, right Paulo and Alan? thanks, greg k-h - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH]: ps3: gigabit ethernet driver for PS3
MOKUNO Masakazu wrote: Hi Jeff, The following patch adds support for the gigabit ethernet device of PS3. It was sent out before as RFC, now I submit it for 2.6.23. Signed-off-by: Masakazu Mokuno <[EMAIL PROTECTED]> Signed-off-by: Geoff Levand <[EMAIL PROTECTED]> --- drivers/net/Kconfig | 10 drivers/net/Makefile|2 drivers/net/gelic_net.c | 1564 drivers/net/gelic_net.h | 233 +++ 4 files changed, 1809 insertions(+) a MAINTAINERS entry would be nice --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -2264,6 +2264,16 @@ config TSI108_ETH To compile this driver as a module, choose M here: the module will be called tsi108_eth. +config GELIC_NET + tristate "PS3 Gigabit Ethernet driver" + depends on PPC_PS3 + help + This driver supports the Gigabit Ethernet device on the + PS3 game console. + + To compile this driver as a module, choose M here: the + module will be called ps3_gelic. + config GIANFAR tristate "Gianfar Ethernet" depends on 85xx || 83xx || PPC_86xx --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -60,6 +60,8 @@ obj-$(CONFIG_TIGON3) += tg3.o obj-$(CONFIG_BNX2) += bnx2.o spidernet-y += spider_net.o spider_net_ethtool.o obj-$(CONFIG_SPIDER_NET) += spidernet.o sungem_phy.o +obj-$(CONFIG_GELIC_NET) += ps3_gelic.o +ps3_gelic-objs += gelic_net.o obj-$(CONFIG_TC35815) += tc35815.o obj-$(CONFIG_SKGE) += skge.o obj-$(CONFIG_SKY2) += sky2.o How about ps3_gige for the driver name. Ditto DaveM's comments about cleanups here. --- /dev/null +++ b/drivers/net/gelic_net.c @@ -0,0 +1,1564 @@ +/* + * PS3 Platfom gelic network driver. + * + * Copyright (C) 2007 Sony Computer Entertainment Inc. + * Copyright 2007 Sony Corporation + * + * this file is based on: spider_net.c + * + * Network device driver for Cell Processor-Based Blade + * + * (C) Copyright IBM Corp. 2005 + * + * Authors : Utz Bacher <[EMAIL PROTECTED]> + * Jens Osterkamp <[EMAIL PROTECTED]> + * + * 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#undef DEBUG + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "gelic_net.h" Please run this patch through scripts/checkpatch.pl (newly added in latest 2.6.22-rcX-gitY) +#define GELIC_NET_DRV_NAME "Gelic Network Driver" +#define GELIC_NET_DRV_VERSION "1.0" please follow other net drivers and use the more simple DRV_NAME and DRV_VERSION +MODULE_AUTHOR("SCE Inc."); +MODULE_DESCRIPTION("Gelic Network driver"); +MODULE_LICENSE("GPL"); + +static inline struct device * ctodev(struct gelic_net_card * card) +{ + return &card->dev->core; +} +static inline unsigned int bus_id(struct gelic_net_card *card) +{ + return card->dev->bus_id; +} +static inline unsigned int dev_id(struct gelic_net_card *card) +{ + return card->dev->dev_id; +} + +/* set irq_mask */ +static int gelic_net_set_irq_mask(struct gelic_net_card *card, u64 mask) +{ + int status; + + status = lv1_net_set_interrupt_mask(bus_id(card), dev_id(card), + mask, 0); + if (status) + dev_info(ctodev(card), +"lv1_net_set_interrupt_mask failed %d\n", status); + return status; +} +static inline void gelic_net_rx_irq_on(struct gelic_net_card *card) +{ + gelic_net_set_irq_mask(card, card->ghiintmask | GELIC_NET_RXINT); +} +static inline void gelic_net_rx_irq_off(struct gelic_net_card *card) +{ + gelic_net_set_irq_mask(card, card->ghiintmask & ~GELIC_NET_RXINT); +} +/** + * gelic_net_get_descr_status -- returns the status of a descriptor + * @descr: descriptor to look at + * + * returns the status as in the dmac_cmd_status field of the descriptor + */ +static enum gelic_net_descr_status +gelic_net_get_descr_status(struct gelic_net_descr *descr) +{ + u32 cmd_status; + + cmd_status = descr->dmac_cmd_status; + cmd_status >>= GELIC_NET_DESCR_IND_PROC_SHIFT; + return cmd_status; +} + +/** + * gelic_net_set_descr_status -- sets the status of a descriptor + * @descr: descriptor to change + * @status: status to set in the descriptor + * + * changes
Re: [2/2] 2.6.22-rc4: known regressions v3
On 2007.06.13 21:57:56 +0200, Michal Piotrowski wrote: > TTY > > Subject: OOPS (NULL pointer dereference) in v2.6.22-rc3 > References : http://lkml.org/lkml/2007/6/1/389 > http://bugzilla.kernel.org/show_bug.cgi?id=8473 > http://bugzilla.kernel.org/show_bug.cgi?id=8574 > Submitter : Alex Riesen <[EMAIL PROTECTED]> > Status : problem is being debugged Patch available at: http://lkml.org/lkml/2007/6/8/490 Björn - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH]is_power_of_2-myri10ge/myri10ge.c
vignesh babu wrote: Replacing (n & (n-1)) in the context of power of 2 checks with is_power_of_2 Signed-off-by: vignesh babu <[EMAIL PROTECTED]> Patches look OK, but please * CC relevant driver maintainers, and * combined all drivers/net/* patches of this nature into a single patch - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 8/15] spidernet: beautify error messages
Linas Vepstas wrote: Use dev_err() to print device error messages. Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]> drivers/net/spider_net.c | 64 --- 1 file changed, 34 insertions(+), 30 deletions(-) applied 8-11, 13-15 to #upstream (2.6.23) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/15] spidernet: increase the NAPI weight
Linas Vepstas wrote: Another way of minimizing the likelyhood of RX ram from overflowing is to empty out the entire rx ring every chance we get. Change the crazy watchdog timeout from 50 seconds to 3 seconds, while we're here. Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]> drivers/net/spider_net.h |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) Index: linux-2.6.22-rc1/drivers/net/spider_net.h === --- linux-2.6.22-rc1.orig/drivers/net/spider_net.h 2007-06-11 11:50:03.0 -0500 +++ linux-2.6.22-rc1/drivers/net/spider_net.h 2007-06-11 11:53:26.0 -0500 @@ -56,8 +56,13 @@ extern char spider_net_driver_name[]; #define SPIDER_NET_RX_CSUM_DEFAULT 1 -#define SPIDER_NET_WATCHDOG_TIMEOUT 50*HZ -#define SPIDER_NET_NAPI_WEIGHT 64 +#define SPIDER_NET_WATCHDOG_TIMEOUT3*HZ + +/* We really really want to empty the ring buffer every time, + * so as to avoid the RX ram full bug. So set te napi wieght + * to the ring size. + */ +#define SPIDER_NET_NAPI_WEIGHT SPIDER_NET_RX_DESCRIPTORS_DEFAULT I don't see why spider_net should have a different NAPI weight from other drivers - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/15] spidernet: silence the ramfull messages
Linas Vepstas wrote: --- linux-2.6.22-rc1.orig/drivers/net/spider_net.c 2007-06-11 10:02:34.0 -0500 +++ linux-2.6.22-rc1/drivers/net/spider_net.c 2007-06-11 11:45:25.0 -0500 @@ -1172,7 +1172,7 @@ spider_net_decode_one_descr(struct spide goto bad_desc; } - if (hwdescr->dmac_cmd_status & 0xfefe) { + if (hwdescr->dmac_cmd_status & 0xfcf4) { pr_err("%s: bad status, cmd_status=x%08x\n", card->netdev->name, hwdescr->dmac_cmd_status); A follow-up patch needs to remove the above magic numbers (==numeric constants), replacing them with named constants I only accepted the above patch because it was needed for the fixes. Otherwise I would have requested a SPIDERNET_BAD_STATUS constant or similar, containing the relevant split-out bits - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/15] spidernet: null out skb pointer after its been used.
Linas Vepstas wrote: Avoid kernel crash in mm/slab.c due to double-free of pointer. If the ethernet interface is brought down while there is still RX traffic in flight, the device shutdown routine can end up trying to double-free an skb, leading to a crash in mm/slab.c Avoid the double-free by nulling out the skb pointer. Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]> drivers/net/spider_net.c |1 + 1 file changed, 1 insertion(+) applied 1-5, 7 to #upstream-fixes (2.6.22) patch #6 was ignored, because it was already upstream - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/7] sky2 version 1.15 (88e8071) support
Stephen Hemminger wrote: These changes are to enable the Yukon Extreme (88e8071) chipset. This chip is similar to earlier chip but has a different set of offloading operations and some other minor quirks. Marvell has given me some evaluation boards with the 88e8071 chip set. The chip is available now, but haven't seen a systems with the hardware yet. The support fot this is exprerimental at this point, but haven't encountered any new problems. Just to confirm... these are all for #upstream (2.6.23), correct? - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] qla3xxx: cleanup checksum offload code
Stephen Hemminger wrote: The code for checksum is more complex than needed when dealing with VLAN's; the higher layers already pass down the location of the IP header. Compile tested only, no hardware available. Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]> applied to #upstream (2.6.23) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Please pull 'rtl8187' branch of wireless-2.6
John W. Linville wrote: Jeff, This is the second round for the new mac80211-based rtl8187 driver. Michael and Ivo responded to many of the original review comments, and I have added a couple of patches to minimally address some remaining issues. Please look at the comments I added to the header blocks to see if that is satisfactory regarding explanation of the magic values in the driver. This is a new driver, so obviously it would be targeted towards 2.6.23. John --- The following changes since commit 5ecd3100e695228ac5e0ce0e325e252c0f11806f: Linus Torvalds (1): Linux 2.6.22-rc4 are found in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git rtl8187 Ivo van Doorn (2): Add 93cx6 eeprom library eeprom_93cx6: Add comment for 1us delay after pulse John W. Linville (2): eeprom_93cx6: shorten pulse timing to match spec rtl8187: add header blocks and indicate origin of magic values Michael Wu (1): Add rtl8187 wireless driver MAINTAINERS| 10 + drivers/misc/Kconfig |5 + drivers/misc/Makefile |1 + drivers/misc/eeprom_93cx6.c| 241 +++ drivers/net/wireless/Kconfig | 12 + drivers/net/wireless/Makefile |3 + drivers/net/wireless/rtl8187.h | 145 +++ drivers/net/wireless/rtl8187_dev.c | 731 +++ drivers/net/wireless/rtl8187_rtl8225.c | 745 drivers/net/wireless/rtl8187_rtl8225.h | 44 ++ drivers/net/wireless/rtl818x.h | 226 ++ include/linux/eeprom_93cx6.h | 72 +++ 12 files changed, 2235 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/eeprom_93cx6.c create mode 100644 drivers/net/wireless/rtl8187.h create mode 100644 drivers/net/wireless/rtl8187_dev.c create mode 100644 drivers/net/wireless/rtl8187_rtl8225.c create mode 100644 drivers/net/wireless/rtl8187_rtl8225.h create mode 100644 drivers/net/wireless/rtl818x.h create mode 100644 include/linux/eeprom_93cx6.h pulled into #upstream (2.6.23) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2/2] 2.6.22-rc4: known regressions with patches v3
Hi all, Here is a list of some known regressions in 2.6.22-rc4 with patches available. Feel free to add new regressions/remove fixed etc. http://kernelnewbies.org/known_regressions Networking Subject: no irda0 interface (2.6.21 was OK), smsc does not find chip References : http://lkml.org/lkml/2007/6/3/16 Submitter : Andrey Borzenkov <[EMAIL PROTECTED]> Handled-By : Samuel Ortiz <[EMAIL PROTECTED]> Bjorn Helgaas <[EMAIL PROTECTED]> Patch : http://lkml.org/lkml/2007/6/7/237 Status : patch was suggested SELinux Subject: very high non-preempt latency in context_struct_compute_av() References : http://lkml.org/lkml/2007/6/4/78 Submitter : Ingo Molnar <[EMAIL PROTECTED]> Handled-By : Stephen Smalley <[EMAIL PROTECTED]> James Morris <[EMAIL PROTECTED]> Patch : http://lkml.org/lkml/2007/6/7/334 Status : patch available USB Subject: list_add corruption. prev->next should be next (f7d28794), but was f0df8ed4 (prev=f0df8ed4) Kernel Bug at lib/list_debug.c:33 References : http://bugzilla.kernel.org/show_bug.cgi?id=8561 Submitter : Paulo Pereira <[EMAIL PROTECTED]> Handled-By : Alan Stern <[EMAIL PROTECTED]> Patch : http://bugzilla.kernel.org/show_bug.cgi?id=8561#c8 Status : patch was suggested Regards, Michal -- LOG http://www.stardust.webpages.pl/log/ - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2/2] 2.6.22-rc4: known regressions v3
Hi all, Here is a list of some known regressions in 2.6.22-rc4. Feel free to add new regressions/remove fixed etc. http://kernelnewbies.org/known_regressions Networking Subject: commit 9093bbb2d96d0184f037cea9b4e952a44ebe7c32 broke the bonding driver References : http://lkml.org/lkml/2007/6/13/65 Submitter : Dan Aloni <[EMAIL PROTECTED]> Handled-By : Stephen Hemminger <[EMAIL PROTECTED]> Status : Unknown Sparc64 Subject: 2.6.22-rc broke X on Ultra5 References : http://lkml.org/lkml/2007/5/22/78 Submitter : Mikael Pettersson <[EMAIL PROTECTED]> Handled-By : David Miller <[EMAIL PROTECTED]> Status : problem is being debugged Suspend Subject: hibernate(?) fails totally - regression References : http://lkml.org/lkml/2007/6/1/401 Submitter : David Greaves <[EMAIL PROTECTED]> Handled-By : Rafael J. Wysocki <[EMAIL PROTECTED]> Caused-By : Tejun Heo <[EMAIL PROTECTED]> commit 9666f4009c22f6520ac3fb8a19c9e32ab973e828 Status : problem is being debugged TTY Subject: OOPS (NULL pointer dereference) in v2.6.22-rc3 References : http://lkml.org/lkml/2007/6/1/389 http://bugzilla.kernel.org/show_bug.cgi?id=8473 http://bugzilla.kernel.org/show_bug.cgi?id=8574 Submitter : Alex Riesen <[EMAIL PROTECTED]> Status : problem is being debugged x86-64 Subject: x86-64 2.6.22-rc2 random segfaults References : http://lkml.org/lkml/2007/5/24/275 Submitter : Ioan Ionita <[EMAIL PROTECTED]> Status : Unknown Regards, Michal -- LOG http://www.stardust.webpages.pl/log/ - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Please pull 'libertas-upstream' branch of wireless-2.6
John W. Linville wrote: Patches identified by the libertas team as suitable for 2.6.23... --- The following changes since commit 82fde74b94f11eee1e9c30e43fb162f80a5e63c0: Luis Carlos (1): libertas: convert libertas_mpp into anycast_mask are found in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git libertas-upstream since it sounds like some additional 2.6.22 (warning?) fixes will be coming, I'm going to hold off pulling this. I would rather the wireless maintainer sort out the merging in this case :) Once 2.6.22 is all upstream, please do resend this push... - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 2/3] qla3xxx: cleanup checksum offload code
ACK patch #2, not patch 3. I will add patch 3 at a later date. Signed-off-by: Ron Mercer <[EMAIL PROTECTED]> > -Original Message- > From: Jeff Garzik [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 13, 2007 12:44 PM > To: Stephen Hemminger > Cc: Linux Driver; netdev@vger.kernel.org > Subject: Re: [PATCH 2/3] qla3xxx: cleanup checksum offload code > > Stephen Hemminger wrote: > > The code for checksum is more complex than needed when > dealing with VLAN's; > > the higher layers already pass down the location of the IP header. > > > > Compile tested only, no hardware available. > > > > Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]> > > Ron, do you ACK patch #2 and patch #3? > > > - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] add return value check of request_irq()
Yoichi Yuasa wrote: Hi, This patch has added return value check of request_irq() to pcmcia net drivers. Yoichi Signed-off-by: Yoichi Yuasa <[EMAIL PROTECTED]> applied to #upstream (2.6.23) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] acenic: SET_NETDEV_DEV is always there these days
Geert Uytterhoeven wrote: acenic: SET_NETDEV_DEV is always there these days Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]> applied to #upstream - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] b44: timer power saving
Stephen Hemminger wrote: Make the PHY and statistic timer run on one second boundary for powersaving. On resume, the driver should check for link up immediately, to get online faster (rather than waiting for the next second). Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]> --- drivers/net/b44.c |9 - 1 file changed, 4 insertions(+), 5 deletions(-) applied 1-4 to #upstream - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] tulip: Convert to generic boolean
Richard Knutsson wrote: Signed-off-by: Richard Knutsson <[EMAIL PROTECTED]> --- Compile-tested with all(yes|mod|no)config on x86(|_64) & sparc(|64) Diffed against Linus' git-tree. de4x5.c | 98 de4x5.h |9 - 2 files changed, 49 insertions(+), 58 deletions(-) applied to #upstream - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH][RFC] network splice receive v2
On Wed, Jun 13 2007, Evgeniy Polyakov wrote: > On Tue, Jun 12, 2007 at 08:17:32PM +0200, Jens Axboe ([EMAIL PROTECTED]) > wrote: > > On Tue, Jun 12 2007, Evgeniy Polyakov wrote: > > > On Mon, Jun 11, 2007 at 01:59:26PM +0200, Jens Axboe ([EMAIL PROTECTED]) > > > wrote: > > > > Patches are against the #splice branch of the block repo, "official" url > > > > of that is: > > > > > > > > git://git.kernel.dk/data/git/linux-2.6-block.git/ > > > > > > > > and it's based on Linus main tree. Let me know if I should supply netdev > > > > branch patches instead, or even just provide a rolled up patch (or patch > > > > series) for anyone curious to test or play with it. > > > > > > Hi Jens. > > > > > > I've just pulled your tree (splice-net, but splice tree looks the > > > same, git pull says 'Already up-to-date.') on top of linus git and got > > > following bug trace. I will investigate it further tomorrow. > > > > Please tell me the contents of splice-net, it looks like you didn't > > actually use the new code. That BUG_ON() is in get_page(), which > > splice-net no longer uses. So the bug report cannot be valid for the > > current code. > > This is the last commit in that tree: > > commit c90a6ce8242d108a5bc6fd0bc1b2aca72a2b5944 > Author: Jens Axboe <[EMAIL PROTECTED]> > Date: Mon Jun 11 21:59:50 2007 +0200 > > TCP splice receive support > > Support for network splice receive. > > Signed-off-by: Jens Axboe <[EMAIL PROTECTED]> > > :100644 100644 efc4517... 472ee12... M include/linux/net.h > :100644 100644 e7367c7... 64e3eed... M include/linux/skbuff.h > :100644 100644 a8af9ae... 8e86697... M include/net/tcp.h > :100644 100644 7c6a34e... daea7b0... M net/core/skbuff.c > :100644 100644 041fba3... 0ff9f86... M net/ipv4/af_inet.c > :100644 100644 450f44b... 63efd7a... M net/ipv4/tcp.c > :100644 100644 f453019... 41240f5... M net/socket.c > > I will rebase my tree, likely something was not merged correctly. It must have been, please let me know how the current stuf works for you! -- Jens Axboe - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [IPROUTE 00/02]: rtnl_link support
From: Patrick McHardy <[EMAIL PROTECTED]> Date: Wed, 13 Jun 2007 20:11:58 +0200 > Stephen Hemminger wrote: > > On Wed, 13 Jun 2007 19:02:32 +0200 (MEST) > > Patrick McHardy <[EMAIL PROTECTED]> wrote: > > > >>Please apply, thanks. > > > > > > I'm putting out a new iproute2 next week. IF this is in mainline, it will > > go in then. If not, then there will be a development branch > > > Thanks. The first version of these patches are already in > the net-2.6.23 tree, Dave is going to replace them with this > version. Unlikely to be in mainline until next week though :) Right this is 2.6.23 stuff and it is in my net-2.6.23 tree already. - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [NET 00/18]: Netlink link creation API + driver conversions
From: Patrick McHardy <[EMAIL PROTECTED]> Date: Wed, 13 Jun 2007 18:50:42 +0200 (MEST) > The patches are against net-2.6, but AFAICS the only thing in net-2.6.23 > conflicting with them is the previous series. > > Please apply/replace, thanks :) I've respun my tree up at: kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.23.git with these new patches. Thanks Patrick! - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] ehea: Whitespace cleanup
Thomas Klein wrote: This patch fixes several whitespace issues. Signed-off-by: Thomas Klein <[EMAIL PROTECTED]> Patch is obviously OK, but needs rediffing since I had to apply fixes before cleanups (standard patch ordering) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] cxgb3 - sge page management
Divy Le Ray wrote: From: Divy Le Ray <[EMAIL PROTECTED]> Streamline sge page management. Fix dma mappings when buffers are recycled. Signed-off-by: Divy Le Ray <[EMAIL PROTECTED]> --- drivers/net/cxgb3/adapter.h | 38 ++-- drivers/net/cxgb3/sge.c | 423 ++- 2 files changed, 232 insertions(+), 229 deletions(-) applied 1-3 to #upstream (2.6.23) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] drivers/net: fix comparisons of unsigned < 0
Bill Nottingham wrote: Recent gcc versions emit warnings when unsigned variables are compared < 0 or >= 0. Signed-off-by: Bill Nottingham <[EMAIL PROTECTED]> --- mlx4/qp.c |3 +-- netxen/netxen_nic_niu.c |6 +++--- tulip/de2104x.c |1 - 3 files changed, 4 insertions(+), 6 deletions(-) applied to #upstream (2.6.23) BTW please fix your Mail-Followup-To header - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] qla3xxx: cleanup checksum offload code
Stephen Hemminger wrote: The code for checksum is more complex than needed when dealing with VLAN's; the higher layers already pass down the location of the IP header. Compile tested only, no hardware available. Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]> Ron, do you ACK patch #2 and patch #3? - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Blackfin ethernet driver: on chip ethernet MAC controller driver
Bryan Wu wrote: From: "Wu, Bryan" <[EMAIL PROTECTED]> This patch implements the driver necessary use the Analog Devices Blackfin processor's on-chip ethernet MAC controller. Signed-off-by: Bryan Wu <[EMAIL PROTECTED]> Cc: Jeff Garzik <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> --- drivers/net/Kconfig| 44 + drivers/net/Makefile |1 drivers/net/bfin_mac.c | 981 +++ drivers/net/bfin_mac.h | 147 + 4 files changed, 1173 insertions(+) Finally got back to this. Please run this patch through scripts/checkpatch.pl (found in latest linux-2.6.git upstream kernel tree), and follow most of the recommendations. Personally I would ignore the lines slightly over 80 columns, but the other warnings look like real issues. Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH -mm take5 4/7] using symlink for the net_device
Hi again, Ok, so sysfs_create_link() would be illegal from inside spin_lock_irqsave(), and this is why we have to use the dual-list mechanism to react to the net device rename. This isn't so obvious, a comment at the point where you declare modify_target_list would be nice? (BTW temporary_list would be a better name for that, IMO) On 6/13/07, Keiichi KII <[EMAIL PROTECTED]> wrote: > [...] > +static DECLARE_MUTEX(netdev_change_sem); The preferred style these days is to use a DEFINE_MUTEX (and the struct mutex primitives) for such locks that are used as binary semaphores. BTW, a comment here to note what this lock protects is required. [ You don't really need to give a comment for the target_list_lock because it's defined just below the "target_list". It's not equally obvious at first glance what is protected by the netdev_change_sem, however. ] Ok, so reading through the code makes it obvious that this mutex is used to protect against the following race: Thread #1 Thread #2 = = [ NETDEV_CHANGENAME notifier ] [ ioctl(NETCON_REMOVE_TARGET) ] netconsole_event() move from target_list to temp list work on temp list kobject_unregister() -> release_target() -> remove_target() move back to target_list Which would mean a deleted/removed target added back => *boom* But, the race still hasn't been closed properly! You're taking the mutex only around "work on temp list" which is insufficient, you need to ensure atomicity inside netconsole_event() _completely_ like this (renaming netdev_change_sem to netdev_changename_mtx): > +static int netconsole_event(struct notifier_block *this, unsigned long event, > + void *ptr) > +{ > + int error = 0; > + unsigned long flags; > + char *old_link_name = NULL, *new_link_name = NULL; > + struct netconsole_target *nt, *tmp; > + struct net_device *dev = ptr; > + LIST_HEAD(modify_target_list); > + > + if (event == NETDEV_CHANGENAME) { mutex_lock(netdev_changename_mtx) here. > + spin_lock_irqsave(&target_list_lock, flags); > + list_for_each_entry_safe(nt, tmp, &target_list, list) > + if (nt->np.dev == dev) > + list_move(&nt->list, &modify_target_list); > + spin_unlock_irqrestore(&target_list_lock, flags); > + down(&netdev_change_sem); This goes away. > + list_for_each_entry(nt, &modify_target_list, list) { > + [...] > + } > + up(&netdev_change_sem); So does this. > + spin_lock_irqsave(&target_list_lock, flags); > + list_for_each_entry_safe(nt, tmp, &modify_target_list, list) > + list_move(&nt->list, &target_list); > + spin_unlock_irqrestore(&target_list_lock, flags); mutex_unlock(netdev_changename_mtx) comes here. > + } > + > + return NOTIFY_DONE; > +} @@ -239,12 +240,14 @@ static void remove_target(struct netcons { unsigned long flags; + down(&netdev_change_sem); spin_lock_irqsave(&target_list_lock, flags); list_del(&nt->list); if (list_empty(&target_list)) netpoll_cleanup(&nt->np); spin_unlock_irqrestore(&target_list_lock, flags); kfree(nt); + up(&netdev_change_sem); } As I said earlier, the target_list_lock spin-locking needs to be pushed out from here to the callers of remove_target. => mutex_lock(netdev_changename_mtx) must also be done by them. +static char *make_netdev_class_name(char *netdev_name) +{ + char *name; + + name = kasprintf(GFP_KERNEL, "net:%s", netdev_name); Why the "net:" prefix in the filename? + if (!name) { + printk(KERN_ERR "netconsole: kmalloc() failed!\n"); + return NULL; + } + + return name; +} And this doesn't want to be a separate function either. static int setup_target_sysfs(struct netconsole_target *nt) { + int retval = 0; + char *name; + kobject_set_name(&nt->obj, "port%d", nt->id); nt->obj.parent = &netconsole_miscdev.this_device->kobj; nt->obj.ktype = &target_ktype; - return kobject_register(&nt->obj); + retval = kobject_register(&nt->obj); + name = make_netdev_class_name(nt->np.dev_name); + if (!name) + return -ENOMEM; Just call kasprintf() directly, why the obfuscation? Satyam - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Cbe-oss-dev] [PATCH 0/15] spidernet driver bug fixes
Segher Boessenkool wrote: I wish there was a git option to "just make my shit look like the remote, dammit!" The above is the "easiest" way I know how to do that. git-fetch -f remote:local ? If that works... great :) Much better than what I described. Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Cbe-oss-dev] [PATCH 0/15] spidernet driver bug fixes
I wish there was a git option to "just make my shit look like the remote, dammit!" The above is the "easiest" way I know how to do that. git-fetch -f remote:local ? Segher - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/15] spidernet driver bug fixes
As of this moment there are -no- spidernet patches in netdev. I just rebased 'upstream', and dropped the existing spidernet patches. Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/15] spidernet driver bug fixes
Linas Vepstas wrote: "git branch" shows that I'm on "upstream". So I performed a "git pull" (without any additional arguments) assuming that it would sync to your "upstream" branch. And so my email was based on this. Some googling seems to show that "git pull" has a bug/feature of ignoring the branch that one is working in, and pulling "master" no matter what. I have no clue why; this seems broken to me. So ... let me try again ... git pull git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6 upstream ... Automatic merge failed; fix up by hand Unfortunately git isn't the greatest for saying "just give me what is on the remote", since each repository is an independent peer. You need to: * grab the latest torvalds/linux-2.6.git * erase local netdev-2.6 * clone to create local netdev-2.6: URL=git//git.kernel.org/.../jgarzik/netdev-2.6 git-clone --reference linux-2.6 $URL netdev-2.6 * that creates 'master' branch, which always equals vanilla upstream * now create a local upstream branch: git checkout -b upstream master * and finally, pull remote upstream branch into local upstream branch: git pull $URL upstream:upstream Occasionally the remote 'upstream' will get "rebased", which means is has been completely replaced by a new linear history. If you pull 'upstream' after a rebase, into a local 'upstream', git will attempt to merge the same patches all over again, with disastrous results. I wish there was a git option to "just make my shit look like the remote, dammit!" The above is the "easiest" way I know how to do that. Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] TCP: remove initial_ssthresh from Cubic
From: Stephen Hemminger <[EMAIL PROTECTED]> Date: Wed, 13 Jun 2007 11:31:49 -0700 > Maybe it is time to remove BIC? I don't see any compelling reason, the same could be said of the other experimental protocols we include in the tree. - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/15] spidernet driver bug fixes
Michael Ellerman wrote: I was just keen to see the "major bugfixes" get into 22, rather than waiting another few months for 23. Agreed. Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: arp-scan triggers via-velocity "eth0: excessive work at interrupt"
On 12 Jun 2007 21:56:38 -0400 [EMAIL PROTECTED] wrote: > It kind of surprised me that sending 254 arp packets by using the arp-scan > tool (http://www.nta-monitor.com/tools/arp-scan/) on a /24 consistently > triggers a burst of "eth0: excessive work at interrupt." > > This is a 600 MHz PIII, 2.6.22-rc4, via-velocity driver. > > model name : Pentium III (Katmai) > stepping: 3 > cpu MHz : 601.406 > cache size : 512 KB > > 00:09.0 Ethernet controller [0200]: VIA Technologies, Inc. > VT6120/VT6121/VT6122 Gigabit Ethernet Adapter [1106:3119] (rev 11) > > Just double-checking... the program actually sent 463 packets (256 + > a retry to all those that didn't respond to the first one), and triggers > 11 copies of the kernel message. > > Command line: arp-scan -I eth0 -l [-v] The via-velocity needs NAPI among lots of other fixes. The driver is too vendor ish and nobody works on it. - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] NET: Multiqueue network device support.
> PJ Waskiewicz wrote: > > diff --git a/net/sched/sch_generic.c > b/net/sched/sch_generic.c index > > f28bb2d..b9dc2a6 100644 > > --- a/net/sched/sch_generic.c > > +++ b/net/sched/sch_generic.c > > @@ -123,7 +123,8 @@ static inline int qdisc_restart(struct > net_device *dev) > > /* And release queue */ > > spin_unlock(&dev->queue_lock); > > > > - if (!netif_queue_stopped(dev)) { > > + if (!netif_queue_stopped(dev) && > > + !netif_subqueue_stopped(dev, > skb->queue_mapping)) { > > int ret; > > > > ret = dev_hard_start_xmit(skb, dev); > > > Your patch doesn't update any other users of netif_queue_stopped(). > The assumption that they can pass packets to the driver when > the queue is running is no longer valid since they don't know > whether the subqueue the packet will end up in is active (it > might be different from queue 0 if packets were redirected > from a multiqueue aware qdisc through TC actions). So they > need to be changed to check the subqueue state as well. The cases I found were net/core/netpoll.c, net/core/pktgen.c, and the software device case in net/core/dev.c. In all cases, the value of skb->queue_mapping will be zero, but they don't initialize the subqueue lock of the single allocated queue (hence panic when trying to use it...). I also don't think it makes sense for them to care, since ->enqueue() doesn't get called as far as I can tell, therefore the classification won't happen. Did I miss something in looking at this? Thanks, -PJ - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] TCP: remove initial_ssthresh from Cubic
On Wed, 13 Jun 2007 11:26:52 -0700 (PDT) David Miller <[EMAIL PROTECTED]> wrote: > From: Stephen Hemminger <[EMAIL PROTECTED]> > Date: Wed, 13 Jun 2007 10:27:18 -0700 > > Please make patches against my net-2.6 tree, I already > made changes in this area. > > > Remove the initial slow start override from TCP cubic. > > The old code caused Cubic to start out in slow start mode, which > > is less agressive but caused slow performance. > > > > The administrator can override initial slow start threshold on any > > TCP congestion control method via the TCP route metrics. > > > > Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]> > > I already sent a merge request to Linus that just changed > the default to zero. > > No need to remove it for now so people can still play > with it if they want to, that's harmless. > > You missed BIC too, which I did take care of... Maybe it is time to remove BIC? - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: IC Plus Corp IC Plus IP1000
> Use the 'sundance' driver that's been in the kernel for quite a while. Er... that driver specifically does not list the IP1000's PCI device ID (13f0:1023), nor does it support anything over 100 Mbit/s. Are you *quite* sure that adding 13f0:1023 to the sundance_pci_tbl is all that's required? - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] TCP: remove initial_ssthresh from Cubic
From: Stephen Hemminger <[EMAIL PROTECTED]> Date: Wed, 13 Jun 2007 10:27:18 -0700 Please make patches against my net-2.6 tree, I already made changes in this area. > Remove the initial slow start override from TCP cubic. > The old code caused Cubic to start out in slow start mode, which > is less agressive but caused slow performance. > > The administrator can override initial slow start threshold on any > TCP congestion control method via the TCP route metrics. > > Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]> I already sent a merge request to Linus that just changed the default to zero. No need to remove it for now so people can still play with it if they want to, that's harmless. You missed BIC too, which I did take care of... - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] NET: Multiqueue network device support.
> From: jamal <[EMAIL PROTECTED]> > Date: Wed, 13 Jun 2007 09:33:22 -0400 > > > So in such a case (assuming 8 rings), One model is creating > 4 netdev > > devices each based on single tx/rx ring and register set and then > > having a mother netdev (what you call the bond) that feeds these > > children netdev based on some qos parametrization is very sensible. > > Why all of this layering and overhead for something so BLOODY > SIMPLE?!?!? > I am currently packing up the newest patches against 2.6.23, with feedback from Patrick. The delay in posting them was a weird panic with the loopback device, which I just found. Let me run a test cycle or two, and I'll send them today for review, including an e1000 patch to show how to use the API. Cheers, -PJ Waskiewicz - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] NET: Multiqueue network device support.
From: jamal <[EMAIL PROTECTED]> Date: Wed, 13 Jun 2007 09:33:22 -0400 > So in such a case (assuming 8 rings), One model is creating 4 netdev > devices each based on single tx/rx ring and register set and then > having a mother netdev (what you call the bond) that feeds these > children netdev based on some qos parametrization is very sensible. Why all of this layering and overhead for something so BLOODY SIMPLE?!?!? - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [IPROUTE 00/02]: rtnl_link support
Stephen Hemminger wrote: > On Wed, 13 Jun 2007 19:02:32 +0200 (MEST) > Patrick McHardy <[EMAIL PROTECTED]> wrote: > >>Please apply, thanks. > > > I'm putting out a new iproute2 next week. IF this is in mainline, it will > go in then. If not, then there will be a development branch Thanks. The first version of these patches are already in the net-2.6.23 tree, Dave is going to replace them with this version. Unlikely to be in mainline until next week though :) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 2/2] qdisc_restart - couple of optimizations.
> - netif_queue_stopped need not be called inside qdisc_restart as > it has been called already in qdisc_run() before the first skb > is sent, and in __qdisc_run() after each intermediate skb is > sent (note : we are the only sender, so the queue cannot get > stopped while the tx lock was got in the ~LLTX case). I somewhat disagree here. The underlying driver can conceivably stop the device queue even if the stack holds the queue lock during an interrupt to clean Tx descriptors, and it finds it's out of them or needs to grab the device for whatever reason. Granted this is a corner case, and the net effect would be a simple requeue of the skb, but checking the status of the queue at the last possible moment before entering the driver could alleviate the requeue in the time between ->dequeue() from the qdisc, and hard_start_xmit() if an event like I mentioned happened. I'm ok with it either way, especially since this is a corner case. But it does need to be considered that it can happen. Cheers, -PJ Waskiewicz - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [IPROUTE 00/02]: rtnl_link support
On Wed, 13 Jun 2007 19:02:32 +0200 (MEST) Patrick McHardy <[EMAIL PROTECTED]> wrote: > Hi Stephen, > > these patches add support for the rtnl_link stuff and VLAN configuration > to iproute. Since the old link configuration was entirely ioctl based and > mixing the two would be really ugly, this patch keeps the old ioctl stuff > guarded by an ifdef (defaults to enabled) and probes for support for > using RTM_NEWLINK. Tested to work properly on both old and patched kernel. > > I've added a new -d[etail] flag to ip, the driver specific things are only > printed when it is specified. I did this mainly because I'm not sure how > careful we want to be not to confuse people using sed/awk/... on iproute > output. I would prefer to have the information always shown, but I'll > leave that decision up to you. > > Changes since the last post: > > - Only call link argument parsing function if arguments are present > - Support xstats dumping > - Add sanitized if_vlan.h file for VLAN flag definition > - Support setting/changing VLAN flags > > Please apply, thanks. I'm putting out a new iproute2 next week. IF this is in mainline, it will go in then. If not, then there will be a development branch - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] TCP: remove initial_ssthresh from Cubic
Remove the initial slow start override from TCP cubic. The old code caused Cubic to start out in slow start mode, which is less agressive but caused slow performance. The administrator can override initial slow start threshold on any TCP congestion control method via the TCP route metrics. Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]> --- a/net/ipv4/tcp_cubic.c 2007-06-13 10:18:38.0 -0700 +++ b/net/ipv4/tcp_cubic.c 2007-06-13 10:19:19.0 -0700 @@ -29,7 +29,6 @@ static int fast_convergence __read_mostly = 1; static int max_increment __read_mostly = 16; static int beta __read_mostly = 819; /* = 819/1024 (BICTCP_BETA_SCALE) */ -static int initial_ssthresh __read_mostly = 100; static int bic_scale __read_mostly = 41; static int tcp_friendliness __read_mostly = 1; @@ -44,8 +43,6 @@ module_param(max_increment, int, 0644); MODULE_PARM_DESC(max_increment, "Limit on increment allowed during binary search"); module_param(beta, int, 0444); MODULE_PARM_DESC(beta, "beta for multiplicative increase"); -module_param(initial_ssthresh, int, 0644); -MODULE_PARM_DESC(initial_ssthresh, "initial value of slow start threshold"); module_param(bic_scale, int, 0444); MODULE_PARM_DESC(bic_scale, "scale (scaled by 1024) value for bic function (bic_scale/1024)"); module_param(tcp_friendliness, int, 0644); @@ -87,8 +84,6 @@ static inline void bictcp_reset(struct b static void bictcp_init(struct sock *sk) { bictcp_reset(inet_csk_ca(sk)); - if (initial_ssthresh) - tcp_sk(sk)->snd_ssthresh = initial_ssthresh; } /* calculate the cubic root of x using a table lookup followed by one - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH -mm take5 7/7] update documentation
Hi, On 6/13/07, Keiichi KII <[EMAIL PROTECTED]> wrote: From: Keiichi KII <[EMAIL PROTECTED]> update Documentation/networking/netconsole.txt - how to use sysfs for dynamic configurability - how to use ioctl for dynamic configurability Signed-off-by: Keiichi KII <[EMAIL PROTECTED]> Ah, so here comes the documentation :-) Actually, I've seen a lot of patchsets these days that prefer to submit the documentation patch in the beginning, so that a reader / reviewer can get ready about what to expect from the code. Anyway, I really liked your submission. It makes netconsole quite flexible and powerful, indeed. Thanks, Satyam - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 1/6] 8139too: force media setting cleanup
Kyuma Ohta wrote: Hi, I was testing 2.6.22-rc4 from yesterday, but communication speed of 8139 side is very slower than 2.6.21.* (less than 10kbytes/sec at 100MBPS,FULL-DUPLEX). I was not test from 2.6.22-rc ,yesterday I started to test 2.6.22-rc. So, I *must* set HALF-DUPLEX to 8139 side below: ethtool -s ethx speed 100 duplex half autoneg on *x is number of 8139 assigned from udev. So,Pls.apply this patch to upstream,and I test this too. Your use of ethtool clearly demonstrates the lack of need for this patch. Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC][PATCH -mm take5 5/7] switch function of netpoll
Hi Keiichi, On 6/13/07, Keiichi KII <[EMAIL PROTECTED]> wrote: From: Keiichi KII <[EMAIL PROTECTED]> This patch contains switch function of netpoll. If "enabled" attribute of certain port is '1', this port is used and the configurations of this port are unable to change. If "enabled" attribute of certain port is '0', this port isn't used and the configurations of this port are able to change. -+- /sys/class/misc/ |-+- netconsole/ |-+- port1/ | |--- id [r--r--r--] id | |--- enabled [rw-r--r--] 0: disable 1: enable, writable | ... |--- port2/ ... Signed-off-by: Keiichi KII <[EMAIL PROTECTED]> Signed-off-by: Takayoshi Kochi <[EMAIL PROTECTED]> --- Index: mm/drivers/net/netconsole.c === --- mm.orig/drivers/net/netconsole.c +++ mm/drivers/net/netconsole.c @@ -71,6 +71,7 @@ struct netconsole_target { struct list_head list; struct kobject obj; int id; + int enabled; struct netpoll np; }; I really think you need to document/comment the struct members. The newly introduced "enabled" for example, is serving a dual-purpose in your code here (like you mention in the Changelog). It's used not only to enable/disable a target, but also to ensure atomicity when changing the (multiple) configurable parameters of a given target ... the first purpose is self-evident from the name, but the second is non-obvious. A sysfs node is also a userspace interface, so some explicit mention of this is required. Satyam - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[IPROUTE 01/02]: iplink: use netlink for link configuration
[IPROUTE]: iplink: use netlink for link configuration Add support for using netlink for link configuration. Kernel-support is probed, when not available it falls back to using ioctls. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit 4feb48d12295eb41850c39996f3a8c1dd7909ed5 tree dbb34cf5a9b38adb0c2602a88b09823f922c8a2c parent b16621cafd599499fdbaa79236266d72a53106bb author Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 14:10:57 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 14:10:57 +0200 include/linux/if_link.h | 13 ++ ip/Makefile |2 ip/ip.c |5 + ip/ip_common.h | 15 ++ ip/ipaddress.c | 39 ++ ip/iplink.c | 311 +++ 6 files changed, 382 insertions(+), 3 deletions(-) diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 2920e8a..58a48d7 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h @@ -76,6 +76,8 @@ enum #define IFLA_WEIGHT IFLA_WEIGHT IFLA_OPERSTATE, IFLA_LINKMODE, + IFLA_LINKINFO, +#define IFLA_LINKINFO IFLA_LINKINFO __IFLA_MAX }; @@ -137,4 +139,15 @@ struct ifla_cacheinfo __u32 retrans_time; }; +enum +{ + IFLA_INFO_UNSPEC, + IFLA_INFO_KIND, + IFLA_INFO_DATA, + IFLA_INFO_XSTATS, + __IFLA_INFO_MAX, +}; + +#define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1) + #endif /* _LINUX_IF_LINK_H */ diff --git a/ip/Makefile b/ip/Makefile index a749993..9a5bfe3 100644 --- a/ip/Makefile +++ b/ip/Makefile @@ -22,3 +22,5 @@ install: all clean: rm -f $(ALLOBJ) $(TARGETS) +LDLIBS += -ldl +LDFLAGS+= -Wl,-export-dynamic diff --git a/ip/ip.c b/ip/ip.c index c084292..4bdb83b 100644 --- a/ip/ip.c +++ b/ip/ip.c @@ -30,6 +30,7 @@ int preferred_family = AF_UNSPEC; int show_stats = 0; +int show_details = 0; int resolve_hosts = 0; int oneline = 0; int timestamp = 0; @@ -47,7 +48,7 @@ static void usage(void) " ip [ -force ] [-batch filename\n" "where OBJECT := { link | addr | route | rule | neigh | ntable | tunnel |\n" " maddr | mroute | monitor | xfrm }\n" -" OPTIONS := { -V[ersion] | -s[tatistics] | -r[esolve] |\n" +" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n" "-f[amily] { inet | inet6 | ipx | dnet | link } |\n" "-o[neline] | -t[imestamp] }\n"); exit(-1); @@ -188,6 +189,8 @@ int main(int argc, char **argv) } else if (matches(opt, "-stats") == 0 || matches(opt, "-statistics") == 0) { ++show_stats; + } else if (matches(opt, "-details") == 0) { + ++show_details; } else if (matches(opt, "-resolve") == 0) { ++resolve_hosts; } else if (matches(opt, "-oneline") == 0) { diff --git a/ip/ip_common.h b/ip/ip_common.h index 5bfd9b9..39f2507 100644 --- a/ip/ip_common.h +++ b/ip/ip_common.h @@ -45,6 +45,21 @@ static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb) extern struct rtnl_handle rth; +struct link_util +{ + struct link_util*next; + const char *id; + int maxattr; + int (*parse_opt)(struct link_util *, int, char **, +struct nlmsghdr *); + void(*print_opt)(struct link_util *, FILE *, +struct rtattr *[]); + void(*print_xstats)(struct link_util *, FILE *, +struct rtattr *); +}; + +struct link_util *get_link_kind(const char *kind); + #ifndefINFINITY_LIFE_TIME #define INFINITY_LIFE_TIME 0xU #endif diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 98effa3..da6b270 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -134,6 +134,41 @@ void print_queuelen(char *name) printf("qlen %d", ifr.ifr_qlen); } +static void print_linktype(FILE *fp, struct rtattr *tb) +{ + struct rtattr *linkinfo[IFLA_INFO_MAX+1]; + struct link_util *lu; + char *kind; + + parse_rtattr_nested(linkinfo, IFLA_INFO_MAX, tb); + + if (!linkinfo[IFLA_INFO_KIND]) + return; + kind = RTA_DATA(linkinfo[IFLA_INFO_KIND]); + + fprintf(fp, "%s", _SL_); + fprintf(fp, "%s ", kind); + + lu = get_link_kind(kind); + if (!lu || !lu->print_opt) + return; + + if (1) { + struct rtattr *attr[lu->maxattr+1], **data = NULL; + + if (linkinfo[IFLA_INFO_DATA]) { + parse_rtattr_nested(attr, lu->maxattr, + linkinfo[IFLA_INFO_DATA]); + data = attr; + } + lu->print_opt(lu,
[IPROUTE 02/02]: VLAN support
[IPROUTE]: VLAN support --- commit 90727b2bf5b4a7ef9d0638ca80206083b965a0b5 tree 173722acd855b7fe1eb1a5f22cf7706814f72c8f parent 4feb48d12295eb41850c39996f3a8c1dd7909ed5 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:46:21 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:46:21 +0200 include/linux/if_link.h | 34 + include/linux/if_vlan.h | 61 ip/Makefile |2 + ip/iplink_vlan.c| 184 +++ 4 files changed, 281 insertions(+), 0 deletions(-) diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 58a48d7..7e6d15d 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h @@ -150,4 +150,38 @@ enum #define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1) +/* VLAN section */ + +enum +{ + IFLA_VLAN_UNSPEC, + IFLA_VLAN_ID, + IFLA_VLAN_FLAGS, + IFLA_VLAN_EGRESS_QOS, + IFLA_VLAN_INGRESS_QOS, + __IFLA_VLAN_MAX, +}; + +#define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1) + +struct ifla_vlan_flags { + __u32 flags; + __u32 mask; +}; + +enum +{ + IFLA_VLAN_QOS_UNSPEC, + IFLA_VLAN_QOS_MAPPING, + __IFLA_VLAN_QOS_MAX +}; + +#define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1) + +struct ifla_vlan_qos_mapping +{ + __u32 from; + __u32 to; +}; + #endif /* _LINUX_IF_LINK_H */ diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h new file mode 100644 index 000..4014ba9 --- /dev/null +++ b/include/linux/if_vlan.h @@ -0,0 +1,61 @@ +/* + * VLANAn implementation of 802.1Q VLAN tagging. + * + * Authors:Ben Greear <[EMAIL PROTECTED]> + * + * 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. + * + */ + +#ifndef _LINUX_IF_VLAN_H_ +#define _LINUX_IF_VLAN_H_ + + +/* VLAN IOCTLs are found in sockios.h */ + +/* Passed in vlan_ioctl_args structure to determine behaviour. */ +enum vlan_ioctl_cmds { + ADD_VLAN_CMD, + DEL_VLAN_CMD, + SET_VLAN_INGRESS_PRIORITY_CMD, + SET_VLAN_EGRESS_PRIORITY_CMD, + GET_VLAN_INGRESS_PRIORITY_CMD, + GET_VLAN_EGRESS_PRIORITY_CMD, + SET_VLAN_NAME_TYPE_CMD, + SET_VLAN_FLAG_CMD, + GET_VLAN_REALDEV_NAME_CMD, /* If this works, you know it's a VLAN device, btw */ + GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */ +}; + +enum vlan_flags { + VLAN_FLAG_REORDER_HDR = 0x1, +}; + +enum vlan_name_types { + VLAN_NAME_TYPE_PLUS_VID, /* Name will look like: vlan0005 */ + VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like: eth1.0005 */ + VLAN_NAME_TYPE_PLUS_VID_NO_PAD, /* Name will look like: vlan5 */ + VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD, /* Name will look like: eth0.5 */ + VLAN_NAME_TYPE_HIGHEST +}; + +struct vlan_ioctl_args { + int cmd; /* Should be one of the vlan_ioctl_cmds enum above. */ + char device1[24]; + +union { + char device2[24]; + int VID; + unsigned int skb_priority; + unsigned int name_type; + unsigned int bind_type; + unsigned int flag; /* Matches vlan_dev_info flags */ +} u; + + short vlan_qos; +}; + +#endif /* !(_LINUX_IF_VLAN_H_) */ diff --git a/ip/Makefile b/ip/Makefile index 9a5bfe3..b6d8693 100644 --- a/ip/Makefile +++ b/ip/Makefile @@ -3,6 +3,8 @@ IPOBJ=ip.o ipaddress.o iproute.o iprule.o \ ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o \ ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o +IPOBJ += iplink_vlan.o + RTMONOBJ=rtmon.o ALLOBJ=$(IPOBJ) $(RTMONOBJ) diff --git a/ip/iplink_vlan.c b/ip/iplink_vlan.c new file mode 100644 index 000..ef05fbc --- /dev/null +++ b/ip/iplink_vlan.c @@ -0,0 +1,184 @@ +/* + * iplink_vlan.c VLAN device support + * + * 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. + * + * Authors: Patrick McHardy <[EMAIL PROTECTED]> + */ + +#include +#include +#include +#include + +#include "rt_names.h" +#include "utils.h" +#include "ip_common.h" + +static void explain(void) +{ + fprintf(stderr, + "Usage: ... vlan id VLANID [ FLAG-LIST ]\n" + " [ ingress-qos-map QOS-MAP ] [ egress-qos-map QOS-MAP ]\n" + "\n" + "VLANID := 0-4095\n" + "FLAG-LIST := [ FLAG-LIST ] FLAG\n" + "FLAG := [ reorder_hdr { on | off } ]\n" + "QOS-MAP := [ QOS-MAP ] QOS-M
[IPROUTE 00/02]: rtnl_link support
Hi Stephen, these patches add support for the rtnl_link stuff and VLAN configuration to iproute. Since the old link configuration was entirely ioctl based and mixing the two would be really ugly, this patch keeps the old ioctl stuff guarded by an ifdef (defaults to enabled) and probes for support for using RTM_NEWLINK. Tested to work properly on both old and patched kernel. I've added a new -d[etail] flag to ip, the driver specific things are only printed when it is specified. I did this mainly because I'm not sure how careful we want to be not to confuse people using sed/awk/... on iproute output. I would prefer to have the information always shown, but I'll leave that decision up to you. Changes since the last post: - Only call link argument parsing function if arguments are present - Support xstats dumping - Add sanitized if_vlan.h file for VLAN flag definition - Support setting/changing VLAN flags Please apply, thanks. include/linux/if_link.h | 47 +++ include/linux/if_vlan.h | 61 + ip/Makefile |4 ip/ip.c |5 ip/ip_common.h | 15 ++ ip/ipaddress.c | 39 ++ ip/iplink.c | 311 +++- ip/iplink_vlan.c| 184 8 files changed, 663 insertions(+), 3 deletions(-) Patrick McHardy (2): [IPROUTE]: iplink: use netlink for link configuration [IPROUTE]: VLAN support - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 1/6] 8139too: force media setting cleanup
Hi, I was testing 2.6.22-rc4 from yesterday, but communication speed of 8139 side is very slower than 2.6.21.* (less than 10kbytes/sec at 100MBPS,FULL-DUPLEX). I was not test from 2.6.22-rc ,yesterday I started to test 2.6.22-rc. So, I *must* set HALF-DUPLEX to 8139 side below: ethtool -s ethx speed 100 duplex half autoneg on *x is number of 8139 assigned from udev. So,Pls.apply this patch to upstream,and I test this too. Best Regards, Ohta. Appendix information: archtecture: x86_64 Main Board : Gigabyte GA-M69P-M3 (rev.1.0?) MPU: Athlon 64x2 4600+ (Not overclocked) Chipset : nVidia nForce430+GForce 6150 Complex chip Memory : PC-5300 2GB (w/shared graphix memory) Ether: nForce430 (within complex chip,using forcedeth) Realtec 8139C (+?) (on PCI Slot,using 8139too) OS: Debian GNU/Linux "sid" (after "etch",using glibc2.5). On 2007-05-24 (Thu) 17:36 -0400 , Jeff Garzik Wrote: > [EMAIL PROTECTED] wrote: > > From: Bernard Lee <[EMAIL PROTECTED]> > > > > Setting bit 4 & 5 alone in 8139too module media option does not really > > force 100Mbps full-duplex mode. When media option bit 0-3 is cleared, > > 8139too module does not force media setting. Therefore, bit 0-3 requires > > to be set for bit 4 & 5 to take effect. The hidden bit 0-3 setting is not > > stated in module description. > > > > It can be fixed by changing rtl8139_private structure default_port bitfield > > from 4-bit to 6-bit. > > > > Besides, module media bit 9 is a duplicate of bit 4 (full-duplex). It is > > suggested that bit 9 is freed. A remark is added to module description > > that bit 0 can be used to force setting. It helps to clarify 10Mbps > > half-duplex mode. > > > > Signed-off-by: Bernard Lee <[EMAIL PROTECTED]> > > Cc: Jeff Garzik <[EMAIL PROTECTED]> > > Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> > > --- > > > > drivers/net/8139too.c |8 > > 1 files changed, 4 insertions(+), 4 deletions(-) > > (re-replying, just to refresh everybody on the status) > > The status of this patch is HOLD, and has been for months. > > AFAICS this is a behavior change that differs from other Becker-derived > drivers. I would suggest looking at other drivers. > > Furthermore, people should be using ethtool to set media. Rather than > changing the behavior of this module parameter to be non-standard, I > feel it is better to (a) leave it as is or (b) remove it completely. > > Jeff - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[VLAN 18/18]: Use rtnl_link API
[VLAN]: Use rtnl_link API Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit b4bb367897c114980367013f1a636bb6a9630a11 tree 8f1904816e27d07df5a7a910dc1e81a08215b490 parent 84bb1e021b6c3567bebccfc5e3dd4ab7d8f5bfae author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:47:07 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:45:04 +0200 include/linux/if_link.h | 34 +++ net/8021q/Makefile |2 net/8021q/vlan.c | 29 -- net/8021q/vlan.h | 10 ++ net/8021q/vlan_netlink.c | 236 ++ 5 files changed, 300 insertions(+), 11 deletions(-) diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 3144bab..422084d 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h @@ -153,4 +153,38 @@ enum #define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1) +/* VLAN section */ + +enum +{ + IFLA_VLAN_UNSPEC, + IFLA_VLAN_ID, + IFLA_VLAN_FLAGS, + IFLA_VLAN_EGRESS_QOS, + IFLA_VLAN_INGRESS_QOS, + __IFLA_VLAN_MAX, +}; + +#define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1) + +struct ifla_vlan_flags { + __u32 flags; + __u32 mask; +}; + +enum +{ + IFLA_VLAN_QOS_UNSPEC, + IFLA_VLAN_QOS_MAPPING, + __IFLA_VLAN_QOS_MAX +}; + +#define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1) + +struct ifla_vlan_qos_mapping +{ + __u32 from; + __u32 to; +}; + #endif /* _LINUX_IF_LINK_H */ diff --git a/net/8021q/Makefile b/net/8021q/Makefile index 97feb44..10ca7f4 100644 --- a/net/8021q/Makefile +++ b/net/8021q/Makefile @@ -4,7 +4,7 @@ obj-$(CONFIG_VLAN_8021Q) += 8021q.o -8021q-objs := vlan.o vlan_dev.o +8021q-objs := vlan.o vlan_dev.o vlan_netlink.o ifeq ($(CONFIG_PROC_FS),y) 8021q-objs += vlanproc.o diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index f12f914..e7583ee 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -97,15 +97,22 @@ static int __init vlan_proto_init(void) /* Register us to receive netdevice events */ err = register_netdevice_notifier(&vlan_notifier_block); - if (err < 0) { - dev_remove_pack(&vlan_packet_type); - vlan_proc_cleanup(); - return err; - } + if (err < 0) + goto err1; - vlan_ioctl_set(vlan_ioctl_handler); + err = vlan_netlink_init(); + if (err < 0) + goto err2; + vlan_ioctl_set(vlan_ioctl_handler); return 0; + +err2: + unregister_netdevice_notifier(&vlan_notifier_block); +err1: + vlan_proc_cleanup(); + dev_remove_pack(&vlan_packet_type); + return err; } /* Cleanup all vlan devices @@ -136,6 +143,7 @@ static void __exit vlan_cleanup_module(void) { int i; + vlan_netlink_fini(); vlan_ioctl_set(NULL); /* Un-register us from receiving netdevice events */ @@ -306,7 +314,7 @@ static int unregister_vlan_dev(struct net_device *real_dev, return ret; } -static int unregister_vlan_device(struct net_device *dev) +int unregister_vlan_device(struct net_device *dev) { int ret; @@ -361,7 +369,7 @@ static int vlan_dev_init(struct net_device *dev) return 0; } -static void vlan_setup(struct net_device *new_dev) +void vlan_setup(struct net_device *new_dev) { SET_MODULE_OWNER(new_dev); @@ -410,7 +418,7 @@ static void vlan_transfer_operstate(const struct net_device *dev, struct net_dev } } -static int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id) +int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id) { if (real_dev->features & NETIF_F_VLAN_CHALLENGED) { printk(VLAN_DBG "%s: VLANs not supported on %s.\n", @@ -447,7 +455,7 @@ static int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_ return 0; } -static int register_vlan_dev(struct net_device *dev) +int register_vlan_dev(struct net_device *dev) { struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev); struct net_device *real_dev = vlan->real_dev; @@ -567,6 +575,7 @@ static int register_vlan_device(struct net_device *real_dev, VLAN_DEV_INFO(new_dev)->dent = NULL; VLAN_DEV_INFO(new_dev)->flags = VLAN_FLAG_REORDER_HDR; + new_dev->rtnl_link_ops = &vlan_link_ops; err = register_vlan_dev(new_dev); if (err < 0) goto out_free_newdev; diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index b837390..fe6bb0f 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h @@ -72,4 +72,14 @@ void vlan_dev_get_realdev_name(const struct net_device *dev, char *result); void vlan_dev_get_vid(const struct net_device *dev, unsigned short *result); void vlan_dev_set_multicast_list(struct net_device *vlan_dev); +int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id); +void vlan_setup(struct net_device *dev); +int register_vlan_dev(struct ne
[VLAN 17/18]: Introduce symbolic constants for flag values
[VLAN]: Introduce symbolic constants for flag values Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit 84bb1e021b6c3567bebccfc5e3dd4ab7d8f5bfae tree 74f71648d2821cc86765694a7d41d94b39bffce4 parent fc3fa5f1275ec357ae719066eef18c51c186c2b9 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:33 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:33 +0200 include/linux/if_vlan.h |4 net/8021q/vlan.c|2 +- net/8021q/vlan_dev.c| 13 +++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index b46d422..c791287 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -398,6 +398,10 @@ enum vlan_ioctl_cmds { GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */ }; +enum vlan_flags { + VLAN_FLAG_REORDER_HDR = 0x1, +}; + enum vlan_name_types { VLAN_NAME_TYPE_PLUS_VID, /* Name will look like: vlan0005 */ VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like: eth1.0005 */ diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 5801993..f12f914 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -565,7 +565,7 @@ static int register_vlan_device(struct net_device *real_dev, VLAN_DEV_INFO(new_dev)->vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */ VLAN_DEV_INFO(new_dev)->real_dev = real_dev; VLAN_DEV_INFO(new_dev)->dent = NULL; - VLAN_DEV_INFO(new_dev)->flags = 1; + VLAN_DEV_INFO(new_dev)->flags = VLAN_FLAG_REORDER_HDR; err = register_vlan_dev(new_dev); if (err < 0) diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 4f6ede7..95afe38 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -73,7 +73,7 @@ int vlan_dev_rebuild_header(struct sk_buff *skb) static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb) { - if (VLAN_DEV_INFO(skb->dev)->flags & 1) { + if (VLAN_DEV_INFO(skb->dev)->flags & VLAN_FLAG_REORDER_HDR) { if (skb_shared(skb) || skb_cloned(skb)) { struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC); kfree_skb(skb); @@ -350,7 +350,8 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, * header shuffling in the hard_start_xmit. Users can turn off this * REORDER behaviour with the vconfig tool. */ - build_vlan_header = ((VLAN_DEV_INFO(dev)->flags & 1) == 0); + if (!(VLAN_DEV_INFO(dev)->flags & VLAN_FLAG_REORDER_HDR)) + build_vlan_header = 1; if (build_vlan_header) { vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN); @@ -584,16 +585,16 @@ int vlan_dev_set_egress_priority(const struct net_device *dev, return 0; } -/* Flags are defined in the vlan_dev_info class in include/linux/if_vlan.h file. */ +/* Flags are defined in the vlan_flags enum in include/linux/if_vlan.h file. */ int vlan_dev_set_vlan_flag(const struct net_device *dev, u32 flag, short flag_val) { /* verify flag is supported */ - if (flag == 1) { + if (flag == VLAN_FLAG_REORDER_HDR) { if (flag_val) { - VLAN_DEV_INFO(dev)->flags |= 1; + VLAN_DEV_INFO(dev)->flags |= VLAN_FLAG_REORDER_HDR; } else { - VLAN_DEV_INFO(dev)->flags &= ~1; + VLAN_DEV_INFO(dev)->flags &= ~VLAN_FLAG_REORDER_HDR; } return 0; } - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[VLAN 16/18]: Keep track of number of QoS mappings
[VLAN]: Keep track of number of QoS mappings Keep track of the number of configured ingress/egress QoS mappings to avoid iteration while calculating the netlink attribute size. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit fc3fa5f1275ec357ae719066eef18c51c186c2b9 tree c1b3f59a2404aad88854e6c1e78f38737ce90534 parent a285e1ab7cfb856fc9e503eefd507eb7958b7524 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:47:03 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:33 +0200 include/linux/if_vlan.h |3 +++ net/8021q/vlan_dev.c| 27 +-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index aeddb49..b46d422 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -112,7 +112,10 @@ struct vlan_dev_info { /** This will be the mapping that correlates skb->priority to * 3 bits of VLAN QOS tags... */ + unsigned int nr_ingress_mappings; u32 ingress_priority_map[8]; + + unsigned int nr_egress_mappings; struct vlan_priority_tci_mapping *egress_priority_map[16]; /* hash table */ unsigned short vlan_id;/* The VLAN Identifier for this interface. */ diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 05a2360..4f6ede7 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -537,35 +537,50 @@ int vlan_dev_change_mtu(struct net_device *dev, int new_mtu) void vlan_dev_set_ingress_priority(const struct net_device *dev, u32 skb_prio, short vlan_prio) { - VLAN_DEV_INFO(dev)->ingress_priority_map[vlan_prio & 0x7] = skb_prio; + struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev); + + if (vlan->ingress_priority_map[vlan_prio & 0x7] && !skb_prio) + vlan->nr_ingress_mappings--; + else if (!vlan->ingress_priority_map[vlan_prio & 0x7] && skb_prio) + vlan->nr_ingress_mappings++; + + vlan->ingress_priority_map[vlan_prio & 0x7] = skb_prio; } int vlan_dev_set_egress_priority(const struct net_device *dev, u32 skb_prio, short vlan_prio) { + struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev); struct vlan_priority_tci_mapping *mp = NULL; struct vlan_priority_tci_mapping *np; + u32 vlan_qos = (vlan_prio << 13) & 0xE000; /* See if a priority mapping exists.. */ - mp = VLAN_DEV_INFO(dev)->egress_priority_map[skb_prio & 0xF]; + mp = vlan->egress_priority_map[skb_prio & 0xF]; while (mp) { if (mp->priority == skb_prio) { - mp->vlan_qos = ((vlan_prio << 13) & 0xE000); + if (mp->vlan_qos && !vlan_qos) + vlan->nr_egress_mappings--; + else if (!mp->vlan_qos && vlan_qos) + vlan->nr_egress_mappings++; + mp->vlan_qos = vlan_qos; return 0; } mp = mp->next; } /* Create a new mapping then. */ - mp = VLAN_DEV_INFO(dev)->egress_priority_map[skb_prio & 0xF]; + mp = vlan->egress_priority_map[skb_prio & 0xF]; np = kmalloc(sizeof(struct vlan_priority_tci_mapping), GFP_KERNEL); if (!np) return -ENOBUFS; np->next = mp; np->priority = skb_prio; - np->vlan_qos = ((vlan_prio << 13) & 0xE000); - VLAN_DEV_INFO(dev)->egress_priority_map[skb_prio & 0xF] = np; + np->vlan_qos = vlan_qos; + vlan->egress_priority_map[skb_prio & 0xF] = np; + if (vlan_qos) + vlan->nr_egress_mappings++; return 0; } - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[VLAN 15/18]: Use 32 bit value for skb->priority mapping
[VLAN]: Use 32 bit value for skb->priority mapping skb->priority has only 32 bits and even VLAN uses 32 bit values in its API. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit a285e1ab7cfb856fc9e503eefd507eb7958b7524 tree 0f95eb6c73eedc66a305bb0ca5cd1ee1391b47d3 parent 5924a55528b3a6897ea49f4af9fa7dcefc50fd57 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:46:57 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:33 +0200 include/linux/if_vlan.h |4 ++-- net/8021q/vlanproc.c|4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 81e9bc9..aeddb49 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -99,7 +99,7 @@ static inline void vlan_group_set_device(struct vlan_group *vg, int vlan_id, } struct vlan_priority_tci_mapping { - unsigned long priority; + u32 priority; unsigned short vlan_qos; /* This should be shifted when first set, so we only do it * at provisioning time. * ((skb->priority << 13) & 0xE000) @@ -112,7 +112,7 @@ struct vlan_dev_info { /** This will be the mapping that correlates skb->priority to * 3 bits of VLAN QOS tags... */ - unsigned long ingress_priority_map[8]; + u32 ingress_priority_map[8]; struct vlan_priority_tci_mapping *egress_priority_map[16]; /* hash table */ unsigned short vlan_id;/* The VLAN Identifier for this interface. */ diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c index d216a64..8693b21 100644 --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c @@ -342,7 +342,7 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset) seq_printf(seq, "Device: %s", dev_info->real_dev->name); /* now show all PRIORITY mappings relating to this VLAN */ seq_printf(seq, - "\nINGRESS priority mappings: 0:%lu 1:%lu 2:%lu 3:%lu 4:%lu 5:%lu 6:%lu 7:%lu\n", + "\nINGRESS priority mappings: 0:%u 1:%u 2:%u 3:%u 4:%u 5:%u 6:%u 7:%u\n", dev_info->ingress_priority_map[0], dev_info->ingress_priority_map[1], dev_info->ingress_priority_map[2], @@ -357,7 +357,7 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset) const struct vlan_priority_tci_mapping *mp = dev_info->egress_priority_map[i]; while (mp) { - seq_printf(seq, "%lu:%hu ", + seq_printf(seq, "%u:%hu ", mp->priority, ((mp->vlan_qos >> 13) & 0x7)); mp = mp->next; } - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[VLAN 14/18]: Return proper error codes in register_vlan_device
[VLAN]: Return proper error codes in register_vlan_device The returned device is unused, return proper error codes instead and avoid having the ioctl handler guess the error. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit 5924a55528b3a6897ea49f4af9fa7dcefc50fd57 tree 5fe3152d604de9f44efd614207ada20e13ef2d3c parent 0bd5a42a938a42aa15a4e9ac01777d74653e7c8d author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:46:52 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:32 +0200 net/8021q/vlan.c | 32 ++-- 1 files changed, 14 insertions(+), 18 deletions(-) diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index e68b503..5801993 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -493,14 +493,14 @@ out_free_group: } /* Attach a VLAN device to a mac address (ie Ethernet Card). - * Returns the device that was created, or NULL if there was - * an error of some kind. + * Returns 0 if the device was created or a negative error code otherwise. */ -static struct net_device *register_vlan_device(struct net_device *real_dev, - unsigned short VLAN_ID) +static int register_vlan_device(struct net_device *real_dev, + unsigned short VLAN_ID) { struct net_device *new_dev; char name[IFNAMSIZ]; + int err; #ifdef VLAN_DEBUG printk(VLAN_DBG "%s: if_name -:%s:- vid: %i\n", @@ -508,10 +508,11 @@ static struct net_device *register_vlan_device(struct net_device *real_dev, #endif if (VLAN_ID >= VLAN_VID_MASK) - goto out_ret_null; + return -ERANGE; - if (vlan_check_real_dev(real_dev, VLAN_ID) < 0) - goto out_ret_null; + err = vlan_check_real_dev(real_dev, VLAN_ID); + if (err < 0) + return err; /* Gotta set up the fields for the device. */ #ifdef VLAN_DEBUG @@ -547,7 +548,7 @@ static struct net_device *register_vlan_device(struct net_device *real_dev, vlan_setup); if (new_dev == NULL) - goto out_ret_null; + return -ENOBUFS; /* need 4 bytes for extra VLAN header info, * hope the underlying device can handle it. @@ -566,7 +567,8 @@ static struct net_device *register_vlan_device(struct net_device *real_dev, VLAN_DEV_INFO(new_dev)->dent = NULL; VLAN_DEV_INFO(new_dev)->flags = 1; - if (register_vlan_dev(new_dev) < 0) + err = register_vlan_dev(new_dev); + if (err < 0) goto out_free_newdev; /* Account for reference in struct vlan_dev_info */ @@ -574,13 +576,11 @@ static struct net_device *register_vlan_device(struct net_device *real_dev, #ifdef VLAN_DEBUG printk(VLAN_DBG "Allocated new device successfully, returning.\n"); #endif - return new_dev; + return 0; out_free_newdev: free_netdev(new_dev); - -out_ret_null: - return NULL; + return err; } static int vlan_device_event(struct notifier_block *unused, unsigned long event, void *ptr) @@ -753,11 +753,7 @@ static int vlan_ioctl_handler(void __user *arg) err = -EPERM; if (!capable(CAP_NET_ADMIN)) break; - if (register_vlan_device(dev, args.u.VID)) { - err = 0; - } else { - err = -EINVAL; - } + err = register_vlan_device(dev, args.u.VID); break; case DEL_VLAN_CMD: - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[VLAN 10/18]: Move some device intialization code to dev->init callback
[VLAN]: Move some device intialization code to dev->init callback Move some device initialization code to new dev->init callback to make it shareable with netlink. Additionally this fixes a minor bug, dev->iflink is set after registration, which causes an incorrect value in the initial netlink message. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit cdca24994aa848abede6d80566fd64be997d3a20 tree 327daea07b09d7d4a41307a6fb31d6ae39c56a3b parent 3288fa26d2f10d9c6d43a5ee3180bedc2ef1edc5 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:46:33 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:31 +0200 net/8021q/vlan.c | 92 +++--- 1 files changed, 46 insertions(+), 46 deletions(-) diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 3678f07..dc95f7c 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -291,6 +291,48 @@ static int unregister_vlan_device(struct net_device *dev) return ret; } +/* + * vlan network devices have devices nesting below it, and are a special + * "super class" of normal network devices; split their locks off into a + * separate class since they always nest. + */ +static struct lock_class_key vlan_netdev_xmit_lock_key; + +static int vlan_dev_init(struct net_device *dev) +{ + struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; + + /* IFF_BROADCAST|IFF_MULTICAST; ??? */ + dev->flags = real_dev->flags & ~IFF_UP; + dev->iflink = real_dev->ifindex; + dev->state = (real_dev->state & ((1<<__LINK_STATE_NOCARRIER) | + (1<<__LINK_STATE_DORMANT))) | + (1<<__LINK_STATE_PRESENT); + + /* TODO: maybe just assign it to be ETHERNET? */ + dev->type = real_dev->type; + + memcpy(dev->broadcast, real_dev->broadcast, real_dev->addr_len); + memcpy(dev->dev_addr, real_dev->dev_addr, real_dev->addr_len); + dev->addr_len = real_dev->addr_len; + + if (real_dev->features & NETIF_F_HW_VLAN_TX) { + dev->hard_header = real_dev->hard_header; + dev->hard_header_len = real_dev->hard_header_len; + dev->hard_start_xmit = vlan_dev_hwaccel_hard_start_xmit; + dev->rebuild_header = real_dev->rebuild_header; + } else { + dev->hard_header = vlan_dev_hard_header; + dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN; + dev->hard_start_xmit = vlan_dev_hard_start_xmit; + dev->rebuild_header = vlan_dev_rebuild_header; + } + dev->hard_header_parse = real_dev->hard_header_parse; + + lockdep_set_class(&dev->_xmit_lock, &vlan_netdev_xmit_lock_key); + return 0; +} + static void vlan_setup(struct net_device *new_dev) { SET_MODULE_OWNER(new_dev); @@ -311,6 +353,7 @@ static void vlan_setup(struct net_device *new_dev) /* set up method calls */ new_dev->change_mtu = vlan_dev_change_mtu; + new_dev->init = vlan_dev_init; new_dev->open = vlan_dev_open; new_dev->stop = vlan_dev_stop; new_dev->set_mac_address = vlan_dev_set_mac_address; @@ -339,14 +382,6 @@ static void vlan_transfer_operstate(const struct net_device *dev, struct net_dev } } -/* - * vlan network devices have devices nesting below it, and are a special - * "super class" of normal network devices; split their locks off into a - * separate class since they always nest. - */ -static struct lock_class_key vlan_netdev_xmit_lock_key; - - /* Attach a VLAN device to a mac address (ie Ethernet Card). * Returns the device that was created, or NULL if there was * an error of some kind. @@ -435,49 +470,17 @@ static struct net_device *register_vlan_device(struct net_device *real_dev, if (new_dev == NULL) goto out_ret_null; -#ifdef VLAN_DEBUG - printk(VLAN_DBG "Allocated new name -:%s:-\n", new_dev->name); -#endif - /* IFF_BROADCAST|IFF_MULTICAST; ??? */ - new_dev->flags = real_dev->flags; - new_dev->flags &= ~IFF_UP; - - new_dev->state = (real_dev->state & ((1<<__LINK_STATE_NOCARRIER) | -(1<<__LINK_STATE_DORMANT))) | -(1<<__LINK_STATE_PRESENT); - /* need 4 bytes for extra VLAN header info, * hope the underlying device can handle it. */ new_dev->mtu = real_dev->mtu; - /* TODO: maybe just assign it to be ETHERNET? */ - new_dev->type = real_dev->type; - - new_dev->hard_header_len = real_dev->hard_header_len; - if (!(real_dev->features & NETIF_F_HW_VLAN_TX)) { - /* Regular ethernet + 4 bytes (18 total). */ - new_dev->hard_header_len += VLAN_HLEN; - } - +#ifdef VLAN_DEBUG + printk(VLAN_DBG "Allocated new name -:%s:-\n", new_dev->name); VLAN_MEM_DBG("new_dev->priv malloc, addr: %p size
[VLAN 11/18]: Move vlan_group allocation to seperate function
[VLAN]: Move vlan_group allocation to seperate function Move group allocation to a seperate function to clean up the code a bit and allocate groups before registering the device. Device registration is globally visible and causes netlink events, so we shouldn't fail afterwards. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit db130c75de212df303702758f553a7f4349ae56a tree cd086b8106cb58dab0d28bf276b06f8b3f1295dc parent cdca24994aa848abede6d80566fd64be997d3a20 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:46:38 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:31 +0200 net/8021q/vlan.c | 78 -- 1 files changed, 41 insertions(+), 37 deletions(-) diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index dc95f7c..1b9dc5e 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -197,6 +197,34 @@ static void vlan_group_free(struct vlan_group *grp) kfree(grp); } +static struct vlan_group *vlan_group_alloc(int ifindex) +{ + struct vlan_group *grp; + unsigned int size; + unsigned int i; + + grp = kzalloc(sizeof(struct vlan_group), GFP_KERNEL); + if (!grp) + return NULL; + + size = sizeof(struct net_device *) * VLAN_GROUP_ARRAY_PART_LEN; + + for (i = 0; i < VLAN_GROUP_ARRAY_SPLIT_PARTS; i++) { + grp->vlan_devices_arrays[i] = kzalloc(size, GFP_KERNEL); + if (!grp->vlan_devices_arrays[i]) + goto err; + } + + grp->real_dev_ifindex = ifindex; + hlist_add_head_rcu(&grp->hlist, + &vlan_group_hash[vlan_grp_hashfn(ifindex)]); + return grp; + +err: + vlan_group_free(grp); + return NULL; +} + static void vlan_rcu_free(struct rcu_head *rcu) { vlan_group_free(container_of(rcu, struct vlan_group, rcu)); @@ -389,10 +417,9 @@ static void vlan_transfer_operstate(const struct net_device *dev, struct net_dev static struct net_device *register_vlan_device(struct net_device *real_dev, unsigned short VLAN_ID) { - struct vlan_group *grp; + struct vlan_group *grp, *ngrp = NULL; struct net_device *new_dev; char name[IFNAMSIZ]; - int i; #ifdef VLAN_DEBUG printk(VLAN_DBG "%s: if_name -:%s:- vid: %i\n", @@ -491,9 +518,15 @@ static struct net_device *register_vlan_device(struct net_device *real_dev, printk(VLAN_DBG "About to go find the group for idx: %i\n", real_dev->ifindex); #endif + grp = __vlan_find_group(real_dev->ifindex); + if (!grp) { + ngrp = grp = vlan_group_alloc(real_dev->ifindex); + if (!grp) + goto out_free_newdev; + } if (register_netdevice(new_dev)) - goto out_free_newdev; + goto out_free_group; vlan_transfer_operstate(real_dev, new_dev); linkwatch_fire_event(new_dev); /* _MUST_ call rfc2863_policy() */ @@ -501,34 +534,8 @@ static struct net_device *register_vlan_device(struct net_device *real_dev, /* So, got the sucker initialized, now lets place * it into our local structure. */ - grp = __vlan_find_group(real_dev->ifindex); - - /* Note, we are running under the RTNL semaphore -* so it cannot "appear" on us. -*/ - if (!grp) { /* need to add a new group */ - grp = kzalloc(sizeof(struct vlan_group), GFP_KERNEL); - if (!grp) - goto out_free_unregister; - - for (i=0; i < VLAN_GROUP_ARRAY_SPLIT_PARTS; i++) { - grp->vlan_devices_arrays[i] = kzalloc( - sizeof(struct net_device *)*VLAN_GROUP_ARRAY_PART_LEN, - GFP_KERNEL); - - if (!grp->vlan_devices_arrays[i]) - goto out_free_arrays; - } - - /* printk(KERN_ALERT "VLAN REGISTER: Allocated new group.\n"); */ - grp->real_dev_ifindex = real_dev->ifindex; - - hlist_add_head_rcu(&grp->hlist, - &vlan_group_hash[vlan_grp_hashfn(real_dev->ifindex)]); - - if (real_dev->features & NETIF_F_HW_VLAN_RX) - real_dev->vlan_rx_register(real_dev, grp); - } + if (ngrp && real_dev->features & NETIF_F_HW_VLAN_RX) + real_dev->vlan_rx_register(real_dev, ngrp); vlan_group_set_device(grp, VLAN_ID, new_dev); @@ -546,12 +553,9 @@ static struct net_device *register_vlan_device(struct net_device *real_dev, #endif return new_dev; -out_free_arrays: - vlan_group_free(grp); - -out_free_unregister: - unregister_netdev(new_dev); - goto out_ret_null; +out_free_group: + if (ngrp) + vlan_group_free(ngrp); out_free_new
[VLAN 12/18]: Split up device checks
[VLAN]: Split up device checks Move the checks of the underlying device to a seperate function. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit 8defb0af6d2f31cfa6180b0b4c83124f5d90cb32 tree a460163ea31c953a60b894a24051deee5f401006 parent db130c75de212df303702758f553a7f4349ae56a author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:46:43 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:32 +0200 net/8021q/vlan.c | 56 +++--- 1 files changed, 32 insertions(+), 24 deletions(-) diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 1b9dc5e..1e33dbb 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -410,57 +410,65 @@ static void vlan_transfer_operstate(const struct net_device *dev, struct net_dev } } -/* Attach a VLAN device to a mac address (ie Ethernet Card). - * Returns the device that was created, or NULL if there was - * an error of some kind. - */ -static struct net_device *register_vlan_device(struct net_device *real_dev, - unsigned short VLAN_ID) +static int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id) { - struct vlan_group *grp, *ngrp = NULL; - struct net_device *new_dev; - char name[IFNAMSIZ]; - -#ifdef VLAN_DEBUG - printk(VLAN_DBG "%s: if_name -:%s:- vid: %i\n", - __FUNCTION__, eth_IF_name, VLAN_ID); -#endif - - if (VLAN_ID >= VLAN_VID_MASK) - goto out_ret_null; - if (real_dev->features & NETIF_F_VLAN_CHALLENGED) { printk(VLAN_DBG "%s: VLANs not supported on %s.\n", __FUNCTION__, real_dev->name); - goto out_ret_null; + return -EOPNOTSUPP; } if ((real_dev->features & NETIF_F_HW_VLAN_RX) && !real_dev->vlan_rx_register) { printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n", __FUNCTION__, real_dev->name); - goto out_ret_null; + return -EOPNOTSUPP; } if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) && (!real_dev->vlan_rx_add_vid || !real_dev->vlan_rx_kill_vid)) { printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n", __FUNCTION__, real_dev->name); - goto out_ret_null; + return -EOPNOTSUPP; } /* The real device must be up and operating in order to * assosciate a VLAN device with it. */ if (!(real_dev->flags & IFF_UP)) - goto out_ret_null; + return -ENETDOWN; - if (__find_vlan_dev(real_dev, VLAN_ID) != NULL) { + if (__find_vlan_dev(real_dev, vlan_id) != NULL) { /* was already registered. */ printk(VLAN_DBG "%s: ALREADY had VLAN registered\n", __FUNCTION__); - goto out_ret_null; + return -EEXIST; } + return 0; +} + +/* Attach a VLAN device to a mac address (ie Ethernet Card). + * Returns the device that was created, or NULL if there was + * an error of some kind. + */ +static struct net_device *register_vlan_device(struct net_device *real_dev, + unsigned short VLAN_ID) +{ + struct vlan_group *grp, *ngrp = NULL; + struct net_device *new_dev; + char name[IFNAMSIZ]; + +#ifdef VLAN_DEBUG + printk(VLAN_DBG "%s: if_name -:%s:- vid: %i\n", + __FUNCTION__, eth_IF_name, VLAN_ID); +#endif + + if (VLAN_ID >= VLAN_VID_MASK) + goto out_ret_null; + + if (vlan_check_real_dev(real_dev, VLAN_ID) < 0) + goto out_ret_null; + /* Gotta set up the fields for the device. */ #ifdef VLAN_DEBUG printk(VLAN_DBG "About to allocate name, vlan_name_type: %i\n", - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[VLAN 13/18]: Move device registation to seperate function
[VLAN]: Move device registation to seperate function Move device registration and configuration of the underlying device to a seperate function. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit 0bd5a42a938a42aa15a4e9ac01777d74653e7c8d tree e7ddfd00b19f52f1e04ad955fa3e4037485e0cdc parent 8defb0af6d2f31cfa6180b0b4c83124f5d90cb32 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:46:48 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:32 +0200 net/8021q/vlan.c | 83 +++--- 1 files changed, 47 insertions(+), 36 deletions(-) diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 1e33dbb..e68b503 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -447,6 +447,51 @@ static int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_ return 0; } +static int register_vlan_dev(struct net_device *dev) +{ + struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev); + struct net_device *real_dev = vlan->real_dev; + unsigned short vlan_id = vlan->vlan_id; + struct vlan_group *grp, *ngrp = NULL; + int err; + + grp = __vlan_find_group(real_dev->ifindex); + if (!grp) { + ngrp = grp = vlan_group_alloc(real_dev->ifindex); + if (!grp) + return -ENOBUFS; + } + + err = register_netdevice(dev); + if (err < 0) + goto out_free_group; + + /* Account for reference in struct vlan_dev_info */ + dev_hold(real_dev); + + vlan_transfer_operstate(real_dev, dev); + linkwatch_fire_event(dev); /* _MUST_ call rfc2863_policy() */ + + /* So, got the sucker initialized, now lets place +* it into our local structure. +*/ + vlan_group_set_device(grp, vlan_id, dev); + if (ngrp && real_dev->features & NETIF_F_HW_VLAN_RX) + real_dev->vlan_rx_register(real_dev, ngrp); + if (real_dev->features & NETIF_F_HW_VLAN_FILTER) + real_dev->vlan_rx_add_vid(real_dev, vlan_id); + + if (vlan_proc_add_dev(dev) < 0) + printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n", + dev->name); + return 0; + +out_free_group: + if (ngrp) + vlan_group_free(ngrp); + return err; +} + /* Attach a VLAN device to a mac address (ie Ethernet Card). * Returns the device that was created, or NULL if there was * an error of some kind. @@ -454,7 +499,6 @@ static int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_ static struct net_device *register_vlan_device(struct net_device *real_dev, unsigned short VLAN_ID) { - struct vlan_group *grp, *ngrp = NULL; struct net_device *new_dev; char name[IFNAMSIZ]; @@ -522,37 +566,8 @@ static struct net_device *register_vlan_device(struct net_device *real_dev, VLAN_DEV_INFO(new_dev)->dent = NULL; VLAN_DEV_INFO(new_dev)->flags = 1; -#ifdef VLAN_DEBUG - printk(VLAN_DBG "About to go find the group for idx: %i\n", - real_dev->ifindex); -#endif - grp = __vlan_find_group(real_dev->ifindex); - if (!grp) { - ngrp = grp = vlan_group_alloc(real_dev->ifindex); - if (!grp) - goto out_free_newdev; - } - - if (register_netdevice(new_dev)) - goto out_free_group; - - vlan_transfer_operstate(real_dev, new_dev); - linkwatch_fire_event(new_dev); /* _MUST_ call rfc2863_policy() */ - - /* So, got the sucker initialized, now lets place -* it into our local structure. -*/ - if (ngrp && real_dev->features & NETIF_F_HW_VLAN_RX) - real_dev->vlan_rx_register(real_dev, ngrp); - - vlan_group_set_device(grp, VLAN_ID, new_dev); - - if (vlan_proc_add_dev(new_dev)<0)/* create it's proc entry */ - printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n", -new_dev->name); - - if (real_dev->features & NETIF_F_HW_VLAN_FILTER) - real_dev->vlan_rx_add_vid(real_dev, VLAN_ID); + if (register_vlan_dev(new_dev) < 0) + goto out_free_newdev; /* Account for reference in struct vlan_dev_info */ dev_hold(real_dev); @@ -561,10 +576,6 @@ static struct net_device *register_vlan_device(struct net_device *real_dev, #endif return new_dev; -out_free_group: - if (ngrp) - vlan_group_free(ngrp); - out_free_newdev: free_netdev(new_dev); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[VLAN 09/18]: Convert name-based configuration functions to struct netdevice *
[VLAN]: Convert name-based configuration functions to struct netdevice * Move the device lookup and checks to the ioctl handler under the RTNL and change all name-based interfaces to take a struct net_device * instead. This allows to use them from a netlink interface, which identifies devices based on ifindex not name. It also avoids races between the ioctl interface and the (upcoming) netlink interface since now all changes happen under the RTNL. As a nice side effect this greatly simplifies error handling in the helper functions and fixes a number of incorrect error codes like -EINVAL for device not found. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit 3288fa26d2f10d9c6d43a5ee3180bedc2ef1edc5 tree 98d1a82a5d030bbc1b80f975f0b8f89676c2d099 parent 7cd41b2caa4f124f84d6f458fe913de8e3b492a3 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:46:28 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:31 +0200 net/8021q/vlan.c | 153 +- net/8021q/vlan.h | 13 +++- net/8021q/vlan_dev.c | 142 -- 3 files changed, 109 insertions(+), 199 deletions(-) diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index de78c9d..3678f07 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -278,43 +278,16 @@ static int unregister_vlan_dev(struct net_device *real_dev, return ret; } -static int unregister_vlan_device(const char *vlan_IF_name) +static int unregister_vlan_device(struct net_device *dev) { - struct net_device *dev = NULL; int ret; + ret = unregister_vlan_dev(VLAN_DEV_INFO(dev)->real_dev, + VLAN_DEV_INFO(dev)->vlan_id); + unregister_netdevice(dev); - dev = dev_get_by_name(vlan_IF_name); - ret = -EINVAL; - if (dev) { - if (dev->priv_flags & IFF_802_1Q_VLAN) { - rtnl_lock(); - - ret = unregister_vlan_dev(VLAN_DEV_INFO(dev)->real_dev, - VLAN_DEV_INFO(dev)->vlan_id); - - dev_put(dev); - unregister_netdevice(dev); - - rtnl_unlock(); - - if (ret == 1) - ret = 0; - } else { - printk(VLAN_ERR - "%s: ERROR: Tried to remove a non-vlan device " - "with VLAN code, name: %s priv_flags: %hX\n", - __FUNCTION__, dev->name, dev->priv_flags); - dev_put(dev); - ret = -EPERM; - } - } else { -#ifdef VLAN_DEBUG - printk(VLAN_DBG "%s: WARNING: Could not find dev.\n", __FUNCTION__); -#endif - ret = -EINVAL; - } - + if (ret == 1) + ret = 0; return ret; } @@ -378,12 +351,11 @@ static struct lock_class_key vlan_netdev_xmit_lock_key; * Returns the device that was created, or NULL if there was * an error of some kind. */ -static struct net_device *register_vlan_device(const char *eth_IF_name, +static struct net_device *register_vlan_device(struct net_device *real_dev, unsigned short VLAN_ID) { struct vlan_group *grp; struct net_device *new_dev; - struct net_device *real_dev; /* the ethernet device */ char name[IFNAMSIZ]; int i; @@ -395,46 +367,36 @@ static struct net_device *register_vlan_device(const char *eth_IF_name, if (VLAN_ID >= VLAN_VID_MASK) goto out_ret_null; - /* find the device relating to eth_IF_name. */ - real_dev = dev_get_by_name(eth_IF_name); - if (!real_dev) - goto out_ret_null; - if (real_dev->features & NETIF_F_VLAN_CHALLENGED) { printk(VLAN_DBG "%s: VLANs not supported on %s.\n", __FUNCTION__, real_dev->name); - goto out_put_dev; + goto out_ret_null; } if ((real_dev->features & NETIF_F_HW_VLAN_RX) && !real_dev->vlan_rx_register) { printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n", __FUNCTION__, real_dev->name); - goto out_put_dev; + goto out_ret_null; } if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) && (!real_dev->vlan_rx_add_vid || !real_dev->vlan_rx_kill_vid)) { printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n", __FUNCTION__, real_dev->name); - goto out_put_dev; + goto out_ret_null; } - /* From this point on, all the data structures must remain -* consistent. -*/ - rtnl_lock(); - /* The real device must be up and operat
[IFB 07/18]: Keep ifb devices on list
[IFB]: Keep ifb devices on list Use a list instead of an array to allow creating new devices. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit cfbc876235237d990af80b7fc396f4458b5a1657 tree 1ebce533598ae9220b8e3edef269bd4f054961e7 parent 379884fb0587cd4832ecf8785467209885204124 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:46:17 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:30 +0200 drivers/net/ifb.c | 36 +--- 1 files changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 07b4c0d..819945e 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -33,12 +33,15 @@ #include #include #include +#include #include #define TX_TIMEOUT (2*HZ) #define TX_Q_LIMIT32 struct ifb_private { + struct list_headlist; + struct net_device *dev; struct net_device_stats stats; struct tasklet_struct ifb_tasklet; int tasklet_pending; @@ -197,7 +200,7 @@ static struct net_device_stats *ifb_get_stats(struct net_device *dev) return stats; } -static struct net_device **ifbs; +static LIST_HEAD(ifbs); /* Number of ifb devices to be set up by this module. */ module_param(numifbs, int, 0); @@ -229,6 +232,7 @@ static int ifb_open(struct net_device *dev) static int __init ifb_init_one(int index) { struct net_device *dev_ifb; + struct ifb_private *priv; int err; dev_ifb = alloc_netdev(sizeof(struct ifb_private), @@ -241,30 +245,33 @@ static int __init ifb_init_one(int index) free_netdev(dev_ifb); dev_ifb = NULL; } else { - ifbs[index] = dev_ifb; + priv = netdev_priv(dev_ifb); + priv->dev = dev_ifb; + list_add_tail(&priv->list, &ifbs); } return err; } -static void ifb_free_one(int index) +static void ifb_free_one(struct net_device *dev) { - unregister_netdev(ifbs[index]); - free_netdev(ifbs[index]); + struct ifb_private *priv = netdev_priv(dev); + + list_del(&priv->list); + unregister_netdev(dev); + free_netdev(dev); } static int __init ifb_init_module(void) { + struct ifb_private *priv, *next; int i, err = 0; - ifbs = kmalloc(numifbs * sizeof(void *), GFP_KERNEL); - if (!ifbs) - return -ENOMEM; + for (i = 0; i < numifbs && !err; i++) err = ifb_init_one(i); if (err) { - i--; - while (--i >= 0) - ifb_free_one(i); + list_for_each_entry_safe(priv, next, &ifbs, list) + ifb_free_one(priv->dev); } return err; @@ -272,11 +279,10 @@ static int __init ifb_init_module(void) static void __exit ifb_cleanup_module(void) { - int i; + struct ifb_private *priv, *next; - for (i = 0; i < numifbs; i++) - ifb_free_one(i); - kfree(ifbs); + list_for_each_entry_safe(priv, next, &ifbs, list) + ifb_free_one(priv->dev); } module_init(ifb_init_module); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[IFB 08/18]: Use rtnl_link API
[IFB]: Use rtnl_link API Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit 7cd41b2caa4f124f84d6f458fe913de8e3b492a3 tree c62fa740c7e41ab388da72b67a4e4538ad97eda7 parent cfbc876235237d990af80b7fc396f4458b5a1657 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:46:22 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:30 +0200 drivers/net/ifb.c | 80 - 1 files changed, 60 insertions(+), 20 deletions(-) diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 819945e..669ee1a 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -139,13 +139,14 @@ resched: } -static void __init ifb_setup(struct net_device *dev) +static void ifb_setup(struct net_device *dev) { /* Initialize the device structure. */ dev->get_stats = ifb_get_stats; dev->hard_start_xmit = ifb_xmit; dev->open = &ifb_open; dev->stop = &ifb_close; + dev->destructor = free_netdev; /* Fill in device structure with ethernet-generic values. */ ether_setup(dev); @@ -229,6 +230,37 @@ static int ifb_open(struct net_device *dev) return 0; } +static int ifb_newlink(struct net_device *dev, + struct nlattr *tb[], struct nlattr *data[]) +{ + struct ifb_private *priv = netdev_priv(dev); + int err; + + err = register_netdevice(dev); + if (err < 0) + return err; + + priv->dev = dev; + list_add_tail(&priv->list, &ifbs); + return 0; +} + +static void ifb_dellink(struct net_device *dev) +{ + struct ifb_private *priv = netdev_priv(dev); + + list_del(&priv->list); + unregister_netdevice(dev); +} + +static struct rtnl_link_ops ifb_link_ops __read_mostly = { + .kind = "ifb", + .priv_size = sizeof(struct ifb_private), + .setup = ifb_setup, + .newlink= ifb_newlink, + .dellink= ifb_dellink, +}; + static int __init ifb_init_one(int index) { struct net_device *dev_ifb; @@ -241,38 +273,41 @@ static int __init ifb_init_one(int index) if (!dev_ifb) return -ENOMEM; - if ((err = register_netdev(dev_ifb))) { - free_netdev(dev_ifb); - dev_ifb = NULL; - } else { - priv = netdev_priv(dev_ifb); - priv->dev = dev_ifb; - list_add_tail(&priv->list, &ifbs); - } + err = dev_alloc_name(dev_ifb, dev_ifb->name); + if (err < 0) + goto err; - return err; -} + dev_ifb->rtnl_link_ops = &ifb_link_ops; + err = register_netdevice(dev_ifb); + if (err < 0) + goto err; -static void ifb_free_one(struct net_device *dev) -{ - struct ifb_private *priv = netdev_priv(dev); + priv = netdev_priv(dev_ifb); + priv->dev = dev_ifb; + list_add_tail(&priv->list, &ifbs); + return 0; - list_del(&priv->list); - unregister_netdev(dev); - free_netdev(dev); +err: + free_netdev(dev_ifb); + return err; } static int __init ifb_init_module(void) { struct ifb_private *priv, *next; - int i, err = 0; + int i, err; + + rtnl_lock(); + err = __rtnl_link_register(&ifb_link_ops); for (i = 0; i < numifbs && !err; i++) err = ifb_init_one(i); if (err) { list_for_each_entry_safe(priv, next, &ifbs, list) - ifb_free_one(priv->dev); + ifb_dellink(priv->dev); + __rtnl_link_unregister(&ifb_link_ops); } + rtnl_unlock(); return err; } @@ -281,11 +316,16 @@ static void __exit ifb_cleanup_module(void) { struct ifb_private *priv, *next; + rtnl_lock(); list_for_each_entry_safe(priv, next, &ifbs, list) - ifb_free_one(priv->dev); + ifb_dellink(priv->dev); + + __rtnl_link_unregister(&ifb_link_ops); + rtnl_unlock(); } module_init(ifb_init_module); module_exit(ifb_cleanup_module); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Jamal Hadi Salim"); +MODULE_ALIAS_RTNL_LINK("ifb"); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[DUMMY 06/18]: Use rtnl_link API
[DUMMY]: Use rtnl_link API Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit 379884fb0587cd4832ecf8785467209885204124 tree 8bce1ffae7d2b2afabba9bc5ab2c7b06402c51c1 parent 18094391f33349687e35eaf0e768b18a71523100 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:46:12 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:30 +0200 drivers/net/dummy.c | 82 +++ 1 files changed, 62 insertions(+), 20 deletions(-) diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index 2f2cf3c..91126b9 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c @@ -35,6 +35,7 @@ #include #include #include +#include struct dummy_priv { struct net_device *dev; @@ -61,12 +62,13 @@ static void set_multicast_list(struct net_device *dev) { } -static void __init dummy_setup(struct net_device *dev) +static void dummy_setup(struct net_device *dev) { /* Initialize the device structure. */ dev->hard_start_xmit = dummy_xmit; dev->set_multicast_list = set_multicast_list; dev->set_mac_address = dummy_set_address; + dev->destructor = free_netdev; /* Fill in device structure with ethernet-generic values. */ ether_setup(dev); @@ -89,6 +91,37 @@ static int dummy_xmit(struct sk_buff *skb, struct net_device *dev) static LIST_HEAD(dummies); +static int dummy_newlink(struct net_device *dev, +struct nlattr *tb[], struct nlattr *data[]) +{ + struct dummy_priv *priv = netdev_priv(dev); + int err; + + err = register_netdevice(dev); + if (err < 0) + return err; + + priv->dev = dev; + list_add_tail(&priv->list, &dummies); + return 0; +} + +static void dummy_dellink(struct net_device *dev) +{ + struct dummy_priv *priv = netdev_priv(dev); + + list_del(&priv->list); + unregister_netdevice(dev); +} + +static struct rtnl_link_ops dummy_link_ops __read_mostly = { + .kind = "dummy", + .priv_size = sizeof(struct dummy_priv), + .setup = dummy_setup, + .newlink= dummy_newlink, + .dellink= dummy_dellink, +}; + /* Number of dummy devices to be set up by this module. */ module_param(numdummies, int, 0); MODULE_PARM_DESC(numdummies, "Number of dummy pseudo devices"); @@ -105,25 +138,23 @@ static int __init dummy_init_one(void) if (!dev_dummy) return -ENOMEM; - if ((err = register_netdev(dev_dummy))) { - free_netdev(dev_dummy); - dev_dummy = NULL; - } else { - priv = netdev_priv(dev_dummy); - priv->dev = dev_dummy; - list_add_tail(&priv->list, &dummies); - } + err = dev_alloc_name(dev_dummy, dev_dummy->name); + if (err < 0) + goto err; - return err; -} + dev_dummy->rtnl_link_ops = &dummy_link_ops; + err = register_netdevice(dev_dummy); + if (err < 0) + goto err; -static void dummy_free_one(struct net_device *dev) -{ - struct dummy_priv *priv = netdev_priv(dev); + priv = netdev_priv(dev_dummy); + priv->dev = dev_dummy; + list_add_tail(&priv->list, &dummies); + return 0; - list_del(&priv->list); - unregister_netdev(dev); - free_netdev(dev); +err: + free_netdev(dev_dummy); + return err; } static int __init dummy_init_module(void) @@ -131,12 +162,18 @@ static int __init dummy_init_module(void) struct dummy_priv *priv, *next; int i, err = 0; + rtnl_lock(); + err = __rtnl_link_register(&dummy_link_ops); + for (i = 0; i < numdummies && !err; i++) err = dummy_init_one(); - if (err) { + if (err < 0) { list_for_each_entry_safe(priv, next, &dummies, list) - dummy_free_one(priv->dev); + dummy_dellink(priv->dev); + __rtnl_link_unregister(&dummy_link_ops); } + rtnl_unlock(); + return err; } @@ -144,10 +181,15 @@ static void __exit dummy_cleanup_module(void) { struct dummy_priv *priv, *next; + rtnl_lock(); list_for_each_entry_safe(priv, next, &dummies, list) - dummy_free_one(priv->dev); + dummy_dellink(priv->dev); + + __rtnl_link_unregister(&dummy_link_ops); + rtnl_unlock(); } module_init(dummy_init_module); module_exit(dummy_cleanup_module); MODULE_LICENSE("GPL"); +MODULE_ALIAS_RTNL_LINK("dummy"); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[DUMMY 05/18]: Keep dummy devices on list
[DUMMY]: Keep dummy devices on list Use a list instead of an array to allow creating new devices. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit 18094391f33349687e35eaf0e768b18a71523100 tree 8697434fd6ce5c2d16b4e823482ba9cf7ee8cea2 parent af03e9fd45eb64f27bcc2ac79d0d615e563100a9 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:46:07 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:30 +0200 drivers/net/dummy.c | 47 +-- 1 files changed, 29 insertions(+), 18 deletions(-) diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index 91b474c..2f2cf3c 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c @@ -34,6 +34,12 @@ #include #include #include +#include + +struct dummy_priv { + struct net_device *dev; + struct list_head list; +}; static int numdummies = 1; @@ -81,18 +87,20 @@ static int dummy_xmit(struct sk_buff *skb, struct net_device *dev) return 0; } -static struct net_device **dummies; +static LIST_HEAD(dummies); /* Number of dummy devices to be set up by this module. */ module_param(numdummies, int, 0); MODULE_PARM_DESC(numdummies, "Number of dummy pseudo devices"); -static int __init dummy_init_one(int index) +static int __init dummy_init_one(void) { struct net_device *dev_dummy; + struct dummy_priv *priv; int err; - dev_dummy = alloc_netdev(0, "dummy%d", dummy_setup); + dev_dummy = alloc_netdev(sizeof(struct dummy_priv), "dummy%d", +dummy_setup); if (!dev_dummy) return -ENOMEM; @@ -101,40 +109,43 @@ static int __init dummy_init_one(int index) free_netdev(dev_dummy); dev_dummy = NULL; } else { - dummies[index] = dev_dummy; + priv = netdev_priv(dev_dummy); + priv->dev = dev_dummy; + list_add_tail(&priv->list, &dummies); } return err; } -static void dummy_free_one(int index) +static void dummy_free_one(struct net_device *dev) { - unregister_netdev(dummies[index]); - free_netdev(dummies[index]); + struct dummy_priv *priv = netdev_priv(dev); + + list_del(&priv->list); + unregister_netdev(dev); + free_netdev(dev); } static int __init dummy_init_module(void) { + struct dummy_priv *priv, *next; int i, err = 0; - dummies = kmalloc(numdummies * sizeof(void *), GFP_KERNEL); - if (!dummies) - return -ENOMEM; + for (i = 0; i < numdummies && !err; i++) - err = dummy_init_one(i); + err = dummy_init_one(); if (err) { - i--; - while (--i >= 0) - dummy_free_one(i); + list_for_each_entry_safe(priv, next, &dummies, list) + dummy_free_one(priv->dev); } return err; } static void __exit dummy_cleanup_module(void) { - int i; - for (i = 0; i < numdummies; i++) - dummy_free_one(i); - kfree(dummies); + struct dummy_priv *priv, *next; + + list_for_each_entry_safe(priv, next, &dummies, list) + dummy_free_one(priv->dev); } module_init(dummy_init_module); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[RTNETLINK 03/18]: Link creation API
[RTNETLINK]: Link creation API Add rtnetlink API for creating, changing and deleting software devices. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit 8a4171f86c516a43a7ed07f198c6cad2273ce2a7 tree 6bab9e96dd04c4ea13654fcda6a402a20a4f43c1 parent 806243b51e1f1607cec07f320dc9a8c3a70a8480 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:45:57 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:29 +0200 include/linux/if_link.h | 13 ++ include/linux/netdevice.h |3 include/net/rtnetlink.h | 58 net/core/rtnetlink.c | 342 - 4 files changed, 409 insertions(+), 7 deletions(-) diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 604c243..3144bab 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h @@ -76,6 +76,8 @@ enum #define IFLA_WEIGHT IFLA_WEIGHT IFLA_OPERSTATE, IFLA_LINKMODE, + IFLA_LINKINFO, +#define IFLA_LINKINFO IFLA_LINKINFO __IFLA_MAX }; @@ -140,4 +142,15 @@ struct ifla_cacheinfo __u32 retrans_time; }; +enum +{ + IFLA_INFO_UNSPEC, + IFLA_INFO_KIND, + IFLA_INFO_DATA, + IFLA_INFO_XSTATS, + __IFLA_INFO_MAX, +}; + +#define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1) + #endif /* _LINUX_IF_LINK_H */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 94cc77c..e7913ee 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -540,6 +540,9 @@ struct net_device struct device dev; /* space for optional statistics and wireless sysfs groups */ struct attribute_group *sysfs_groups[3]; + + /* rtnetlink link ops */ + const struct rtnl_link_ops *rtnl_link_ops; }; #define to_net_dev(d) container_of(d, struct net_device, dev) diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index 3b3d474..3861c05 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h @@ -22,4 +22,62 @@ static inline int rtnl_msg_family(struct nlmsghdr *nlh) return AF_UNSPEC; } +/** + * struct rtnl_link_ops - rtnetlink link operations + * + * @list: Used internally + * @kind: Identifier + * @maxtype: Highest device specific netlink attribute number + * @policy: Netlink policy for device specific attribute validation + * @validate: Optional validation function for netlink/changelink parameters + * @priv_size: sizeof net_device private space + * @setup: net_device setup function + * @newlink: Function for configuring and registering a new device + * @changelink: Function for changing parameters of an existing device + * @dellink: Function to remove a device + * @get_size: Function to calculate required room for dumping device + *specific netlink attributes + * @fill_info: Function to dump device specific netlink attributes + * @get_xstats_size: Function to calculate required room for dumping devic + * specific statistics + * @fill_xstats: Function to dump device specific statistics + */ +struct rtnl_link_ops { + struct list_headlist; + + const char *kind; + + size_t priv_size; + void(*setup)(struct net_device *dev); + + int maxtype; + const struct nla_policy *policy; + int (*validate)(struct nlattr *tb[], + struct nlattr *data[]); + + int (*newlink)(struct net_device *dev, + struct nlattr *tb[], + struct nlattr *data[]); + int (*changelink)(struct net_device *dev, + struct nlattr *tb[], + struct nlattr *data[]); + void(*dellink)(struct net_device *dev); + + size_t (*get_size)(const struct net_device *dev); + int (*fill_info)(struct sk_buff *skb, +const struct net_device *dev); + + size_t (*get_xstats_size)(const struct net_device *dev); + int (*fill_xstats)(struct sk_buff *skb, + const struct net_device *dev); +}; + +extern int __rtnl_link_register(struct rtnl_link_ops *ops); +extern void__rtnl_link_unregister(struct rtnl_link_ops *ops); + +extern int rtnl_link_register(struct rtnl_link_ops *ops); +extern voidrtnl_link_unregister(struct rtnl_link_ops *ops); + +#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) + #endif diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 25ca219..06c0c5a 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -24
[DUMMY 04/18]: Use dev->stats
[DUMMY]: Use dev->stats Use dev->stats instead of netdev_priv(). Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit af03e9fd45eb64f27bcc2ac79d0d615e563100a9 tree 9a1aa56016d17805dd2b41e955fbb41d46d9c3f5 parent 8a4171f86c516a43a7ed07f198c6cad2273ce2a7 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:46:02 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:29 +0200 drivers/net/dummy.c | 16 +++- 1 files changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index 60673bc..91b474c 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c @@ -38,7 +38,6 @@ static int numdummies = 1; static int dummy_xmit(struct sk_buff *skb, struct net_device *dev); -static struct net_device_stats *dummy_get_stats(struct net_device *dev); static int dummy_set_address(struct net_device *dev, void *p) { @@ -59,7 +58,6 @@ static void set_multicast_list(struct net_device *dev) static void __init dummy_setup(struct net_device *dev) { /* Initialize the device structure. */ - dev->get_stats = dummy_get_stats; dev->hard_start_xmit = dummy_xmit; dev->set_multicast_list = set_multicast_list; dev->set_mac_address = dummy_set_address; @@ -76,20 +74,13 @@ static void __init dummy_setup(struct net_device *dev) static int dummy_xmit(struct sk_buff *skb, struct net_device *dev) { - struct net_device_stats *stats = netdev_priv(dev); - - stats->tx_packets++; - stats->tx_bytes+=skb->len; + dev->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; dev_kfree_skb(skb); return 0; } -static struct net_device_stats *dummy_get_stats(struct net_device *dev) -{ - return netdev_priv(dev); -} - static struct net_device **dummies; /* Number of dummy devices to be set up by this module. */ @@ -101,8 +92,7 @@ static int __init dummy_init_one(int index) struct net_device *dev_dummy; int err; - dev_dummy = alloc_netdev(sizeof(struct net_device_stats), -"dummy%d", dummy_setup); + dev_dummy = alloc_netdev(0, "dummy%d", dummy_setup); if (!dev_dummy) return -ENOMEM; - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[RTNETLINK 02/18]: Split up rtnl_setlink
[RTNETLINK]: Split up rtnl_setlink Split up rtnl_setlink into a function performing validation and a function performing the actual changes. This allows to share the modifcation logic with rtnl_newlink, which is introduced by the next patch. Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit 806243b51e1f1607cec07f320dc9a8c3a70a8480 tree d5a73dce1019704e9eaca483281cb5f3e82c3a95 parent 2c029e7d78d67b07e6cc138ded377021555a author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:45:52 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:29 +0200 net/core/rtnetlink.c | 105 +++--- 1 files changed, 57 insertions(+), 48 deletions(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 02e8bf0..25ca219 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -561,44 +561,11 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = { [IFLA_LINKMODE] = { .type = NLA_U8 }, }; -static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) +static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm, + struct nlattr **tb, char *ifname) { - struct ifinfomsg *ifm; - struct net_device *dev; - int err, send_addr_notify = 0, modified = 0; - struct nlattr *tb[IFLA_MAX+1]; - char ifname[IFNAMSIZ]; - - err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); - if (err < 0) - goto errout; - - if (tb[IFLA_IFNAME]) - nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ); - else - ifname[0] = '\0'; - - err = -EINVAL; - ifm = nlmsg_data(nlh); - if (ifm->ifi_index > 0) - dev = dev_get_by_index(ifm->ifi_index); - else if (tb[IFLA_IFNAME]) - dev = dev_get_by_name(ifname); - else - goto errout; - - if (dev == NULL) { - err = -ENODEV; - goto errout; - } - - if (tb[IFLA_ADDRESS] && - nla_len(tb[IFLA_ADDRESS]) < dev->addr_len) - goto errout_dev; - - if (tb[IFLA_BROADCAST] && - nla_len(tb[IFLA_BROADCAST]) < dev->addr_len) - goto errout_dev; + int modified = 0, send_addr_notify = 0; + int err; if (tb[IFLA_MAP]) { struct rtnl_link_ifmap *u_map; @@ -606,12 +573,12 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) if (!dev->set_config) { err = -EOPNOTSUPP; - goto errout_dev; + goto errout; } if (!netif_device_present(dev)) { err = -ENODEV; - goto errout_dev; + goto errout; } u_map = nla_data(tb[IFLA_MAP]); @@ -624,7 +591,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) err = dev->set_config(dev, &k_map); if (err < 0) - goto errout_dev; + goto errout; modified = 1; } @@ -635,19 +602,19 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) if (!dev->set_mac_address) { err = -EOPNOTSUPP; - goto errout_dev; + goto errout; } if (!netif_device_present(dev)) { err = -ENODEV; - goto errout_dev; + goto errout; } len = sizeof(sa_family_t) + dev->addr_len; sa = kmalloc(len, GFP_KERNEL); if (!sa) { err = -ENOMEM; - goto errout_dev; + goto errout; } sa->sa_family = dev->type; memcpy(sa->sa_data, nla_data(tb[IFLA_ADDRESS]), @@ -655,7 +622,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) err = dev->set_mac_address(dev, sa); kfree(sa); if (err) - goto errout_dev; + goto errout; send_addr_notify = 1; modified = 1; } @@ -663,7 +630,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) if (tb[IFLA_MTU]) { err = dev_set_mtu(dev, nla_get_u32(tb[IFLA_MTU])); if (err < 0) - goto errout_dev; + goto errout; modified = 1; } @@ -675,7 +642,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) if (ifm->ifi_index > 0 && ifname[0]) { err = dev_change_name(dev, ifname)
[NET 01/18]: Mark struct net_device * argument to netdev_priv const
[NET]: Mark struct net_device * argument to netdev_priv const Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]> --- commit 2c029e7d78d67b07e6cc138ded377021555a tree 415a297754ec7f62f3dfe46f22171de88aa22d2e parent 14e26eae98ec9a02ebb4b17ddb689f9b92d76ad7 author Patrick McHardy <[EMAIL PROTECTED]> Wed, 06 Jun 2007 14:44:49 +0200 committer Patrick McHardy <[EMAIL PROTECTED]> Wed, 13 Jun 2007 18:10:28 +0200 include/linux/netdevice.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3a70f55..94cc77c 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -546,7 +546,7 @@ struct net_device #defineNETDEV_ALIGN32 #defineNETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) -static inline void *netdev_priv(struct net_device *dev) +static inline void *netdev_priv(const struct net_device *dev) { return (char *)dev + ((sizeof(struct net_device) + NETDEV_ALIGN_CONST) - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[NET 00/18]: Netlink link creation API + driver conversions
Hi Dave, these are the updated rtnl_link API patches and dummy, ifb and VLAN conversions. The documentation is not quite done yet, I'll finish it when I find some spare time. Changes since the last post: - fix attribute parsing after module load - fix module aliases - refuse all unsupported options on device creation - turn xstats_size into a function to calculate the size since it turned out not to be flexible enough for my multiqueue simulator device - use const and __read_mostly where possible - rename IFLA_INFO_NAME to IFLA_INFO_KIND VLAN: - remove broken VLAN_MASK patch - support REORDER_HDR flag - support setting initial MTU The patches are against net-2.6, but AFAICS the only thing in net-2.6.23 conflicting with them is the previous series. Please apply/replace, thanks :) drivers/net/dummy.c | 145 drivers/net/ifb.c | 116 +++--- include/linux/if_link.h | 47 include/linux/if_vlan.h | 11 include/linux/netdevice.h |5 include/net/rtnetlink.h | 58 + net/8021q/Makefile|2 net/8021q/vlan.c | 525 +++--- net/8021q/vlan.h | 23 +- net/8021q/vlan_dev.c | 182 +-- net/8021q/vlan_netlink.c | 236 net/8021q/vlanproc.c |4 net/core/rtnetlink.c | 447 ++- 13 files changed, 1271 insertions(+), 530 deletions(-) Patrick McHardy (18): [NET]: Mark struct net_device * argument to netdev_priv const [RTNETLINK]: Split up rtnl_setlink [RTNETLINK]: Link creation API [DUMMY]: Use dev->stats [DUMMY]: Keep dummy devices on list [DUMMY]: Use rtnl_link API [IFB]: Keep ifb devices on list [IFB]: Use rtnl_link API [VLAN]: Convert name-based configuration functions to struct netdevice * [VLAN]: Move some device intialization code to dev->init callback [VLAN]: Move vlan_group allocation to seperate function [VLAN]: Split up device checks [VLAN]: Move device registation to seperate function [VLAN]: Return proper error codes in register_vlan_device [VLAN]: Use 32 bit value for skb->priority mapping [VLAN]: Keep track of number of QoS mappings [VLAN]: Introduce symbolic constants for flag values [VLAN]: Use rtnl_link API - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html