diff options
author | David S. Miller <davem@davemloft.net> | 2012-04-15 13:19:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-15 13:19:04 -0400 |
commit | 56845d78cee8576a8160cee8aeac62efdb561ae2 (patch) | |
tree | f891afed5324d359da1713a80a7131968373acc4 | |
parent | df8ef8f3aaa6692970a436204c4429210addb23a (diff) | |
parent | 8a9a0ea6032186e3030419262678d652b88bf6a8 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/ethernet/atheros/atlx/atl1.c
drivers/net/ethernet/atheros/atlx/atl1.h
Resolved a conflict between a DMA error bug fix and NAPI
support changes in the atl1 driver.
Signed-off-by: David S. Miller <davem@davemloft.net>
24 files changed, 167 insertions, 99 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 9ee96bbf79cc..f1b5694340f4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -7572,8 +7572,8 @@ F: Documentation/filesystems/xfs.txt | |||
7572 | F: fs/xfs/ | 7572 | F: fs/xfs/ |
7573 | 7573 | ||
7574 | XILINX AXI ETHERNET DRIVER | 7574 | XILINX AXI ETHERNET DRIVER |
7575 | M: Ariane Keller <ariane.keller@tik.ee.ethz.ch> | 7575 | M: Anirudha Sarangi <anirudh@xilinx.com> |
7576 | M: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch> | 7576 | M: John Linn <John.Linn@xilinx.com> |
7577 | S: Maintained | 7577 | S: Maintained |
7578 | F: drivers/net/ethernet/xilinx/xilinx_axienet* | 7578 | F: drivers/net/ethernet/xilinx/xilinx_axienet* |
7579 | 7579 | ||
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c index 7f1e498c3c06..5d10884e5080 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.c +++ b/drivers/net/ethernet/atheros/atlx/atl1.c | |||
@@ -2528,7 +2528,7 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
2528 | "pcie phy link down %x\n", status); | 2528 | "pcie phy link down %x\n", status); |
2529 | if (netif_running(adapter->netdev)) { /* reset MAC */ | 2529 | if (netif_running(adapter->netdev)) { /* reset MAC */ |
2530 | atlx_irq_disable(adapter); | 2530 | atlx_irq_disable(adapter); |
2531 | schedule_work(&adapter->pcie_dma_to_rst_task); | 2531 | schedule_work(&adapter->reset_dev_task); |
2532 | return IRQ_HANDLED; | 2532 | return IRQ_HANDLED; |
2533 | } | 2533 | } |
2534 | } | 2534 | } |
@@ -2540,7 +2540,7 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
2540 | "pcie DMA r/w error (status = 0x%x)\n", | 2540 | "pcie DMA r/w error (status = 0x%x)\n", |
2541 | status); | 2541 | status); |
2542 | atlx_irq_disable(adapter); | 2542 | atlx_irq_disable(adapter); |
2543 | schedule_work(&adapter->pcie_dma_to_rst_task); | 2543 | schedule_work(&adapter->reset_dev_task); |
2544 | return IRQ_HANDLED; | 2544 | return IRQ_HANDLED; |
2545 | } | 2545 | } |
2546 | 2546 | ||
@@ -2681,10 +2681,10 @@ static void atl1_down(struct atl1_adapter *adapter) | |||
2681 | atl1_clean_rx_ring(adapter); | 2681 | atl1_clean_rx_ring(adapter); |
2682 | } | 2682 | } |
2683 | 2683 | ||
2684 | static void atl1_tx_timeout_task(struct work_struct *work) | 2684 | static void atl1_reset_dev_task(struct work_struct *work) |
2685 | { | 2685 | { |
2686 | struct atl1_adapter *adapter = | 2686 | struct atl1_adapter *adapter = |
2687 | container_of(work, struct atl1_adapter, tx_timeout_task); | 2687 | container_of(work, struct atl1_adapter, reset_dev_task); |
2688 | struct net_device *netdev = adapter->netdev; | 2688 | struct net_device *netdev = adapter->netdev; |
2689 | 2689 | ||
2690 | netif_device_detach(netdev); | 2690 | netif_device_detach(netdev); |
@@ -3087,12 +3087,10 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | |||
3087 | (unsigned long)adapter); | 3087 | (unsigned long)adapter); |
3088 | adapter->phy_timer_pending = false; | 3088 | adapter->phy_timer_pending = false; |
3089 | 3089 | ||
3090 | INIT_WORK(&adapter->tx_timeout_task, atl1_tx_timeout_task); | 3090 | INIT_WORK(&adapter->reset_dev_task, atl1_reset_dev_task); |
3091 | 3091 | ||
3092 | INIT_WORK(&adapter->link_chg_task, atlx_link_chg_task); | 3092 | INIT_WORK(&adapter->link_chg_task, atlx_link_chg_task); |
3093 | 3093 | ||
3094 | INIT_WORK(&adapter->pcie_dma_to_rst_task, atl1_tx_timeout_task); | ||
3095 | |||
3096 | err = register_netdev(netdev); | 3094 | err = register_netdev(netdev); |
3097 | if (err) | 3095 | if (err) |
3098 | goto err_common; | 3096 | goto err_common; |
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.h b/drivers/net/ethernet/atheros/atlx/atl1.h index 1cb658b2ff92..b1fb209b9dd9 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.h +++ b/drivers/net/ethernet/atheros/atlx/atl1.h | |||
@@ -764,8 +764,8 @@ struct atl1_adapter { | |||
764 | spinlock_t lock; | 764 | spinlock_t lock; |
765 | struct napi_struct napi; | 765 | struct napi_struct napi; |
766 | struct work_struct tx_timeout_task; | 766 | struct work_struct tx_timeout_task; |
767 | struct work_struct reset_dev_task; | ||
767 | struct work_struct link_chg_task; | 768 | struct work_struct link_chg_task; |
768 | struct work_struct pcie_dma_to_rst_task; | ||
769 | 769 | ||
770 | struct timer_list phy_config_timer; | 770 | struct timer_list phy_config_timer; |
771 | bool phy_timer_pending; | 771 | bool phy_timer_pending; |
diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c index 95975b5b7f70..b4f3aa49a7fc 100644 --- a/drivers/net/ethernet/atheros/atlx/atlx.c +++ b/drivers/net/ethernet/atheros/atlx/atlx.c | |||
@@ -201,7 +201,7 @@ static void atlx_tx_timeout(struct net_device *netdev) | |||
201 | { | 201 | { |
202 | struct atlx_adapter *adapter = netdev_priv(netdev); | 202 | struct atlx_adapter *adapter = netdev_priv(netdev); |
203 | /* Do the reset outside of interrupt context */ | 203 | /* Do the reset outside of interrupt context */ |
204 | schedule_work(&adapter->tx_timeout_task); | 204 | schedule_work(&adapter->reset_dev_task); |
205 | } | 205 | } |
206 | 206 | ||
207 | /* | 207 | /* |
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index 0f158a95d94f..14af3e22d8d9 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c | |||
@@ -1310,10 +1310,6 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) | |||
1310 | 1310 | ||
1311 | if (mac_reg & E1000_PHY_CTRL_D0A_LPLU) | 1311 | if (mac_reg & E1000_PHY_CTRL_D0A_LPLU) |
1312 | oem_reg |= HV_OEM_BITS_LPLU; | 1312 | oem_reg |= HV_OEM_BITS_LPLU; |
1313 | |||
1314 | /* Set Restart auto-neg to activate the bits */ | ||
1315 | if (!hw->phy.ops.check_reset_block(hw)) | ||
1316 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
1317 | } else { | 1313 | } else { |
1318 | if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE | | 1314 | if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE | |
1319 | E1000_PHY_CTRL_NOND0A_GBE_DISABLE)) | 1315 | E1000_PHY_CTRL_NOND0A_GBE_DISABLE)) |
@@ -1324,6 +1320,11 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) | |||
1324 | oem_reg |= HV_OEM_BITS_LPLU; | 1320 | oem_reg |= HV_OEM_BITS_LPLU; |
1325 | } | 1321 | } |
1326 | 1322 | ||
1323 | /* Set Restart auto-neg to activate the bits */ | ||
1324 | if ((d0_state || (hw->mac.type != e1000_pchlan)) && | ||
1325 | !hw->phy.ops.check_reset_block(hw)) | ||
1326 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
1327 | |||
1327 | ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg); | 1328 | ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg); |
1328 | 1329 | ||
1329 | release: | 1330 | release: |
@@ -3682,7 +3683,11 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw) | |||
3682 | 3683 | ||
3683 | if (hw->mac.type >= e1000_pchlan) { | 3684 | if (hw->mac.type >= e1000_pchlan) { |
3684 | e1000_oem_bits_config_ich8lan(hw, false); | 3685 | e1000_oem_bits_config_ich8lan(hw, false); |
3685 | e1000_phy_hw_reset_ich8lan(hw); | 3686 | |
3687 | /* Reset PHY to activate OEM bits on 82577/8 */ | ||
3688 | if (hw->mac.type == e1000_pchlan) | ||
3689 | e1000e_phy_hw_reset_generic(hw); | ||
3690 | |||
3686 | ret_val = hw->phy.ops.acquire(hw); | 3691 | ret_val = hw->phy.ops.acquire(hw); |
3687 | if (ret_val) | 3692 | if (ret_val) |
3688 | return; | 3693 | return; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 10606bdbb5ae..f3b849438b62 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -4865,6 +4865,16 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
4865 | if (wufc) { | 4865 | if (wufc) { |
4866 | ixgbe_set_rx_mode(netdev); | 4866 | ixgbe_set_rx_mode(netdev); |
4867 | 4867 | ||
4868 | /* | ||
4869 | * enable the optics for both mult-speed fiber and | ||
4870 | * 82599 SFP+ fiber as we can WoL. | ||
4871 | */ | ||
4872 | if (hw->mac.ops.enable_tx_laser && | ||
4873 | (hw->phy.multispeed_fiber || | ||
4874 | (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber && | ||
4875 | hw->mac.type == ixgbe_mac_82599EB))) | ||
4876 | hw->mac.ops.enable_tx_laser(hw); | ||
4877 | |||
4868 | /* turn on all-multi mode if wake on multicast is enabled */ | 4878 | /* turn on all-multi mode if wake on multicast is enabled */ |
4869 | if (wufc & IXGBE_WUFC_MC) { | 4879 | if (wufc & IXGBE_WUFC_MC) { |
4870 | fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); | 4880 | fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); |
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c index c722aa607d07..e5dc0757f077 100644 --- a/drivers/net/ethernet/micrel/ks8851.c +++ b/drivers/net/ethernet/micrel/ks8851.c | |||
@@ -1418,6 +1418,7 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
1418 | struct net_device *ndev; | 1418 | struct net_device *ndev; |
1419 | struct ks8851_net *ks; | 1419 | struct ks8851_net *ks; |
1420 | int ret; | 1420 | int ret; |
1421 | unsigned cider; | ||
1421 | 1422 | ||
1422 | ndev = alloc_etherdev(sizeof(struct ks8851_net)); | 1423 | ndev = alloc_etherdev(sizeof(struct ks8851_net)); |
1423 | if (!ndev) | 1424 | if (!ndev) |
@@ -1484,8 +1485,8 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
1484 | ks8851_soft_reset(ks, GRR_GSR); | 1485 | ks8851_soft_reset(ks, GRR_GSR); |
1485 | 1486 | ||
1486 | /* simple check for a valid chip being connected to the bus */ | 1487 | /* simple check for a valid chip being connected to the bus */ |
1487 | 1488 | cider = ks8851_rdreg16(ks, KS_CIDER); | |
1488 | if ((ks8851_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) { | 1489 | if ((cider & ~CIDER_REV_MASK) != CIDER_ID) { |
1489 | dev_err(&spi->dev, "failed to read device ID\n"); | 1490 | dev_err(&spi->dev, "failed to read device ID\n"); |
1490 | ret = -ENODEV; | 1491 | ret = -ENODEV; |
1491 | goto err_id; | 1492 | goto err_id; |
@@ -1516,8 +1517,7 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
1516 | } | 1517 | } |
1517 | 1518 | ||
1518 | netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n", | 1519 | netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n", |
1519 | CIDER_REV_GET(ks8851_rdreg16(ks, KS_CIDER)), | 1520 | CIDER_REV_GET(cider), ndev->dev_addr, ndev->irq, |
1520 | ndev->dev_addr, ndev->irq, | ||
1521 | ks->rc_ccr & CCR_EEPROM ? "has" : "no"); | 1521 | ks->rc_ccr & CCR_EEPROM ? "has" : "no"); |
1522 | 1522 | ||
1523 | return 0; | 1523 | return 0; |
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c index b8104d9f4081..5ffde23ac8fb 100644 --- a/drivers/net/ethernet/micrel/ks8851_mll.c +++ b/drivers/net/ethernet/micrel/ks8851_mll.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #define DRV_NAME "ks8851_mll" | 40 | #define DRV_NAME "ks8851_mll" |
41 | 41 | ||
42 | static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 }; | 42 | static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 }; |
43 | #define MAX_RECV_FRAMES 32 | 43 | #define MAX_RECV_FRAMES 255 |
44 | #define MAX_BUF_SIZE 2048 | 44 | #define MAX_BUF_SIZE 2048 |
45 | #define TX_BUF_SIZE 2000 | 45 | #define TX_BUF_SIZE 2000 |
46 | #define RX_BUF_SIZE 2000 | 46 | #define RX_BUF_SIZE 2000 |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 69c7d695807c..5eef290997f9 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
@@ -961,6 +961,11 @@ static inline void cp_start_hw (struct cp_private *cp) | |||
961 | cpw8(Cmd, RxOn | TxOn); | 961 | cpw8(Cmd, RxOn | TxOn); |
962 | } | 962 | } |
963 | 963 | ||
964 | static void cp_enable_irq(struct cp_private *cp) | ||
965 | { | ||
966 | cpw16_f(IntrMask, cp_intr_mask); | ||
967 | } | ||
968 | |||
964 | static void cp_init_hw (struct cp_private *cp) | 969 | static void cp_init_hw (struct cp_private *cp) |
965 | { | 970 | { |
966 | struct net_device *dev = cp->dev; | 971 | struct net_device *dev = cp->dev; |
@@ -1000,8 +1005,6 @@ static void cp_init_hw (struct cp_private *cp) | |||
1000 | 1005 | ||
1001 | cpw16(MultiIntr, 0); | 1006 | cpw16(MultiIntr, 0); |
1002 | 1007 | ||
1003 | cpw16_f(IntrMask, cp_intr_mask); | ||
1004 | |||
1005 | cpw8_f(Cfg9346, Cfg9346_Lock); | 1008 | cpw8_f(Cfg9346, Cfg9346_Lock); |
1006 | } | 1009 | } |
1007 | 1010 | ||
@@ -1134,6 +1137,8 @@ static int cp_open (struct net_device *dev) | |||
1134 | if (rc) | 1137 | if (rc) |
1135 | goto err_out_hw; | 1138 | goto err_out_hw; |
1136 | 1139 | ||
1140 | cp_enable_irq(cp); | ||
1141 | |||
1137 | netif_carrier_off(dev); | 1142 | netif_carrier_off(dev); |
1138 | mii_check_media(&cp->mii_if, netif_msg_link(cp), true); | 1143 | mii_check_media(&cp->mii_if, netif_msg_link(cp), true); |
1139 | netif_start_queue(dev); | 1144 | netif_start_queue(dev); |
@@ -2032,6 +2037,7 @@ static int cp_resume (struct pci_dev *pdev) | |||
2032 | /* FIXME: sh*t may happen if the Rx ring buffer is depleted */ | 2037 | /* FIXME: sh*t may happen if the Rx ring buffer is depleted */ |
2033 | cp_init_rings_index (cp); | 2038 | cp_init_rings_index (cp); |
2034 | cp_init_hw (cp); | 2039 | cp_init_hw (cp); |
2040 | cp_enable_irq(cp); | ||
2035 | netif_start_queue (dev); | 2041 | netif_start_queue (dev); |
2036 | 2042 | ||
2037 | spin_lock_irqsave (&cp->lock, flags); | 2043 | spin_lock_irqsave (&cp->lock, flags); |
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index 519ed8ef54e0..480fd0822e4a 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
@@ -1166,10 +1166,8 @@ smsc911x_rx_counterrors(struct net_device *dev, unsigned int rxstat) | |||
1166 | 1166 | ||
1167 | /* Quickly dumps bad packets */ | 1167 | /* Quickly dumps bad packets */ |
1168 | static void | 1168 | static void |
1169 | smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes) | 1169 | smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktwords) |
1170 | { | 1170 | { |
1171 | unsigned int pktwords = (pktbytes + NET_IP_ALIGN + 3) >> 2; | ||
1172 | |||
1173 | if (likely(pktwords >= 4)) { | 1171 | if (likely(pktwords >= 4)) { |
1174 | unsigned int timeout = 500; | 1172 | unsigned int timeout = 500; |
1175 | unsigned int val; | 1173 | unsigned int val; |
@@ -1233,7 +1231,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget) | |||
1233 | continue; | 1231 | continue; |
1234 | } | 1232 | } |
1235 | 1233 | ||
1236 | skb = netdev_alloc_skb(dev, pktlength + NET_IP_ALIGN); | 1234 | skb = netdev_alloc_skb(dev, pktwords << 2); |
1237 | if (unlikely(!skb)) { | 1235 | if (unlikely(!skb)) { |
1238 | SMSC_WARN(pdata, rx_err, | 1236 | SMSC_WARN(pdata, rx_err, |
1239 | "Unable to allocate skb for rx packet"); | 1237 | "Unable to allocate skb for rx packet"); |
@@ -1243,14 +1241,12 @@ static int smsc911x_poll(struct napi_struct *napi, int budget) | |||
1243 | break; | 1241 | break; |
1244 | } | 1242 | } |
1245 | 1243 | ||
1246 | skb->data = skb->head; | 1244 | pdata->ops->rx_readfifo(pdata, |
1247 | skb_reset_tail_pointer(skb); | 1245 | (unsigned int *)skb->data, pktwords); |
1248 | 1246 | ||
1249 | /* Align IP on 16B boundary */ | 1247 | /* Align IP on 16B boundary */ |
1250 | skb_reserve(skb, NET_IP_ALIGN); | 1248 | skb_reserve(skb, NET_IP_ALIGN); |
1251 | skb_put(skb, pktlength - 4); | 1249 | skb_put(skb, pktlength - 4); |
1252 | pdata->ops->rx_readfifo(pdata, | ||
1253 | (unsigned int *)skb->head, pktwords); | ||
1254 | skb->protocol = eth_type_trans(skb, dev); | 1250 | skb->protocol = eth_type_trans(skb, dev); |
1255 | skb_checksum_none_assert(skb); | 1251 | skb_checksum_none_assert(skb); |
1256 | netif_receive_skb(skb); | 1252 | netif_receive_skb(skb); |
@@ -1565,7 +1561,7 @@ static int smsc911x_open(struct net_device *dev) | |||
1565 | smsc911x_reg_write(pdata, FIFO_INT, temp); | 1561 | smsc911x_reg_write(pdata, FIFO_INT, temp); |
1566 | 1562 | ||
1567 | /* set RX Data offset to 2 bytes for alignment */ | 1563 | /* set RX Data offset to 2 bytes for alignment */ |
1568 | smsc911x_reg_write(pdata, RX_CFG, (2 << 8)); | 1564 | smsc911x_reg_write(pdata, RX_CFG, (NET_IP_ALIGN << 8)); |
1569 | 1565 | ||
1570 | /* enable NAPI polling before enabling RX interrupts */ | 1566 | /* enable NAPI polling before enabling RX interrupts */ |
1571 | napi_enable(&pdata->napi); | 1567 | napi_enable(&pdata->napi); |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h index cc83af083fd7..44b8d2bad8c3 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h | |||
@@ -2,9 +2,7 @@ | |||
2 | * Definitions for Xilinx Axi Ethernet device driver. | 2 | * Definitions for Xilinx Axi Ethernet device driver. |
3 | * | 3 | * |
4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. | 4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. |
5 | * Copyright (c) 2010 Xilinx, Inc. All rights reserved. | 5 | * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. |
6 | * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> | ||
7 | * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> | ||
8 | */ | 6 | */ |
9 | 7 | ||
10 | #ifndef XILINX_AXIENET_H | 8 | #ifndef XILINX_AXIENET_H |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 2fcbeba6814b..9c365e192a31 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | |||
@@ -4,9 +4,9 @@ | |||
4 | * Copyright (c) 2008 Nissin Systems Co., Ltd., Yoshio Kashiwagi | 4 | * Copyright (c) 2008 Nissin Systems Co., Ltd., Yoshio Kashiwagi |
5 | * Copyright (c) 2005-2008 DLA Systems, David H. Lynch Jr. <dhlii@dlasys.net> | 5 | * Copyright (c) 2005-2008 DLA Systems, David H. Lynch Jr. <dhlii@dlasys.net> |
6 | * Copyright (c) 2008-2009 Secret Lab Technologies Ltd. | 6 | * Copyright (c) 2008-2009 Secret Lab Technologies Ltd. |
7 | * Copyright (c) 2010 Xilinx, Inc. All rights reserved. | 7 | * Copyright (c) 2010 - 2011 Michal Simek <monstr@monstr.eu> |
8 | * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> | 8 | * Copyright (c) 2010 - 2011 PetaLogix |
9 | * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> | 9 | * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. |
10 | * | 10 | * |
11 | * This is a driver for the Xilinx Axi Ethernet which is used in the Virtex6 | 11 | * This is a driver for the Xilinx Axi Ethernet which is used in the Virtex6 |
12 | * and Spartan6. | 12 | * and Spartan6. |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c index d70b6e79f6c0..e90e1f46121e 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | |||
@@ -2,9 +2,9 @@ | |||
2 | * MDIO bus driver for the Xilinx Axi Ethernet device | 2 | * MDIO bus driver for the Xilinx Axi Ethernet device |
3 | * | 3 | * |
4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. | 4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. |
5 | * Copyright (c) 2010 Xilinx, Inc. All rights reserved. | 5 | * Copyright (c) 2010 - 2011 Michal Simek <monstr@monstr.eu> |
6 | * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> | 6 | * Copyright (c) 2010 - 2011 PetaLogix |
7 | * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> | 7 | * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/of_address.h> | 10 | #include <linux/of_address.h> |
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 33f8c51968b6..21d7151fb0ab 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c | |||
@@ -235,7 +235,7 @@ struct ppp_net { | |||
235 | /* Prototypes. */ | 235 | /* Prototypes. */ |
236 | static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, | 236 | static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, |
237 | struct file *file, unsigned int cmd, unsigned long arg); | 237 | struct file *file, unsigned int cmd, unsigned long arg); |
238 | static int ppp_xmit_process(struct ppp *ppp); | 238 | static void ppp_xmit_process(struct ppp *ppp); |
239 | static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb); | 239 | static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb); |
240 | static void ppp_push(struct ppp *ppp); | 240 | static void ppp_push(struct ppp *ppp); |
241 | static void ppp_channel_push(struct channel *pch); | 241 | static void ppp_channel_push(struct channel *pch); |
@@ -969,8 +969,7 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
969 | put_unaligned_be16(proto, pp); | 969 | put_unaligned_be16(proto, pp); |
970 | 970 | ||
971 | skb_queue_tail(&ppp->file.xq, skb); | 971 | skb_queue_tail(&ppp->file.xq, skb); |
972 | if (!ppp_xmit_process(ppp)) | 972 | ppp_xmit_process(ppp); |
973 | netif_stop_queue(dev); | ||
974 | return NETDEV_TX_OK; | 973 | return NETDEV_TX_OK; |
975 | 974 | ||
976 | outf: | 975 | outf: |
@@ -1048,11 +1047,10 @@ static void ppp_setup(struct net_device *dev) | |||
1048 | * Called to do any work queued up on the transmit side | 1047 | * Called to do any work queued up on the transmit side |
1049 | * that can now be done. | 1048 | * that can now be done. |
1050 | */ | 1049 | */ |
1051 | static int | 1050 | static void |
1052 | ppp_xmit_process(struct ppp *ppp) | 1051 | ppp_xmit_process(struct ppp *ppp) |
1053 | { | 1052 | { |
1054 | struct sk_buff *skb; | 1053 | struct sk_buff *skb; |
1055 | int ret = 0; | ||
1056 | 1054 | ||
1057 | ppp_xmit_lock(ppp); | 1055 | ppp_xmit_lock(ppp); |
1058 | if (!ppp->closing) { | 1056 | if (!ppp->closing) { |
@@ -1062,13 +1060,12 @@ ppp_xmit_process(struct ppp *ppp) | |||
1062 | ppp_send_frame(ppp, skb); | 1060 | ppp_send_frame(ppp, skb); |
1063 | /* If there's no work left to do, tell the core net | 1061 | /* If there's no work left to do, tell the core net |
1064 | code that we can accept some more. */ | 1062 | code that we can accept some more. */ |
1065 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) { | 1063 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) |
1066 | netif_wake_queue(ppp->dev); | 1064 | netif_wake_queue(ppp->dev); |
1067 | ret = 1; | 1065 | else |
1068 | } | 1066 | netif_stop_queue(ppp->dev); |
1069 | } | 1067 | } |
1070 | ppp_xmit_unlock(ppp); | 1068 | ppp_xmit_unlock(ppp); |
1071 | return ret; | ||
1072 | } | 1069 | } |
1073 | 1070 | ||
1074 | static inline struct sk_buff * | 1071 | static inline struct sk_buff * |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index f0da2c32fbde..1f21d2a1e528 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -238,7 +238,7 @@ static void handle_tx(struct vhost_net *net) | |||
238 | 238 | ||
239 | vq->heads[vq->upend_idx].len = len; | 239 | vq->heads[vq->upend_idx].len = len; |
240 | ubuf->callback = vhost_zerocopy_callback; | 240 | ubuf->callback = vhost_zerocopy_callback; |
241 | ubuf->arg = vq->ubufs; | 241 | ubuf->ctx = vq->ubufs; |
242 | ubuf->desc = vq->upend_idx; | 242 | ubuf->desc = vq->upend_idx; |
243 | msg.msg_control = ubuf; | 243 | msg.msg_control = ubuf; |
244 | msg.msg_controllen = sizeof(ubuf); | 244 | msg.msg_controllen = sizeof(ubuf); |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 947f00d8e091..51e4c1eeec4f 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -1598,10 +1598,9 @@ void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *ubufs) | |||
1598 | kfree(ubufs); | 1598 | kfree(ubufs); |
1599 | } | 1599 | } |
1600 | 1600 | ||
1601 | void vhost_zerocopy_callback(void *arg) | 1601 | void vhost_zerocopy_callback(struct ubuf_info *ubuf) |
1602 | { | 1602 | { |
1603 | struct ubuf_info *ubuf = arg; | 1603 | struct vhost_ubuf_ref *ubufs = ubuf->ctx; |
1604 | struct vhost_ubuf_ref *ubufs = ubuf->arg; | ||
1605 | struct vhost_virtqueue *vq = ubufs->vq; | 1604 | struct vhost_virtqueue *vq = ubufs->vq; |
1606 | 1605 | ||
1607 | /* set len = 1 to mark this desc buffers done DMA */ | 1606 | /* set len = 1 to mark this desc buffers done DMA */ |
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 8dcf4cca6bf2..8de1fd5b8efb 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
@@ -188,7 +188,7 @@ bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *); | |||
188 | 188 | ||
189 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, | 189 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, |
190 | unsigned int log_num, u64 len); | 190 | unsigned int log_num, u64 len); |
191 | void vhost_zerocopy_callback(void *arg); | 191 | void vhost_zerocopy_callback(struct ubuf_info *); |
192 | int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq); | 192 | int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq); |
193 | 193 | ||
194 | #define vq_err(vq, fmt, ...) do { \ | 194 | #define vq_err(vq, fmt, ...) do { \ |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 70a3f8d49118..775292a66fa4 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -238,11 +238,12 @@ enum { | |||
238 | /* | 238 | /* |
239 | * The callback notifies userspace to release buffers when skb DMA is done in | 239 | * The callback notifies userspace to release buffers when skb DMA is done in |
240 | * lower device, the skb last reference should be 0 when calling this. | 240 | * lower device, the skb last reference should be 0 when calling this. |
241 | * The desc is used to track userspace buffer index. | 241 | * The ctx field is used to track device context. |
242 | * The desc field is used to track userspace buffer index. | ||
242 | */ | 243 | */ |
243 | struct ubuf_info { | 244 | struct ubuf_info { |
244 | void (*callback)(void *); | 245 | void (*callback)(struct ubuf_info *); |
245 | void *arg; | 246 | void *ctx; |
246 | unsigned long desc; | 247 | unsigned long desc; |
247 | }; | 248 | }; |
248 | 249 | ||
diff --git a/include/net/dst.h b/include/net/dst.h index 59c5d18cc385..ff4da42fcfc6 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -36,7 +36,11 @@ struct dst_entry { | |||
36 | struct net_device *dev; | 36 | struct net_device *dev; |
37 | struct dst_ops *ops; | 37 | struct dst_ops *ops; |
38 | unsigned long _metrics; | 38 | unsigned long _metrics; |
39 | unsigned long expires; | 39 | union { |
40 | unsigned long expires; | ||
41 | /* point to where the dst_entry copied from */ | ||
42 | struct dst_entry *from; | ||
43 | }; | ||
40 | struct dst_entry *path; | 44 | struct dst_entry *path; |
41 | struct neighbour __rcu *_neighbour; | 45 | struct neighbour __rcu *_neighbour; |
42 | #ifdef CONFIG_XFRM | 46 | #ifdef CONFIG_XFRM |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index b26bb8101981..c64778fd5e13 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -123,6 +123,48 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) | |||
123 | return ((struct rt6_info *)dst)->rt6i_idev; | 123 | return ((struct rt6_info *)dst)->rt6i_idev; |
124 | } | 124 | } |
125 | 125 | ||
126 | static inline void rt6_clean_expires(struct rt6_info *rt) | ||
127 | { | ||
128 | if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) | ||
129 | dst_release(rt->dst.from); | ||
130 | |||
131 | rt->rt6i_flags &= ~RTF_EXPIRES; | ||
132 | rt->dst.expires = 0; | ||
133 | } | ||
134 | |||
135 | static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires) | ||
136 | { | ||
137 | if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) | ||
138 | dst_release(rt->dst.from); | ||
139 | |||
140 | rt->rt6i_flags |= RTF_EXPIRES; | ||
141 | rt->dst.expires = expires; | ||
142 | } | ||
143 | |||
144 | static inline void rt6_update_expires(struct rt6_info *rt, int timeout) | ||
145 | { | ||
146 | if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) | ||
147 | dst_release(rt->dst.from); | ||
148 | |||
149 | dst_set_expires(&rt->dst, timeout); | ||
150 | rt->rt6i_flags |= RTF_EXPIRES; | ||
151 | } | ||
152 | |||
153 | static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from) | ||
154 | { | ||
155 | struct dst_entry *new = (struct dst_entry *) from; | ||
156 | |||
157 | if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) { | ||
158 | if (new == rt->dst.from) | ||
159 | return; | ||
160 | dst_release(rt->dst.from); | ||
161 | } | ||
162 | |||
163 | rt->rt6i_flags &= ~RTF_EXPIRES; | ||
164 | rt->dst.from = new; | ||
165 | dst_hold(new); | ||
166 | } | ||
167 | |||
126 | struct fib6_walker_t { | 168 | struct fib6_walker_t { |
127 | struct list_head lh; | 169 | struct list_head lh; |
128 | struct fib6_node *root, *node; | 170 | struct fib6_node *root, *node; |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 5c031c07776b..4a839836e59c 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -802,8 +802,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) | |||
802 | ip6_del_rt(rt); | 802 | ip6_del_rt(rt); |
803 | rt = NULL; | 803 | rt = NULL; |
804 | } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { | 804 | } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { |
805 | rt->dst.expires = expires; | 805 | rt6_set_expires(rt, expires); |
806 | rt->rt6i_flags |= RTF_EXPIRES; | ||
807 | } | 806 | } |
808 | } | 807 | } |
809 | dst_release(&rt->dst); | 808 | dst_release(&rt->dst); |
@@ -1886,11 +1885,9 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao) | |||
1886 | rt = NULL; | 1885 | rt = NULL; |
1887 | } else if (addrconf_finite_timeout(rt_expires)) { | 1886 | } else if (addrconf_finite_timeout(rt_expires)) { |
1888 | /* not infinity */ | 1887 | /* not infinity */ |
1889 | rt->dst.expires = jiffies + rt_expires; | 1888 | rt6_set_expires(rt, jiffies + rt_expires); |
1890 | rt->rt6i_flags |= RTF_EXPIRES; | ||
1891 | } else { | 1889 | } else { |
1892 | rt->rt6i_flags &= ~RTF_EXPIRES; | 1890 | rt6_clean_expires(rt); |
1893 | rt->dst.expires = 0; | ||
1894 | } | 1891 | } |
1895 | } else if (valid_lft) { | 1892 | } else if (valid_lft) { |
1896 | clock_t expires = 0; | 1893 | clock_t expires = 0; |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 5b27fbcae346..93717435013e 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -673,11 +673,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
673 | &rt->rt6i_gateway)) { | 673 | &rt->rt6i_gateway)) { |
674 | if (!(iter->rt6i_flags & RTF_EXPIRES)) | 674 | if (!(iter->rt6i_flags & RTF_EXPIRES)) |
675 | return -EEXIST; | 675 | return -EEXIST; |
676 | iter->dst.expires = rt->dst.expires; | 676 | if (!(rt->rt6i_flags & RTF_EXPIRES)) |
677 | if (!(rt->rt6i_flags & RTF_EXPIRES)) { | 677 | rt6_clean_expires(iter); |
678 | iter->rt6i_flags &= ~RTF_EXPIRES; | 678 | else |
679 | iter->dst.expires = 0; | 679 | rt6_set_expires(iter, rt->dst.expires); |
680 | } | ||
681 | return -EEXIST; | 680 | return -EEXIST; |
682 | } | 681 | } |
683 | } | 682 | } |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 7cb236e8e261..35615c6358b8 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1267,8 +1267,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | if (rt) | 1269 | if (rt) |
1270 | rt->dst.expires = jiffies + (HZ * lifetime); | 1270 | rt6_set_expires(rt, jiffies + (HZ * lifetime)); |
1271 | |||
1272 | if (ra_msg->icmph.icmp6_hop_limit) { | 1271 | if (ra_msg->icmph.icmp6_hop_limit) { |
1273 | in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; | 1272 | in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; |
1274 | if (rt) | 1273 | if (rt) |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index f910cce69c9f..0aefc36f74c7 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <linux/sysctl.h> | 62 | #include <linux/sysctl.h> |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | 65 | static struct rt6_info *ip6_rt_copy(struct rt6_info *ort, |
66 | const struct in6_addr *dest); | 66 | const struct in6_addr *dest); |
67 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); | 67 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); |
68 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); | 68 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); |
@@ -285,6 +285,10 @@ static void ip6_dst_destroy(struct dst_entry *dst) | |||
285 | rt->rt6i_idev = NULL; | 285 | rt->rt6i_idev = NULL; |
286 | in6_dev_put(idev); | 286 | in6_dev_put(idev); |
287 | } | 287 | } |
288 | |||
289 | if (!(rt->rt6i_flags & RTF_EXPIRES) && dst->from) | ||
290 | dst_release(dst->from); | ||
291 | |||
288 | if (peer) { | 292 | if (peer) { |
289 | rt->rt6i_peer = NULL; | 293 | rt->rt6i_peer = NULL; |
290 | inet_putpeer(peer); | 294 | inet_putpeer(peer); |
@@ -329,8 +333,17 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
329 | 333 | ||
330 | static __inline__ int rt6_check_expired(const struct rt6_info *rt) | 334 | static __inline__ int rt6_check_expired(const struct rt6_info *rt) |
331 | { | 335 | { |
332 | return (rt->rt6i_flags & RTF_EXPIRES) && | 336 | struct rt6_info *ort = NULL; |
333 | time_after(jiffies, rt->dst.expires); | 337 | |
338 | if (rt->rt6i_flags & RTF_EXPIRES) { | ||
339 | if (time_after(jiffies, rt->dst.expires)) | ||
340 | return 1; | ||
341 | } else if (rt->dst.from) { | ||
342 | ort = (struct rt6_info *) rt->dst.from; | ||
343 | return (ort->rt6i_flags & RTF_EXPIRES) && | ||
344 | time_after(jiffies, ort->dst.expires); | ||
345 | } | ||
346 | return 0; | ||
334 | } | 347 | } |
335 | 348 | ||
336 | static inline int rt6_need_strict(const struct in6_addr *daddr) | 349 | static inline int rt6_need_strict(const struct in6_addr *daddr) |
@@ -620,12 +633,11 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, | |||
620 | (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); | 633 | (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); |
621 | 634 | ||
622 | if (rt) { | 635 | if (rt) { |
623 | if (!addrconf_finite_timeout(lifetime)) { | 636 | if (!addrconf_finite_timeout(lifetime)) |
624 | rt->rt6i_flags &= ~RTF_EXPIRES; | 637 | rt6_clean_expires(rt); |
625 | } else { | 638 | else |
626 | rt->dst.expires = jiffies + HZ * lifetime; | 639 | rt6_set_expires(rt, jiffies + HZ * lifetime); |
627 | rt->rt6i_flags |= RTF_EXPIRES; | 640 | |
628 | } | ||
629 | dst_release(&rt->dst); | 641 | dst_release(&rt->dst); |
630 | } | 642 | } |
631 | return 0; | 643 | return 0; |
@@ -730,7 +742,7 @@ int ip6_ins_rt(struct rt6_info *rt) | |||
730 | return __ip6_ins_rt(rt, &info); | 742 | return __ip6_ins_rt(rt, &info); |
731 | } | 743 | } |
732 | 744 | ||
733 | static struct rt6_info *rt6_alloc_cow(const struct rt6_info *ort, | 745 | static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, |
734 | const struct in6_addr *daddr, | 746 | const struct in6_addr *daddr, |
735 | const struct in6_addr *saddr) | 747 | const struct in6_addr *saddr) |
736 | { | 748 | { |
@@ -954,10 +966,10 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori | |||
954 | rt->rt6i_idev = ort->rt6i_idev; | 966 | rt->rt6i_idev = ort->rt6i_idev; |
955 | if (rt->rt6i_idev) | 967 | if (rt->rt6i_idev) |
956 | in6_dev_hold(rt->rt6i_idev); | 968 | in6_dev_hold(rt->rt6i_idev); |
957 | rt->dst.expires = 0; | ||
958 | 969 | ||
959 | rt->rt6i_gateway = ort->rt6i_gateway; | 970 | rt->rt6i_gateway = ort->rt6i_gateway; |
960 | rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES; | 971 | rt->rt6i_flags = ort->rt6i_flags; |
972 | rt6_clean_expires(rt); | ||
961 | rt->rt6i_metric = 0; | 973 | rt->rt6i_metric = 0; |
962 | 974 | ||
963 | memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key)); | 975 | memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key)); |
@@ -1019,10 +1031,9 @@ static void ip6_link_failure(struct sk_buff *skb) | |||
1019 | 1031 | ||
1020 | rt = (struct rt6_info *) skb_dst(skb); | 1032 | rt = (struct rt6_info *) skb_dst(skb); |
1021 | if (rt) { | 1033 | if (rt) { |
1022 | if (rt->rt6i_flags & RTF_CACHE) { | 1034 | if (rt->rt6i_flags & RTF_CACHE) |
1023 | dst_set_expires(&rt->dst, 0); | 1035 | rt6_update_expires(rt, 0); |
1024 | rt->rt6i_flags |= RTF_EXPIRES; | 1036 | else if (rt->rt6i_node && (rt->rt6i_flags & RTF_DEFAULT)) |
1025 | } else if (rt->rt6i_node && (rt->rt6i_flags & RTF_DEFAULT)) | ||
1026 | rt->rt6i_node->fn_sernum = -1; | 1037 | rt->rt6i_node->fn_sernum = -1; |
1027 | } | 1038 | } |
1028 | } | 1039 | } |
@@ -1289,9 +1300,12 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1289 | } | 1300 | } |
1290 | 1301 | ||
1291 | rt->dst.obsolete = -1; | 1302 | rt->dst.obsolete = -1; |
1292 | rt->dst.expires = (cfg->fc_flags & RTF_EXPIRES) ? | 1303 | |
1293 | jiffies + clock_t_to_jiffies(cfg->fc_expires) : | 1304 | if (cfg->fc_flags & RTF_EXPIRES) |
1294 | 0; | 1305 | rt6_set_expires(rt, jiffies + |
1306 | clock_t_to_jiffies(cfg->fc_expires)); | ||
1307 | else | ||
1308 | rt6_clean_expires(rt); | ||
1295 | 1309 | ||
1296 | if (cfg->fc_protocol == RTPROT_UNSPEC) | 1310 | if (cfg->fc_protocol == RTPROT_UNSPEC) |
1297 | cfg->fc_protocol = RTPROT_BOOT; | 1311 | cfg->fc_protocol = RTPROT_BOOT; |
@@ -1736,8 +1750,8 @@ again: | |||
1736 | features |= RTAX_FEATURE_ALLFRAG; | 1750 | features |= RTAX_FEATURE_ALLFRAG; |
1737 | dst_metric_set(&rt->dst, RTAX_FEATURES, features); | 1751 | dst_metric_set(&rt->dst, RTAX_FEATURES, features); |
1738 | } | 1752 | } |
1739 | dst_set_expires(&rt->dst, net->ipv6.sysctl.ip6_rt_mtu_expires); | 1753 | rt6_update_expires(rt, net->ipv6.sysctl.ip6_rt_mtu_expires); |
1740 | rt->rt6i_flags |= RTF_MODIFIED|RTF_EXPIRES; | 1754 | rt->rt6i_flags |= RTF_MODIFIED; |
1741 | goto out; | 1755 | goto out; |
1742 | } | 1756 | } |
1743 | 1757 | ||
@@ -1765,9 +1779,8 @@ again: | |||
1765 | * which is 10 mins. After 10 mins the decreased pmtu is expired | 1779 | * which is 10 mins. After 10 mins the decreased pmtu is expired |
1766 | * and detecting PMTU increase will be automatically happened. | 1780 | * and detecting PMTU increase will be automatically happened. |
1767 | */ | 1781 | */ |
1768 | dst_set_expires(&nrt->dst, net->ipv6.sysctl.ip6_rt_mtu_expires); | 1782 | rt6_update_expires(nrt, net->ipv6.sysctl.ip6_rt_mtu_expires); |
1769 | nrt->rt6i_flags |= RTF_DYNAMIC|RTF_EXPIRES; | 1783 | nrt->rt6i_flags |= RTF_DYNAMIC; |
1770 | |||
1771 | ip6_ins_rt(nrt); | 1784 | ip6_ins_rt(nrt); |
1772 | } | 1785 | } |
1773 | out: | 1786 | out: |
@@ -1799,7 +1812,7 @@ void rt6_pmtu_discovery(const struct in6_addr *daddr, const struct in6_addr *sad | |||
1799 | * Misc support functions | 1812 | * Misc support functions |
1800 | */ | 1813 | */ |
1801 | 1814 | ||
1802 | static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | 1815 | static struct rt6_info *ip6_rt_copy(struct rt6_info *ort, |
1803 | const struct in6_addr *dest) | 1816 | const struct in6_addr *dest) |
1804 | { | 1817 | { |
1805 | struct net *net = dev_net(ort->dst.dev); | 1818 | struct net *net = dev_net(ort->dst.dev); |
@@ -1819,10 +1832,14 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | |||
1819 | if (rt->rt6i_idev) | 1832 | if (rt->rt6i_idev) |
1820 | in6_dev_hold(rt->rt6i_idev); | 1833 | in6_dev_hold(rt->rt6i_idev); |
1821 | rt->dst.lastuse = jiffies; | 1834 | rt->dst.lastuse = jiffies; |
1822 | rt->dst.expires = 0; | ||
1823 | 1835 | ||
1824 | rt->rt6i_gateway = ort->rt6i_gateway; | 1836 | rt->rt6i_gateway = ort->rt6i_gateway; |
1825 | rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES; | 1837 | rt->rt6i_flags = ort->rt6i_flags; |
1838 | if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) == | ||
1839 | (RTF_DEFAULT | RTF_ADDRCONF)) | ||
1840 | rt6_set_from(rt, ort); | ||
1841 | else | ||
1842 | rt6_clean_expires(rt); | ||
1826 | rt->rt6i_metric = 0; | 1843 | rt->rt6i_metric = 0; |
1827 | 1844 | ||
1828 | #ifdef CONFIG_IPV6_SUBTREES | 1845 | #ifdef CONFIG_IPV6_SUBTREES |