From 24549c4cf5793611147f84b63a5c21f9d74e2e1a Mon Sep 17 00:00:00 2001 From: Don Skidmore Date: Wed, 24 Oct 2012 06:19:01 +0000 Subject: [PATCH] --- yaml --- r: 340550 b: refs/heads/master c: d7bbcd32adafee94e965d9ca188ddeede4c94597 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/x86/net/bpf_jit_comp.c | 21 -- trunk/drivers/net/ethernet/cadence/Kconfig | 1 - .../net/ethernet/chelsio/cxgb3/common.h | 7 +- trunk/drivers/net/ethernet/dlink/dl2k.c | 16 +- .../drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 + .../net/ethernet/intel/ixgbe/ixgbe_82599.c | 114 +++++++--- .../net/ethernet/intel/ixgbe/ixgbe_common.c | 70 +++++- .../net/ethernet/intel/ixgbe/ixgbe_main.c | 59 +---- .../net/ethernet/intel/ixgbe/ixgbe_sriov.c | 3 - .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 10 - .../drivers/net/ethernet/marvell/pxa168_eth.c | 7 +- .../qlogic/netxen/netxen_nic_ethtool.c | 7 - trunk/drivers/net/ethernet/qlogic/qla3xxx.c | 16 +- trunk/drivers/net/ethernet/realtek/r8169.c | 13 +- trunk/drivers/net/usb/Kconfig | 2 - trunk/drivers/net/usb/smsc95xx.c | 127 +---------- trunk/drivers/net/usb/smsc95xx.h | 5 - trunk/include/linux/filter.h | 2 - trunk/include/linux/netdevice.h | 10 - trunk/include/linux/rtnetlink.h | 3 - trunk/include/linux/skbuff.h | 2 +- trunk/include/uapi/linux/filter.h | 4 +- trunk/include/uapi/linux/if_bridge.h | 18 -- trunk/net/batman-adv/bat_iv_ogm.c | 43 ++-- trunk/net/batman-adv/bitarray.c | 23 +- trunk/net/batman-adv/bridge_loop_avoidance.c | 36 ++- trunk/net/batman-adv/debugfs.c | 6 +- trunk/net/batman-adv/gateway_client.c | 19 +- trunk/net/batman-adv/hard-interface.c | 4 +- trunk/net/batman-adv/icmp_socket.c | 12 +- trunk/net/batman-adv/main.c | 46 +--- trunk/net/batman-adv/main.h | 19 +- trunk/net/batman-adv/originator.c | 19 +- trunk/net/batman-adv/routing.c | 54 +++-- trunk/net/batman-adv/soft-interface.c | 56 +---- trunk/net/batman-adv/sysfs.c | 49 +++++ trunk/net/batman-adv/translation-table.c | 77 ++++--- trunk/net/batman-adv/translation-table.h | 6 +- trunk/net/batman-adv/types.h | 16 +- trunk/net/bridge/br_device.c | 2 - trunk/net/bridge/br_netlink.c | 75 +++++-- trunk/net/bridge/br_private.h | 7 +- trunk/net/core/filter.c | 9 - trunk/net/core/rtnetlink.c | 207 ------------------ trunk/net/ipv4/ipconfig.c | 6 +- trunk/net/ipv4/tcp_ipv4.c | 2 +- 47 files changed, 528 insertions(+), 785 deletions(-) diff --git a/[refs] b/[refs] index 60b0b925e87e..6a741a1d83a5 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f7b4fb22b838f895ce9fa994f0ef4f7f541f5266 +refs/heads/master: d7bbcd32adafee94e965d9ca188ddeede4c94597 diff --git a/trunk/arch/x86/net/bpf_jit_comp.c b/trunk/arch/x86/net/bpf_jit_comp.c index d11a47099d33..520d2bd0b9c5 100644 --- a/trunk/arch/x86/net/bpf_jit_comp.c +++ b/trunk/arch/x86/net/bpf_jit_comp.c @@ -11,7 +11,6 @@ #include #include #include -#include /* * Conventions : @@ -213,8 +212,6 @@ void bpf_jit_compile(struct sk_filter *fp) case BPF_S_ANC_MARK: case BPF_S_ANC_RXHASH: case BPF_S_ANC_CPU: - case BPF_S_ANC_VLAN_TAG: - case BPF_S_ANC_VLAN_TAG_PRESENT: case BPF_S_ANC_QUEUE: case BPF_S_LD_W_ABS: case BPF_S_LD_H_ABS: @@ -518,24 +515,6 @@ void bpf_jit_compile(struct sk_filter *fp) CLEAR_A(); #endif break; - case BPF_S_ANC_VLAN_TAG: - case BPF_S_ANC_VLAN_TAG_PRESENT: - BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); - if (is_imm8(offsetof(struct sk_buff, vlan_tci))) { - /* movzwl off8(%rdi),%eax */ - EMIT4(0x0f, 0xb7, 0x47, offsetof(struct sk_buff, vlan_tci)); - } else { - EMIT3(0x0f, 0xb7, 0x87); /* movzwl off32(%rdi),%eax */ - EMIT(offsetof(struct sk_buff, vlan_tci), 4); - } - BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000); - if (filter[i].code == BPF_S_ANC_VLAN_TAG) { - EMIT3(0x80, 0xe4, 0xef); /* and $0xef,%ah */ - } else { - EMIT3(0xc1, 0xe8, 0x0c); /* shr $0xc,%eax */ - EMIT3(0x83, 0xe0, 0x01); /* and $0x1,%eax */ - } - break; case BPF_S_LD_W_ABS: func = CHOOSE_LOAD_FUNC(K, sk_load_word); common_load: seen |= SEEN_DATAREF; diff --git a/trunk/drivers/net/ethernet/cadence/Kconfig b/trunk/drivers/net/ethernet/cadence/Kconfig index ceb0de0cf62c..40172d1ca605 100644 --- a/trunk/drivers/net/ethernet/cadence/Kconfig +++ b/trunk/drivers/net/ethernet/cadence/Kconfig @@ -4,7 +4,6 @@ config NET_CADENCE bool "Cadence devices" - depends on HAS_IOMEM default y ---help--- If you have a network (Ethernet) card belonging to this class, say Y. diff --git a/trunk/drivers/net/ethernet/chelsio/cxgb3/common.h b/trunk/drivers/net/ethernet/chelsio/cxgb3/common.h index 8c82248ce416..df01b6343241 100644 --- a/trunk/drivers/net/ethernet/chelsio/cxgb3/common.h +++ b/trunk/drivers/net/ethernet/chelsio/cxgb3/common.h @@ -42,9 +42,10 @@ #include #include "version.h" -#define CH_ERR(adap, fmt, ...) dev_err(&adap->pdev->dev, fmt, ##__VA_ARGS__) -#define CH_WARN(adap, fmt, ...) dev_warn(&adap->pdev->dev, fmt, ##__VA_ARGS__) -#define CH_ALERT(adap, fmt, ...) dev_alert(&adap->pdev->dev, fmt, ##__VA_ARGS__) +#define CH_ERR(adap, fmt, ...) dev_err(&adap->pdev->dev, fmt, ## __VA_ARGS__) +#define CH_WARN(adap, fmt, ...) dev_warn(&adap->pdev->dev, fmt, ## __VA_ARGS__) +#define CH_ALERT(adap, fmt, ...) \ + dev_printk(KERN_ALERT, &adap->pdev->dev, fmt, ## __VA_ARGS__) /* * More powerful macro that selectively prints messages based on msg_enable. diff --git a/trunk/drivers/net/ethernet/dlink/dl2k.c b/trunk/drivers/net/ethernet/dlink/dl2k.c index 2fb01bf18155..a059f0c27e28 100644 --- a/trunk/drivers/net/ethernet/dlink/dl2k.c +++ b/trunk/drivers/net/ethernet/dlink/dl2k.c @@ -1758,7 +1758,21 @@ static struct pci_driver rio_driver = { .remove = __devexit_p(rio_remove1), }; -module_pci_driver(rio_driver); +static int __init +rio_init (void) +{ + return pci_register_driver(&rio_driver); +} + +static void __exit +rio_exit (void) +{ + pci_unregister_driver (&rio_driver); +} + +module_init (rio_init); +module_exit (rio_exit); + /* Compile command: diff --git a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe.h index c64a777b2c0b..a17116b3c470 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe.h @@ -693,6 +693,7 @@ extern s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw, u16 soft_id); extern void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input, union ixgbe_atr_input *mask); +extern bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw); extern void ixgbe_set_rx_mode(struct net_device *netdev); #ifdef CONFIG_IXGBE_DCB extern void ixgbe_set_rx_drop_en(struct ixgbe_adapter *adapter); diff --git a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c index b52781351659..e75f5a4a2a6d 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c +++ b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c @@ -62,7 +62,6 @@ static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, bool autoneg, bool autoneg_wait_to_complete); static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw); -static bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw); static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) { @@ -99,9 +98,8 @@ static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) static s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw) { s32 ret_val = 0; - u32 reg_anlp1 = 0; - u32 i = 0; u16 list_offset, data_offset, data_value; + bool got_lock = false; if (hw->phy.sfp_type != ixgbe_sfp_type_unknown) { ixgbe_init_mac_link_ops_82599(hw); @@ -137,28 +135,36 @@ static s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw) usleep_range(hw->eeprom.semaphore_delay * 1000, hw->eeprom.semaphore_delay * 2000); - /* Now restart DSP by setting Restart_AN and clearing LMS */ - IXGBE_WRITE_REG(hw, IXGBE_AUTOC, ((IXGBE_READ_REG(hw, - IXGBE_AUTOC) & ~IXGBE_AUTOC_LMS_MASK) | - IXGBE_AUTOC_AN_RESTART)); - - /* Wait for AN to leave state 0 */ - for (i = 0; i < 10; i++) { - usleep_range(4000, 8000); - reg_anlp1 = IXGBE_READ_REG(hw, IXGBE_ANLP1); - if (reg_anlp1 & IXGBE_ANLP1_AN_STATE_MASK) - break; + /* Need SW/FW semaphore around AUTOC writes if LESM on, + * likewise reset_pipeline requires lock as it also writes + * AUTOC. + */ + if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { + ret_val = hw->mac.ops.acquire_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + if (ret_val) + goto setup_sfp_out; + + got_lock = true; + } + + /* Restart DSP and set SFI mode */ + IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (IXGBE_READ_REG(hw, + IXGBE_AUTOC) | IXGBE_AUTOC_LMS_10G_SERIAL)); + + ret_val = ixgbe_reset_pipeline_82599(hw); + + if (got_lock) { + hw->mac.ops.release_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + got_lock = false; } - if (!(reg_anlp1 & IXGBE_ANLP1_AN_STATE_MASK)) { - hw_dbg(hw, "sfp module setup not complete\n"); + + if (ret_val) { + hw_dbg(hw, " sfp module setup not complete\n"); ret_val = IXGBE_ERR_SFP_SETUP_NOT_COMPLETE; goto setup_sfp_out; } - - /* Restart DSP by setting Restart_AN and return to SFI mode */ - IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (IXGBE_READ_REG(hw, - IXGBE_AUTOC) | IXGBE_AUTOC_LMS_10G_SERIAL | - IXGBE_AUTOC_AN_RESTART)); } setup_sfp_out: @@ -394,14 +400,26 @@ static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, u32 links_reg; u32 i; s32 status = 0; + bool got_lock = false; + + if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { + status = hw->mac.ops.acquire_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + if (status) + goto out; + + got_lock = true; + } /* Restart link */ - autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); - autoc_reg |= IXGBE_AUTOC_AN_RESTART; - IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); + ixgbe_reset_pipeline_82599(hw); + + if (got_lock) + hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); /* Only poll for autoneg to complete if specified to do so */ if (autoneg_wait_to_complete) { + autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) == IXGBE_AUTOC_LMS_KX4_KX_KR || (autoc_reg & IXGBE_AUTOC_LMS_MASK) == @@ -425,6 +443,7 @@ static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, /* Add delay to filter out noises during initial link setup */ msleep(50); +out: return status; } @@ -779,6 +798,7 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, u32 links_reg; u32 i; ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; + bool got_lock = false; /* Check to see if speed passed in is supported. */ status = hw->mac.ops.get_link_capabilities(hw, &link_capabilities, @@ -836,9 +856,26 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, } if (autoc != start_autoc) { + /* Need SW/FW semaphore around AUTOC writes if LESM is on, + * likewise reset_pipeline requires us to hold this lock as + * it also writes to AUTOC. + */ + if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { + status = hw->mac.ops.acquire_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + if (status != 0) + goto out; + + got_lock = true; + } + /* Restart link */ - autoc |= IXGBE_AUTOC_AN_RESTART; IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc); + ixgbe_reset_pipeline_82599(hw); + + if (got_lock) + hw->mac.ops.release_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); /* Only poll for autoneg to complete if specified to do so */ if (autoneg_wait_to_complete) { @@ -994,9 +1031,28 @@ static s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw) hw->mac.orig_autoc2 = autoc2; hw->mac.orig_link_settings_stored = true; } else { - if (autoc != hw->mac.orig_autoc) - IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (hw->mac.orig_autoc | - IXGBE_AUTOC_AN_RESTART)); + if (autoc != hw->mac.orig_autoc) { + /* Need SW/FW semaphore around AUTOC writes if LESM is + * on, likewise reset_pipeline requires us to hold + * this lock as it also writes to AUTOC. + */ + bool got_lock = false; + if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { + status = hw->mac.ops.acquire_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + if (status) + goto reset_hw_out; + + got_lock = true; + } + + IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc); + ixgbe_reset_pipeline_82599(hw); + + if (got_lock) + hw->mac.ops.release_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + } if ((autoc2 & IXGBE_AUTOC2_UPPER_MASK) != (hw->mac.orig_autoc2 & IXGBE_AUTOC2_UPPER_MASK)) { @@ -1983,7 +2039,7 @@ static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw) * Returns true if the LESM FW module is present and enabled. Otherwise * returns false. Smart Speed must be disabled if LESM FW module is enabled. **/ -static bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw) +bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw) { bool lesm_enabled = false; u16 fw_offset, fw_lesm_param_offset, fw_lesm_state; diff --git a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c index a2a9bcca4915..8f285edb5094 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +++ b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c @@ -90,6 +90,7 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw) s32 ret_val = 0; u32 reg = 0, reg_bp = 0; u16 reg_cu = 0; + bool got_lock = false; /* * Validate the requested mode. Strict IEEE mode does not allow @@ -210,8 +211,29 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw) * */ if (hw->phy.media_type == ixgbe_media_type_backplane) { - reg_bp |= IXGBE_AUTOC_AN_RESTART; + /* Need the SW/FW semaphore around AUTOC writes if 82599 and + * LESM is on, likewise reset_pipeline requries the lock as + * it also writes AUTOC. + */ + if ((hw->mac.type == ixgbe_mac_82599EB) && + ixgbe_verify_lesm_fw_enabled_82599(hw)) { + ret_val = hw->mac.ops.acquire_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + if (ret_val) + goto out; + + got_lock = true; + } + IXGBE_WRITE_REG(hw, IXGBE_AUTOC, reg_bp); + + if (hw->mac.type == ixgbe_mac_82599EB) + ixgbe_reset_pipeline_82599(hw); + + if (got_lock) + hw->mac.ops.release_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + } else if ((hw->phy.media_type == ixgbe_media_type_copper) && (ixgbe_device_supports_autoneg_fc(hw) == 0)) { hw->phy.ops.write_reg(hw, MDIO_AN_ADVERTISE, @@ -2616,6 +2638,7 @@ s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index) bool link_up = false; u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); + s32 ret_val = 0; /* * Link must be up to auto-blink the LEDs; @@ -2624,10 +2647,28 @@ s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index) hw->mac.ops.check_link(hw, &speed, &link_up, false); if (!link_up) { + /* Need the SW/FW semaphore around AUTOC writes if 82599 and + * LESM is on. + */ + bool got_lock = false; + + if ((hw->mac.type == ixgbe_mac_82599EB) && + ixgbe_verify_lesm_fw_enabled_82599(hw)) { + ret_val = hw->mac.ops.acquire_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + if (ret_val) + goto out; + + got_lock = true; + } autoc_reg |= IXGBE_AUTOC_AN_RESTART; autoc_reg |= IXGBE_AUTOC_FLU; IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); IXGBE_WRITE_FLUSH(hw); + + if (got_lock) + hw->mac.ops.release_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); usleep_range(10000, 20000); } @@ -2636,7 +2677,8 @@ s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index) IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); IXGBE_WRITE_FLUSH(hw); - return 0; +out: + return ret_val; } /** @@ -2648,18 +2690,40 @@ s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index) { u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); + s32 ret_val = 0; + bool got_lock = false; + + /* Need the SW/FW semaphore around AUTOC writes if 82599 and + * LESM is on. + */ + if ((hw->mac.type == ixgbe_mac_82599EB) && + ixgbe_verify_lesm_fw_enabled_82599(hw)) { + ret_val = hw->mac.ops.acquire_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + if (ret_val) + goto out; + + got_lock = true; + } autoc_reg &= ~IXGBE_AUTOC_FLU; autoc_reg |= IXGBE_AUTOC_AN_RESTART; IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); + if (hw->mac.type == ixgbe_mac_82599EB) + ixgbe_reset_pipeline_82599(hw); + + if (got_lock) + hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); + led_reg &= ~IXGBE_LED_MODE_MASK(index); led_reg &= ~IXGBE_LED_BLINK(index); led_reg |= IXGBE_LED_LINK_ACTIVE << IXGBE_LED_MODE_SHIFT(index); IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, led_reg); IXGBE_WRITE_FLUSH(hw); - return 0; +out: + return ret_val; } /** diff --git a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 9a88e01216bb..88d636a7459c 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include @@ -3225,6 +3224,7 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter) IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset ^ 1), reg_offset - 1); IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), (~0) << vf_shift); IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset ^ 1), reg_offset - 1); + IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); /* Map PF MAC address in RAR Entry 0 to first pool following VFs */ hw->mac.ops.set_vmdq(hw, 0, VMDQ_P(0)); @@ -3247,6 +3247,8 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter) IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext); + /* enable Tx loopback for VF/PF communication */ + IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); /* Enable MAC Anti-Spoofing */ hw->mac.ops.set_mac_anti_spoofing(hw, (adapter->num_vfs != 0), @@ -7023,59 +7025,6 @@ static int ixgbe_ndo_fdb_dump(struct sk_buff *skb, return idx; } -static int ixgbe_ndo_bridge_setlink(struct net_device *dev, - struct nlmsghdr *nlh) -{ - struct ixgbe_adapter *adapter = netdev_priv(dev); - struct nlattr *attr, *br_spec; - int rem; - - if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) - return -EOPNOTSUPP; - - br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); - - nla_for_each_nested(attr, br_spec, rem) { - __u16 mode; - u32 reg = 0; - - if (nla_type(attr) != IFLA_BRIDGE_MODE) - continue; - - mode = nla_get_u16(attr); - if (mode == BRIDGE_MODE_VEPA) - reg = 0; - else if (mode == BRIDGE_MODE_VEB) - reg = IXGBE_PFDTXGSWC_VT_LBEN; - else - return -EINVAL; - - IXGBE_WRITE_REG(&adapter->hw, IXGBE_PFDTXGSWC, reg); - - e_info(drv, "enabling bridge mode: %s\n", - mode == BRIDGE_MODE_VEPA ? "VEPA" : "VEB"); - } - - return 0; -} - -static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, - struct net_device *dev) -{ - struct ixgbe_adapter *adapter = netdev_priv(dev); - u16 mode; - - if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) - return 0; - - if (IXGBE_READ_REG(&adapter->hw, IXGBE_PFDTXGSWC) & 1) - mode = BRIDGE_MODE_VEB; - else - mode = BRIDGE_MODE_VEPA; - - return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode); -} - static const struct net_device_ops ixgbe_netdev_ops = { .ndo_open = ixgbe_open, .ndo_stop = ixgbe_close, @@ -7115,8 +7064,6 @@ static const struct net_device_ops ixgbe_netdev_ops = { .ndo_fdb_add = ixgbe_ndo_fdb_add, .ndo_fdb_del = ixgbe_ndo_fdb_del, .ndo_fdb_dump = ixgbe_ndo_fdb_dump, - .ndo_bridge_setlink = ixgbe_ndo_bridge_setlink, - .ndo_bridge_getlink = ixgbe_ndo_bridge_getlink, }; /** diff --git a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 7e3ac28ffba8..96876b7442b1 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -117,9 +117,6 @@ void ixgbe_enable_sriov(struct ixgbe_adapter *adapter, } } - /* Initialize default switching mode VEB */ - IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); - /* If call to enable VFs succeeded then allocate memory * for per VF control structures. */ diff --git a/trunk/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/trunk/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index ac6a76deb01d..07d7eaba6f1b 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/trunk/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -478,16 +478,6 @@ static bool ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector, } skb->protocol = eth_type_trans(skb, rx_ring->netdev); - /* Workaround hardware that can't do proper VEPA multicast - * source pruning. - */ - if ((skb->pkt_type & (PACKET_BROADCAST | PACKET_MULTICAST)) && - !(compare_ether_addr(adapter->netdev->dev_addr, - eth_hdr(skb)->h_source))) { - dev_kfree_skb_irq(skb); - goto next_desc; - } - ixgbevf_receive_skb(q_vector, skb, staterr, rx_desc); next_desc: diff --git a/trunk/drivers/net/ethernet/marvell/pxa168_eth.c b/trunk/drivers/net/ethernet/marvell/pxa168_eth.c index 10d678d3dd01..59489722e898 100644 --- a/trunk/drivers/net/ethernet/marvell/pxa168_eth.c +++ b/trunk/drivers/net/ethernet/marvell/pxa168_eth.c @@ -1131,7 +1131,7 @@ static int pxa168_eth_open(struct net_device *dev) err = request_irq(dev->irq, pxa168_eth_int_handler, IRQF_DISABLED, dev->name, dev); if (err) { - dev_err(&dev->dev, "can't assign irq\n"); + dev_printk(KERN_ERR, &dev->dev, "can't assign irq\n"); return -EAGAIN; } pep->rx_resource_err = 0; @@ -1201,8 +1201,9 @@ static int pxa168_eth_change_mtu(struct net_device *dev, int mtu) */ pxa168_eth_stop(dev); if (pxa168_eth_open(dev)) { - dev_err(&dev->dev, - "fatal error on re-opening device after MTU change\n"); + dev_printk(KERN_ERR, &dev->dev, + "fatal error on re-opening device after " + "MTU change\n"); } return 0; diff --git a/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c b/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c index 6bf73e10d449..10468e7932dd 100644 --- a/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c +++ b/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c @@ -488,8 +488,6 @@ netxen_nic_get_pauseparam(struct net_device *dev, __u32 val; int port = adapter->physical_port; - pause->autoneg = 0; - if (adapter->ahw.port_type == NETXEN_NIC_GBE) { if ((port < 0) || (port >= NETXEN_NIU_MAX_GBE_PORTS)) return; @@ -534,11 +532,6 @@ netxen_nic_set_pauseparam(struct net_device *dev, struct netxen_adapter *adapter = netdev_priv(dev); __u32 val; int port = adapter->physical_port; - - /* not supported */ - if (pause->autoneg) - return -EINVAL; - /* read mode */ if (adapter->ahw.port_type == NETXEN_NIC_GBE) { if ((port < 0) || (port >= NETXEN_NIU_MAX_GBE_PORTS)) diff --git a/trunk/drivers/net/ethernet/qlogic/qla3xxx.c b/trunk/drivers/net/ethernet/qlogic/qla3xxx.c index 80ba7292ec3d..df09b1cb742f 100644 --- a/trunk/drivers/net/ethernet/qlogic/qla3xxx.c +++ b/trunk/drivers/net/ethernet/qlogic/qla3xxx.c @@ -1920,6 +1920,7 @@ static void ql_process_mac_tx_intr(struct ql3_adapter *qdev, { struct ql_tx_buf_cb *tx_cb; int i; + int retval = 0; if (mac_rsp->flags & OB_MAC_IOCB_RSP_S) { netdev_warn(qdev->ndev, @@ -1934,6 +1935,7 @@ static void ql_process_mac_tx_intr(struct ql3_adapter *qdev, "Frame too short to be legal, frame not sent\n"); qdev->ndev->stats.tx_errors++; + retval = -EIO; goto frame_not_sent; } @@ -1942,6 +1944,7 @@ static void ql_process_mac_tx_intr(struct ql3_adapter *qdev, mac_rsp->transaction_id); qdev->ndev->stats.tx_errors++; + retval = -EIO; goto invalid_seg_count; } @@ -3950,4 +3953,15 @@ static struct pci_driver ql3xxx_driver = { .remove = __devexit_p(ql3xxx_remove), }; -module_pci_driver(ql3xxx_driver); +static int __init ql3xxx_init_module(void) +{ + return pci_register_driver(&ql3xxx_driver); +} + +static void __exit ql3xxx_exit(void) +{ + pci_unregister_driver(&ql3xxx_driver); +} + +module_init(ql3xxx_init_module); +module_exit(ql3xxx_exit); diff --git a/trunk/drivers/net/ethernet/realtek/r8169.c b/trunk/drivers/net/ethernet/realtek/r8169.c index 123c6a5c5fe6..2317b8cd25fd 100644 --- a/trunk/drivers/net/ethernet/realtek/r8169.c +++ b/trunk/drivers/net/ethernet/realtek/r8169.c @@ -7023,4 +7023,15 @@ static struct pci_driver rtl8169_pci_driver = { .driver.pm = RTL8169_PM_OPS, }; -module_pci_driver(rtl8169_pci_driver); +static int __init rtl8169_init_module(void) +{ + return pci_register_driver(&rtl8169_pci_driver); +} + +static void __exit rtl8169_cleanup_module(void) +{ + pci_unregister_driver(&rtl8169_pci_driver); +} + +module_init(rtl8169_init_module); +module_exit(rtl8169_cleanup_module); diff --git a/trunk/drivers/net/usb/Kconfig b/trunk/drivers/net/usb/Kconfig index e62882c68dd7..2ab8043e1e28 100644 --- a/trunk/drivers/net/usb/Kconfig +++ b/trunk/drivers/net/usb/Kconfig @@ -256,8 +256,6 @@ config USB_NET_SMSC75XX config USB_NET_SMSC95XX tristate "SMSC LAN95XX based USB 2.0 10/100 ethernet devices" depends on USB_USBNET - select BITREVERSE - select CRC16 select CRC32 help This option adds support for SMSC LAN95XX based USB 2.0 diff --git a/trunk/drivers/net/usb/smsc95xx.c b/trunk/drivers/net/usb/smsc95xx.c index 46cd784467d5..1730f753d062 100644 --- a/trunk/drivers/net/usb/smsc95xx.c +++ b/trunk/drivers/net/usb/smsc95xx.c @@ -26,8 +26,6 @@ #include #include #include -#include -#include #include #include #include @@ -48,8 +46,7 @@ #define SMSC95XX_INTERNAL_PHY_ID (1) #define SMSC95XX_TX_OVERHEAD (8) #define SMSC95XX_TX_OVERHEAD_CSUM (12) -#define SUPPORTED_WAKE (WAKE_UCAST | WAKE_BCAST | \ - WAKE_MCAST | WAKE_ARP | WAKE_MAGIC) +#define SUPPORTED_WAKE (WAKE_MAGIC) #define check_warn(ret, fmt, args...) \ ({ if (ret < 0) netdev_warn(dev->net, fmt, ##args); }) @@ -66,7 +63,6 @@ struct smsc95xx_priv { u32 hash_lo; u32 wolopts; spinlock_t mac_cr_lock; - int wuff_filter_count; }; static bool turbo_mode = true; @@ -960,7 +956,6 @@ static const struct net_device_ops smsc95xx_netdev_ops = { static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) { struct smsc95xx_priv *pdata = NULL; - u32 val; int ret; printk(KERN_INFO SMSC_CHIPNAME " v" SMSC_DRIVER_VERSION "\n"); @@ -991,15 +986,6 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) /* Init all registers */ ret = smsc95xx_reset(dev); - /* detect device revision as different features may be available */ - ret = smsc95xx_read_reg(dev, ID_REV, &val); - check_warn_return(ret, "Failed to read ID_REV: %d\n", ret); - val >>= 16; - if ((val == ID_REV_CHIP_ID_9500A_) || (val == ID_REV_CHIP_ID_9512_)) - pdata->wuff_filter_count = LAN9500A_WUFF_NUM; - else - pdata->wuff_filter_count = LAN9500_WUFF_NUM; - dev->net->netdev_ops = &smsc95xx_netdev_ops; dev->net->ethtool_ops = &smsc95xx_ethtool_ops; dev->net->flags |= IFF_MULTICAST; @@ -1019,11 +1005,6 @@ static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf) } } -static u16 smsc_crc(const u8 *buffer, size_t len, int filter) -{ - return bitrev16(crc16(0xFFFF, buffer, len)) << ((filter % 2) * 16); -} - static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message) { struct usbnet *dev = usb_get_intfdata(intf); @@ -1068,94 +1049,6 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message) return 0; } - if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) { - u32 *filter_mask = kzalloc(32, GFP_KERNEL); - u32 *command = kzalloc(2, GFP_KERNEL); - u32 *offset = kzalloc(2, GFP_KERNEL); - u32 *crc = kzalloc(4, GFP_KERNEL); - int i, filter = 0; - - if (pdata->wolopts & WAKE_BCAST) { - const u8 bcast[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - netdev_info(dev->net, "enabling broadcast detection"); - filter_mask[filter * 4] = 0x003F; - filter_mask[filter * 4 + 1] = 0x00; - filter_mask[filter * 4 + 2] = 0x00; - filter_mask[filter * 4 + 3] = 0x00; - command[filter/4] |= 0x05UL << ((filter % 4) * 8); - offset[filter/4] |= 0x00 << ((filter % 4) * 8); - crc[filter/2] |= smsc_crc(bcast, 6, filter); - filter++; - } - - if (pdata->wolopts & WAKE_MCAST) { - const u8 mcast[] = {0x01, 0x00, 0x5E}; - netdev_info(dev->net, "enabling multicast detection"); - filter_mask[filter * 4] = 0x0007; - filter_mask[filter * 4 + 1] = 0x00; - filter_mask[filter * 4 + 2] = 0x00; - filter_mask[filter * 4 + 3] = 0x00; - command[filter/4] |= 0x09UL << ((filter % 4) * 8); - offset[filter/4] |= 0x00 << ((filter % 4) * 8); - crc[filter/2] |= smsc_crc(mcast, 3, filter); - filter++; - } - - if (pdata->wolopts & WAKE_ARP) { - const u8 arp[] = {0x08, 0x06}; - netdev_info(dev->net, "enabling ARP detection"); - filter_mask[filter * 4] = 0x0003; - filter_mask[filter * 4 + 1] = 0x00; - filter_mask[filter * 4 + 2] = 0x00; - filter_mask[filter * 4 + 3] = 0x00; - command[filter/4] |= 0x05UL << ((filter % 4) * 8); - offset[filter/4] |= 0x0C << ((filter % 4) * 8); - crc[filter/2] |= smsc_crc(arp, 2, filter); - filter++; - } - - if (pdata->wolopts & WAKE_UCAST) { - netdev_info(dev->net, "enabling unicast detection"); - filter_mask[filter * 4] = 0x003F; - filter_mask[filter * 4 + 1] = 0x00; - filter_mask[filter * 4 + 2] = 0x00; - filter_mask[filter * 4 + 3] = 0x00; - command[filter/4] |= 0x01UL << ((filter % 4) * 8); - offset[filter/4] |= 0x00 << ((filter % 4) * 8); - crc[filter/2] |= smsc_crc(dev->net->dev_addr, ETH_ALEN, filter); - filter++; - } - - for (i = 0; i < (pdata->wuff_filter_count * 4); i++) { - ret = smsc95xx_write_reg(dev, WUFF, filter_mask[i]); - check_warn_return(ret, "Error writing WUFF"); - } - - for (i = 0; i < (pdata->wuff_filter_count / 4); i++) { - ret = smsc95xx_write_reg(dev, WUFF, command[i]); - check_warn_return(ret, "Error writing WUFF"); - } - - for (i = 0; i < (pdata->wuff_filter_count / 4); i++) { - ret = smsc95xx_write_reg(dev, WUFF, offset[i]); - check_warn_return(ret, "Error writing WUFF"); - } - - for (i = 0; i < (pdata->wuff_filter_count / 2); i++) { - ret = smsc95xx_write_reg(dev, WUFF, crc[i]); - check_warn_return(ret, "Error writing WUFF"); - } - - /* clear any pending pattern match packet status */ - ret = smsc95xx_read_reg(dev, WUCSR, &val); - check_warn_return(ret, "Error reading WUCSR"); - - val |= WUCSR_WUFR_; - - ret = smsc95xx_write_reg(dev, WUCSR, val); - check_warn_return(ret, "Error writing WUCSR"); - } - if (pdata->wolopts & WAKE_MAGIC) { /* clear any pending magic packet status */ ret = smsc95xx_read_reg(dev, WUCSR, &val); @@ -1167,18 +1060,10 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message) check_warn_return(ret, "Error writing WUCSR"); } - /* enable/disable wakeup sources */ + /* enable/disable magic packup wake */ ret = smsc95xx_read_reg(dev, WUCSR, &val); check_warn_return(ret, "Error reading WUCSR"); - if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) { - netdev_info(dev->net, "enabling pattern match wakeup"); - val |= WUCSR_WAKE_EN_; - } else { - netdev_info(dev->net, "disabling pattern match wakeup"); - val &= ~WUCSR_WAKE_EN_; - } - if (pdata->wolopts & WAKE_MAGIC) { netdev_info(dev->net, "enabling magic packet wakeup"); val |= WUCSR_MPEN_; @@ -1199,7 +1084,7 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message) ret = smsc95xx_write_reg(dev, PM_CTRL, val); check_warn_return(ret, "Error writing PM_CTRL"); - /* enable receiver to enable frame reception */ + /* enable receiver */ smsc95xx_start_rx_path(dev); /* some wol options are enabled, so enter SUSPEND0 */ @@ -1238,14 +1123,14 @@ static int smsc95xx_resume(struct usb_interface *intf) BUG_ON(!dev); - if (pdata->wolopts) { + if (pdata->wolopts & WAKE_MAGIC) { smsc95xx_clear_feature(dev, USB_DEVICE_REMOTE_WAKEUP); - /* clear wake-up sources */ + /* Disable magic packup wake */ ret = smsc95xx_read_reg(dev, WUCSR, &val); check_warn_return(ret, "Error reading WUCSR"); - val &= ~(WUCSR_WAKE_EN_ | WUCSR_MPEN_); + val &= ~WUCSR_MPEN_; ret = smsc95xx_write_reg(dev, WUCSR, val); check_warn_return(ret, "Error writing WUCSR"); diff --git a/trunk/drivers/net/usb/smsc95xx.h b/trunk/drivers/net/usb/smsc95xx.h index 1f862693dd7e..2ff9815aa27c 100644 --- a/trunk/drivers/net/usb/smsc95xx.h +++ b/trunk/drivers/net/usb/smsc95xx.h @@ -53,8 +53,6 @@ #define ID_REV_CHIP_ID_MASK_ (0xFFFF0000) #define ID_REV_CHIP_REV_MASK_ (0x0000FFFF) #define ID_REV_CHIP_ID_9500_ (0x9500) -#define ID_REV_CHIP_ID_9500A_ (0x9E00) -#define ID_REV_CHIP_ID_9512_ (0xEC00) #define INT_STS (0x08) #define INT_STS_TX_STOP_ (0x00020000) @@ -205,11 +203,8 @@ #define VLAN2 (0x124) #define WUFF (0x128) -#define LAN9500_WUFF_NUM (4) -#define LAN9500A_WUFF_NUM (8) #define WUCSR (0x12C) -#define WUCSR_WFF_PTR_RST_ (0x80000000) #define WUCSR_GUE_ (0x00000200) #define WUCSR_WUFR_ (0x00000040) #define WUCSR_MPR_ (0x00000020) diff --git a/trunk/include/linux/filter.h b/trunk/include/linux/filter.h index c9f0005c35e2..24d251f3bab0 100644 --- a/trunk/include/linux/filter.h +++ b/trunk/include/linux/filter.h @@ -123,8 +123,6 @@ enum { BPF_S_ANC_CPU, BPF_S_ANC_ALU_XOR_X, BPF_S_ANC_SECCOMP_LD_W, - BPF_S_ANC_VLAN_TAG, - BPF_S_ANC_VLAN_TAG_PRESENT, }; #endif /* __LINUX_FILTER_H__ */ diff --git a/trunk/include/linux/netdevice.h b/trunk/include/linux/netdevice.h index 7bf867c97043..f8eda0276f03 100644 --- a/trunk/include/linux/netdevice.h +++ b/trunk/include/linux/netdevice.h @@ -887,10 +887,6 @@ struct netdev_fcoe_hbainfo { * struct net_device *dev, int idx) * Used to add FDB entries to dump requests. Implementers should add * entries to skb and update idx with the number of entries. - * - * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh) - * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, - * struct net_device *dev) */ struct net_device_ops { int (*ndo_init)(struct net_device *dev); @@ -1002,12 +998,6 @@ struct net_device_ops { struct netlink_callback *cb, struct net_device *dev, int idx); - - int (*ndo_bridge_setlink)(struct net_device *dev, - struct nlmsghdr *nlh); - int (*ndo_bridge_getlink)(struct sk_buff *skb, - u32 pid, u32 seq, - struct net_device *dev); }; /* diff --git a/trunk/include/linux/rtnetlink.h b/trunk/include/linux/rtnetlink.h index 489dd7bb28ec..7002bbfd5d4a 100644 --- a/trunk/include/linux/rtnetlink.h +++ b/trunk/include/linux/rtnetlink.h @@ -69,7 +69,4 @@ extern int ndo_dflt_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb, struct net_device *dev, int idx); - -extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, - struct net_device *dev, u16 mode); #endif /* __LINUX_RTNETLINK_H */ diff --git a/trunk/include/linux/skbuff.h b/trunk/include/linux/skbuff.h index a2a0bdb95a8f..6a2c34e6d962 100644 --- a/trunk/include/linux/skbuff.h +++ b/trunk/include/linux/skbuff.h @@ -643,7 +643,7 @@ extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, extern void __skb_get_rxhash(struct sk_buff *skb); static inline __u32 skb_get_rxhash(struct sk_buff *skb) { - if (!skb->l4_rxhash) + if (!skb->rxhash) __skb_get_rxhash(skb); return skb->rxhash; diff --git a/trunk/include/uapi/linux/filter.h b/trunk/include/uapi/linux/filter.h index 9cfde6941099..3d7922433aba 100644 --- a/trunk/include/uapi/linux/filter.h +++ b/trunk/include/uapi/linux/filter.h @@ -127,9 +127,7 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */ #define SKF_AD_RXHASH 32 #define SKF_AD_CPU 36 #define SKF_AD_ALU_XOR_X 40 -#define SKF_AD_VLAN_TAG 44 -#define SKF_AD_VLAN_TAG_PRESENT 48 -#define SKF_AD_MAX 52 +#define SKF_AD_MAX 44 #define SKF_NET_OFF (-0x100000) #define SKF_LL_OFF (-0x200000) diff --git a/trunk/include/uapi/linux/if_bridge.h b/trunk/include/uapi/linux/if_bridge.h index b3885791e11e..a8fe9549ddbc 100644 --- a/trunk/include/uapi/linux/if_bridge.h +++ b/trunk/include/uapi/linux/if_bridge.h @@ -97,23 +97,5 @@ struct __fdb_entry { __u16 unused; }; -/* Bridge Flags */ -#define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from master */ -#define BRIDGE_FLAGS_SELF 2 /* Bridge command to/from lowerdev */ -#define BRIDGE_MODE_VEB 0 /* Default loopback mode */ -#define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */ - -/* Bridge management nested attributes - * [IFLA_AF_SPEC] = { - * [IFLA_BRIDGE_FLAGS] - * [IFLA_BRIDGE_MODE] - * } - */ -enum { - IFLA_BRIDGE_FLAGS, - IFLA_BRIDGE_MODE, - __IFLA_BRIDGE_MAX, -}; -#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1) #endif /* _UAPI_LINUX_IF_BRIDGE_H */ diff --git a/trunk/net/batman-adv/bat_iv_ogm.c b/trunk/net/batman-adv/bat_iv_ogm.c index 75403a491892..b02b75dae3a8 100644 --- a/trunk/net/batman-adv/bat_iv_ogm.c +++ b/trunk/net/batman-adv/bat_iv_ogm.c @@ -57,22 +57,20 @@ batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface, static int batadv_iv_ogm_iface_enable(struct batadv_hard_iface *hard_iface) { struct batadv_ogm_packet *batadv_ogm_packet; - unsigned char *ogm_buff; uint32_t random_seqno; int res = -ENOMEM; /* randomize initial seqno to avoid collision */ get_random_bytes(&random_seqno, sizeof(random_seqno)); - atomic_set(&hard_iface->bat_iv.ogm_seqno, random_seqno); + atomic_set(&hard_iface->seqno, random_seqno); - hard_iface->bat_iv.ogm_buff_len = BATADV_OGM_HLEN; - ogm_buff = kmalloc(hard_iface->bat_iv.ogm_buff_len, GFP_ATOMIC); - if (!ogm_buff) - goto out; + hard_iface->packet_len = BATADV_OGM_HLEN; + hard_iface->packet_buff = kmalloc(hard_iface->packet_len, GFP_ATOMIC); - hard_iface->bat_iv.ogm_buff = ogm_buff; + if (!hard_iface->packet_buff) + goto out; - batadv_ogm_packet = (struct batadv_ogm_packet *)ogm_buff; + batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff; batadv_ogm_packet->header.packet_type = BATADV_IV_OGM; batadv_ogm_packet->header.version = BATADV_COMPAT_VERSION; batadv_ogm_packet->header.ttl = 2; @@ -89,16 +87,15 @@ static int batadv_iv_ogm_iface_enable(struct batadv_hard_iface *hard_iface) static void batadv_iv_ogm_iface_disable(struct batadv_hard_iface *hard_iface) { - kfree(hard_iface->bat_iv.ogm_buff); - hard_iface->bat_iv.ogm_buff = NULL; + kfree(hard_iface->packet_buff); + hard_iface->packet_buff = NULL; } static void batadv_iv_ogm_iface_update_mac(struct batadv_hard_iface *hard_iface) { struct batadv_ogm_packet *batadv_ogm_packet; - unsigned char *ogm_buff = hard_iface->bat_iv.ogm_buff; - batadv_ogm_packet = (struct batadv_ogm_packet *)ogm_buff; + batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff; memcpy(batadv_ogm_packet->orig, hard_iface->net_dev->dev_addr, ETH_ALEN); memcpy(batadv_ogm_packet->prev_sender, @@ -109,9 +106,8 @@ static void batadv_iv_ogm_primary_iface_set(struct batadv_hard_iface *hard_iface) { struct batadv_ogm_packet *batadv_ogm_packet; - unsigned char *ogm_buff = hard_iface->bat_iv.ogm_buff; - batadv_ogm_packet = (struct batadv_ogm_packet *)ogm_buff; + batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff; batadv_ogm_packet->flags = BATADV_PRIMARIES_FIRST_HOP; batadv_ogm_packet->header.ttl = BATADV_TTL; } @@ -594,10 +590,8 @@ static void batadv_iv_ogm_forward(struct batadv_orig_node *orig_node, static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) { struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); - unsigned char **ogm_buff = &hard_iface->bat_iv.ogm_buff; struct batadv_ogm_packet *batadv_ogm_packet; struct batadv_hard_iface *primary_if; - int *ogm_buff_len = &hard_iface->bat_iv.ogm_buff_len; int vis_server, tt_num_changes = 0; uint32_t seqno; uint8_t bandwidth; @@ -606,16 +600,17 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) primary_if = batadv_primary_if_get_selected(bat_priv); if (hard_iface == primary_if) - tt_num_changes = batadv_tt_append_diff(bat_priv, ogm_buff, - ogm_buff_len, + tt_num_changes = batadv_tt_append_diff(bat_priv, + &hard_iface->packet_buff, + &hard_iface->packet_len, BATADV_OGM_HLEN); - batadv_ogm_packet = (struct batadv_ogm_packet *)(*ogm_buff); + batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff; /* change sequence number to network order */ - seqno = (uint32_t)atomic_read(&hard_iface->bat_iv.ogm_seqno); + seqno = (uint32_t)atomic_read(&hard_iface->seqno); batadv_ogm_packet->seqno = htonl(seqno); - atomic_inc(&hard_iface->bat_iv.ogm_seqno); + atomic_inc(&hard_iface->seqno); batadv_ogm_packet->ttvn = atomic_read(&bat_priv->tt.vn); batadv_ogm_packet->tt_crc = htons(bat_priv->tt.local_crc); @@ -636,8 +631,8 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) } batadv_slide_own_bcast_window(hard_iface); - batadv_iv_ogm_queue_add(bat_priv, hard_iface->bat_iv.ogm_buff, - hard_iface->bat_iv.ogm_buff_len, hard_iface, 1, + batadv_iv_ogm_queue_add(bat_priv, hard_iface->packet_buff, + hard_iface->packet_len, hard_iface, 1, batadv_iv_ogm_emit_send_time(bat_priv)); if (primary_if) @@ -1020,7 +1015,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, return; /* could be changed by schedule_own_packet() */ - if_incoming_seqno = atomic_read(&if_incoming->bat_iv.ogm_seqno); + if_incoming_seqno = atomic_read(&if_incoming->seqno); if (batadv_ogm_packet->flags & BATADV_DIRECTLINK) has_directlink_flag = 1; diff --git a/trunk/net/batman-adv/bitarray.c b/trunk/net/batman-adv/bitarray.c index 5453b17d8df2..aea174cdbfbd 100644 --- a/trunk/net/batman-adv/bitarray.c +++ b/trunk/net/batman-adv/bitarray.c @@ -79,17 +79,20 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, * or the old packet got delayed somewhere in the network. The * packet should be dropped without calling this function if the * seqno window is protected. - * - * seq_num_diff <= -BATADV_TQ_LOCAL_WINDOW_SIZE - * or - * seq_num_diff >= BATADV_EXPECTED_SEQNO_RANGE */ - batadv_dbg(BATADV_DBG_BATMAN, bat_priv, - "Other host probably restarted!\n"); + if (seq_num_diff <= -BATADV_TQ_LOCAL_WINDOW_SIZE || + seq_num_diff >= BATADV_EXPECTED_SEQNO_RANGE) { - bitmap_zero(seq_bits, BATADV_TQ_LOCAL_WINDOW_SIZE); - if (set_mark) - batadv_set_bit(seq_bits, 0); + batadv_dbg(BATADV_DBG_BATMAN, bat_priv, + "Other host probably restarted!\n"); + + bitmap_zero(seq_bits, BATADV_TQ_LOCAL_WINDOW_SIZE); + if (set_mark) + batadv_set_bit(seq_bits, 0); + + return 1; + } - return 1; + /* never reached */ + return 0; } diff --git a/trunk/net/batman-adv/bridge_loop_avoidance.c b/trunk/net/batman-adv/bridge_loop_avoidance.c index 29a5542aac75..fd8d5afec0dd 100644 --- a/trunk/net/batman-adv/bridge_loop_avoidance.c +++ b/trunk/net/batman-adv/bridge_loop_avoidance.c @@ -1585,11 +1585,23 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) struct hlist_head *head; uint32_t i; bool is_own; + int ret = 0; uint8_t *primary_addr; - primary_if = batadv_seq_print_text_primary_if_get(seq); - if (!primary_if) + primary_if = batadv_primary_if_get_selected(bat_priv); + if (!primary_if) { + ret = seq_printf(seq, + "BATMAN mesh %s disabled - please specify interfaces to enable it\n", + net_dev->name); goto out; + } + + if (primary_if->if_status != BATADV_IF_ACTIVE) { + ret = seq_printf(seq, + "BATMAN mesh %s disabled - primary interface not active\n", + net_dev->name); + goto out; + } primary_addr = primary_if->net_dev->dev_addr; seq_printf(seq, @@ -1616,7 +1628,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) out: if (primary_if) batadv_hardif_free_ref(primary_if); - return 0; + return ret; } int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) @@ -1631,11 +1643,23 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) int secs, msecs; uint32_t i; bool is_own; + int ret = 0; uint8_t *primary_addr; - primary_if = batadv_seq_print_text_primary_if_get(seq); - if (!primary_if) + primary_if = batadv_primary_if_get_selected(bat_priv); + if (!primary_if) { + ret = seq_printf(seq, + "BATMAN mesh %s disabled - please specify interfaces to enable it\n", + net_dev->name); goto out; + } + + if (primary_if->if_status != BATADV_IF_ACTIVE) { + ret = seq_printf(seq, + "BATMAN mesh %s disabled - primary interface not active\n", + net_dev->name); + goto out; + } primary_addr = primary_if->net_dev->dev_addr; seq_printf(seq, @@ -1669,5 +1693,5 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) out: if (primary_if) batadv_hardif_free_ref(primary_if); - return 0; + return ret; } diff --git a/trunk/net/batman-adv/debugfs.c b/trunk/net/batman-adv/debugfs.c index bd032bc4e262..391d4fb2026f 100644 --- a/trunk/net/batman-adv/debugfs.c +++ b/trunk/net/batman-adv/debugfs.c @@ -99,17 +99,15 @@ int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...) static int batadv_log_open(struct inode *inode, struct file *file) { - if (!try_module_get(THIS_MODULE)) - return -EBUSY; - nonseekable_open(inode, file); file->private_data = inode->i_private; + batadv_inc_module_count(); return 0; } static int batadv_log_release(struct inode *inode, struct file *file) { - module_put(THIS_MODULE); + batadv_dec_module_count(); return 0; } diff --git a/trunk/net/batman-adv/gateway_client.c b/trunk/net/batman-adv/gateway_client.c index dd07c7e3654f..15d67abc10a4 100644 --- a/trunk/net/batman-adv/gateway_client.c +++ b/trunk/net/batman-adv/gateway_client.c @@ -477,11 +477,22 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) struct batadv_hard_iface *primary_if; struct batadv_gw_node *gw_node; struct hlist_node *node; - int gw_count = 0; + int gw_count = 0, ret = 0; - primary_if = batadv_seq_print_text_primary_if_get(seq); - if (!primary_if) + primary_if = batadv_primary_if_get_selected(bat_priv); + if (!primary_if) { + ret = seq_printf(seq, + "BATMAN mesh %s disabled - please specify interfaces to enable it\n", + net_dev->name); goto out; + } + + if (primary_if->if_status != BATADV_IF_ACTIVE) { + ret = seq_printf(seq, + "BATMAN mesh %s disabled - primary interface not active\n", + net_dev->name); + goto out; + } seq_printf(seq, " %-12s (%s/%i) %17s [%10s]: gw_class ... [B.A.T.M.A.N. adv %s, MainIF/MAC: %s/%pM (%s)]\n", @@ -508,7 +519,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset) out: if (primary_if) batadv_hardif_free_ref(primary_if); - return 0; + return ret; } static bool batadv_is_type_dhcprequest(struct sk_buff *skb, int header_len) diff --git a/trunk/net/batman-adv/hard-interface.c b/trunk/net/batman-adv/hard-interface.c index fab9e4158dc2..d112fd6750b0 100644 --- a/trunk/net/batman-adv/hard-interface.c +++ b/trunk/net/batman-adv/hard-interface.c @@ -450,8 +450,8 @@ batadv_hardif_add_interface(struct net_device *net_dev) /* This can't be called via a bat_priv callback because * we have no bat_priv yet. */ - atomic_set(&hard_iface->bat_iv.ogm_seqno, 1); - hard_iface->bat_iv.ogm_buff = NULL; + atomic_set(&hard_iface->seqno, 1); + hard_iface->packet_buff = NULL; return hard_iface; diff --git a/trunk/net/batman-adv/icmp_socket.c b/trunk/net/batman-adv/icmp_socket.c index 5874c0e84846..bde3cf747507 100644 --- a/trunk/net/batman-adv/icmp_socket.c +++ b/trunk/net/batman-adv/icmp_socket.c @@ -42,16 +42,12 @@ static int batadv_socket_open(struct inode *inode, struct file *file) unsigned int i; struct batadv_socket_client *socket_client; - if (!try_module_get(THIS_MODULE)) - return -EBUSY; - nonseekable_open(inode, file); socket_client = kmalloc(sizeof(*socket_client), GFP_KERNEL); - if (!socket_client) { - module_put(THIS_MODULE); + + if (!socket_client) return -ENOMEM; - } for (i = 0; i < ARRAY_SIZE(batadv_socket_client_hash); i++) { if (!batadv_socket_client_hash[i]) { @@ -63,7 +59,6 @@ static int batadv_socket_open(struct inode *inode, struct file *file) if (i == ARRAY_SIZE(batadv_socket_client_hash)) { pr_err("Error - can't add another packet client: maximum number of clients reached\n"); kfree(socket_client); - module_put(THIS_MODULE); return -EXFULL; } @@ -76,6 +71,7 @@ static int batadv_socket_open(struct inode *inode, struct file *file) file->private_data = socket_client; + batadv_inc_module_count(); return 0; } @@ -100,7 +96,7 @@ static int batadv_socket_release(struct inode *inode, struct file *file) spin_unlock_bh(&socket_client->lock); kfree(socket_client); - module_put(THIS_MODULE); + batadv_dec_module_count(); return 0; } diff --git a/trunk/net/batman-adv/main.c b/trunk/net/batman-adv/main.c index f9bcfa17f50f..b4aa470bc4a6 100644 --- a/trunk/net/batman-adv/main.c +++ b/trunk/net/batman-adv/main.c @@ -160,6 +160,16 @@ void batadv_mesh_free(struct net_device *soft_iface) atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE); } +void batadv_inc_module_count(void) +{ + try_module_get(THIS_MODULE); +} + +void batadv_dec_module_count(void) +{ + module_put(THIS_MODULE); +} + int batadv_is_my_mac(const uint8_t *addr) { const struct batadv_hard_iface *hard_iface; @@ -178,42 +188,6 @@ int batadv_is_my_mac(const uint8_t *addr) return 0; } -/** - * batadv_seq_print_text_primary_if_get - called from debugfs table printing - * function that requires the primary interface - * @seq: debugfs table seq_file struct - * - * Returns primary interface if found or NULL otherwise. - */ -struct batadv_hard_iface * -batadv_seq_print_text_primary_if_get(struct seq_file *seq) -{ - struct net_device *net_dev = (struct net_device *)seq->private; - struct batadv_priv *bat_priv = netdev_priv(net_dev); - struct batadv_hard_iface *primary_if; - - primary_if = batadv_primary_if_get_selected(bat_priv); - - if (!primary_if) { - seq_printf(seq, - "BATMAN mesh %s disabled - please specify interfaces to enable it\n", - net_dev->name); - goto out; - } - - if (primary_if->if_status == BATADV_IF_ACTIVE) - goto out; - - seq_printf(seq, - "BATMAN mesh %s disabled - primary interface not active\n", - net_dev->name); - batadv_hardif_free_ref(primary_if); - primary_if = NULL; - -out: - return primary_if; -} - static int batadv_recv_unhandled_packet(struct sk_buff *skb, struct batadv_hard_iface *recv_if) { diff --git a/trunk/net/batman-adv/main.h b/trunk/net/batman-adv/main.h index 897ba6a8f8f2..d57b746219de 100644 --- a/trunk/net/batman-adv/main.h +++ b/trunk/net/batman-adv/main.h @@ -150,9 +150,9 @@ extern struct workqueue_struct *batadv_event_workqueue; int batadv_mesh_init(struct net_device *soft_iface); void batadv_mesh_free(struct net_device *soft_iface); +void batadv_inc_module_count(void); +void batadv_dec_module_count(void); int batadv_is_my_mac(const uint8_t *addr); -struct batadv_hard_iface * -batadv_seq_print_text_primary_if_get(struct seq_file *seq); int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype, struct net_device *orig_dev); @@ -165,19 +165,12 @@ int batadv_algo_register(struct batadv_algo_ops *bat_algo_ops); int batadv_algo_select(struct batadv_priv *bat_priv, char *name); int batadv_algo_seq_print_text(struct seq_file *seq, void *offset); -/** - * enum batadv_dbg_level - available log levels - * @BATADV_DBG_BATMAN: OGM and TQ computations related messages - * @BATADV_DBG_ROUTES: route added / changed / deleted - * @BATADV_DBG_TT: translation table messages - * @BATADV_DBG_BLA: bridge loop avoidance messages - * @BATADV_DBG_ALL: the union of all the above log levels - */ +/* all messages related to routing / flooding / broadcasting / etc */ enum batadv_dbg_level { BATADV_DBG_BATMAN = BIT(0), - BATADV_DBG_ROUTES = BIT(1), - BATADV_DBG_TT = BIT(2), - BATADV_DBG_BLA = BIT(3), + BATADV_DBG_ROUTES = BIT(1), /* route added / changed / deleted */ + BATADV_DBG_TT = BIT(2), /* translation table operations */ + BATADV_DBG_BLA = BIT(3), /* bridge loop avoidance */ BATADV_DBG_ALL = 15, }; diff --git a/trunk/net/batman-adv/originator.c b/trunk/net/batman-adv/originator.c index d9c14b8fca0e..ac9bdf8f80a6 100644 --- a/trunk/net/batman-adv/originator.c +++ b/trunk/net/batman-adv/originator.c @@ -415,10 +415,23 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) int last_seen_msecs; unsigned long last_seen_jiffies; uint32_t i; + int ret = 0; - primary_if = batadv_seq_print_text_primary_if_get(seq); - if (!primary_if) + primary_if = batadv_primary_if_get_selected(bat_priv); + + if (!primary_if) { + ret = seq_printf(seq, + "BATMAN mesh %s disabled - please specify interfaces to enable it\n", + net_dev->name); + goto out; + } + + if (primary_if->if_status != BATADV_IF_ACTIVE) { + ret = seq_printf(seq, + "BATMAN mesh %s disabled - primary interface not active\n", + net_dev->name); goto out; + } seq_printf(seq, "[B.A.T.M.A.N. adv %s, MainIF/MAC: %s/%pM (%s)]\n", BATADV_SOURCE_VERSION, primary_if->net_dev->name, @@ -472,7 +485,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset) out: if (primary_if) batadv_hardif_free_ref(primary_if); - return 0; + return ret; } static int batadv_orig_node_add_if(struct batadv_orig_node *orig_node, diff --git a/trunk/net/batman-adv/routing.c b/trunk/net/batman-adv/routing.c index 46dd5b47ed29..376b4cc6ca82 100644 --- a/trunk/net/batman-adv/routing.c +++ b/trunk/net/batman-adv/routing.c @@ -549,18 +549,25 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig, if (tmp_neigh_node->if_incoming == recv_if) continue; - if (router && tmp_neigh_node->tq_avg <= router->tq_avg) - continue; - if (!atomic_inc_not_zero(&tmp_neigh_node->refcount)) continue; - /* decrement refcount of previously selected router */ - if (router) - batadv_neigh_node_free_ref(router); + /* if we don't have a router yet + * or this one is better, choose it. + */ + if ((!router) || + (tmp_neigh_node->tq_avg > router->tq_avg)) { + /* decrement refcount of + * previously selected router + */ + if (router) + batadv_neigh_node_free_ref(router); - /* we found a better router (or at least one valid router) */ - router = tmp_neigh_node; + router = tmp_neigh_node; + atomic_inc_not_zero(&router->refcount); + } + + batadv_neigh_node_free_ref(tmp_neigh_node); } /* use the first candidate if nothing was found. */ @@ -680,8 +687,21 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if) struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct batadv_roam_adv_packet *roam_adv_packet; struct batadv_orig_node *orig_node; + struct ethhdr *ethhdr; - if (batadv_check_unicast_packet(skb, sizeof(*roam_adv_packet)) < 0) + /* drop packet if it has not necessary minimum size */ + if (unlikely(!pskb_may_pull(skb, + sizeof(struct batadv_roam_adv_packet)))) + goto out; + + ethhdr = (struct ethhdr *)skb_mac_header(skb); + + /* packet with unicast indication but broadcast recipient */ + if (is_broadcast_ether_addr(ethhdr->h_dest)) + goto out; + + /* packet with broadcast sender address */ + if (is_broadcast_ether_addr(ethhdr->h_source)) goto out; batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); @@ -908,12 +928,8 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, bool tt_poss_change; int is_old_ttvn; - /* check if there is enough data before accessing it */ - if (pskb_may_pull(skb, sizeof(*unicast_packet) + ETH_HLEN) < 0) - return 0; - - /* create a copy of the skb (in case of for re-routing) to modify it. */ - if (skb_cow(skb, sizeof(*unicast_packet)) < 0) + /* I could need to modify it */ + if (skb_cow(skb, sizeof(struct batadv_unicast_packet)) < 0) return 0; unicast_packet = (struct batadv_unicast_packet *)skb->data; @@ -969,10 +985,10 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, batadv_orig_node_free_ref(orig_node); } - net_ratelimited_function(batadv_dbg, BATADV_DBG_TT, bat_priv, - "TTVN mismatch (old_ttvn %u new_ttvn %u)! Rerouting unicast packet (for %pM) to %pM\n", - unicast_packet->ttvn, curr_ttvn, - ethhdr->h_dest, unicast_packet->dest); + batadv_dbg(BATADV_DBG_ROUTES, bat_priv, + "TTVN mismatch (old_ttvn %u new_ttvn %u)! Rerouting unicast packet (for %pM) to %pM\n", + unicast_packet->ttvn, curr_ttvn, ethhdr->h_dest, + unicast_packet->dest); unicast_packet->ttvn = curr_ttvn; } diff --git a/trunk/net/batman-adv/soft-interface.c b/trunk/net/batman-adv/soft-interface.c index 22bc65102370..b9a28d2dd3e8 100644 --- a/trunk/net/batman-adv/soft-interface.c +++ b/trunk/net/batman-adv/soft-interface.c @@ -146,10 +146,8 @@ static int batadv_interface_tx(struct sk_buff *skb, struct batadv_bcast_packet *bcast_packet; struct vlan_ethhdr *vhdr; __be16 ethertype = __constant_htons(BATADV_ETH_P_BATMAN); - static const uint8_t stp_addr[ETH_ALEN] = {0x01, 0x80, 0xC2, 0x00, - 0x00, 0x00}; - static const uint8_t ectp_addr[ETH_ALEN] = {0xCF, 0x00, 0x00, 0x00, - 0x00, 0x00}; + static const uint8_t stp_addr[ETH_ALEN] = {0x01, 0x80, 0xC2, 0x00, 0x00, + 0x00}; unsigned int header_len = 0; int data_len = skb->len, ret; short vid __maybe_unused = -1; @@ -182,16 +180,10 @@ static int batadv_interface_tx(struct sk_buff *skb, /* don't accept stp packets. STP does not help in meshes. * better use the bridge loop avoidance ... - * - * The same goes for ECTP sent at least by some Cisco Switches, - * it might confuse the mesh when used with bridge loop avoidance. */ if (batadv_compare_eth(ethhdr->h_dest, stp_addr)) goto dropped; - if (batadv_compare_eth(ethhdr->h_dest, ectp_addr)) - goto dropped; - if (is_multicast_ether_addr(ethhdr->h_dest)) { do_bcast = true; @@ -355,51 +347,7 @@ void batadv_interface_rx(struct net_device *soft_iface, return; } -/* batman-adv 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 batadv_netdev_xmit_lock_key; -static struct lock_class_key batadv_netdev_addr_lock_key; - -/** - * batadv_set_lockdep_class_one - Set lockdep class for a single tx queue - * @dev: device which owns the tx queue - * @txq: tx queue to modify - * @_unused: always NULL - */ -static void batadv_set_lockdep_class_one(struct net_device *dev, - struct netdev_queue *txq, - void *_unused) -{ - lockdep_set_class(&txq->_xmit_lock, &batadv_netdev_xmit_lock_key); -} - -/** - * batadv_set_lockdep_class - Set txq and addr_list lockdep class - * @dev: network device to modify - */ -static void batadv_set_lockdep_class(struct net_device *dev) -{ - lockdep_set_class(&dev->addr_list_lock, &batadv_netdev_addr_lock_key); - netdev_for_each_tx_queue(dev, batadv_set_lockdep_class_one, NULL); -} - -/** - * batadv_softif_init - Late stage initialization of soft interface - * @dev: registered network device to modify - * - * Returns error code on failures - */ -static int batadv_softif_init(struct net_device *dev) -{ - batadv_set_lockdep_class(dev); - - return 0; -} - static const struct net_device_ops batadv_netdev_ops = { - .ndo_init = batadv_softif_init, .ndo_open = batadv_interface_open, .ndo_stop = batadv_interface_release, .ndo_get_stats = batadv_interface_stats, diff --git a/trunk/net/batman-adv/sysfs.c b/trunk/net/batman-adv/sysfs.c index 42cd09e24c5f..66518c75c217 100644 --- a/trunk/net/batman-adv/sysfs.c +++ b/trunk/net/batman-adv/sysfs.c @@ -122,6 +122,55 @@ ssize_t batadv_show_##_name(struct kobject *kobj, \ batadv_store_##_name) +#define BATADV_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func) \ +ssize_t batadv_store_##_name(struct kobject *kobj, \ + struct attribute *attr, char *buff, \ + size_t count) \ +{ \ + struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \ + struct batadv_hard_iface *hard_iface; \ + ssize_t length; \ + \ + hard_iface = batadv_hardif_get_by_netdev(net_dev); \ + if (!hard_iface) \ + return 0; \ + \ + length = __batadv_store_uint_attr(buff, count, _min, _max, \ + _post_func, attr, \ + &hard_iface->_name, net_dev); \ + \ + batadv_hardif_free_ref(hard_iface); \ + return length; \ +} + +#define BATADV_ATTR_HIF_SHOW_UINT(_name) \ +ssize_t batadv_show_##_name(struct kobject *kobj, \ + struct attribute *attr, char *buff) \ +{ \ + struct net_device *net_dev = batadv_kobj_to_netdev(kobj); \ + struct batadv_hard_iface *hard_iface; \ + ssize_t length; \ + \ + hard_iface = batadv_hardif_get_by_netdev(net_dev); \ + if (!hard_iface) \ + return 0; \ + \ + length = sprintf(buff, "%i\n", atomic_read(&hard_iface->_name));\ + \ + batadv_hardif_free_ref(hard_iface); \ + return length; \ +} + +/* Use this, if you are going to set [name] in hard_iface to an + * unsigned integer value + */ +#define BATADV_ATTR_HIF_UINT(_name, _mode, _min, _max, _post_func) \ + static BATADV_ATTR_HIF_STORE_UINT(_name, _min, _max, _post_func)\ + static BATADV_ATTR_HIF_SHOW_UINT(_name) \ + static BATADV_ATTR(_name, _mode, batadv_show_##_name, \ + batadv_store_##_name) + + static int batadv_store_bool_attr(char *buff, size_t count, struct net_device *net_dev, const char *attr_name, atomic_t *attr) diff --git a/trunk/net/batman-adv/translation-table.c b/trunk/net/batman-adv/translation-table.c index a570d957a5a0..112edd371b2f 100644 --- a/trunk/net/batman-adv/translation-table.c +++ b/trunk/net/batman-adv/translation-table.c @@ -434,10 +434,22 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) struct hlist_node *node; struct hlist_head *head; uint32_t i; + int ret = 0; - primary_if = batadv_seq_print_text_primary_if_get(seq); - if (!primary_if) + primary_if = batadv_primary_if_get_selected(bat_priv); + if (!primary_if) { + ret = seq_printf(seq, + "BATMAN mesh %s disabled - please specify interfaces to enable it\n", + net_dev->name); + goto out; + } + + if (primary_if->if_status != BATADV_IF_ACTIVE) { + ret = seq_printf(seq, + "BATMAN mesh %s disabled - primary interface not active\n", + net_dev->name); goto out; + } seq_printf(seq, "Locally retrieved addresses (from %s) announced via TT (TTVN: %u):\n", @@ -467,7 +479,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) out: if (primary_if) batadv_hardif_free_ref(primary_if); - return 0; + return ret; } static void @@ -489,39 +501,24 @@ batadv_tt_local_set_pending(struct batadv_priv *bat_priv, tt_local_entry->common.addr, message); } -/** - * batadv_tt_local_remove - logically remove an entry from the local table - * @bat_priv: the bat priv with all the soft interface information - * @addr: the MAC address of the client to remove - * @message: message to append to the log on deletion - * @roaming: true if the deletion is due to a roaming event - * - * Returns the flags assigned to the local entry before being deleted - */ -uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, - const uint8_t *addr, const char *message, - bool roaming) +void batadv_tt_local_remove(struct batadv_priv *bat_priv, const uint8_t *addr, + const char *message, bool roaming) { struct batadv_tt_local_entry *tt_local_entry = NULL; - uint16_t flags, curr_flags = BATADV_NO_FLAGS; + uint16_t flags; tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr); if (!tt_local_entry) goto out; - curr_flags = tt_local_entry->common.flags; - flags = BATADV_TT_CLIENT_DEL; if (roaming) flags |= BATADV_TT_CLIENT_ROAM; batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, message); - out: if (tt_local_entry) batadv_tt_local_entry_free_ref(tt_local_entry); - - return curr_flags; } static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv, @@ -728,7 +725,6 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv, int ret = 0; int hash_added; struct batadv_tt_common_entry *common; - uint16_t local_flags; tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr); @@ -742,12 +738,6 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv, common->flags = flags; tt_global_entry->roam_at = 0; - /* node must store current time in case of roaming. This is - * needed to purge this entry out on timeout (if nobody claims - * it) - */ - if (flags & BATADV_TT_CLIENT_ROAM) - tt_global_entry->roam_at = jiffies; atomic_set(&common->refcount, 2); common->added_at = jiffies; @@ -798,16 +788,13 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv, batadv_dbg(BATADV_DBG_TT, bat_priv, "Creating new global tt entry: %pM (via %pM)\n", tt_global_entry->common.addr, orig_node->orig); - ret = 1; out_remove: - /* remove address from local hash if present */ - local_flags = batadv_tt_local_remove(bat_priv, tt_addr, - "global tt received", - flags & BATADV_TT_CLIENT_ROAM); - tt_global_entry->common.flags |= local_flags & BATADV_TT_CLIENT_WIFI; - + batadv_tt_local_remove(bat_priv, tt_global_entry->common.addr, + "global tt received", + flags & BATADV_TT_CLIENT_ROAM); + ret = 1; out: if (tt_global_entry) batadv_tt_global_entry_free_ref(tt_global_entry); @@ -855,10 +842,22 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) struct hlist_node *node; struct hlist_head *head; uint32_t i; + int ret = 0; - primary_if = batadv_seq_print_text_primary_if_get(seq); - if (!primary_if) + primary_if = batadv_primary_if_get_selected(bat_priv); + if (!primary_if) { + ret = seq_printf(seq, + "BATMAN mesh %s disabled - please specify interfaces to enable it\n", + net_dev->name); goto out; + } + + if (primary_if->if_status != BATADV_IF_ACTIVE) { + ret = seq_printf(seq, + "BATMAN mesh %s disabled - primary interface not active\n", + net_dev->name); + goto out; + } seq_printf(seq, "Globally announced TT entries received via the mesh %s\n", @@ -882,7 +881,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) out: if (primary_if) batadv_hardif_free_ref(primary_if); - return 0; + return ret; } /* deletes the orig list of a tt_global_entry */ @@ -2439,7 +2438,7 @@ bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv, if (!tt_global_entry) goto out; - ret = !!(tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM); + ret = tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM; batadv_tt_global_entry_free_ref(tt_global_entry); out: return ret; diff --git a/trunk/net/batman-adv/translation-table.h b/trunk/net/batman-adv/translation-table.h index 9fa4fe41c868..811fffd4760c 100644 --- a/trunk/net/batman-adv/translation-table.h +++ b/trunk/net/batman-adv/translation-table.h @@ -24,9 +24,9 @@ int batadv_tt_len(int changes_num); int batadv_tt_init(struct batadv_priv *bat_priv); void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, int ifindex); -uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, - const uint8_t *addr, const char *message, - bool roaming); +void batadv_tt_local_remove(struct batadv_priv *bat_priv, + const uint8_t *addr, const char *message, + bool roaming); int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset); void batadv_tt_global_add_orig(struct batadv_priv *bat_priv, struct batadv_orig_node *orig_node, diff --git a/trunk/net/batman-adv/types.h b/trunk/net/batman-adv/types.h index faaebd6c8140..ac1e07a80454 100644 --- a/trunk/net/batman-adv/types.h +++ b/trunk/net/batman-adv/types.h @@ -28,30 +28,20 @@ (ETH_HLEN + max(sizeof(struct batadv_unicast_packet), \ sizeof(struct batadv_bcast_packet))) -/** - * struct batadv_hard_iface_bat_iv - per hard interface B.A.T.M.A.N. IV data - * @ogm_buff: buffer holding the OGM packet - * @ogm_buff_len: length of the OGM packet buffer - * @ogm_seqno: OGM sequence number - used to identify each OGM - */ -struct batadv_hard_iface_bat_iv { - unsigned char *ogm_buff; - int ogm_buff_len; - atomic_t ogm_seqno; -}; - struct batadv_hard_iface { struct list_head list; int16_t if_num; char if_status; struct net_device *net_dev; + atomic_t seqno; atomic_t frag_seqno; + unsigned char *packet_buff; + int packet_len; struct kobject *hardif_obj; atomic_t refcount; struct packet_type batman_adv_ptype; struct net_device *soft_iface; struct rcu_head rcu; - struct batadv_hard_iface_bat_iv bat_iv; }; /** diff --git a/trunk/net/bridge/br_device.c b/trunk/net/bridge/br_device.c index 63b5b088e80f..070e8a68cfc6 100644 --- a/trunk/net/bridge/br_device.c +++ b/trunk/net/bridge/br_device.c @@ -313,8 +313,6 @@ static const struct net_device_ops br_netdev_ops = { .ndo_fdb_add = br_fdb_add, .ndo_fdb_del = br_fdb_delete, .ndo_fdb_dump = br_fdb_dump, - .ndo_bridge_getlink = br_getlink, - .ndo_bridge_setlink = br_setlink, }; static void br_dev_free(struct net_device *dev) diff --git a/trunk/net/bridge/br_netlink.c b/trunk/net/bridge/br_netlink.c index 14b065cbd214..093f527276a3 100644 --- a/trunk/net/bridge/br_netlink.c +++ b/trunk/net/bridge/br_netlink.c @@ -111,33 +111,54 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port) /* * Dump information about all ports, in response to GETLINK */ -int br_getlink(struct sk_buff *skb, u32 pid, u32 seq, - struct net_device *dev) +static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) { - int err = 0; - struct net_bridge_port *port = br_port_get_rcu(dev); - - /* not a bridge port */ - if (!port) - goto out; + struct net *net = sock_net(skb->sk); + struct net_device *dev; + int idx; + + idx = 0; + rcu_read_lock(); + for_each_netdev_rcu(net, dev) { + struct net_bridge_port *port = br_port_get_rcu(dev); + + /* not a bridge port */ + if (!port || idx < cb->args[0]) + goto skip; + + if (br_fill_ifinfo(skb, port, + NETLINK_CB(cb->skb).portid, + cb->nlh->nlmsg_seq, RTM_NEWLINK, + NLM_F_MULTI) < 0) + break; +skip: + ++idx; + } + rcu_read_unlock(); + cb->args[0] = idx; - err = br_fill_ifinfo(skb, port, pid, seq, RTM_NEWLINK, NLM_F_MULTI); -out: - return err; + return skb->len; } /* * Change state of port (ie from forwarding to blocking etc) * Used by spanning tree in user space. */ -int br_setlink(struct net_device *dev, struct nlmsghdr *nlh) +static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) { + struct net *net = sock_net(skb->sk); struct ifinfomsg *ifm; struct nlattr *protinfo; + struct net_device *dev; struct net_bridge_port *p; u8 new_state; + if (nlmsg_len(nlh) < sizeof(*ifm)) + return -EINVAL; + ifm = nlmsg_data(nlh); + if (ifm->ifi_family != AF_BRIDGE) + return -EPFNOSUPPORT; protinfo = nlmsg_find_attr(nlh, sizeof(*ifm), IFLA_PROTINFO); if (!protinfo || nla_len(protinfo) < sizeof(u8)) @@ -147,6 +168,10 @@ int br_setlink(struct net_device *dev, struct nlmsghdr *nlh) if (new_state > BR_STATE_BLOCKING) return -EINVAL; + dev = __dev_get_by_index(net, ifm->ifi_index); + if (!dev) + return -ENODEV; + p = br_port_get_rtnl(dev); if (!p) return -EINVAL; @@ -166,6 +191,8 @@ int br_setlink(struct net_device *dev, struct nlmsghdr *nlh) br_port_state_selection(p->br); spin_unlock_bh(&p->br->lock); + br_ifinfo_notify(RTM_NEWLINK, p); + return 0; } @@ -191,7 +218,29 @@ struct rtnl_link_ops br_link_ops __read_mostly = { int __init br_netlink_init(void) { - return rtnl_link_register(&br_link_ops); + int err; + + err = rtnl_link_register(&br_link_ops); + if (err < 0) + goto err1; + + err = __rtnl_register(PF_BRIDGE, RTM_GETLINK, NULL, + br_dump_ifinfo, NULL); + if (err) + goto err2; + err = __rtnl_register(PF_BRIDGE, RTM_SETLINK, + br_rtm_setlink, NULL, NULL); + if (err) + goto err3; + + return 0; + +err3: + rtnl_unregister_all(PF_BRIDGE); +err2: + rtnl_link_unregister(&br_link_ops); +err1: + return err; } void __exit br_netlink_fini(void) diff --git a/trunk/net/bridge/br_private.h b/trunk/net/bridge/br_private.h index 6f40c14a2a65..9b278c4ebee1 100644 --- a/trunk/net/bridge/br_private.h +++ b/trunk/net/bridge/br_private.h @@ -158,9 +158,7 @@ struct net_bridge_port static inline struct net_bridge_port *br_port_get_rcu(const struct net_device *dev) { - struct net_bridge_port *port = - rcu_dereference_rtnl(dev->rx_handler_data); - + struct net_bridge_port *port = rcu_dereference(dev->rx_handler_data); return br_port_exists(dev) ? port : NULL; } @@ -555,9 +553,6 @@ extern struct rtnl_link_ops br_link_ops; extern int br_netlink_init(void); extern void br_netlink_fini(void); extern void br_ifinfo_notify(int event, struct net_bridge_port *port); -extern int br_setlink(struct net_device *dev, struct nlmsghdr *nlmsg); -extern int br_getlink(struct sk_buff *skb, u32 pid, u32 seq, - struct net_device *dev); #ifdef CONFIG_SYSFS /* br_sysfs_if.c */ diff --git a/trunk/net/core/filter.c b/trunk/net/core/filter.c index 5a114d41bf11..3d92ebb7fbcf 100644 --- a/trunk/net/core/filter.c +++ b/trunk/net/core/filter.c @@ -39,7 +39,6 @@ #include #include #include -#include /* No hurry in this branch * @@ -342,12 +341,6 @@ unsigned int sk_run_filter(const struct sk_buff *skb, case BPF_S_ANC_CPU: A = raw_smp_processor_id(); continue; - case BPF_S_ANC_VLAN_TAG: - A = vlan_tx_tag_get(skb); - continue; - case BPF_S_ANC_VLAN_TAG_PRESENT: - A = !!vlan_tx_tag_present(skb); - continue; case BPF_S_ANC_NLATTR: { struct nlattr *nla; @@ -607,8 +600,6 @@ int sk_chk_filter(struct sock_filter *filter, unsigned int flen) ANCILLARY(RXHASH); ANCILLARY(CPU); ANCILLARY(ALU_XOR_X); - ANCILLARY(VLAN_TAG); - ANCILLARY(VLAN_TAG_PRESENT); } } ftest->code = code; diff --git a/trunk/net/core/rtnetlink.c b/trunk/net/core/rtnetlink.c index 51dc58ff0091..64fe3cca2a4e 100644 --- a/trunk/net/core/rtnetlink.c +++ b/trunk/net/core/rtnetlink.c @@ -2252,210 +2252,6 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb) return skb->len; } -int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, - struct net_device *dev, u16 mode) -{ - struct nlmsghdr *nlh; - struct ifinfomsg *ifm; - struct nlattr *br_afspec; - u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN; - - nlh = nlmsg_put(skb, pid, seq, RTM_NEWLINK, sizeof(*ifm), NLM_F_MULTI); - if (nlh == NULL) - return -EMSGSIZE; - - ifm = nlmsg_data(nlh); - ifm->ifi_family = AF_BRIDGE; - ifm->__ifi_pad = 0; - ifm->ifi_type = dev->type; - ifm->ifi_index = dev->ifindex; - ifm->ifi_flags = dev_get_flags(dev); - ifm->ifi_change = 0; - - - if (nla_put_string(skb, IFLA_IFNAME, dev->name) || - nla_put_u32(skb, IFLA_MTU, dev->mtu) || - nla_put_u8(skb, IFLA_OPERSTATE, operstate) || - (dev->master && - nla_put_u32(skb, IFLA_MASTER, dev->master->ifindex)) || - (dev->addr_len && - nla_put(skb, IFLA_ADDRESS, dev->addr_len, dev->dev_addr)) || - (dev->ifindex != dev->iflink && - nla_put_u32(skb, IFLA_LINK, dev->iflink))) - goto nla_put_failure; - - br_afspec = nla_nest_start(skb, IFLA_AF_SPEC); - if (!br_afspec) - goto nla_put_failure; - - if (nla_put_u16(skb, IFLA_BRIDGE_FLAGS, BRIDGE_FLAGS_SELF) || - nla_put_u16(skb, IFLA_BRIDGE_MODE, mode)) { - nla_nest_cancel(skb, br_afspec); - goto nla_put_failure; - } - nla_nest_end(skb, br_afspec); - - return nlmsg_end(skb, nlh); -nla_put_failure: - nlmsg_cancel(skb, nlh); - return -EMSGSIZE; -} -EXPORT_SYMBOL(ndo_dflt_bridge_getlink); - -static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) -{ - struct net *net = sock_net(skb->sk); - struct net_device *dev; - int idx = 0; - u32 portid = NETLINK_CB(cb->skb).portid; - u32 seq = cb->nlh->nlmsg_seq; - - rcu_read_lock(); - for_each_netdev_rcu(net, dev) { - const struct net_device_ops *ops = dev->netdev_ops; - struct net_device *master = dev->master; - - if (idx < cb->args[0]) - continue; - - if (master && master->netdev_ops->ndo_bridge_getlink) { - const struct net_device_ops *bops = master->netdev_ops; - int err = bops->ndo_bridge_getlink(skb, portid, - seq, dev); - - if (err < 0) - break; - else - idx++; - } - - if (ops->ndo_bridge_getlink) { - int err = ops->ndo_bridge_getlink(skb, portid, - seq, dev); - - if (err < 0) - break; - else - idx++; - } - } - rcu_read_unlock(); - cb->args[0] = idx; - - return skb->len; -} - -static inline size_t bridge_nlmsg_size(void) -{ - return NLMSG_ALIGN(sizeof(struct ifinfomsg)) - + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */ - + nla_total_size(MAX_ADDR_LEN) /* IFLA_ADDRESS */ - + nla_total_size(sizeof(u32)) /* IFLA_MASTER */ - + nla_total_size(sizeof(u32)) /* IFLA_MTU */ - + nla_total_size(sizeof(u32)) /* IFLA_LINK */ - + nla_total_size(sizeof(u32)) /* IFLA_OPERSTATE */ - + nla_total_size(sizeof(u8)) /* IFLA_PROTINFO */ - + nla_total_size(sizeof(struct nlattr)) /* IFLA_AF_SPEC */ - + nla_total_size(sizeof(u16)) /* IFLA_BRIDGE_FLAGS */ - + nla_total_size(sizeof(u16)); /* IFLA_BRIDGE_MODE */ -} - -static int rtnl_bridge_notify(struct net_device *dev, u16 flags) -{ - struct net *net = dev_net(dev); - struct net_device *master = dev->master; - struct sk_buff *skb; - int err = -EOPNOTSUPP; - - skb = nlmsg_new(bridge_nlmsg_size(), GFP_ATOMIC); - if (!skb) { - err = -ENOMEM; - goto errout; - } - - if (!flags && master && master->netdev_ops->ndo_bridge_getlink) - err = master->netdev_ops->ndo_bridge_getlink(skb, 0, 0, dev); - else if (dev->netdev_ops->ndo_bridge_getlink) - err = dev->netdev_ops->ndo_bridge_getlink(skb, 0, 0, dev); - - if (err < 0) - goto errout; - - rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); - return 0; -errout: - WARN_ON(err == -EMSGSIZE); - kfree_skb(skb); - rtnl_set_sk_err(net, RTNLGRP_LINK, err); - return err; -} - -static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, - void *arg) -{ - struct net *net = sock_net(skb->sk); - struct ifinfomsg *ifm; - struct net_device *dev; - struct nlattr *br_spec, *attr = NULL; - int rem, err = -EOPNOTSUPP; - u16 flags = 0; - - if (nlmsg_len(nlh) < sizeof(*ifm)) - return -EINVAL; - - ifm = nlmsg_data(nlh); - if (ifm->ifi_family != AF_BRIDGE) - return -EPFNOSUPPORT; - - dev = __dev_get_by_index(net, ifm->ifi_index); - if (!dev) { - pr_info("PF_BRIDGE: RTM_SETLINK with unknown ifindex\n"); - return -ENODEV; - } - - br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); - if (br_spec) { - nla_for_each_nested(attr, br_spec, rem) { - if (nla_type(attr) == IFLA_BRIDGE_FLAGS) { - flags = nla_get_u16(attr); - break; - } - } - } - - if (!flags || (flags & BRIDGE_FLAGS_MASTER)) { - if (!dev->master || - !dev->master->netdev_ops->ndo_bridge_setlink) { - err = -EOPNOTSUPP; - goto out; - } - - err = dev->master->netdev_ops->ndo_bridge_setlink(dev, nlh); - if (err) - goto out; - - flags &= ~BRIDGE_FLAGS_MASTER; - } - - if ((flags & BRIDGE_FLAGS_SELF)) { - if (!dev->netdev_ops->ndo_bridge_setlink) - err = -EOPNOTSUPP; - else - err = dev->netdev_ops->ndo_bridge_setlink(dev, nlh); - - if (!err) - flags &= ~BRIDGE_FLAGS_SELF; - } - - if (attr && nla_type(attr) == IFLA_BRIDGE_FLAGS) - memcpy(nla_data(attr), &flags, sizeof(flags)); - /* Generate event to notify upper layer of bridge change */ - if (!err) - err = rtnl_bridge_notify(dev, flags); -out: - return err; -} - /* Protected by RTNL sempahore. */ static struct rtattr **rta_buf; static int rtattr_max; @@ -2637,8 +2433,5 @@ void __init rtnetlink_init(void) rtnl_register(PF_BRIDGE, RTM_NEWNEIGH, rtnl_fdb_add, NULL, NULL); rtnl_register(PF_BRIDGE, RTM_DELNEIGH, rtnl_fdb_del, NULL, NULL); rtnl_register(PF_BRIDGE, RTM_GETNEIGH, NULL, rtnl_fdb_dump, NULL); - - rtnl_register(PF_BRIDGE, RTM_GETLINK, NULL, rtnl_bridge_getlink, NULL); - rtnl_register(PF_BRIDGE, RTM_SETLINK, rtnl_bridge_setlink, NULL, NULL); } diff --git a/trunk/net/ipv4/ipconfig.c b/trunk/net/ipv4/ipconfig.c index d763701cff1b..798358b10717 100644 --- a/trunk/net/ipv4/ipconfig.c +++ b/trunk/net/ipv4/ipconfig.c @@ -1500,10 +1500,8 @@ static int __init ip_auto_config(void) * Clue in the operator. */ pr_info("IP-Config: Complete:\n"); - - pr_info(" device=%s, hwaddr=%*phC, ipaddr=%pI4, mask=%pI4, gw=%pI4\n", - ic_dev->name, ic_dev->addr_len, ic_dev->dev_addr, - &ic_myaddr, &ic_netmask, &ic_gateway); + pr_info(" device=%s, addr=%pI4, mask=%pI4, gw=%pI4\n", + ic_dev->name, &ic_myaddr, &ic_netmask, &ic_gateway); pr_info(" host=%s, domain=%s, nis-domain=%s\n", utsname()->nodename, ic_domain, utsname()->domainname); pr_info(" bootserver=%pI4, rootserver=%pI4, rootpath=%s", diff --git a/trunk/net/ipv4/tcp_ipv4.c b/trunk/net/ipv4/tcp_ipv4.c index 60e2e5d3ce29..694ea4c557f8 100644 --- a/trunk/net/ipv4/tcp_ipv4.c +++ b/trunk/net/ipv4/tcp_ipv4.c @@ -1070,7 +1070,7 @@ int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, int family) } EXPORT_SYMBOL(tcp_md5_do_del); -static void tcp_clear_md5_list(struct sock *sk) +void tcp_clear_md5_list(struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); struct tcp_md5sig_key *key;