From 0aeb829320bb9388e993bbd7b323af64a378078d Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Tue, 1 Feb 2005 20:42:17 -0800 Subject: [PKT_SCHED]: Fix ingress qdisc to pick up IPv6 packets when using netfilter hooks. Fixes the ingress qdisc to pick up IPv6 packets when using the old style netfilter hooks, i.e. when CONFIG_NET_CLS_ACT is not enabled. Signed-off-by: Thomas Graf Signed-off-by: David S. Miller --- net/sched/sch_ingress.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c index fd751a57fff1..8edc32a6ad2f 100644 --- a/net/sched/sch_ingress.c +++ b/net/sched/sch_ingress.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -271,6 +272,14 @@ static struct nf_hook_ops ing_ops = { .priority = NF_IP_PRI_FILTER + 1, }; +static struct nf_hook_ops ing6_ops = { + .hook = ing_hook, + .owner = THIS_MODULE, + .pf = PF_INET6, + .hooknum = NF_IP6_PRE_ROUTING, + .priority = NF_IP6_PRI_FILTER + 1, +}; + #endif #endif @@ -297,6 +306,12 @@ static int ingress_init(struct Qdisc *sch,struct rtattr *opt) return -EINVAL; } nf_registered++; + + if (nf_register_hook(&ing6_ops) < 0) { + printk("IPv6 ingress qdisc registration error, " \ + "disabling IPv6 support.\n"); + } else + nf_registered++; } #endif #endif @@ -408,8 +423,11 @@ static void __exit ingress_module_exit(void) unregister_qdisc(&ingress_qdisc_ops); #ifndef CONFIG_NET_CLS_ACT #ifdef CONFIG_NETFILTER - if (nf_registered) + if (nf_registered) { nf_unregister_hook(&ing_ops); + if (nf_registered > 1) + nf_unregister_hook(&ing6_ops); + } #endif #endif } -- cgit v1.2.3 From d81a225319073c94b19455b0c645bbbdc037f1af Mon Sep 17 00:00:00 2001 From: Robert Olsson Date: Tue, 1 Feb 2005 20:44:14 -0800 Subject: [IPV4]: Add gc_min_interval_ms sysctl. The existing seconds based gc_min_interval is barely usable. Signed-off-by: David S. Miller --- Documentation/filesystems/proc.txt | 9 +++++---- include/linux/sysctl.h | 1 + net/ipv4/route.c | 11 +++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 2c3fc3a2745b..f3f69ad01a87 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt @@ -1709,12 +1709,13 @@ flush Writing to this file results in a flush of the routing cache. -gc_elasticity, gc_interval, gc_min_interval, gc_tresh, gc_timeout, -gc_thresh, gc_thresh1, gc_thresh2, gc_thresh3 --------------------------------------------------------------- +gc_elasticity, gc_interval, gc_min_interval_ms, gc_timeout, gc_thresh +--------------------------------------------------------------------- Values to control the frequency and behavior of the garbage collection -algorithm for the routing cache. +algorithm for the routing cache. gc_min_interval is deprecated and replaced +by gc_min_interval_ms. + max_size -------- diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 8aa91e5bcc28..fee259a872ee 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -365,6 +365,7 @@ enum { NET_IPV4_ROUTE_MIN_PMTU=16, NET_IPV4_ROUTE_MIN_ADVMSS=17, NET_IPV4_ROUTE_SECRET_INTERVAL=18, + NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS=19, }; enum diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 0c5619cdce98..8a06923f8451 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -2529,6 +2529,8 @@ ctl_table ipv4_route_table[] = { .proc_handler = &proc_dointvec, }, { + /* Deprecated. Use gc_min_interval_ms */ + .ctl_name = NET_IPV4_ROUTE_GC_MIN_INTERVAL, .procname = "gc_min_interval", .data = &ip_rt_gc_min_interval, @@ -2537,6 +2539,15 @@ ctl_table ipv4_route_table[] = { .proc_handler = &proc_dointvec_jiffies, .strategy = &sysctl_jiffies, }, + { + .ctl_name = NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS, + .procname = "gc_min_interval_ms", + .data = &ip_rt_gc_min_interval, + .maxlen = sizeof(unsigned long), + .mode = 0644, + .proc_handler = &proc_doulongvec_ms_jiffies_minmax, + .strategy = &sysctl_jiffies, + }, { .ctl_name = NET_IPV4_ROUTE_GC_TIMEOUT, .procname = "gc_timeout", -- cgit v1.2.3 From f59478e12fc15b18efb7abafa6a2c94cffdbfe3d Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Tue, 1 Feb 2005 23:41:06 -0800 Subject: [TG3]: 5704 serdes fixes - Fix capacitive coupling detection by reading the correct offset in sram - Add support for different signal pre-emphasis on 5704S (used in some blade servers) - Improve 5704S link parallel detection. When autonegotiation fails, we only detect link-up if we have PCS_SYNC and we are not receiving config code words. This will prevent false link-up when only the rx cable is attached. Signed-off-by: Michael Chan Signed-off-by: David S. Miller --- drivers/net/tg3.c | 36 ++++++++++++++++++++++++------------ drivers/net/tg3.h | 1 + 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 5fd1f14aed99..b96d0213e7b1 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -2146,8 +2146,9 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status) if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID) port_a = 0; - serdes_cfg = tr32(MAC_SERDES_CFG) & - ((1 << 23) | (1 << 22) | (1 << 21) | (1 << 20)); + /* preserve bits 0-11,13,14 for signal pre-emphasis */ + /* preserve bits 20-23 for voltage regulator */ + serdes_cfg = tr32(MAC_SERDES_CFG) & 0x00f06fff; } sg_dig_ctrl = tr32(SG_DIG_CTRL); @@ -2158,9 +2159,9 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status) u32 val = serdes_cfg; if (port_a) - val |= 0xc010880; + val |= 0xc010000; else - val |= 0x4010880; + val |= 0x4010000; tw32_f(MAC_SERDES_CFG, val); } tw32_f(SG_DIG_CTRL, 0x01388400); @@ -2183,7 +2184,7 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status) if (sg_dig_ctrl != expected_sg_dig_ctrl) { if (workaround) - tw32_f(MAC_SERDES_CFG, serdes_cfg | 0xc011880); + tw32_f(MAC_SERDES_CFG, serdes_cfg | 0xc011000); tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl | (1 << 30)); udelay(5); tw32_f(SG_DIG_CTRL, expected_sg_dig_ctrl); @@ -2224,9 +2225,9 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status) u32 val = serdes_cfg; if (port_a) - val |= 0xc010880; + val |= 0xc010000; else - val |= 0x4010880; + val |= 0x4010000; tw32_f(MAC_SERDES_CFG, val); } @@ -2234,8 +2235,12 @@ static int tg3_setup_fiber_hw_autoneg(struct tg3 *tp, u32 mac_status) tw32_f(SG_DIG_CTRL, 0x01388400); udelay(40); + /* Link parallel detection - link is up */ + /* only if we have PCS_SYNC and not */ + /* receiving config code words */ mac_status = tr32(MAC_STATUS); - if (mac_status & MAC_STATUS_PCS_SYNCED) { + if ((mac_status & MAC_STATUS_PCS_SYNCED) && + !(mac_status & MAC_STATUS_RCVD_CFG)) { tg3_setup_flow_control(tp, 0, 0); current_link_up = 1; } @@ -5416,8 +5421,10 @@ static int tg3_reset_hw(struct tg3 *tp) udelay(10); if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) && + !(tp->tg3_flags2 & TG3_FLG2_SERDES_PREEMPHASIS)) { /* Set drive transmission level to 1.2V */ + /* only if the signal pre-emphasis bit is not set */ val = tr32(MAC_SERDES_CFG); val &= 0xfffff000; val |= 0x880; @@ -7513,6 +7520,8 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) tg3_read_mem(tp, NIC_SRAM_DATA_CFG, &nic_cfg); tp->nic_sram_data_cfg = nic_cfg; + tg3_read_mem(tp, NIC_SRAM_DATA_CFG_2, &cfg2); + eeprom_signature_found = 1; if ((nic_cfg & NIC_SRAM_DATA_CFG_PHY_TYPE_MASK) == @@ -7531,8 +7540,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) eeprom_phy_id = 0; if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) { - tg3_read_mem(tp, NIC_SRAM_DATA_CFG_2, &led_cfg); - led_cfg &= (NIC_SRAM_DATA_CFG_LED_MODE_MASK | + led_cfg = cfg2 & (NIC_SRAM_DATA_CFG_LED_MODE_MASK | SHASTA_EXT_LED_MODE_MASK); } else led_cfg = nic_cfg & NIC_SRAM_DATA_CFG_LED_MODE_MASK; @@ -7590,9 +7598,13 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) if (nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL) tp->tg3_flags |= TG3_FLAG_SERDES_WOL_CAP; - tg3_read_mem(tp, NIC_SRAM_DATA_PHY_ID, &cfg2); if (cfg2 & (1 << 17)) tp->tg3_flags2 |= TG3_FLG2_CAPACITIVE_COUPLING; + + /* serdes signal pre-emphasis in register 0x590 set by */ + /* bootcode if bit 18 is set */ + if (cfg2 & (1 << 18)) + tp->tg3_flags2 |= TG3_FLG2_SERDES_PREEMPHASIS; } /* Reading the PHY ID register can conflict with ASF diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index f91cb0aa6f8b..02b75de37af8 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h @@ -2106,6 +2106,7 @@ struct tg3 { #define TG3_FLG2_CAPACITIVE_COUPLING 0x00004000 #define TG3_FLG2_FLASH 0x00008000 #define TG3_FLG2_HW_TSO 0x00010000 +#define TG3_FLG2_SERDES_PREEMPHASIS 0x00020000 u32 split_mode_max_reqs; #define SPLIT_MODE_5704_MAX_REQ 3 -- cgit v1.2.3 From 6c0bf12fd6abc42160298567e25848bc9ca8589e Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 1 Feb 2005 23:42:18 -0800 Subject: [TG3]: Update driver version and reldate. Signed-off-by: David S. Miller --- drivers/net/tg3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index b96d0213e7b1..0a09d933a770 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -60,8 +60,8 @@ #define DRV_MODULE_NAME "tg3" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "3.19" -#define DRV_MODULE_RELDATE "January 26, 2005" +#define DRV_MODULE_VERSION "3.20" +#define DRV_MODULE_RELDATE "February 2, 2005" #define TG3_DEF_MAC_MODE 0 #define TG3_DEF_RX_MODE 0 -- cgit v1.2.3 From 97d52752736afedddab09c0db190ccceff9570b9 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Wed, 2 Feb 2005 23:18:37 -0800 Subject: [XFRM]: Fix inverted strcmp() test in xfrm_get_byname(). Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- net/xfrm/xfrm_algo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c index 40e41ab847ff..74e995aed022 100644 --- a/net/xfrm/xfrm_algo.c +++ b/net/xfrm/xfrm_algo.c @@ -357,7 +357,7 @@ static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_algo_desc *list, return NULL; for (i = 0; i < entries; i++) { - if (!strcmp(name, list[i].name)) + if (strcmp(name, list[i].name)) continue; if (list[i].available) -- cgit v1.2.3 From 09d3e84de438f217510b604a980befd07b0c8262 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sat, 5 Feb 2005 03:23:27 -0800 Subject: [NET]: Add missing memory barrier to kfree_skb(). Also kill kfree_skb_fast(), that is a relic from fast switching which was killed off years ago. The bug is that in the case where we do the atomic_read() optimization, we need to make sure that reads of skb state later in __kfree_skb() processing (particularly the skb->list BUG check) are not reordered to occur before the counter read by the cpu. Thanks to Olaf Kirch and Anton Blanchard for discovering and helping fix this bug. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- include/linux/skbuff.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index a6b744bccdc8..23e0b48b79a4 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -353,15 +353,11 @@ static inline struct sk_buff *skb_get(struct sk_buff *skb) */ static inline void kfree_skb(struct sk_buff *skb) { - if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users)) - __kfree_skb(skb); -} - -/* Use this if you didn't touch the skb state [for fast switching] */ -static inline void kfree_skb_fast(struct sk_buff *skb) -{ - if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users)) - kfree_skbmem(skb); + if (likely(atomic_read(&skb->users) == 1)) + smp_rmb(); + else if (likely(!atomic_dec_and_test(&skb->users))) + return; + __kfree_skb(skb); } /** -- cgit v1.2.3 From 9eabad0207272c6cc0d50a067732ffc8d9a22f6f Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sat, 5 Feb 2005 03:24:20 -0800 Subject: [NET]: Add barriers for dst refcnt. In light of the recent discussion about sk_buff, I think we need the following patch for dst_entry. This adds a memory barrier before dst_release drops the refcnt, and a read memory barrier before dst_destroy starts destroying the entry. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- include/net/dst.h | 1 + net/core/dst.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/net/dst.h b/include/net/dst.h index 7ffb470d0e9a..d214a5781c17 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -147,6 +147,7 @@ void dst_release(struct dst_entry * dst) { if (dst) { WARN_ON(atomic_read(&dst->__refcnt) < 1); + smp_mb__before_atomic_dec(); atomic_dec(&dst->__refcnt); } } diff --git a/net/core/dst.c b/net/core/dst.c index f1c95a538e3b..bca63465b0f1 100644 --- a/net/core/dst.c +++ b/net/core/dst.c @@ -169,6 +169,8 @@ struct dst_entry *dst_destroy(struct dst_entry * dst) struct neighbour *neigh; struct hh_cache *hh; + smp_rmb(); + again: neigh = dst->neighbour; hh = dst->hh; -- cgit v1.2.3