* [PATCH 4/6 net-next] bnx2: Use SIMPLE_DEV_PM_OPS.
From: Michael Chan @ 2013-08-06 22:50 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1375829412-26425-4-git-send-email-mchan@broadcom.com>
This simplifies the suspend/resume code.
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2.c | 45 +++++++++++++++++++---------------
1 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 0b54ca0..27a128c 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -8602,46 +8602,52 @@ bnx2_remove_one(struct pci_dev *pdev)
}
static int
-bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
+bnx2_suspend(struct device *device)
{
+ struct pci_dev *pdev = to_pci_dev(device);
struct net_device *dev = pci_get_drvdata(pdev);
struct bnx2 *bp = netdev_priv(dev);
- /* PCI register 4 needs to be saved whether netif_running() or not.
- * MSI address and data need to be saved if using MSI and
- * netif_running().
- */
- pci_save_state(pdev);
- if (!netif_running(dev))
- return 0;
-
- cancel_work_sync(&bp->reset_task);
- bnx2_netif_stop(bp, true);
- netif_device_detach(dev);
- del_timer_sync(&bp->timer);
- bnx2_shutdown_chip(bp);
- bnx2_free_skbs(bp);
- bnx2_set_power_state(bp, pci_choose_state(pdev, state));
+ if (netif_running(dev)) {
+ cancel_work_sync(&bp->reset_task);
+ bnx2_netif_stop(bp, true);
+ netif_device_detach(dev);
+ del_timer_sync(&bp->timer);
+ bnx2_shutdown_chip(bp);
+ __bnx2_free_irq(bp);
+ bnx2_free_skbs(bp);
+ }
+ bnx2_setup_wol(bp);
return 0;
}
static int
-bnx2_resume(struct pci_dev *pdev)
+bnx2_resume(struct device *device)
{
+ struct pci_dev *pdev = to_pci_dev(device);
struct net_device *dev = pci_get_drvdata(pdev);
struct bnx2 *bp = netdev_priv(dev);
- pci_restore_state(pdev);
if (!netif_running(dev))
return 0;
bnx2_set_power_state(bp, PCI_D0);
netif_device_attach(dev);
+ bnx2_request_irq(bp);
bnx2_init_nic(bp, 1);
bnx2_netif_start(bp, true);
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+static SIMPLE_DEV_PM_OPS(bnx2_pm_ops, bnx2_suspend, bnx2_resume);
+#define BNX2_PM_OPS (&bnx2_pm_ops)
+
+#else
+
+#define BNX2_PM_OPS NULL
+
+#endif /* CONFIG_PM_SLEEP */
/**
* bnx2_io_error_detected - called when PCI error is detected
* @pdev: Pointer to PCI device
@@ -8757,8 +8763,7 @@ static struct pci_driver bnx2_pci_driver = {
.id_table = bnx2_pci_tbl,
.probe = bnx2_init_one,
.remove = bnx2_remove_one,
- .suspend = bnx2_suspend,
- .resume = bnx2_resume,
+ .driver.pm = BNX2_PM_OPS,
.err_handler = &bnx2_err_handler,
};
--
1.7.1
^ permalink raw reply related
* [PATCH 1/6 net-next] bnx2: Handle error condition in ->slot_reset()
From: Michael Chan @ 2013-08-06 22:50 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1375829412-26425-1-git-send-email-mchan@broadcom.com>
by closing the device if necessary. Otherwise, since NAPI state is
already disabled, a subsequent close will hang the system.
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 6a2de1d..3baf8b5 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -8694,14 +8694,13 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct bnx2 *bp = netdev_priv(dev);
- pci_ers_result_t result;
- int err;
+ pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT;
+ int err = 0;
rtnl_lock();
if (pci_enable_device(pdev)) {
dev_err(&pdev->dev,
"Cannot re-enable PCI device after reset\n");
- result = PCI_ERS_RESULT_DISCONNECT;
} else {
pci_set_master(pdev);
pci_restore_state(pdev);
@@ -8709,9 +8708,15 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
if (netif_running(dev)) {
bnx2_set_power_state(bp, PCI_D0);
- bnx2_init_nic(bp, 1);
+ err = bnx2_init_nic(bp, 1);
}
- result = PCI_ERS_RESULT_RECOVERED;
+ if (!err)
+ result = PCI_ERS_RESULT_RECOVERED;
+ }
+
+ if (result != PCI_ERS_RESULT_RECOVERED && netif_running(dev)) {
+ bnx2_napi_enable(bp);
+ dev_close(dev);
}
rtnl_unlock();
--
1.7.1
^ permalink raw reply related
* [PATCH 5/6 net-next] bnx2: Add pci shutdown handler.
From: Michael Chan @ 2013-08-06 22:50 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1375829412-26425-5-git-send-email-mchan@broadcom.com>
WoL and power state changes will now be done in the shutdown handler.
open/close/ethtool will no longer change the power state. NVRAM
operations can now be permitted whether the device is up or down.
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2.c | 47 ++++++++++++++++++----------------
1 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 27a128c..88f5ab1 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -6302,7 +6302,6 @@ bnx2_open(struct net_device *dev)
netif_carrier_off(dev);
- bnx2_set_power_state(bp, PCI_D0);
bnx2_disable_int(bp);
rc = bnx2_setup_int_mode(bp, disable_msi);
@@ -6709,7 +6708,6 @@ bnx2_close(struct net_device *dev)
bnx2_del_napi(bp);
bp->link_up = 0;
netif_carrier_off(bp->dev);
- bnx2_set_power_state(bp, PCI_D3hot);
return 0;
}
@@ -7144,9 +7142,6 @@ bnx2_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
struct bnx2 *bp = netdev_priv(dev);
int rc;
- if (!netif_running(dev))
- return -EAGAIN;
-
/* parameters already validated in ethtool_get_eeprom */
rc = bnx2_nvram_read(bp, eeprom->offset, eebuf, eeprom->len);
@@ -7161,9 +7156,6 @@ bnx2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
struct bnx2 *bp = netdev_priv(dev);
int rc;
- if (!netif_running(dev))
- return -EAGAIN;
-
/* parameters already validated in ethtool_set_eeprom */
rc = bnx2_nvram_write(bp, eeprom->offset, eebuf, eeprom->len);
@@ -7523,8 +7515,6 @@ bnx2_self_test(struct net_device *dev, struct ethtool_test *etest, u64 *buf)
{
struct bnx2 *bp = netdev_priv(dev);
- bnx2_set_power_state(bp, PCI_D0);
-
memset(buf, 0, sizeof(u64) * BNX2_NUM_TESTS);
if (etest->flags & ETH_TEST_FL_OFFLINE) {
int i;
@@ -7573,8 +7563,6 @@ bnx2_self_test(struct net_device *dev, struct ethtool_test *etest, u64 *buf)
etest->flags |= ETH_TEST_FL_FAILED;
}
- if (!netif_running(bp->dev))
- bnx2_set_power_state(bp, PCI_D3hot);
}
static void
@@ -7646,8 +7634,6 @@ bnx2_set_phys_id(struct net_device *dev, enum ethtool_phys_id_state state)
switch (state) {
case ETHTOOL_ID_ACTIVE:
- bnx2_set_power_state(bp, PCI_D0);
-
bp->leds_save = BNX2_RD(bp, BNX2_MISC_CFG);
BNX2_WR(bp, BNX2_MISC_CFG, BNX2_MISC_CFG_LEDMODE_MAC);
return 1; /* cycle on/off once per second */
@@ -7668,9 +7654,6 @@ bnx2_set_phys_id(struct net_device *dev, enum ethtool_phys_id_state state)
case ETHTOOL_ID_INACTIVE:
BNX2_WR(bp, BNX2_EMAC_LED, 0);
BNX2_WR(bp, BNX2_MISC_CFG, bp->leds_save);
-
- if (!netif_running(dev))
- bnx2_set_power_state(bp, PCI_D3hot);
break;
}
@@ -8118,8 +8101,6 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
goto err_out_release;
}
- bnx2_set_power_state(bp, PCI_D0);
-
/* Configure byte swap and enable write to the reg_window registers.
* Rely on CPU to do target byte swapping on big endian systems
* The chip's target access swapping will not swap all accesses
@@ -8705,10 +8686,9 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
pci_restore_state(pdev);
pci_save_state(pdev);
- if (netif_running(dev)) {
- bnx2_set_power_state(bp, PCI_D0);
+ if (netif_running(dev))
err = bnx2_init_nic(bp, 1);
- }
+
if (!err)
result = PCI_ERS_RESULT_RECOVERED;
}
@@ -8752,6 +8732,28 @@ static void bnx2_io_resume(struct pci_dev *pdev)
rtnl_unlock();
}
+static void bnx2_shutdown(struct pci_dev *pdev)
+{
+ struct net_device *dev = pci_get_drvdata(pdev);
+ struct bnx2 *bp;
+
+ if (!dev)
+ return;
+
+ bp = netdev_priv(dev);
+ if (!bp)
+ return;
+
+ rtnl_lock();
+ if (netif_running(dev))
+ dev_close(bp->dev);
+
+ if (system_state == SYSTEM_POWER_OFF)
+ bnx2_set_power_state(bp, PCI_D3hot);
+
+ rtnl_unlock();
+}
+
static const struct pci_error_handlers bnx2_err_handler = {
.error_detected = bnx2_io_error_detected,
.slot_reset = bnx2_io_slot_reset,
@@ -8765,6 +8767,7 @@ static struct pci_driver bnx2_pci_driver = {
.remove = bnx2_remove_one,
.driver.pm = BNX2_PM_OPS,
.err_handler = &bnx2_err_handler,
+ .shutdown = bnx2_shutdown,
};
module_pci_driver(bnx2_pci_driver);
--
1.7.1
^ permalink raw reply related
* [PATCH 0/6 net-next] bnx2 EEH and WoL/PM patches
From: Michael Chan @ 2013-08-06 22:50 UTC (permalink / raw)
To: davem; +Cc: netdev
First patch fixes EEH/AER error path. The rest of the patches
modernize the driver to use latest APIs for WoL and power management.
Michael Chan (6):
bnx2: Handle error condition in ->slot_reset()
bnx2: Use kernel APIs for WoL and power state changes.
bnx2: Refactor WoL setup into a separate function.
bnx2: Use SIMPLE_DEV_PM_OPS.
bnx2: Add pci shutdown handler.
bnx2: Update version to 2.2.4
drivers/net/ethernet/broadcom/bnx2.c | 308 +++++++++++++++++-----------------
drivers/net/ethernet/broadcom/bnx2.h | 2 +-
2 files changed, 158 insertions(+), 152 deletions(-)
^ permalink raw reply
* [PATCH 6/6 net-next] bnx2: Update version to 2.2.4
From: Michael Chan @ 2013-08-06 22:50 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1375829412-26425-6-git-send-email-mchan@broadcom.com>
and update copyright year.
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2.c | 6 +++---
drivers/net/ethernet/broadcom/bnx2.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 88f5ab1..6fdfc18 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -1,6 +1,6 @@
/* bnx2.c: Broadcom NX2 network driver.
*
- * Copyright (c) 2004-2011 Broadcom Corporation
+ * Copyright (c) 2004-2013 Broadcom Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -58,8 +58,8 @@
#include "bnx2_fw.h"
#define DRV_MODULE_NAME "bnx2"
-#define DRV_MODULE_VERSION "2.2.3"
-#define DRV_MODULE_RELDATE "June 27, 2012"
+#define DRV_MODULE_VERSION "2.2.4"
+#define DRV_MODULE_RELDATE "Aug 05, 2013"
#define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-6.2.3.fw"
#define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-6.0.15.fw"
#define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-6.2.1b.fw"
diff --git a/drivers/net/ethernet/broadcom/bnx2.h b/drivers/net/ethernet/broadcom/bnx2.h
index 172efbe..18cb2d2 100644
--- a/drivers/net/ethernet/broadcom/bnx2.h
+++ b/drivers/net/ethernet/broadcom/bnx2.h
@@ -1,6 +1,6 @@
/* bnx2.h: Broadcom NX2 network driver.
*
- * Copyright (c) 2004-2011 Broadcom Corporation
+ * Copyright (c) 2004-2013 Broadcom Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
--
1.7.1
^ permalink raw reply related
* [PATCH 2/6 net-next] bnx2: Use kernel APIs for WoL and power state changes.
From: Michael Chan @ 2013-08-06 22:50 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1375829412-26425-2-git-send-email-mchan@broadcom.com>
Simple API changes with no functional changes.
Signed-off-by: Michael Chan <mchan@broadocm.com>
---
drivers/net/ethernet/broadcom/bnx2.c | 36 +++++++++++++--------------------
1 files changed, 14 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 3baf8b5..ac72f80 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -3911,21 +3911,12 @@ init_cpu_err:
static int
bnx2_set_power_state(struct bnx2 *bp, pci_power_t state)
{
- u16 pmcsr;
-
- pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, &pmcsr);
-
switch (state) {
case PCI_D0: {
u32 val;
- pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL,
- (pmcsr & ~PCI_PM_CTRL_STATE_MASK) |
- PCI_PM_CTRL_PME_STATUS);
-
- if (pmcsr & PCI_PM_CTRL_STATE_MASK)
- /* delay required during transition out of D3hot */
- msleep(20);
+ pci_enable_wake(bp->pdev, PCI_D0, false);
+ pci_set_power_state(bp->pdev, PCI_D0);
val = BNX2_RD(bp, BNX2_EMAC_MODE);
val |= BNX2_EMAC_MODE_MPKT_RCVD | BNX2_EMAC_MODE_ACPI_RCVD;
@@ -4018,26 +4009,19 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state)
bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT3 | wol_msg,
1, 0);
- pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
+ pci_wake_from_d3(bp->pdev, bp->wol);
if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) ||
(BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1)) {
if (bp->wol)
- pmcsr |= 3;
- }
- else {
- pmcsr |= 3;
- }
- if (bp->wol) {
- pmcsr |= PCI_PM_CTRL_PME_ENABLE;
+ pci_set_power_state(bp->pdev, PCI_D3hot);
+ } else {
+ pci_set_power_state(bp->pdev, PCI_D3hot);
}
- pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL,
- pmcsr);
/* No more memory access after this point until
* device is brought back to D0.
*/
- udelay(50);
break;
}
default:
@@ -7081,6 +7065,9 @@ bnx2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
else {
bp->wol = 0;
}
+
+ device_set_wakeup_enable(&bp->pdev->dev, bp->wol);
+
return 0;
}
@@ -8369,6 +8356,11 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
bp->wol = 0;
}
+ if (bp->flags & BNX2_FLAG_NO_WOL)
+ device_set_wakeup_capable(&bp->pdev->dev, false);
+ else
+ device_set_wakeup_enable(&bp->pdev->dev, bp->wol);
+
if (BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) {
bp->tx_quick_cons_trip_int =
bp->tx_quick_cons_trip;
--
1.7.1
^ permalink raw reply related
* [PATCH 3/6 net-next] bnx2: Refactor WoL setup into a separate function.
From: Michael Chan @ 2013-08-06 22:50 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <1375829412-26425-3-git-send-email-mchan@broadcom.com>
Separate MAC and PHY WoL setup code into a separate function.
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2.c | 161 +++++++++++++++++-----------------
1 files changed, 81 insertions(+), 80 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index ac72f80..0b54ca0 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -3908,6 +3908,86 @@ init_cpu_err:
return rc;
}
+static void
+bnx2_setup_wol(struct bnx2 *bp)
+{
+ int i;
+ u32 val, wol_msg;
+
+ if (bp->wol) {
+ u32 advertising;
+ u8 autoneg;
+
+ autoneg = bp->autoneg;
+ advertising = bp->advertising;
+
+ if (bp->phy_port == PORT_TP) {
+ bp->autoneg = AUTONEG_SPEED;
+ bp->advertising = ADVERTISED_10baseT_Half |
+ ADVERTISED_10baseT_Full |
+ ADVERTISED_100baseT_Half |
+ ADVERTISED_100baseT_Full |
+ ADVERTISED_Autoneg;
+ }
+
+ spin_lock_bh(&bp->phy_lock);
+ bnx2_setup_phy(bp, bp->phy_port);
+ spin_unlock_bh(&bp->phy_lock);
+
+ bp->autoneg = autoneg;
+ bp->advertising = advertising;
+
+ bnx2_set_mac_addr(bp, bp->dev->dev_addr, 0);
+
+ val = BNX2_RD(bp, BNX2_EMAC_MODE);
+
+ /* Enable port mode. */
+ val &= ~BNX2_EMAC_MODE_PORT;
+ val |= BNX2_EMAC_MODE_MPKT_RCVD |
+ BNX2_EMAC_MODE_ACPI_RCVD |
+ BNX2_EMAC_MODE_MPKT;
+ if (bp->phy_port == PORT_TP) {
+ val |= BNX2_EMAC_MODE_PORT_MII;
+ } else {
+ val |= BNX2_EMAC_MODE_PORT_GMII;
+ if (bp->line_speed == SPEED_2500)
+ val |= BNX2_EMAC_MODE_25G_MODE;
+ }
+
+ BNX2_WR(bp, BNX2_EMAC_MODE, val);
+
+ /* receive all multicast */
+ for (i = 0; i < NUM_MC_HASH_REGISTERS; i++) {
+ BNX2_WR(bp, BNX2_EMAC_MULTICAST_HASH0 + (i * 4),
+ 0xffffffff);
+ }
+ BNX2_WR(bp, BNX2_EMAC_RX_MODE, BNX2_EMAC_RX_MODE_SORT_MODE);
+
+ val = 1 | BNX2_RPM_SORT_USER0_BC_EN | BNX2_RPM_SORT_USER0_MC_EN;
+ BNX2_WR(bp, BNX2_RPM_SORT_USER0, 0x0);
+ BNX2_WR(bp, BNX2_RPM_SORT_USER0, val);
+ BNX2_WR(bp, BNX2_RPM_SORT_USER0, val | BNX2_RPM_SORT_USER0_ENA);
+
+ /* Need to enable EMAC and RPM for WOL. */
+ BNX2_WR(bp, BNX2_MISC_ENABLE_SET_BITS,
+ BNX2_MISC_ENABLE_SET_BITS_RX_PARSER_MAC_ENABLE |
+ BNX2_MISC_ENABLE_SET_BITS_TX_HEADER_Q_ENABLE |
+ BNX2_MISC_ENABLE_SET_BITS_EMAC_ENABLE);
+
+ val = BNX2_RD(bp, BNX2_RPM_CONFIG);
+ val &= ~BNX2_RPM_CONFIG_ACPI_ENA;
+ BNX2_WR(bp, BNX2_RPM_CONFIG, val);
+
+ wol_msg = BNX2_DRV_MSG_CODE_SUSPEND_WOL;
+ } else {
+ wol_msg = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
+ }
+
+ if (!(bp->flags & BNX2_FLAG_NO_WOL))
+ bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT3 | wol_msg, 1, 0);
+
+}
+
static int
bnx2_set_power_state(struct bnx2 *bp, pci_power_t state)
{
@@ -3929,86 +4009,7 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state)
break;
}
case PCI_D3hot: {
- int i;
- u32 val, wol_msg;
-
- if (bp->wol) {
- u32 advertising;
- u8 autoneg;
-
- autoneg = bp->autoneg;
- advertising = bp->advertising;
-
- if (bp->phy_port == PORT_TP) {
- bp->autoneg = AUTONEG_SPEED;
- bp->advertising = ADVERTISED_10baseT_Half |
- ADVERTISED_10baseT_Full |
- ADVERTISED_100baseT_Half |
- ADVERTISED_100baseT_Full |
- ADVERTISED_Autoneg;
- }
-
- spin_lock_bh(&bp->phy_lock);
- bnx2_setup_phy(bp, bp->phy_port);
- spin_unlock_bh(&bp->phy_lock);
-
- bp->autoneg = autoneg;
- bp->advertising = advertising;
-
- bnx2_set_mac_addr(bp, bp->dev->dev_addr, 0);
-
- val = BNX2_RD(bp, BNX2_EMAC_MODE);
-
- /* Enable port mode. */
- val &= ~BNX2_EMAC_MODE_PORT;
- val |= BNX2_EMAC_MODE_MPKT_RCVD |
- BNX2_EMAC_MODE_ACPI_RCVD |
- BNX2_EMAC_MODE_MPKT;
- if (bp->phy_port == PORT_TP)
- val |= BNX2_EMAC_MODE_PORT_MII;
- else {
- val |= BNX2_EMAC_MODE_PORT_GMII;
- if (bp->line_speed == SPEED_2500)
- val |= BNX2_EMAC_MODE_25G_MODE;
- }
-
- BNX2_WR(bp, BNX2_EMAC_MODE, val);
-
- /* receive all multicast */
- for (i = 0; i < NUM_MC_HASH_REGISTERS; i++) {
- BNX2_WR(bp, BNX2_EMAC_MULTICAST_HASH0 + (i * 4),
- 0xffffffff);
- }
- BNX2_WR(bp, BNX2_EMAC_RX_MODE,
- BNX2_EMAC_RX_MODE_SORT_MODE);
-
- val = 1 | BNX2_RPM_SORT_USER0_BC_EN |
- BNX2_RPM_SORT_USER0_MC_EN;
- BNX2_WR(bp, BNX2_RPM_SORT_USER0, 0x0);
- BNX2_WR(bp, BNX2_RPM_SORT_USER0, val);
- BNX2_WR(bp, BNX2_RPM_SORT_USER0, val |
- BNX2_RPM_SORT_USER0_ENA);
-
- /* Need to enable EMAC and RPM for WOL. */
- BNX2_WR(bp, BNX2_MISC_ENABLE_SET_BITS,
- BNX2_MISC_ENABLE_SET_BITS_RX_PARSER_MAC_ENABLE |
- BNX2_MISC_ENABLE_SET_BITS_TX_HEADER_Q_ENABLE |
- BNX2_MISC_ENABLE_SET_BITS_EMAC_ENABLE);
-
- val = BNX2_RD(bp, BNX2_RPM_CONFIG);
- val &= ~BNX2_RPM_CONFIG_ACPI_ENA;
- BNX2_WR(bp, BNX2_RPM_CONFIG, val);
-
- wol_msg = BNX2_DRV_MSG_CODE_SUSPEND_WOL;
- }
- else {
- wol_msg = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
- }
-
- if (!(bp->flags & BNX2_FLAG_NO_WOL))
- bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT3 | wol_msg,
- 1, 0);
-
+ bnx2_setup_wol(bp);
pci_wake_from_d3(bp->pdev, bp->wol);
if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A0) ||
(BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1)) {
--
1.7.1
^ permalink raw reply related
* Re: linux-next: Tree for Aug 6 [ wireless | iwlwifi | mac80211 ? ]
From: Sedat Dilek @ 2013-08-06 22:55 UTC (permalink / raw)
To: Johannes Berg, sedat.dilek, David Miller, Stephen Rothwell,
wireless, netdev
In-Reply-To: <20130806215657.GA16410@order.stressinduktion.org>
On Tue, Aug 6, 2013 at 11:56 PM, Hannes Frederic Sowa
<hannes@stressinduktion.org> wrote:
> On Tue, Aug 06, 2013 at 11:45:38PM +0200, Johannes Berg wrote:
>> On Tue, 2013-08-06 at 23:40 +0200, Sedat Dilek wrote:
>>
>> > > Does the problem occur on client or server side? AFAICT, hostapd as well
>> > > as wpa_supplicant use AF_PACKET.
>> > >
>> > > The tricky thing is, these patches are meant to *loosen* the
>> > > restrictions in af_packet.c, so *should* not be harmful. So either my
>> > > patches create a side effect I did not foresee, or it's something nasty
>> > > (too much delay introduced by calling eth_type_trans() or so).
>>
>> > By reverting the culprit commit my network/wifi is fine, again.
>> > See also attached patch with changelog.
>>
>> I think skb->protocol is probably getting set up wrong, and just putting
>> back the last two lines
>>
>> skb->protocol = proto;
>> skb->dev = dev;
>>
>> is probably sufficient to fix wifi. If skb->protocol isn't set to
>> ETH_P_PAE, then we'd drop the packet in the wifi stack - might be worth
>> printing out what it's set to at the point where the skb->protocol
>> assignment above was removed.
>>
>> I'm trying to wrap my head around all this right now but I don't yet see
>> how the code after the patch would not get skb->protocol correct.
>
> Has anybody tested plain ethernet? I have a malfunctioning dhclient on
> ethernet since the weekend(it seems to not receive any packet). I did not
> look after it because have other patches on my todo list currently. Maybe
> it is the same error?
>
No, tested only with iwlwifi.
Can you try the patch from [1]?
- Sedat -
[1] http://marc.info/?l=linux-netdev&m=137582524017840&w=2
> Greetings,
>
> Hannes
>
^ permalink raw reply
* Re: linux-next: Tree for Aug 6 [ wireless | iwlwifi | mac80211 ? ]
From: Hannes Frederic Sowa @ 2013-08-06 23:07 UTC (permalink / raw)
To: Sedat Dilek
Cc: Johannes Berg, David Miller, Stephen Rothwell, wireless,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <CA+icZUWY8PfYeV-iaPCm4MZenNaHRboK6Kmc8=Fnse9_dwfdqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Wed, Aug 07, 2013 at 12:55:33AM +0200, Sedat Dilek wrote:
> No, tested only with iwlwifi.
> Can you try the patch from [1]?
>
> - Sedat -
>
> [1] http://marc.info/?l=linux-netdev&m=137582524017840&w=2
Fixed the problem with virtio_net, too.
Thanks,
Hannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: linux-next: Tree for Aug 6 [ wireless | iwlwifi | mac80211 ? ]
From: Sedat Dilek @ 2013-08-06 23:14 UTC (permalink / raw)
To: Sedat Dilek, Johannes Berg, David Miller, Stephen Rothwell,
wireless, netdev
In-Reply-To: <20130806230749.GC16410@order.stressinduktion.org>
On Wed, Aug 7, 2013 at 1:07 AM, Hannes Frederic Sowa
<hannes@stressinduktion.org> wrote:
> On Wed, Aug 07, 2013 at 12:55:33AM +0200, Sedat Dilek wrote:
>> No, tested only with iwlwifi.
>> Can you try the patch from [1]?
>>
>> - Sedat -
>>
>> [1] http://marc.info/?l=linux-netdev&m=137582524017840&w=2
>
> Fixed the problem with virtio_net, too.
>
> Thanks,
>
Cool!
I retested with latest next-20130806 which is also fine with this patch.
- Sedat -
> Hannes
>
^ permalink raw reply
* [RFC] ip_tunnel: follow lower device state
From: Stephen Hemminger @ 2013-08-06 23:44 UTC (permalink / raw)
To: Pravin Shelar; +Cc: David Miller, netdev
In-Reply-To: <CALnjE+p_rSYZSgrT=P2B5XJebJ4_i6UKKo_8gyD1EoNG_1ve7w@mail.gmail.com>
This is merge of Pravin's earlier patch and mine..
IP tunnels like other layered devices should propogate
carrier and state from lower device to tunnel.
Following patch would propogate link status to IPIP and
GRE devices.
---
v2 - embed link_map in per-net struct.
no need for RCU on link map
handle carrier (NETDEV_CHANGE) as well
include/net/ip_tunnels.h | 1
net/ipv4/ip_tunnel.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 107 insertions(+), 2 deletions(-)
--- a/net/ipv4/ip_tunnel.c 2013-08-06 16:28:14.000000000 -0700
+++ b/net/ipv4/ip_tunnel.c 2013-08-06 16:40:36.498464820 -0700
@@ -61,6 +61,11 @@
#include <net/ip6_route.h>
#endif
+static int tunnels_net_id;
+struct tunnels_net {
+ struct hlist_head link_map[IP_TNL_HASH_SIZE];
+};
+
static unsigned int ip_tunnel_hash(struct ip_tunnel_net *itn,
__be32 key, __be32 remote)
{
@@ -248,8 +253,62 @@ static void ip_tunnel_add(struct ip_tunn
static void ip_tunnel_del(struct ip_tunnel *t)
{
hlist_del_init_rcu(&t->hash_node);
+ hlist_del_init(&t->link_node);
+}
+
+static void ip_tunnel_add_link(struct net *net, struct ip_tunnel *t, int iflink)
+{
+ struct tunnels_net *tn = net_generic(net, tunnels_net_id);
+ int hash = hash_32(iflink, IP_TNL_HASH_BITS);
+
+ hlist_add_head(&t->link_node, &tn->link_map[hash]);
}
+static int ip_tunnel_notify(struct notifier_block *unused,
+ unsigned long event, void *ptr)
+{
+ struct net_device *rootdev = netdev_notifier_info_to_dev(ptr);
+ struct tunnels_net *tn = net_generic(dev_net(rootdev), tunnels_net_id);
+ int hash = hash_32(rootdev->iflink, IP_TNL_HASH_BITS);
+ struct hlist_node *n;
+ struct ip_tunnel *t;
+
+ hlist_for_each_entry_safe(t, n, &tn->link_map[hash], link_node) {
+ int flags;
+
+ if (rootdev->ifindex != t->dev->iflink)
+ continue;
+
+ switch (event) {
+ case NETDEV_CHANGE:
+ break;
+
+ case NETDEV_DOWN:
+ flags = t->dev->flags;
+ if (!(flags & IFF_UP))
+ break;
+ dev_change_flags(t->dev, flags & ~IFF_UP);
+ break;
+
+ case NETDEV_UP:
+ flags = t->dev->flags;
+ if (flags & IFF_UP)
+ break;
+ dev_change_flags(t->dev, flags | IFF_UP);
+ break;
+
+ default:
+ continue;
+ }
+ netif_stacked_transfer_operstate(rootdev, t->dev);
+ }
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block ip_tunnel_notifier = {
+ .notifier_call = ip_tunnel_notify,
+};
+
static struct ip_tunnel *ip_tunnel_find(struct ip_tunnel_net *itn,
struct ip_tunnel_parm *parms,
int type)
@@ -370,8 +429,12 @@ static int ip_tunnel_bind_dev(struct net
if (tdev) {
hlen = tdev->hard_header_len + tdev->needed_headroom;
mtu = tdev->mtu;
+ netif_stacked_transfer_operstate(tdev, dev);
+ ip_tunnel_add_link(dev_net(dev), tunnel, tdev->ifindex);
+ dev->iflink = tdev->ifindex;
+ } else {
+ dev->iflink = tunnel->parms.link;
}
- dev->iflink = tunnel->parms.link;
dev->needed_headroom = t_hlen + hlen;
mtu -= (dev->hard_header_len + t_hlen);
@@ -919,7 +982,7 @@ int ip_tunnel_newlink(struct net_device
dev->mtu = mtu;
ip_tunnel_add(itn, nt);
-
+ linkwatch_fire_event(dev);
out:
return err;
}
@@ -1012,4 +1075,45 @@ void ip_tunnel_setup(struct net_device *
}
EXPORT_SYMBOL_GPL(ip_tunnel_setup);
+static int __net_init tunnels_init_net(struct net *net)
+{
+ struct tunnels_net *tn = net_generic(net, tunnels_net_id);
+ unsigned i;
+
+ for (i = 0; i < IP_TNL_HASH_SIZE; i++)
+ INIT_HLIST_HEAD(&tn->link_map[i]);
+
+ return 0;
+}
+
+static struct pernet_operations tunnels_net_ops = {
+ .init = tunnels_init_net,
+ .id = &tunnels_net_id,
+ .size = sizeof(struct tunnels_net),
+};
+
+static int __init ip_tunnel_mod_init(void)
+{
+ int err;
+
+ pr_info("IP_Tunnel init\n");
+ err = register_pernet_device(&tunnels_net_ops);
+ if (err < 0)
+ return err;
+
+ err = register_netdevice_notifier(&ip_tunnel_notifier);
+ if (err < 0)
+ unregister_pernet_device(&tunnels_net_ops);
+
+ return err;
+}
+
+static void __exit ip_tunnel_mod_fini(void)
+{
+ unregister_netdevice_notifier(&ip_tunnel_notifier);
+ unregister_pernet_device(&tunnels_net_ops);
+}
+
+module_init(ip_tunnel_mod_init);
+module_exit(ip_tunnel_mod_fini);
MODULE_LICENSE("GPL");
--- a/include/net/ip_tunnels.h 2013-08-06 16:28:14.358362477 -0700
+++ b/include/net/ip_tunnels.h 2013-08-06 16:39:35.719423506 -0700
@@ -41,6 +41,7 @@ struct ip_tunnel_prl_entry {
struct ip_tunnel {
struct ip_tunnel __rcu *next;
struct hlist_node hash_node;
+ struct hlist_node link_node;
struct net_device *dev;
struct net *net; /* netns for packet i/o */
^ permalink raw reply
* [PATCH net] ipv6: don't stop backtracking in fib6_lookup_1 if subtree does not match
From: Hannes Frederic Sowa @ 2013-08-07 0:34 UTC (permalink / raw)
To: netdev; +Cc: teco, yoshfuji, equinox, boutier
In case a subtree did not match we currently stop backtracking and return
NULL (root table from fib_lookup). This could yield in invalid routing
table lookups when using subtrees.
Instead continue to backtrack until a valid subtree or node is found
and return this match.
Also remove unneeded NULL check.
Reported-by: Teco Boot <teco@inf-net.nl>
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: David Lamparter <equinox@diac24.net>
Cc: <boutier@pps.univ-paris-diderot.fr>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
net/ipv6/ip6_fib.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index ed828d6..73db48e 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -993,14 +993,22 @@ static struct fib6_node * fib6_lookup_1(struct fib6_node *root,
if (ipv6_prefix_equal(&key->addr, args->addr, key->plen)) {
#ifdef CONFIG_IPV6_SUBTREES
- if (fn->subtree)
- fn = fib6_lookup_1(fn->subtree, args + 1);
+ if (fn->subtree) {
+ struct fib6_node *sfn;
+ sfn = fib6_lookup_1(fn->subtree,
+ args + 1);
+ if (!sfn)
+ goto backtrack;
+ fn = sfn;
+ }
#endif
- if (!fn || fn->fn_flags & RTN_RTINFO)
+ if (fn->fn_flags & RTN_RTINFO)
return fn;
}
}
-
+#ifdef CONFIG_IPV6_SUBTREES
+backtrack:
+#endif
if (fn->fn_flags & RTN_ROOT)
break;
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH v3 4/4] USBNET: ax88179_178a: enable tso if usb host supports sg dma
From: Ming Lei @ 2013-08-07 0:41 UTC (permalink / raw)
To: Grant Grundler
Cc: Eric Dumazet, David S. Miller, Greg Kroah-Hartman, Oliver Neukum,
Sarah Sharp, netdev, linux-usb, Ben Hutchings, Alan Stern,
Freddy Xin
In-Reply-To: <CANEJEGvbS=o-942tFJTDzpNvgaB=KUZcBwzJCU-7OHaAF-aQFQ@mail.gmail.com>
On Wed, Aug 7, 2013 at 1:09 AM, Grant Grundler <grundler@google.com> wrote:
> On Tue, Aug 6, 2013 at 5:22 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> ...
>>> @@ -1310,6 +1318,10 @@ static int ax88179_reset(struct usbnet *dev)
>>>
>>> dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
>>> NETIF_F_RXCSUM;
>>> + if (dev->can_dma_sg) {
>>> + dev->net->features |= NETIF_F_SG | NETIF_F_TSO;
>>> + dev->net->hw_features |= NETIF_F_SG | NETIF_F_TSO;
>>> + }
>>>
>>
>> My concern with setting TSO on reset() is the following :
>>
>> Admin can disable TSO with
>>
>> ethtool -K ethX tso off
>>
>>
>> Then, one hour later, or one month later, a reset happens, and this code
>> magically re-enables TSO
>>
>> So, I really think this part should be removed from your patch.
>
> Following that logic, shouldn't all the features/hw_features settings
> be removed from reset code path?
This patch won't touch other settings because that isn't related with
this patch.
>
> hw_features shouldn't change since power up.
> FWIW, I do agree with you.
>
> I'll note that any "hiccup" in the USB side that causes the device to
> get dropped and re-probed will cause the same symptom. There is
I am afraid that PCI network devices' setting still won't survive unbound&
re-probed, will they?
> nothing the driver can do about it in this case. Perhaps add some udev
> rules to preserve ethtool settings the same way I've seen udev rules
> to record MAC address to enumerate devices (eth0, eth1, etc.)
Some usbnet devices may have random MAC address assigned in every
probe().
Thanks,
--
Ming Lei
^ permalink raw reply
* Re: [PATCH v4 1/3] net: igmp: Reduce Unsolicited report interval to 1s when using IGMPv3
From: Hannes Frederic Sowa @ 2013-08-07 0:45 UTC (permalink / raw)
To: William Manley; +Cc: netdev, bcrl, luky-37, sergei.shtylyov, bhutchings, davem
In-Reply-To: <1375812195-6575-2-git-send-email-william.manley@youview.com>
On Tue, Aug 06, 2013 at 07:03:13PM +0100, William Manley wrote:
> If an IGMP join packet is lost you will not receive data sent to the
> multicast group so if no data arrives from that multicast group in a
> period of time after the IGMP join a second IGMP join will be sent. The
> delay between joins is the "IGMP Unsolicited Report Interval".
>
> Previously this value was hard coded to be chosen randomly between 0-10s.
> This can be too long for some use-cases, such as IPTV as it can cause
> channel change to be slow in the presence of packet loss.
>
> The value 10s has come from IGMPv2 RFC2236, which was reduced to 1s in
> IGMPv3 RFC3376. This patch makes the kernel use the 1s value from the
> later RFC if we are operating in IGMPv3 mode. IGMPv2 behaviour is
> unaffected.
>
> Tested with Wireshark and a simple program to join a (non-existent)
> multicast group. The distribution of timings for the second join differ
> based upon setting /proc/sys/net/ipv4/conf/eth0/force_igmp_version.
>
> Signed-off-by: William Manley <william.manley@youview.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
^ permalink raw reply
* Re: [PATCH v4 2/3] net: igmp: Don't flush routing cache when force_igmp_version is modified
From: Hannes Frederic Sowa @ 2013-08-07 0:45 UTC (permalink / raw)
To: William Manley; +Cc: netdev, bcrl, luky-37, sergei.shtylyov, bhutchings, davem
In-Reply-To: <1375812195-6575-3-git-send-email-william.manley@youview.com>
On Tue, Aug 06, 2013 at 07:03:14PM +0100, William Manley wrote:
> The procfs knob /proc/sys/net/ipv4/conf/*/force_igmp_version allows the
> IGMP protocol version to use to be explicitly set. As a side effect this
> caused the routing cache to be flushed as it was declared as a
> DEVINET_SYSCTL_FLUSHING_ENTRY. Flushing is unnecessary and this patch
> makes it so flushing does not occur.
>
> Requested by Hannes Frederic Sowa as he was reviewing other patches
> adding procfs entries.
>
> Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: William Manley <william.manley@youview.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
^ permalink raw reply
* Re: [PATCH v4 3/3] net: igmp: Allow user-space configuration of igmp unsolicited report interval
From: Hannes Frederic Sowa @ 2013-08-07 1:00 UTC (permalink / raw)
To: William Manley; +Cc: netdev, bcrl, luky-37, sergei.shtylyov, bhutchings, davem
In-Reply-To: <1375812195-6575-4-git-send-email-william.manley@youview.com>
On Tue, Aug 06, 2013 at 07:03:15PM +0100, William Manley wrote:
> Adds the new procfs knobs:
>
> /proc/sys/net/ipv4/conf/*/igmpv2_unsolicited_report_interval
> /proc/sys/net/ipv4/conf/*/igmpv3_unsolicited_report_interval
>
> Which will allow userspace configuration of the IGMP unsolicited report
> interval (see below) in milliseconds. The defaults are 10000ms for IGMPv2
> and 1000ms for IGMPv3 in accordance with RFC2236 and RFC3376.
>
> Background:
>
> If an IGMP join packet is lost you will not receive data sent to the
> multicast group so if no data arrives from that multicast group in a
> period of time after the IGMP join a second IGMP join will be sent. The
> delay between joins is the "IGMP Unsolicited Report Interval".
>
> Prior to this patch this value was hard coded in the kernel to 10s for
> IGMPv2 and 1s for IGMPv3. 10s is unsuitable for some use-cases, such as
> IPTV as it can cause channel change to be slow in the presence of packet
> loss.
>
> This patch allows the value to be overridden from userspace for both
> IGMPv2 and IGMPv3 such that it can be tuned accoding to the network.
>
> Tested with Wireshark and a simple program to join a (non-existent)
> multicast group. The distribution of timings for the second join differ
> based upon setting the procfs knobs.
>
> igmpvX_unsolicited_report_interval is intended to follow the pattern
> established by force_igmp_version, and while a procfs entry has been added
> a corresponding sysctl knob has not as it is my understanding that sysctl
> is deprecated[1].
>
> [1]: http://lwn.net/Articles/247243/
>
> Signed-off-by: William Manley <william.manley@youview.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
^ permalink raw reply
* Re: IGMP Unsolicited report interval patches
From: Hannes Frederic Sowa @ 2013-08-07 1:03 UTC (permalink / raw)
To: William Manley; +Cc: netdev, bcrl, luky-37, sergei.shtylyov, bhutchings, davem
In-Reply-To: <1375812195-6575-1-git-send-email-william.manley@youview.com>
On Tue, Aug 06, 2013 at 07:03:12PM +0100, William Manley wrote:
> 4th version of the patches.
>
> The significant changes since last review are:
>
> 1. there is a new patch (2/3) as requested by Hannes.
Thanks!
> 2. the third patch now uses IN_DEV_CONF_GET in place of
> IPV4_DEVCONF_ALL. This means that the unsolicited report interval can
> now be configured on an interface-by-interface basis as I'd originally
> intended but messed up in the implementation. One concern I have now
> is that with this latest patch-set is that while
> /proc/sys/net/ipv4/conf/eth0/igmp... will now have an effect
> /proc/sys/net/ipv4/conf/all/igmp... will not. I'm not sure how to
> resolve this.
Hm, it seems to be come more difficult dealing with ranges.
One way would be, to check the state bit for the devinet entry and chose the
all value always but when the state bit for the interface for this entry is
set. I'll have a look on how to do this.
> One option would be to have a special value of -1 to mean use the
> default so I could implement fall-back semantics. A down-side of this
> approach is that it makes the meaning of the knobs less clear for
> someone browsing through the filesystem. Another option would be to
> remove the knob from all/ entirely, although I'm not sure how to do
> this. Suggestions are very much welcome :)
This seems to be confusing, at least or me. ;)
Thanks for the series! The patches are find IMHO.
Do you plan to make the corresponding changes for ipv6 or should I put that on
my todo list?
Thanks,
Hannes
^ permalink raw reply
* A soft lockup in vxlan module
From: Cong Wang @ 2013-08-07 1:23 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
Hi, Stephen
You introduced a soft lockup in vxlan module in
commit fe5c3561e6f0ac7c9546209f01351113c1b77ec8
Author: stephen hemminger <stephen@networkplumber.org>
Date: Sat Jul 13 10:18:18 2013 -0700
vxlan: add necessary locking on device removal
The problem is that vxlan_dellink(), which is called with RTNL lock
held, tries to flush the workqueue synchronously, but apparently
igmp_join and igmp_leave work need to hold RTNL lock too, therefore we
have a soft lockup! This is 100% reproducible on my 2.6.32 backport
while running `modprobe -r vxlan`.
A quick but perhaps ugly fix is just releasing RTNL lock before calling
flush_workqueue():
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 8bf31d9..581d3d5 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1837,7 +1837,9 @@ static void vxlan_dellink(struct net_device *dev,
struct list_head *head)
struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
struct vxlan_dev *vxlan = netdev_priv(dev);
+ rtnl_unlock();
flush_workqueue(vxlan_wq);
+ rtnl_lock();
spin_lock(&vn->sock_lock);
hlist_del_rcu(&vxlan->hlist);
However, I think a better way is still what I did, that is, removing
RTNL lock from ip_mc_join_group() and ip_mc_leave_group().
What do you think? Any other idea to fix it?
Thanks.
^ permalink raw reply related
* Re: A soft lockup in vxlan module
From: Stephen Hemminger @ 2013-08-07 2:18 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev
In-Reply-To: <1375838634.11370.13.camel@cr0>
Calling unlock in dellink is not safe.
can you reproduce with 3.10 or 3.11-rc?
On Tue, Aug 6, 2013 at 6:23 PM, Cong Wang <amwang@redhat.com> wrote:
> Hi, Stephen
>
> You introduced a soft lockup in vxlan module in
>
> commit fe5c3561e6f0ac7c9546209f01351113c1b77ec8
> Author: stephen hemminger <stephen@networkplumber.org>
> Date: Sat Jul 13 10:18:18 2013 -0700
>
> vxlan: add necessary locking on device removal
>
> The problem is that vxlan_dellink(), which is called with RTNL lock
> held, tries to flush the workqueue synchronously, but apparently
> igmp_join and igmp_leave work need to hold RTNL lock too, therefore we
> have a soft lockup! This is 100% reproducible on my 2.6.32 backport
> while running `modprobe -r vxlan`.
>
> A quick but perhaps ugly fix is just releasing RTNL lock before calling
> flush_workqueue():
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index 8bf31d9..581d3d5 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -1837,7 +1837,9 @@ static void vxlan_dellink(struct net_device *dev,
> struct list_head *head)
> struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
> struct vxlan_dev *vxlan = netdev_priv(dev);
>
> + rtnl_unlock();
> flush_workqueue(vxlan_wq);
> + rtnl_lock();
>
> spin_lock(&vn->sock_lock);
> hlist_del_rcu(&vxlan->hlist);
>
> However, I think a better way is still what I did, that is, removing
> RTNL lock from ip_mc_join_group() and ip_mc_leave_group().
>
> What do you think? Any other idea to fix it?
>
> Thanks.
>
^ permalink raw reply
* Re: A soft lockup in vxlan module
From: Cong Wang @ 2013-08-07 2:34 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <CAOaVG14-vSR-gt+c8zMe+rk6MX4xO3dGxZHi--M6Nun+qTOSVQ@mail.gmail.com>
On Tue, 2013-08-06 at 19:18 -0700, Stephen Hemminger wrote:
> Calling unlock in dellink is not safe.
This is my feeling as well.
> can you reproduce with 3.10 or 3.11-rc?
>
For net-next, I always compile modules as builtin, therefore can't test
it. But clearly the code is same.
The steps to reproduce it are:
1) ping over vxlan0
2) modprobe -r vxlan
^ permalink raw reply
* [request for stable inclusion] net: neighbour: prohibit negative value for unres_qlen_bytes parameter
From: wangweidong @ 2013-08-07 3:23 UTC (permalink / raw)
To: davem; +Cc: netdev, stable, davidshan, dingtianhong, Li Zefan
Hi Shan Wei or David,
ce46cc64d47a8afaf13c300b09a7f9c29f4979b6
net: neighbour: prohibit negative value for unres_qlen_bytes parameter
This looks applicable to stable-3.4, I can reproduce it on this 3.4 kernel.
It fixes a type overflow when setting unres_qlen. I try to reproduce, and
then this patch works well. But git am or patch -p1 failed, because a
previous patch [commit 9a6308d74ed (neighbour: Stop using NLA_PUT*().)]
change the NLA_PUT_U32 to nla_put_u32. With some modifies, it was built
successful for me. What do you think?
stable-3.0 and stable-3.2 are free from this bug. And the bug was fixed in
3.8; The commit got its way into mainline in 3.8 cycle.
Thanks!
Wang Weidong
^ permalink raw reply
* [request for stable inclusion] tipc: fix lockdep warning during bearer initialization
From: wangweidong @ 2013-08-07 3:23 UTC (permalink / raw)
To: davem
Cc: netdev, stable, ying.xue, jon.maloy, paul.gortmaker, dingtianhong,
Li Zefan
Hi Ying Xue, Jon, Paul or David,
4225a398c1352a7a5c14dc07277cb5cc4473983b
tipc: fix lockdep warning during bearer initialization
This looks applicable to stable-3.0/3.2/3.4, that fixed one deadlock.
With the tipc-config cmd, I can reproduce that. The deadlock possibly
occur when the second TIPC bearer is registered, the deadlock can perhaps
really happen. And this patch works well. But git am or patch -p1 failed,
because a previous patch [commit 617d3c7a5 (tipc: compress out gratuitous
extra carriage returns)] deletes some blank lines. With some modifies, it
was built successful for me. What do you think?
And the bug was fixed in 3.7; The commit got its way into mainline in 3.7
cycle.
Thanks!
Wang Weidong
^ permalink raw reply
* Re: [PATCH net-next 3/3] net: core: fix wrong linkage for ptype_base and ptype_all symbols
From: Jean Sacren @ 2013-08-07 4:00 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Daniel Borkmann, netdev
In-Reply-To: <1375823201.4004.13.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 06 Aug 2013 14:06:41 -0700
>
> On Tue, 2013-08-06 at 14:45 -0600, Jean Sacren wrote:
>
> > I'm sorry to tell you but the patch is correct. Both symbols of
> > ptype_{base,all} were wrongly declared as extern in net-procfs.c in the
> > first place.
>
> You are mistaken.
Sorry for the big mistake.
--
Jean Sacren
^ permalink raw reply
* Re: A soft lockup in vxlan module
From: Stephen Hemminger @ 2013-08-07 4:13 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev
In-Reply-To: <1375838634.11370.13.camel@cr0>
On Wed, 07 Aug 2013 09:23:54 +0800
Cong Wang <amwang@redhat.com> wrote:
> Hi, Stephen
>
> You introduced a soft lockup in vxlan module in
>
> commit fe5c3561e6f0ac7c9546209f01351113c1b77ec8
> Author: stephen hemminger <stephen@networkplumber.org>
> Date: Sat Jul 13 10:18:18 2013 -0700
>
> vxlan: add necessary locking on device removal
>
> The problem is that vxlan_dellink(), which is called with RTNL lock
> held, tries to flush the workqueue synchronously, but apparently
> igmp_join and igmp_leave work need to hold RTNL lock too, therefore we
> have a soft lockup! This is 100% reproducible on my 2.6.32 backport
> while running `modprobe -r vxlan`.
>
> A quick but perhaps ugly fix is just releasing RTNL lock before calling
> flush_workqueue():
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index 8bf31d9..581d3d5 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -1837,7 +1837,9 @@ static void vxlan_dellink(struct net_device *dev,
> struct list_head *head)
> struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
> struct vxlan_dev *vxlan = netdev_priv(dev);
>
> + rtnl_unlock();
> flush_workqueue(vxlan_wq);
> + rtnl_lock();
>
> spin_lock(&vn->sock_lock);
> hlist_del_rcu(&vxlan->hlist);
>
> However, I think a better way is still what I did, that is, removing
> RTNL lock from ip_mc_join_group() and ip_mc_leave_group().
>
> What do you think? Any other idea to fix it?
>
> Thanks.
>
Probably the flush_workqueue can just be removed and let the normal
refcounting work. The workqueue has a reference to device and socket,
therefore the cleanups should work correctly.
^ permalink raw reply
* Re: Bug: alx: Atheros AR8131/AR8151/AR8152/AR8161 Ethernet driver
From: Kinley Dorji @ 2013-08-07 6:32 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Johannes Berg, Stephen Hemminger, netdev
In-Reply-To: <1375790821.4457.90.camel@edumazet-glaptop>
@Johannes Berg: > don't really care much for the
> stats in the system I'm using this device on - and based on the driver
> I'm not sure I'd use the chip for 'serious' work anyway :)
OTOH, conky users love having the stats up, even if they aren't precise. :)
There's one other point:
Before the mainlining of the alx drivers, the default settings for
Wake-on used to be d, whereas now it seems to be pg. This startled me
a couple of times with my computer turning on unexpectedly, having
been used to the previous defaults. Just FYI.
Other than that, I would like thank you all very much for your quick
responses and I look forward to having the stats code restored to the
alx drivers.
With best regards,
Kinley
On Tue, Aug 6, 2013 at 6:07 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Tue, 2013-08-06 at 13:32 +0200, Johannes Berg wrote:
>
>> I don't. There are some stats in the original code at
>> https://github.com/erikarn/alx, but I removed them because I didn't
>> really understand what was going on and don't really care much for the
>> stats in the system I'm using this device on - and based on the driver
>> I'm not sure I'd use the chip for 'serious' work anyway :)
>>
>
> OK, their code seems clean and should be copied/pasted.
>
>
>> FWIW, it had ndo_get_stats() but was updating the netdev->stats from
>> that handler and then returning them, which seemed a bit questionable.
>>
>
> Its fine, as updates of each field are atomic (unsigned long)
>
>
>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox