From ba6cb44cd60479aefb8e9e3431ded8e3c0b77328 Mon Sep 17 00:00:00 2001 From: Andy Fleming Date: Wed, 23 Apr 2008 16:56:17 -0500 Subject: [PATCH] --- yaml --- r: 93091 b: refs/heads/master c: f38d1008b034e39397d3da67919e220c851db75e h: refs/heads/master i: 93089: a589a9393115c8dabad3d87bb3aad0e82f604aba 93087: 715a705de42e1f5269ad1a97edab086c7f90fdc4 v: v3 --- [refs] | 2 +- trunk/drivers/net/niu.c | 371 ++++------------------------------- trunk/drivers/net/niu.h | 12 -- trunk/drivers/net/tg3.c | 2 - trunk/drivers/net/ucc_geth.c | 2 +- trunk/include/linux/xfrm.h | 8 +- trunk/net/core/ethtool.c | 5 - trunk/net/ipv4/tcp_probe.c | 9 +- trunk/net/ipv6/Kconfig | 2 +- trunk/net/ipv6/raw.c | 18 -- 10 files changed, 53 insertions(+), 378 deletions(-) diff --git a/[refs] b/[refs] index 49cffe300f32..284b935702ef 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 461e6c856faf9cdd8862fa4d0785974a64e39dba +refs/heads/master: f38d1008b034e39397d3da67919e220c851db75e diff --git a/trunk/drivers/net/niu.c b/trunk/drivers/net/niu.c index 4009c4ce96b4..7565c2d7f30e 100644 --- a/trunk/drivers/net/niu.c +++ b/trunk/drivers/net/niu.c @@ -33,8 +33,8 @@ #define DRV_MODULE_NAME "niu" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "0.8" -#define DRV_MODULE_RELDATE "April 24, 2008" +#define DRV_MODULE_VERSION "0.7" +#define DRV_MODULE_RELDATE "February 18, 2008" static char version[] __devinitdata = DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; @@ -673,16 +673,11 @@ static int serdes_init_10g(struct niu *np) } if ((sig & mask) != val) { - if (np->flags & NIU_FLAGS_HOTPLUG_PHY) { - np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; - return 0; - } dev_err(np->device, PFX "Port %u signal bits [%08x] are not " "[%08x]\n", np->port, (int) (sig & mask), (int) val); return -ENODEV; } - if (np->flags & NIU_FLAGS_HOTPLUG_PHY) - np->flags |= NIU_FLAGS_HOTPLUG_PHY_PRESENT; + return 0; } @@ -1003,28 +998,6 @@ static int bcm8704_user_dev3_readback(struct niu *np, int reg) return 0; } -static int bcm8706_init_user_dev3(struct niu *np) -{ - int err; - - - err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, - BCM8704_USER_OPT_DIGITAL_CTRL); - if (err < 0) - return err; - err &= ~USER_ODIG_CTRL_GPIOS; - err |= (0x3 << USER_ODIG_CTRL_GPIOS_SHIFT); - err |= USER_ODIG_CTRL_RESV2; - err = mdio_write(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, - BCM8704_USER_OPT_DIGITAL_CTRL, err); - if (err) - return err; - - mdelay(1000); - - return 0; -} - static int bcm8704_init_user_dev3(struct niu *np) { int err; @@ -1154,11 +1127,33 @@ static int xcvr_init_10g_mrvl88x2011(struct niu *np) MRVL88X2011_10G_PMD_TX_DIS, MRVL88X2011_ENA_PMDTX); } - -static int xcvr_diag_bcm870x(struct niu *np) +static int xcvr_init_10g_bcm8704(struct niu *np) { + struct niu_link_config *lp = &np->link_config; u16 analog_stat0, tx_alarm_status; - int err = 0; + int err; + + err = bcm8704_reset(np); + if (err) + return err; + + err = bcm8704_init_user_dev3(np); + if (err) + return err; + + err = mdio_read(np, np->phy_addr, BCM8704_PCS_DEV_ADDR, + MII_BMCR); + if (err < 0) + return err; + err &= ~BMCR_LOOPBACK; + + if (lp->loopback_mode == LOOPBACK_MAC) + err |= BMCR_LOOPBACK; + + err = mdio_write(np, np->phy_addr, BCM8704_PCS_DEV_ADDR, + MII_BMCR, err); + if (err) + return err; #if 1 err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR, @@ -1216,89 +1211,6 @@ static int xcvr_diag_bcm870x(struct niu *np) return 0; } -static int xcvr_10g_set_lb_bcm870x(struct niu *np) -{ - struct niu_link_config *lp = &np->link_config; - int err; - - err = mdio_read(np, np->phy_addr, BCM8704_PCS_DEV_ADDR, - MII_BMCR); - if (err < 0) - return err; - - err &= ~BMCR_LOOPBACK; - - if (lp->loopback_mode == LOOPBACK_MAC) - err |= BMCR_LOOPBACK; - - err = mdio_write(np, np->phy_addr, BCM8704_PCS_DEV_ADDR, - MII_BMCR, err); - if (err) - return err; - - return 0; -} - -static int xcvr_init_10g_bcm8706(struct niu *np) -{ - int err = 0; - u64 val; - - if ((np->flags & NIU_FLAGS_HOTPLUG_PHY) && - (np->flags & NIU_FLAGS_HOTPLUG_PHY_PRESENT) == 0) - return err; - - val = nr64_mac(XMAC_CONFIG); - val &= ~XMAC_CONFIG_LED_POLARITY; - val |= XMAC_CONFIG_FORCE_LED_ON; - nw64_mac(XMAC_CONFIG, val); - - val = nr64(MIF_CONFIG); - val |= MIF_CONFIG_INDIRECT_MODE; - nw64(MIF_CONFIG, val); - - err = bcm8704_reset(np); - if (err) - return err; - - err = xcvr_10g_set_lb_bcm870x(np); - if (err) - return err; - - err = bcm8706_init_user_dev3(np); - if (err) - return err; - - err = xcvr_diag_bcm870x(np); - if (err) - return err; - - return 0; -} - -static int xcvr_init_10g_bcm8704(struct niu *np) -{ - int err; - - err = bcm8704_reset(np); - if (err) - return err; - - err = bcm8704_init_user_dev3(np); - if (err) - return err; - - err = xcvr_10g_set_lb_bcm870x(np); - if (err) - return err; - - err = xcvr_diag_bcm870x(np); - if (err) - return err; - - return 0; -} - static int xcvr_init_10g(struct niu *np) { int phy_id, err; @@ -1636,59 +1548,6 @@ static int link_status_10g_mrvl(struct niu *np, int *link_up_p) return err; } -static int link_status_10g_bcm8706(struct niu *np, int *link_up_p) -{ - int err, link_up; - link_up = 0; - - err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR, - BCM8704_PMD_RCV_SIGDET); - if (err < 0) - goto out; - if (!(err & PMD_RCV_SIGDET_GLOBAL)) { - err = 0; - goto out; - } - - err = mdio_read(np, np->phy_addr, BCM8704_PCS_DEV_ADDR, - BCM8704_PCS_10G_R_STATUS); - if (err < 0) - goto out; - - if (!(err & PCS_10G_R_STATUS_BLK_LOCK)) { - err = 0; - goto out; - } - - err = mdio_read(np, np->phy_addr, BCM8704_PHYXS_DEV_ADDR, - BCM8704_PHYXS_XGXS_LANE_STAT); - if (err < 0) - goto out; - if (err != (PHYXS_XGXS_LANE_STAT_ALINGED | - PHYXS_XGXS_LANE_STAT_MAGIC | - PHYXS_XGXS_LANE_STAT_PATTEST | - PHYXS_XGXS_LANE_STAT_LANE3 | - PHYXS_XGXS_LANE_STAT_LANE2 | - PHYXS_XGXS_LANE_STAT_LANE1 | - PHYXS_XGXS_LANE_STAT_LANE0)) { - err = 0; - np->link_config.active_speed = SPEED_INVALID; - np->link_config.active_duplex = DUPLEX_INVALID; - goto out; - } - - link_up = 1; - np->link_config.active_speed = SPEED_10000; - np->link_config.active_duplex = DUPLEX_FULL; - err = 0; - -out: - *link_up_p = link_up; - if (np->flags & NIU_FLAGS_HOTPLUG_PHY) - err = 0; - return err; -} - static int link_status_10g_bcom(struct niu *np, int *link_up_p) { int err, link_up; @@ -1768,82 +1627,6 @@ static int link_status_10g(struct niu *np, int *link_up_p) return err; } -static int niu_10g_phy_present(struct niu *np) -{ - u64 sig, mask, val; - - sig = nr64(ESR_INT_SIGNALS); - switch (np->port) { - case 0: - mask = ESR_INT_SIGNALS_P0_BITS; - val = (ESR_INT_SRDY0_P0 | - ESR_INT_DET0_P0 | - ESR_INT_XSRDY_P0 | - ESR_INT_XDP_P0_CH3 | - ESR_INT_XDP_P0_CH2 | - ESR_INT_XDP_P0_CH1 | - ESR_INT_XDP_P0_CH0); - break; - - case 1: - mask = ESR_INT_SIGNALS_P1_BITS; - val = (ESR_INT_SRDY0_P1 | - ESR_INT_DET0_P1 | - ESR_INT_XSRDY_P1 | - ESR_INT_XDP_P1_CH3 | - ESR_INT_XDP_P1_CH2 | - ESR_INT_XDP_P1_CH1 | - ESR_INT_XDP_P1_CH0); - break; - - default: - return 0; - } - - if ((sig & mask) != val) - return 0; - return 1; -} - -static int link_status_10g_hotplug(struct niu *np, int *link_up_p) -{ - unsigned long flags; - int err = 0; - int phy_present; - int phy_present_prev; - - spin_lock_irqsave(&np->lock, flags); - - if (np->link_config.loopback_mode == LOOPBACK_DISABLED) { - phy_present_prev = (np->flags & NIU_FLAGS_HOTPLUG_PHY_PRESENT) ? - 1 : 0; - phy_present = niu_10g_phy_present(np); - if (phy_present != phy_present_prev) { - /* state change */ - if (phy_present) { - np->flags |= NIU_FLAGS_HOTPLUG_PHY_PRESENT; - if (np->phy_ops->xcvr_init) - err = np->phy_ops->xcvr_init(np); - if (err) { - /* debounce */ - np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; - } - } else { - np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; - *link_up_p = 0; - niuwarn(LINK, "%s: Hotplug PHY Removed\n", - np->dev->name); - } - } - if (np->flags & NIU_FLAGS_HOTPLUG_PHY_PRESENT) - err = link_status_10g_bcm8706(np, link_up_p); - } - - spin_unlock_irqrestore(&np->lock, flags); - - return err; -} - static int link_status_1g(struct niu *np, int *link_up_p) { struct niu_link_config *lp = &np->link_config; @@ -1978,12 +1761,6 @@ static const struct niu_phy_ops phy_ops_10g_fiber = { .link_status = link_status_10g, }; -static const struct niu_phy_ops phy_ops_10g_fiber_hotplug = { - .serdes_init = serdes_init_10g, - .xcvr_init = xcvr_init_10g_bcm8706, - .link_status = link_status_10g_hotplug, -}; - static const struct niu_phy_ops phy_ops_10g_copper = { .serdes_init = serdes_init_10g, .link_status = link_status_10g, /* XXX */ @@ -2015,11 +1792,6 @@ static const struct niu_phy_template phy_template_10g_fiber = { .phy_addr_base = 8, }; -static const struct niu_phy_template phy_template_10g_fiber_hotplug = { - .ops = &phy_ops_10g_fiber_hotplug, - .phy_addr_base = 8, -}; - static const struct niu_phy_template phy_template_10g_copper = { .ops = &phy_ops_10g_copper, .phy_addr_base = 10, @@ -2224,13 +1996,6 @@ static int niu_determine_phy_disposition(struct niu *np) plat_type == PLAT_TYPE_VF_P1) phy_addr_off = 8; phy_addr_off += np->port; - if (np->flags & NIU_FLAGS_HOTPLUG_PHY) { - tp = &phy_template_10g_fiber_hotplug; - if (np->port == 0) - phy_addr_off = 8; - if (np->port == 1) - phy_addr_off = 12; - } break; case NIU_FLAGS_10G | NIU_FLAGS_XCVR_SERDES: @@ -7008,37 +6773,6 @@ static int __devinit niu_phy_type_prop_decode(struct niu *np, return 0; } -/* niu board models have a trailing dash version incremented - * with HW rev change. Need to ingnore the dash version while - * checking for match - * - * for example, for the 10G card the current vpd.board_model - * is 501-5283-04, of which -04 is the dash version and have - * to be ignored - */ -static int niu_board_model_match(struct niu *np, const char *model) -{ - return !strncmp(np->vpd.board_model, model, strlen(model)); -} - -static int niu_pci_vpd_get_nports(struct niu *np) -{ - int ports = 0; - - if ((niu_board_model_match(np, NIU_QGC_LP_BM_STR)) || - (niu_board_model_match(np, NIU_QGC_PEM_BM_STR)) || - (niu_board_model_match(np, NIU_ALONSO_BM_STR))) { - ports = 4; - } else if ((niu_board_model_match(np, NIU_2XGF_LP_BM_STR)) || - (niu_board_model_match(np, NIU_2XGF_PEM_BM_STR)) || - (niu_board_model_match(np, NIU_FOXXY_BM_STR)) || - (niu_board_model_match(np, NIU_2XGF_MRVL_BM_STR))) { - ports = 2; - } - - return ports; -} - static void __devinit niu_pci_vpd_validate(struct niu *np) { struct net_device *dev = np->dev; @@ -7065,9 +6799,6 @@ static void __devinit niu_pci_vpd_validate(struct niu *np) } if (np->flags & NIU_FLAGS_10G) np->mac_xcvr = MAC_XCVR_XPCS; - } else if (niu_board_model_match(np, NIU_FOXXY_BM_STR)) { - np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER | - NIU_FLAGS_HOTPLUG_PHY); } else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { dev_err(np->device, PFX "Illegal phy string [%s].\n", np->vpd.phy_type); @@ -7256,17 +6987,11 @@ static int __devinit niu_get_and_validate_port(struct niu *np) if (parent->plat_type == PLAT_TYPE_NIU) { parent->num_ports = 2; } else { - parent->num_ports = niu_pci_vpd_get_nports(np); - if (!parent->num_ports) { - /* Fall back to SPROM as last resort. - * This will fail on most cards. - */ - parent->num_ports = nr64(ESPC_NUM_PORTS_MACS) & - ESPC_NUM_PORTS_MACS_VAL; - - if (!parent->num_ports) - return -ENODEV; - } + parent->num_ports = nr64(ESPC_NUM_PORTS_MACS) & + ESPC_NUM_PORTS_MACS_VAL; + + if (!parent->num_ports) + parent->num_ports = 4; } } @@ -7290,8 +7015,7 @@ static int __devinit phy_record(struct niu_parent *parent, return 0; if (type == PHY_TYPE_PMA_PMD || type == PHY_TYPE_PCS) { if (((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8704) && - ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_MRVL88X2011) && - ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8706)) + ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_MRVL88X2011)) return 0; } else { if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM5464R) @@ -7538,6 +7262,7 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent) u32 val; int err; + if (!strcmp(np->vpd.model, "SUNW,CP3220") || !strcmp(np->vpd.model, "SUNW,CP3260")) { num_10g = 0; @@ -7548,12 +7273,6 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent) phy_encode(PORT_TYPE_1G, 1) | phy_encode(PORT_TYPE_1G, 2) | phy_encode(PORT_TYPE_1G, 3)); - } else if (niu_board_model_match(np, NIU_FOXXY_BM_STR)) { - num_10g = 2; - num_1g = 0; - parent->num_ports = 2; - val = (phy_encode(PORT_TYPE_10G, 0) | - phy_encode(PORT_TYPE_10G, 1)); } else { err = fill_phy_probe_info(np, parent, info); if (err) @@ -8014,16 +7733,15 @@ static int __devinit niu_get_invariants(struct niu *np) have_props = !err; - err = niu_init_mac_ipp_pcs_base(np); + err = niu_get_and_validate_port(np); if (err) return err; - if (have_props) { - err = niu_get_and_validate_port(np); - if (err) - return err; + err = niu_init_mac_ipp_pcs_base(np); + if (err) + return err; - } else { + if (!have_props) { if (np->parent->plat_type == PLAT_TYPE_NIU) return -EINVAL; @@ -8035,17 +7753,10 @@ static int __devinit niu_get_invariants(struct niu *np) niu_pci_vpd_fetch(np, offset); nw64(ESPC_PIO_EN, 0); - if (np->flags & NIU_FLAGS_VPD_VALID) { + if (np->flags & NIU_FLAGS_VPD_VALID) niu_pci_vpd_validate(np); - err = niu_get_and_validate_port(np); - if (err) - return err; - } if (!(np->flags & NIU_FLAGS_VPD_VALID)) { - err = niu_get_and_validate_port(np); - if (err) - return err; err = niu_pci_probe_sprom(np); if (err) return err; diff --git a/trunk/drivers/net/niu.h b/trunk/drivers/net/niu.h index 97ffbe137bcb..336aed08b275 100644 --- a/trunk/drivers/net/niu.h +++ b/trunk/drivers/net/niu.h @@ -2537,7 +2537,6 @@ struct fcram_hash_ipv6 { #define NIU_PHY_ID_MASK 0xfffff0f0 #define NIU_PHY_ID_BCM8704 0x00206030 -#define NIU_PHY_ID_BCM8706 0x00206035 #define NIU_PHY_ID_BCM5464R 0x002060b0 #define NIU_PHY_ID_MRVL88X2011 0x01410020 @@ -2938,15 +2937,6 @@ struct rx_ring_info { #define NIU_MAX_MTU 9216 -/* VPD strings */ -#define NIU_QGC_LP_BM_STR "501-7606" -#define NIU_2XGF_LP_BM_STR "501-7283" -#define NIU_QGC_PEM_BM_STR "501-7765" -#define NIU_2XGF_PEM_BM_STR "501-7626" -#define NIU_ALONSO_BM_STR "373-0202" -#define NIU_FOXXY_BM_STR "501-7961" -#define NIU_2XGF_MRVL_BM_STR "SK-6E82" - #define NIU_VPD_MIN_MAJOR 3 #define NIU_VPD_MIN_MINOR 4 @@ -3209,8 +3199,6 @@ struct niu { struct niu_parent *parent; u32 flags; -#define NIU_FLAGS_HOTPLUG_PHY_PRESENT 0x02000000 /* Removebale PHY detected*/ -#define NIU_FLAGS_HOTPLUG_PHY 0x01000000 /* Removebale PHY */ #define NIU_FLAGS_VPD_VALID 0x00800000 /* VPD has valid version */ #define NIU_FLAGS_MSIX 0x00400000 /* MSI-X in use */ #define NIU_FLAGS_MCAST 0x00200000 /* multicast filter enabled */ diff --git a/trunk/drivers/net/tg3.c b/trunk/drivers/net/tg3.c index e3f74c9f78bd..bc4c62b8e81a 100644 --- a/trunk/drivers/net/tg3.c +++ b/trunk/drivers/net/tg3.c @@ -4017,8 +4017,6 @@ static int tg3_halt(struct tg3 *, int, int); * Invoked with tp->lock held. */ static int tg3_restart_hw(struct tg3 *tp, int reset_phy) - __releases(tp->lock) - __acquires(tp->lock) { int err; diff --git a/trunk/drivers/net/ucc_geth.c b/trunk/drivers/net/ucc_geth.c index 29a4d650e8a8..0aac91c3e4e4 100644 --- a/trunk/drivers/net/ucc_geth.c +++ b/trunk/drivers/net/ucc_geth.c @@ -3926,7 +3926,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma ug_info->uf_info.irq = irq_of_parse_and_map(np, 0); fixed_link = of_get_property(np, "fixed-link", NULL); if (fixed_link) { - ug_info->mdio_bus = 0; + snprintf(ug_info->mdio_bus, MII_BUS_ID_SIZE, "0"); ug_info->phy_address = fixed_link[0]; phy = NULL; } else { diff --git a/trunk/include/linux/xfrm.h b/trunk/include/linux/xfrm.h index 2ca6bae88721..0c82c80b277f 100644 --- a/trunk/include/linux/xfrm.h +++ b/trunk/include/linux/xfrm.h @@ -97,10 +97,10 @@ struct xfrm_algo { }; struct xfrm_algo_aead { - char alg_name[64]; - unsigned int alg_key_len; /* in bits */ - unsigned int alg_icv_len; /* in bits */ - char alg_key[0]; + char alg_name[64]; + int alg_key_len; /* in bits */ + int alg_icv_len; /* in bits */ + char alg_key[0]; }; struct xfrm_stats { diff --git a/trunk/net/core/ethtool.c b/trunk/net/core/ethtool.c index 0133b5ebd545..a29b43d0b450 100644 --- a/trunk/net/core/ethtool.c +++ b/trunk/net/core/ethtool.c @@ -323,11 +323,6 @@ static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr) bytes_remaining -= eeprom.len; } - eeprom.len = userbuf - (useraddr + sizeof(eeprom)); - eeprom.offset -= eeprom.len; - if (copy_to_user(useraddr, &eeprom, sizeof(eeprom))) - ret = -EFAULT; - kfree(data); return ret; } diff --git a/trunk/net/ipv4/tcp_probe.c b/trunk/net/ipv4/tcp_probe.c index 5ff0ce6e9d39..1c509592574a 100644 --- a/trunk/net/ipv4/tcp_probe.c +++ b/trunk/net/ipv4/tcp_probe.c @@ -190,18 +190,19 @@ static ssize_t tcpprobe_read(struct file *file, char __user *buf, width = tcpprobe_sprint(tbuf, sizeof(tbuf)); - if (cnt + width < len) + if (width < len) tcp_probe.tail = (tcp_probe.tail + 1) % bufsize; spin_unlock_bh(&tcp_probe.lock); /* if record greater than space available return partial buffer (so far) */ - if (cnt + width >= len) + if (width >= len) break; - if (copy_to_user(buf + cnt, tbuf, width)) - return -EFAULT; + error = copy_to_user(buf + cnt, tbuf, width); + if (error) + break; cnt += width; } diff --git a/trunk/net/ipv6/Kconfig b/trunk/net/ipv6/Kconfig index b2c9becc02e8..42814a2ec9d7 100644 --- a/trunk/net/ipv6/Kconfig +++ b/trunk/net/ipv6/Kconfig @@ -167,7 +167,7 @@ config IPV6_SIT Tunneling means encapsulating data of one protocol type within another protocol and sending it over a channel that understands the encapsulating protocol. This driver implements encapsulation of IPv6 - into IPv4 packets. This is useful if you want to connect to IPv6 + into IPv4 packets. This is useful if you want to connect two IPv6 networks over an IPv4-only path. Saying M here will produce a module called sit.ko. If unsure, say Y. diff --git a/trunk/net/ipv6/raw.c b/trunk/net/ipv6/raw.c index 396f0ea11090..6193b124cbc7 100644 --- a/trunk/net/ipv6/raw.c +++ b/trunk/net/ipv6/raw.c @@ -971,19 +971,6 @@ static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, switch (optname) { case IPV6_CHECKSUM: - if (inet_sk(sk)->num == IPPROTO_ICMPV6 && - level == IPPROTO_IPV6) { - /* - * RFC3542 tells that IPV6_CHECKSUM socket - * option in the IPPROTO_IPV6 level is not - * allowed on ICMPv6 sockets. - * If you want to set it, use IPPROTO_RAW - * level IPV6_CHECKSUM socket option - * (Linux extension). - */ - return -EINVAL; - } - /* You may get strange result with a positive odd offset; RFC2292bis agrees with me. */ if (val > 0 && (val&1)) @@ -1059,11 +1046,6 @@ static int do_rawv6_getsockopt(struct sock *sk, int level, int optname, switch (optname) { case IPV6_CHECKSUM: - /* - * We allow getsockopt() for IPPROTO_IPV6-level - * IPV6_CHECKSUM socket option on ICMPv6 sockets - * since RFC3542 is silent about it. - */ if (rp->checksum == 0) val = -1; else