Re: [Bugme-new] [Bug 9816] New: cannot replace route
Hello, On Sun, 27 Jan 2008, Jarek Poplawski wrote: But comment#3 is ambiguous... It looks like you don't want to show us too much... So, apparently you change the route, but it seems this route exists; you have this: 10.0.0.0/8 dev eth0 scope link but probably also something like this: default via 192.168.1.1 dev eth0 src 10.204.0.116 On replace the problem arises when same fib_info (priority, protocol, prefsrc, metrics, nexthops) is used in another route or routing table. In such cases single copy of structure is used with reference counter, all routes share pointer to such fib_info structure which saves memory when we have many routes using same gateway, for example. So, I doubt there is any real change attempted here. It looks more like a question if program should allow for changing the form of route entries even if they mean the same, and if this should be reported as error at all? But maybe I miss something... No, simply the last change in 2.6.24 is wrong to assume duplication is evident in fib_info reference counter. And such check is only on ip route replace/change. I'm appending brief FIB information for your reference: FIB - Forwarding Information Base - Routes are organized in routing tables - For fib_hash algorithm routing tables have 33 zones (for prefix lengths 0..32), routing lookup walks them from 32 to 0 to find a node containing all routing information - Zones are implemented as hash tables where nodes are hashed by key (prefix=network) because there can be lots of prefixes in a zone. - Nodes can be stored with other methods, eg. trie, where nodes are searched (we hope faster) by prefix and length, no zones are used in this case - Nodes have a list of aliases (tos+type+scope+fib_info ptr) sorted by decreasing TOS because TOS=0 must be a last hit when looking for route. type is unicast, local, prohibit, etc. scope is host, link, etc. - fib_info is a structure containing protocol (kernel, boot, zebra, etc), prefsrc, priority (metric), metrics, nexthop(s). Fallback routes have higher value for priority, they are used if more priority routes disappear or their nexthops are dead. - fib_info structures are organized in 2 global hash tables, one keyed by prefsrc and another by nexthop_count+protocol+prefsrc+priority - fib_info is a shared structure, different aliases can point to same fib_info, even aliases from different prefixes, from different routing tables. By this way if fib_info contains multipath route then many aliases share same route path scheduling context. - Nexthop contains gateway, output device, scope and weight. Weight is used for path scheduling where nexthops have relative priority compared to other nexthops in multipath route. - There can be many aliases with same tos, there can be alternative routes (aliases) with same tos and priority (metric) but only one alias with particular tos, type, scope and fib_info can exist to avoid duplicate alternative routes. - The operation to replace route includes replacing of alias. The alias in node (table - prefix/len) is matched by tos and fib_info priority and they can not be changed. The parameters that are changed are type, scope and fib_info (except priority). * routing table * node (prefix/len) * alias (tos, type, scope) - fib_info (priority, protocol, prefsrc, metrics) * nexthop (gateway, outdev, scope, weight) read '*' for 'many' and '-' for 'counted reference' Regards -- Julian Anastasov [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: [Bugme-new] [Bug 9816] New: cannot replace route
On Sun, Jan 27, 2008 at 11:49:06AM +0200, Julian Anastasov wrote: ... No, simply the last change in 2.6.24 is wrong to assume duplication is evident in fib_info reference counter. And such check is only on ip route replace/change. I'm appending brief FIB information for your reference: Thank you very much! I've just planned to look more at this code today, and maybe try to find how your new patch copes with this problem, so this description should be really helpful! But, since we agree now it's a bug and regression in 2.6.24, it seems this should be fixed as soon as possible, and since your patch isn't probably tested enough for stable, it looks like safe bet to revert Joonwoo's patch, at least until this all is more verified. Regards, Jarek P. -- 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] natsemi: Update locking documentation
The documentation regarding synchronisation at the head of the natsemi driver was badly bitrotted so replace it with a general statement about the techniques used which is less likely to bitrot. Also remove the note saying these chips are uncommon - it makes little difference but they were used in a number of laptops and at least one mass market PCI ethernet card. Signed-off-by: Mark Brown [EMAIL PROTECTED] --- drivers/net/natsemi.c | 18 ++ 1 files changed, 2 insertions(+), 16 deletions(-) diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index c329a4f..0a3e604 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c @@ -203,22 +203,8 @@ skbuff at an offset of +2, 16-byte aligning the IP header. IIId. Synchronization Most operations are synchronized on the np-lock irq spinlock, except the -performance critical codepaths: - -The rx process only runs in the interrupt handler. Access from outside -the interrupt handler is only permitted after disable_irq(). - -The rx process usually runs under the netif_tx_lock. If np-intr_tx_reap -is set, then access is permitted under spin_lock_irq(np-lock). - -Thus configuration functions that want to access everything must call - disable_irq(dev-irq); - netif_tx_lock_bh(dev); - spin_lock_irq(np-lock); - -IV. Notes - -NatSemi PCI network controllers are very uncommon. +recieve and transmit paths which are synchronised using a combination of +hardware descriptor ownership, disabling interrupts and NAPI poll scheduling. IVb. References -- 1.5.3.8 -- 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 10/14] [rndis_host] Add early_init function pointer to 'struct rndis_data'.
On Friday 25 January 2008, Jussi Kivilinna wrote: Function pointer is for 'subminidrivers' that need to do work on device right after minidriver has initialized hardware. For example, rndis_wlan setting device specific configuration parameters with OID_GEN_RNDIS_CONFIG_PARAMETER right after rndis_host has initialized hardware with RNDIS_INIT. Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED] Acked-by: David Brownell [EMAIL PROTECTED] ... though I'm not sure I'd coin a term like subminidriver. ;) --- drivers/net/usb/rndis_host.c |6 ++ drivers/net/usb/usbnet.h |5 + 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index 1d6bf0a..0813903 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c @@ -336,6 +336,12 @@ int generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf) dev-hard_mtu, tmp, dev-rx_urb_size, 1 le32_to_cpu(u.init_c-packet_alignment)); + /* module has some device initialization code needs to be done right + * after RNDIS_INIT */ + if (dev-driver_info-early_init + dev-driver_info-early_init(dev) != 0) + goto halt_fail_and_release; + /* Get designated host ethernet address */ reply_len = ETH_ALEN; retval = rndis_query(dev, intf, u.buf, OID_802_3_PERMANENT_ADDRESS, diff --git a/drivers/net/usb/usbnet.h b/drivers/net/usb/usbnet.h index 0b4bf09..25b63d3 100644 --- a/drivers/net/usb/usbnet.h +++ b/drivers/net/usb/usbnet.h @@ -116,6 +116,11 @@ struct driver_info { struct sk_buff *(*tx_fixup)(struct usbnet *dev, struct sk_buff *skb, gfp_t flags); + /* early initialization code, can sleep. This is for minidrivers + * having 'subminidrivers' that need to do extra initialization + * right after minidriver have initialized hardware. */ + int (*early_init)(struct usbnet *dev); + /* for new devices, use the descriptor-reading code instead */ int in; /* rx endpoint */ int out;/* tx endpoint */ -- 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 11/14] [rndis_host] Add link_change function pointer to 'struct rndis_data'.
On Friday 25 January 2008, Jussi Kivilinna wrote: Callback to signal link state changes from minidriver to 'subminidrivers'. Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED] Acked-by: David Brownell [EMAIL PROTECTED] --- drivers/net/usb/rndis_host.c | 24 drivers/net/usb/usbnet.h |4 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index 0813903..800c9d0 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c @@ -148,10 +148,26 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf) request_id, xid); /* then likely retry */ } else switch (buf-msg_type) { - case RNDIS_MSG_INDICATE: { /* fault */ - // struct rndis_indicate *msg = (void *)buf; - dev_info(info-control-dev, - rndis fault indication\n); + case RNDIS_MSG_INDICATE: { /* fault/event */ + struct rndis_indicate *msg = (void *)buf; + int state = 0; + + switch (msg-status) { + case RNDIS_STATUS_MEDIA_CONNECT: + state = 1; + case RNDIS_STATUS_MEDIA_DISCONNECT: + dev_info(info-control-dev, + rndis media %sconnect\n, + !state?dis:); + if (dev-driver_info-link_change) + dev-driver_info-link_change( + dev, state); + break; + default: + dev_info(info-control-dev, + rndis indication: 0x%08x\n, + le32_to_cpu(msg-status)); + } } break; case RNDIS_MSG_KEEPALIVE: { /* ping */ diff --git a/drivers/net/usb/usbnet.h b/drivers/net/usb/usbnet.h index 25b63d3..e0501da 100644 --- a/drivers/net/usb/usbnet.h +++ b/drivers/net/usb/usbnet.h @@ -121,6 +121,10 @@ struct driver_info { * right after minidriver have initialized hardware. */ int (*early_init)(struct usbnet *dev); + /* called by minidriver when link state changes, state: 0=disconnect, + * 1=connect */ + void(*link_change)(struct usbnet *dev, int state); + /* for new devices, use the descriptor-reading code instead */ int in; /* rx endpoint */ int out;/* tx endpoint */ -- 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/14] [rndis_host] Add RNDIS physical medium checking into generic_rndis_bind()
On Friday 25 January 2008, Jussi Kivilinna wrote: + if(flags FLAG_RNDIS_PHYM_WIRELESS + *phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) { + dev_err(intf-dev, driver requires wireless physical + medium, but device is not.\n); + retval = -ENODEV; + goto halt_fail_and_release; + } + if(flags FLAG_RNDIS_PHYM_NOT_WIRELESS + *phym == RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) { + dev_err(intf-dev, driver requires non-wireless physical + medium, but device is wireless.\n); + retval = -ENODEV; Well, other than the obvious checkpatch.pl warnings waiting to trigger (if is not a function; put a space before the paren) and what I'd call missing parens around the flags ..., those are *not* errors. No wonder you thought this would cause too many messages!! Just make those be dev_dbg() calls instead. The strongest message level you can argue for there would be KERN_NOTICE, normal but significant; except it's not especially significant. Filtering by netif_msg_probe() may be a good idea too; that's normally enabled in this framework. - Dave p.s. Before these get submitted, *all* of them need to pass checkpatch.pl. Ideally, checkpatch.pl --strict ... -- 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 13/14] Move usbnet.h and rndis_host.h to include/linux/usb
On Friday 25 January 2008, Jussi Kivilinna wrote: Move headers usbnet.h and rndis_host.h to include/linux/usb and fix includes for drivers/net/usb modules. Headers are moved because rndis_wlan will be outside drivers/net/usb in drivers/net/wireless and yet need these headers. Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED] Acked-by: David Brownell [EMAIL PROTECTED] --- drivers/net/usb/asix.c |3 drivers/net/usb/cdc_ether.c|3 drivers/net/usb/cdc_subset.c |3 drivers/net/usb/dm9601.c |3 drivers/net/usb/gl620a.c |3 drivers/net/usb/mcs7830.c |3 drivers/net/usb/net1080.c |3 drivers/net/usb/plusb.c|3 drivers/net/usb/rndis_host.c |5 - drivers/net/usb/rndis_host.h | 274 drivers/net/usb/usbnet.c |3 drivers/net/usb/usbnet.h | 214 --- drivers/net/usb/zaurus.c |3 include/linux/usb/rndis_host.h | 274 include/linux/usb/usbnet.h | 214 +++ 15 files changed, 500 insertions(+), 511 deletions(-) diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 569028b..6f245cf 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c @@ -33,8 +33,7 @@ #include linux/mii.h #include linux/usb.h #include linux/crc32.h - -#include usbnet.h +#include linux/usb/usbnet.h #define DRIVER_VERSION 14-Jun-2006 static const char driver_name [] = asix; diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 97c17bb..a934428 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c @@ -31,8 +31,7 @@ #include linux/mii.h #include linux/usb.h #include linux/usb/cdc.h - -#include usbnet.h +#include linux/usb/usbnet.h #if defined(CONFIG_USB_NET_RNDIS_HOST) || defined(CONFIG_USB_NET_RNDIS_HOST_MODULE) diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c index 943988e..0ec7936 100644 --- a/drivers/net/usb/cdc_subset.c +++ b/drivers/net/usb/cdc_subset.c @@ -26,8 +26,7 @@ #include linux/workqueue.h #include linux/mii.h #include linux/usb.h - -#include usbnet.h +#include linux/usb/usbnet.h /* diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 1ffdd10..5a4e40c 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c @@ -20,8 +20,7 @@ #include linux/mii.h #include linux/usb.h #include linux/crc32.h - -#include usbnet.h +#include linux/usb/usbnet.h /* datasheet: http://www.davicom.com.tw/big5/download/Data%20Sheet/DM9601-DS-P01-930914.pdf diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c index 031cf5c..f7ccfad 100644 --- a/drivers/net/usb/gl620a.c +++ b/drivers/net/usb/gl620a.c @@ -29,8 +29,7 @@ #include linux/workqueue.h #include linux/mii.h #include linux/usb.h - -#include usbnet.h +#include linux/usb/usbnet.h /* diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c index 5ea7411..c3d119f 100644 --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c @@ -31,8 +31,7 @@ #include linux/module.h #include linux/netdevice.h #include linux/usb.h - -#include usbnet.h +#include linux/usb/usbnet.h /* requests */ #define MCS7830_RD_BMREQ (USB_DIR_IN | USB_TYPE_VENDOR | \ diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c index 19bf8da..034e8a7 100644 --- a/drivers/net/usb/net1080.c +++ b/drivers/net/usb/net1080.c @@ -28,11 +28,10 @@ #include linux/workqueue.h #include linux/mii.h #include linux/usb.h +#include linux/usb/usbnet.h #include asm/unaligned.h -#include usbnet.h - /* * Netchip 1080 driver ... http://www.netchip.com diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c index 4530093..08555f8 100644 --- a/drivers/net/usb/plusb.c +++ b/drivers/net/usb/plusb.c @@ -28,8 +28,7 @@ #include linux/workqueue.h #include linux/mii.h #include linux/usb.h - -#include usbnet.h +#include linux/usb/usbnet.h /* diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index 825ff51..411314e 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c @@ -29,9 +29,8 @@ #include linux/mii.h #include linux/usb.h #include linux/usb/cdc.h - -#include usbnet.h -#include rndis_host.h +#include linux/usb/usbnet.h +#include linux/usb/rndis_host.h /* diff --git a/drivers/net/usb/rndis_host.h b/drivers/net/usb/rndis_host.h deleted file mode 100644 index edc1d4a..000 --- a/drivers/net/usb/rndis_host.h +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Host Side support for RNDIS Networking Links - * Copyright (C) 2005 by David Brownell - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License
Re: [PATCH 12/14] [rndis_host] Add RNDIS physical medium checking into generic_rndis_bind()
On Sun, 2008-01-27 at 08:29 -0800, David Brownell wrote: Well, other than the obvious checkpatch.pl warnings waiting to trigger (if is not a function; put a space before the paren) and what I'd call missing parens around the flags ..., those are *not* errors. No wonder you thought this would cause too many messages!! Well, I guess I got lazy between patchsets. Just make those be dev_dbg() calls instead. The strongest message level you can argue for there would be KERN_NOTICE, normal but significant; except it's not especially significant. Filtering by netif_msg_probe() may be a good idea too; that's normally enabled in this framework. I'll use dev_dbg() with netif_msg_probe(). p.s. Before these get submitted, *all* of them need to pass checkpatch.pl. Ideally, checkpatch.pl --strict ... Ok, I'll remember that now. I'm not very familiar with posting patches (as some might have noticed) so I have some questions.. if you don't mind. Now that you have acked most of the patches, is it ok for me to add your 'Acked-by' to those patches? Should I even repost all of these patches as patchset or just ones that have been fixed? Should I post new 'physical medium' patch as reply to this post and then repost patchset with your ack just to mailing list? - Jussi Kivilinna -- 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 10/14] [rndis_host] Add early_init function pointer to 'struct rndis_data'.
On Sun, 2008-01-27 at 08:14 -0800, David Brownell wrote: On Friday 25 January 2008, Jussi Kivilinna wrote: Function pointer is for 'subminidrivers' that need to do work on device right after minidriver has initialized hardware. For example, rndis_wlan setting device specific configuration parameters with OID_GEN_RNDIS_CONFIG_PARAMETER right after rndis_host has initialized hardware with RNDIS_INIT. Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED] Acked-by: David Brownell [EMAIL PROTECTED] ... though I'm not sure I'd coin a term like subminidriver. ;) Hm.. sure there could have been better ways of explaining that but with my inadequate english skills that's what came out first :) -- 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/14] [rndis_host] Add RNDIS physical medium checking into generic_rndis_bind()
On Sunday 27 January 2008, Jussi Kivilinna wrote: I'm not very familiar with posting patches (as some might have noticed) so I have some questions.. if you don't mind. Now that you have acked most of the patches, is it ok for me to add your 'Acked-by' to those patches? On those patches I've acked, yes. (Unless it's a different version from what I acked...) You may not need to re-send them ... that's kind of a policy choice of the subsystem maintainer (Jeff Garzik in this case). Most maintainers pick up acks from the mailing list, as part of their merge process. Should I even repost all of these patches as patchset or just ones that have been fixed? Again, that's a subsystem-specific policy. In most cases I'm familiar with, the answer is to avoid needless reposting ... so after it's acked, at most one repost-with-ack. (And typically not even that, when maintainers pick up the acks.) The main reason to repost an entire patch series is to avoid confusion that creeps in with too many tweaked versions. On the other hand, such reposting creates its own confusion... Should I post new 'physical medium' patch as reply to this post and then repost patchset with your ack just to mailing list? My two cents: just post an updated version of $SUBJECT. If Jeff wants a version with the Acks, he'll tell you (or someone more up on netdev policies will). At this point, assuming you update $SUBJECT patch OK, I think this series is ready for Jeff's attention... - Dave -- 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 12/14 v2] [rndis_host] Add RNDIS physical medium checking into generic_rndis_bind()
Add RNDIS physical medium checking into generic_rndis_bind() and also make rndis_host to be only bind on every medium except wireless. Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED] --- drivers/net/usb/rndis_host.c | 36 +--- drivers/net/usb/rndis_host.h | 19 ++- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index 800c9d0..0606e11 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c @@ -271,7 +271,8 @@ response_error: return -EDOM; } -int generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf) +int +generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags) { int retval; struct net_device *net = dev-net; @@ -287,7 +288,7 @@ int generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf) struct rndis_set_c *set_c; struct rndis_halt *halt; } u; - u32 tmp; + u32 tmp, *phym; int reply_len; unsigned char *bp; @@ -358,6 +359,30 @@ int generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf) dev-driver_info-early_init(dev) != 0) goto halt_fail_and_release; + /* Check physical medium */ + reply_len = sizeof *phym; + retval = rndis_query(dev, intf, u.buf, OID_GEN_PHYSICAL_MEDIUM, + 0, (void **) phym, reply_len); + if (retval != 0) + /* OID is optional so don't fail here. */ + *phym = RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED; + if ((flags FLAG_RNDIS_PHYM_WIRELESS) + *phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) { + if (netif_msg_probe(dev)) + dev_dbg(intf-dev, driver requires wireless + physical medium, but device is not.\n); + retval = -ENODEV; + goto halt_fail_and_release; + } + if ((flags FLAG_RNDIS_PHYM_NOT_WIRELESS) + *phym == RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) { + if (netif_msg_probe(dev)) + dev_dbg(intf-dev, driver requires non-wireless + physical medium, but device is wireless.\n); + retval = -ENODEV; + goto halt_fail_and_release; + } + /* Get designated host ethernet address */ reply_len = ETH_ALEN; retval = rndis_query(dev, intf, u.buf, OID_802_3_PERMANENT_ADDRESS, @@ -403,6 +428,11 @@ fail: } EXPORT_SYMBOL_GPL(generic_rndis_bind); +static int rndis_bind(struct usbnet *dev, struct usb_interface *intf) +{ + return generic_rndis_bind(dev, intf, FLAG_RNDIS_PHYM_NOT_WIRELESS); +} + void rndis_unbind(struct usbnet *dev, struct usb_interface *intf) { struct rndis_halt *halt; @@ -518,7 +548,7 @@ EXPORT_SYMBOL_GPL(rndis_tx_fixup); static const struct driver_inforndis_info = { .description = RNDIS device, .flags =FLAG_ETHER | FLAG_FRAMING_RN | FLAG_NO_SETINT, - .bind = generic_rndis_bind, + .bind = rndis_bind, .unbind = rndis_unbind, .status = rndis_status, .rx_fixup = rndis_rx_fixup, diff --git a/drivers/net/usb/rndis_host.h b/drivers/net/usb/rndis_host.h index 61f1fd8..edc1d4a 100644 --- a/drivers/net/usb/rndis_host.h +++ b/drivers/net/usb/rndis_host.h @@ -82,6 +82,17 @@ struct rndis_msg_hdr { #defineRNDIS_STATUS_MEDIA_CONNECT ccpu2(0x4001000b) #defineRNDIS_STATUS_MEDIA_DISCONNECT ccpu2(0x4001000c) +/* codes for OID_GEN_PHYSICAL_MEDIUM */ +#defineRNDIS_PHYSICAL_MEDIUM_UNSPECIFIED ccpu2(0x) +#defineRNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN ccpu2(0x0001) +#defineRNDIS_PHYSICAL_MEDIUM_CABLE_MODEM ccpu2(0x0002) +#defineRNDIS_PHYSICAL_MEDIUM_PHONE_LINEccpu2(0x0003) +#defineRNDIS_PHYSICAL_MEDIUM_POWER_LINEccpu2(0x0004) +#defineRNDIS_PHYSICAL_MEDIUM_DSL ccpu2(0x0005) +#defineRNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL ccpu2(0x0006) +#defineRNDIS_PHYSICAL_MEDIUM_1394 ccpu2(0x0007) +#defineRNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN ccpu2(0x0008) +#defineRNDIS_PHYSICAL_MEDIUM_MAX ccpu2(0x0009) struct rndis_data_hdr { __le32 msg_type; /* RNDIS_MSG_PACKET */ @@ -222,6 +233,7 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */ #define OID_802_3_PERMANENT_ADDRESSccpu2(0x01010101) #define OID_GEN_MAXIMUM_FRAME_SIZE ccpu2(0x00010106) #define OID_GEN_CURRENT_PACKET_FILTER ccpu2(0x0001010e) +#define OID_GEN_PHYSICAL_MEDIUMccpu2(0x00010202) /*
Re: [PATCHv2 2.6.24] fib: fix route replacement, fib_info is shared
Hi, I have a few questions below: Julian Anastasov wrote, On 01/26/2008 01:41 PM: fib_info can be shared by many route prefixes but we don't want duplicate alternative routes for a prefix+tos+priority. Last change was not correct to check fib_treeref because it accounts usage from other prefixes. Additionally, avoid replacement without error if new route is same, as Joonwoo Park suggests. Signed-off-by: Julian Anastasov [EMAIL PROTECTED] --- --- linux-2.6.24/net/ipv4/fib_hash.c_orig 2008-01-25 10:45:06.0 +0200 +++ linux-2.6.24/net/ipv4/fib_hash.c 2008-01-26 14:11:34.0 +0200 @@ -434,19 +434,43 @@ static int fn_hash_insert(struct fib_tab if (fa fa-fa_tos == tos fa-fa_info-fib_priority == fi-fib_priority) { - struct fib_alias *fa_orig; + struct fib_alias *fa_first, *fa_match; err = -EEXIST; if (cfg-fc_nlflags NLM_F_EXCL) goto out; BTW, the way add works wasn't questioned now, but it seems could be, or man ip should call it e.g. ip route add - add new destination, and append ip route append (unless I have old man). + /* We have 2 goals: + * 1. Find exact match for type, scope, fib_info to avoid + * duplicate routes + * 2. Find next 'fa' (or head), NLM_F_APPEND inserts before it + */ + fa_match = NULL; + fa_first = fa; + fa = list_entry(fa-fa_list.prev, struct fib_alias, fa_list); + list_for_each_entry_continue(fa, f-fn_alias, fa_list) { + if (fa-fa_tos != tos) + break; + if (fa-fa_info-fib_priority != fi-fib_priority) + break; + if (fa-fa_type == cfg-fc_type + fa-fa_scope == cfg-fc_scope + fa-fa_info == fi) { + fa_match = fa; + break; Why can't we try goto out from here? (less reading...) + } + } + if (cfg-fc_nlflags NLM_F_REPLACE) { struct fib_info *fi_drop; u8 state; - if (fi-fib_treeref 1) + fa = fa_first; + if (fa_match) { + if (fa == fa_match) + err = 0; Could you comment more why returning an error seems to depend on the order of aliases here? But, IMHO there is no reason to change the old behavior WRT this error, so probably this err = 0 should be always if NLM_F_REPLACE is set. goto out; - + } write_lock_bh(fib_hash_lock); fi_drop = fa-fa_info; fa-fa_info = fi; @@ -469,20 +493,11 @@ static int fn_hash_insert(struct fib_tab * uses the same scope, type, and nexthop * information. */ - fa_orig = fa; - fa = list_entry(fa-fa_list.prev, struct fib_alias, fa_list); - list_for_each_entry_continue(fa, f-fn_alias, fa_list) { - if (fa-fa_tos != tos) - break; - if (fa-fa_info-fib_priority != fi-fib_priority) - break; - if (fa-fa_type == cfg-fc_type - fa-fa_scope == cfg-fc_scope - fa-fa_info == fi) - goto out; - } + if (fa_match) + goto out; + if (!(cfg-fc_nlflags NLM_F_APPEND)) - fa = fa_orig; + fa = fa_first; } err = -ENOENT; Generally this patch looks OK to me. Thanks, Jarek P. PS: I think, this FIB info you sent earlier is just fine for Documentation/networking without any changes! (Maybe one more 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
[PATCH] SCTP: Fix miss of report unrecognized HMAC Algorithm parameter
This patch fix miss of check for report unrecognized HMAC Algorithm parameter. When AUTH is disabled, goto fall through path to report unrecognized parameter, else, just break. Wei Neil Horman wrote: On Wed, Jan 23, 2008 at 09:30:27AM +0900, Wei Yongjun wrote: This patch fix miss of check for report unrecognized HMAC Algorithm parameter. When AUTH is disabled, goto fall through path to report unrecognized parameter, else, just break. Acked-by: Neil Horman [EMAIL PROTECTED] Neil Can you please send this to netdev and CC Dave Miller.. Acked-by: Vlad Yasevich [EMAIL PROTECTED] -vlad Signed-off-by: Wei Yongjun [EMAIL PROTECTED] Acked-by: Neil Horman [EMAIL PROTECTED] Acked-by: Vlad Yasevich [EMAIL PROTECTED] --- a/net/sctp/sm_make_chunk.c 2008-01-21 00:03:25.0 -0500 +++ b/net/sctp/sm_make_chunk.c 2008-01-21 02:33:36.0 -0500 @@ -2014,7 +2014,7 @@ static sctp_ierror_t sctp_verify_param(c break; case SCTP_PARAM_HMAC_ALGO: - if (!sctp_auth_enable) + if (sctp_auth_enable) break; /* Fall Through */ fallthrough: -- 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] Implement skb_partial_csum_set
Implement skb_partial_csum_set, for setting partial csums on untrusted packets. Use it in virtio_net (replacing buggy version there), it's also going to be used by TAP for partial csum support. Signed-off-by: Rusty Russell [EMAIL PROTECTED] Acked-by: David S. Miller [EMAIL PROTECTED] --- drivers/net/virtio_net.c | 11 +-- include/linux/skbuff.h |1 + net/core/skbuff.c| 29 + 3 files changed, 31 insertions(+), 10 deletions(-) diff -r 72be3d596d31 include/linux/skbuff.h --- a/include/linux/skbuff.hWed Jan 09 15:57:40 2008 +1100 +++ b/include/linux/skbuff.hWed Jan 09 16:56:41 2008 +1100 @@ -1804,5 +1804,6 @@ static inline void skb_forward_csum(stru skb-ip_summed = CHECKSUM_NONE; } +bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); #endif /* __KERNEL__ */ #endif /* _LINUX_SKBUFF_H */ diff -r 72be3d596d31 net/core/skbuff.c --- a/net/core/skbuff.c Wed Jan 09 15:57:40 2008 +1100 +++ b/net/core/skbuff.c Wed Jan 09 16:56:41 2008 +1100 @@ -2214,6 +2214,34 @@ int skb_cow_data(struct sk_buff *skb, in return elt; } +/** + * skb_partial_csum_set - set up and verify partial csum values for packet + * @skb: the skb to set + * @start: the number of bytes after skb-data to start checksumming. + * @off: the offset from start to place the checksum. + * + * For untrusted partially-checksummed packets, we need to make sure the values + * for skb-csum_start and skb-csum_offset are valid so we don't oops. + * + * This function checks and sets those values and skb-ip_summed: if this + * returns false you should drop the packet. + */ +bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off) +{ + if (unlikely(start skb-len - 2) || + unlikely((int)start + off skb-len - 2)) { + if (net_ratelimit()) + printk(KERN_WARNING + bad partial csum: csum=%u/%u len=%u\n, + start, off, skb-len); + return false; + } + skb-ip_summed = CHECKSUM_PARTIAL; + skb-csum_start = skb_headroom(skb) + start; + skb-csum_offset = off; + return true; +} + EXPORT_SYMBOL(___pskb_trim); EXPORT_SYMBOL(__kfree_skb); EXPORT_SYMBOL(kfree_skb); @@ -2250,3 +2278,4 @@ EXPORT_SYMBOL(skb_append_datato_frags); EXPORT_SYMBOL_GPL(skb_to_sgvec); EXPORT_SYMBOL_GPL(skb_cow_data); +EXPORT_SYMBOL_GPL(skb_partial_csum_set); diff -r 72be3d596d31 drivers/net/virtio_net.c --- a/drivers/net/virtio_net.c Wed Jan 09 15:57:40 2008 +1100 +++ b/drivers/net/virtio_net.c Wed Jan 09 16:56:41 2008 +1100 @@ -89,17 +89,8 @@ static void receive_skb(struct net_devic if (hdr-flags VIRTIO_NET_HDR_F_NEEDS_CSUM) { pr_debug(Needs csum!\n); - skb-ip_summed = CHECKSUM_PARTIAL; - skb-csum_start = hdr-csum_start; - skb-csum_offset = hdr-csum_offset; - if (skb-csum_start skb-len - 2 - || skb-csum_offset skb-len - 2) { - if (net_ratelimit()) - printk(KERN_WARNING %s: csum=%u/%u len=%u\n, - dev-name, skb-csum_start, - skb-csum_offset, skb-len); + if (!skb_partial_csum_set(skb,hdr-csum_start,hdr-csum_offset)) goto frame_err; - } } if (hdr-gso_type != VIRTIO_NET_HDR_GSO_NONE) { -- 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:Fix a bug in strategy_allowed_congestion_control
Stephen Hemminger 写道: On Fri, 25 Jan 2008 15:10:13 +0800 shanwei [EMAIL PROTECTED] wrote: hi all: In strategy_allowed_congestion_control of the 2.6.24 kernel, when sysctl_string return 1 on success,it should call tcp_set_allowed_congestion_control to set the allowed congestion control.But, it don't. the sysctl_string return 1 on success, otherwise return negative, never return 0.The patch fix the problem. Signed-off-by: Shan Wei [EMAIL PROTECTED] diff -Nuarp linux-2.6.24/net/ipv4/sysctl_net_ipv4.c linux-2.6.24-new/net/ipv4/sysctl_net_ipv4.c --- linux-2.6.24/net/ipv4/sysctl_net_ipv4.c 2008-01-25 06:58:37.0 +0800 +++ linux-2.6.24-new/net/ipv4/sysctl_net_ipv4.c 2008-01-25 12:23:20.0 +0800 @@ -248,7 +248,7 @@ static int strategy_allowed_congestion_c tcp_get_available_congestion_control(tbl.data, tbl.maxlen); ret = sysctl_string(tbl, name, nlen, oldval, oldlenp, newval, newlen); -if (ret == 0 newval newlen) +if (ret == 1 newval newlen) ret = tcp_set_allowed_congestion_control(tbl.data); kfree(tbl.data); Acked-by: Stephen Hemminger [EMAIL PROTECTED] This parallels previous fix by Sam Jansen. From the link:http://marc.info/?l=linux-netdevm=119551836927062w=2, he only fix the sysctl_tcp_congestion_control function. In the latest kernel, the sysctl_string problem is present. Can this patch be applied? -- 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][INET_DIAG]: Fix inet_diag_lock_handler error path
Fixes: http://bugzilla.kernel.org/show_bug.cgi?id=9825 The inet_diag_lock_handler function uses ERR_PTR to encode errors but its callers were testing against NULL. This only happens when the only inet_diag modular user, DCCP, is not built into the kernel or available as a module. Also there was a problem with not dropping the mutex lock when a handler was not found, also fixed in this patch. This caused an OOPS and ss would then hang on subsequent calls, as inet_diag_table_mutex was being left locked. Thanks to spike at ml.yaroslavl.ru for report it after trying 'ss -d' on a kernel that doesn't have DCCP available. This bug was introduced in cset d523a328fb0271e1a763e985a21f2488fd816e7e, after 2.6.24-rc3, so just 2.6.24 seems to be affected. Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED] diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index e468e7a..6d2979c 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c @@ -259,8 +259,10 @@ static int inet_diag_get_exact(struct sk_buff *in_skb, const struct inet_diag_handler *handler; handler = inet_diag_lock_handler(nlh-nlmsg_type); - if (!handler) - return -ENOENT; + if (IS_ERR(handler)) { + err = PTR_ERR(handler); + goto unlock; + } hashinfo = handler-idiag_hashinfo; err = -EINVAL; @@ -708,8 +710,8 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) struct inet_hashinfo *hashinfo; handler = inet_diag_lock_handler(cb-nlh-nlmsg_type); - if (!handler) - goto no_handler; + if (IS_ERR(handler)) + goto unlock; hashinfo = handler-idiag_hashinfo; @@ -838,7 +840,6 @@ done: cb-args[2] = num; unlock: inet_diag_unlock_handler(handler); -no_handler: return skb-len; } -- 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/14 v2] [rndis_host] Add RNDIS physical medium checking into generic_rndis_bind()
On Sunday 27 January 2008, Jussi Kivilinna wrote: Add RNDIS physical medium checking into generic_rndis_bind() and also make rndis_host to be only bind on every medium except wireless. Signed-off-by: Jussi Kivilinna [EMAIL PROTECTED] Acked-by: David Brownell [EMAIL PROTECTED] I think that means the whole series is fair to merge into the network drivers queue, assuming nobody has any issues with the last patch (adding the actual rndis_wlan support). Thanks for doing this ... it's nice to see folk successfully building on top of this rndis_host code, since it started without any real RNDIS devices to test against! (Just the Linux-USB g_ether peripheral code.) - Dave --- drivers/net/usb/rndis_host.c | 36 +--- drivers/net/usb/rndis_host.h | 19 ++- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index 800c9d0..0606e11 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c @@ -271,7 +271,8 @@ response_error: return -EDOM; } -int generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf) +int +generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags) { int retval; struct net_device *net = dev-net; @@ -287,7 +288,7 @@ int generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf) struct rndis_set_c *set_c; struct rndis_halt *halt; } u; - u32 tmp; + u32 tmp, *phym; int reply_len; unsigned char *bp; @@ -358,6 +359,30 @@ int generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf) dev-driver_info-early_init(dev) != 0) goto halt_fail_and_release; + /* Check physical medium */ + reply_len = sizeof *phym; + retval = rndis_query(dev, intf, u.buf, OID_GEN_PHYSICAL_MEDIUM, + 0, (void **) phym, reply_len); + if (retval != 0) + /* OID is optional so don't fail here. */ + *phym = RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED; + if ((flags FLAG_RNDIS_PHYM_WIRELESS) + *phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) { + if (netif_msg_probe(dev)) + dev_dbg(intf-dev, driver requires wireless + physical medium, but device is not.\n); + retval = -ENODEV; + goto halt_fail_and_release; + } + if ((flags FLAG_RNDIS_PHYM_NOT_WIRELESS) + *phym == RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) { + if (netif_msg_probe(dev)) + dev_dbg(intf-dev, driver requires non-wireless + physical medium, but device is wireless.\n); + retval = -ENODEV; + goto halt_fail_and_release; + } + /* Get designated host ethernet address */ reply_len = ETH_ALEN; retval = rndis_query(dev, intf, u.buf, OID_802_3_PERMANENT_ADDRESS, @@ -403,6 +428,11 @@ fail: } EXPORT_SYMBOL_GPL(generic_rndis_bind); +static int rndis_bind(struct usbnet *dev, struct usb_interface *intf) +{ + return generic_rndis_bind(dev, intf, FLAG_RNDIS_PHYM_NOT_WIRELESS); +} + void rndis_unbind(struct usbnet *dev, struct usb_interface *intf) { struct rndis_halt *halt; @@ -518,7 +548,7 @@ EXPORT_SYMBOL_GPL(rndis_tx_fixup); static const struct driver_info rndis_info = { .description = RNDIS device, .flags =FLAG_ETHER | FLAG_FRAMING_RN | FLAG_NO_SETINT, - .bind = generic_rndis_bind, + .bind = rndis_bind, .unbind = rndis_unbind, .status = rndis_status, .rx_fixup = rndis_rx_fixup, diff --git a/drivers/net/usb/rndis_host.h b/drivers/net/usb/rndis_host.h index 61f1fd8..edc1d4a 100644 --- a/drivers/net/usb/rndis_host.h +++ b/drivers/net/usb/rndis_host.h @@ -82,6 +82,17 @@ struct rndis_msg_hdr { #define RNDIS_STATUS_MEDIA_CONNECT ccpu2(0x4001000b) #define RNDIS_STATUS_MEDIA_DISCONNECT ccpu2(0x4001000c) +/* codes for OID_GEN_PHYSICAL_MEDIUM */ +#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED ccpu2(0x) +#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN ccpu2(0x0001) +#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM ccpu2(0x0002) +#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINEccpu2(0x0003) +#define RNDIS_PHYSICAL_MEDIUM_POWER_LINEccpu2(0x0004) +#define RNDIS_PHYSICAL_MEDIUM_DSL ccpu2(0x0005) +#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL ccpu2(0x0006) +#define RNDIS_PHYSICAL_MEDIUM_1394 ccpu2(0x0007) +#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN ccpu2(0x0008)