Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Minor overlapping changes in net/ipv4/ipmr.c, in 'net' we were
fixing the "BH-ness" of the counter bumps whilst in 'net-next'
the functions were modified to take an explicit 'net' parameter.

Signed-off-by: David S. Miller <davem@davemloft.net>

+192 -92
+8 -4
drivers/isdn/i4l/isdn_ppp.c
··· 301 301 is->compflags = 0; 302 302 303 303 is->reset = isdn_ppp_ccp_reset_alloc(is); 304 + if (!is->reset) 305 + return -ENOMEM; 304 306 305 307 is->lp = NULL; 306 308 is->mp_seqno = 0; /* MP sequence number */ ··· 322 320 * VJ header compression init 323 321 */ 324 322 is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */ 323 + if (IS_ERR(is->slcomp)) { 324 + isdn_ppp_ccp_reset_free(is); 325 + return PTR_ERR(is->slcomp); 326 + } 325 327 #endif 326 328 #ifdef CONFIG_IPPP_FILTER 327 329 is->pass_filter = NULL; ··· 573 567 is->maxcid = val; 574 568 #ifdef CONFIG_ISDN_PPP_VJ 575 569 sltmp = slhc_init(16, val); 576 - if (!sltmp) { 577 - printk(KERN_ERR "ippp, can't realloc slhc struct\n"); 578 - return -ENOMEM; 579 - } 570 + if (IS_ERR(sltmp)) 571 + return PTR_ERR(sltmp); 580 572 if (is->slcomp) 581 573 slhc_free(is->slcomp); 582 574 is->slcomp = sltmp;
+1 -1
drivers/net/can/dev.c
··· 915 915 nla_put(skb, IFLA_CAN_BITTIMING_CONST, 916 916 sizeof(*priv->bittiming_const), priv->bittiming_const)) || 917 917 918 - nla_put(skb, IFLA_CAN_CLOCK, sizeof(cm), &priv->clock) || 918 + nla_put(skb, IFLA_CAN_CLOCK, sizeof(priv->clock), &priv->clock) || 919 919 nla_put_u32(skb, IFLA_CAN_STATE, state) || 920 920 nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) || 921 921 nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) ||
+3 -1
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 1055 1055 } 1056 1056 1057 1057 bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); 1058 - if (mode == GENET_POWER_PASSIVE) 1058 + if (mode == GENET_POWER_PASSIVE) { 1059 1059 bcmgenet_phy_power_set(priv->dev, true); 1060 + bcmgenet_mii_reset(priv->dev); 1061 + } 1060 1062 } 1061 1063 1062 1064 /* ioctl handle special commands that are not present in ethtool. */
+1
drivers/net/ethernet/broadcom/genet/bcmgenet.h
··· 673 673 int bcmgenet_mii_config(struct net_device *dev); 674 674 int bcmgenet_mii_probe(struct net_device *dev); 675 675 void bcmgenet_mii_exit(struct net_device *dev); 676 + void bcmgenet_mii_reset(struct net_device *dev); 676 677 void bcmgenet_phy_power_set(struct net_device *dev, bool enable); 677 678 void bcmgenet_mii_setup(struct net_device *dev); 678 679
+18
drivers/net/ethernet/broadcom/genet/bcmmii.c
··· 163 163 phy_print_status(phydev); 164 164 } 165 165 166 + 166 167 static int bcmgenet_fixed_phy_link_update(struct net_device *dev, 167 168 struct fixed_phy_status *status) 168 169 { ··· 171 170 status->link = dev->phydev->link; 172 171 173 172 return 0; 173 + } 174 + 175 + /* Perform a voluntary PHY software reset, since the EPHY is very finicky about 176 + * not doing it and will start corrupting packets 177 + */ 178 + void bcmgenet_mii_reset(struct net_device *dev) 179 + { 180 + struct bcmgenet_priv *priv = netdev_priv(dev); 181 + 182 + if (GENET_IS_V4(priv)) 183 + return; 184 + 185 + if (priv->phydev) { 186 + phy_init_hw(priv->phydev); 187 + phy_start_aneg(priv->phydev); 188 + } 174 189 } 175 190 176 191 void bcmgenet_phy_power_set(struct net_device *dev, bool enable) ··· 231 214 reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); 232 215 reg |= EXT_PWR_DN_EN_LD; 233 216 bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); 217 + bcmgenet_mii_reset(dev); 234 218 } 235 219 236 220 static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv)
+1 -1
drivers/net/ethernet/freescale/fec_main.c
··· 3261 3261 return; 3262 3262 } 3263 3263 msleep(msec); 3264 - gpio_set_value(phy_reset, 1); 3264 + gpio_set_value_cansleep(phy_reset, 1); 3265 3265 } 3266 3266 #else /* CONFIG_OF */ 3267 3267 static void fec_reset_phy(struct platform_device *pdev)
+5 -5
drivers/net/ethernet/renesas/sh_eth.c
··· 1212 1212 mdp->rx_buf_sz += NET_IP_ALIGN; 1213 1213 1214 1214 /* Allocate RX and TX skb rings */ 1215 - mdp->rx_skbuff = kmalloc_array(mdp->num_rx_ring, 1216 - sizeof(*mdp->rx_skbuff), GFP_KERNEL); 1215 + mdp->rx_skbuff = kcalloc(mdp->num_rx_ring, sizeof(*mdp->rx_skbuff), 1216 + GFP_KERNEL); 1217 1217 if (!mdp->rx_skbuff) { 1218 1218 ret = -ENOMEM; 1219 1219 return ret; 1220 1220 } 1221 1221 1222 - mdp->tx_skbuff = kmalloc_array(mdp->num_tx_ring, 1223 - sizeof(*mdp->tx_skbuff), GFP_KERNEL); 1222 + mdp->tx_skbuff = kcalloc(mdp->num_tx_ring, sizeof(*mdp->tx_skbuff), 1223 + GFP_KERNEL); 1224 1224 if (!mdp->tx_skbuff) { 1225 1225 ret = -ENOMEM; 1226 1226 goto skb_ring_free; ··· 1232 1232 GFP_KERNEL); 1233 1233 if (!mdp->rx_ring) { 1234 1234 ret = -ENOMEM; 1235 - goto desc_ring_free; 1235 + goto skb_ring_free; 1236 1236 } 1237 1237 1238 1238 mdp->dirty_rx = 0;
+3 -1
drivers/net/ethernet/sfc/ef10.c
··· 1855 1855 unsigned int write_ptr; 1856 1856 efx_qword_t *txd; 1857 1857 1858 - BUG_ON(tx_queue->write_count == tx_queue->insert_count); 1858 + tx_queue->xmit_more_available = false; 1859 + if (unlikely(tx_queue->write_count == tx_queue->insert_count)) 1860 + return; 1859 1861 1860 1862 do { 1861 1863 write_ptr = tx_queue->write_count & tx_queue->ptr_mask;
+3 -1
drivers/net/ethernet/sfc/farch.c
··· 321 321 unsigned write_ptr; 322 322 unsigned old_write_count = tx_queue->write_count; 323 323 324 - BUG_ON(tx_queue->write_count == tx_queue->insert_count); 324 + tx_queue->xmit_more_available = false; 325 + if (unlikely(tx_queue->write_count == tx_queue->insert_count)) 326 + return; 325 327 326 328 do { 327 329 write_ptr = tx_queue->write_count & tx_queue->ptr_mask;
+2
drivers/net/ethernet/sfc/net_driver.h
··· 219 219 * @tso_packets: Number of packets via the TSO xmit path 220 220 * @pushes: Number of times the TX push feature has been used 221 221 * @pio_packets: Number of times the TX PIO feature has been used 222 + * @xmit_more_available: Are any packets waiting to be pushed to the NIC 222 223 * @empty_read_count: If the completion path has seen the queue as empty 223 224 * and the transmission path has not yet checked this, the value of 224 225 * @read_count bitwise-added to %EFX_EMPTY_COUNT_VALID; otherwise 0. ··· 254 253 unsigned int tso_packets; 255 254 unsigned int pushes; 256 255 unsigned int pio_packets; 256 + bool xmit_more_available; 257 257 /* Statistics to supplement MAC stats */ 258 258 unsigned long tx_packets; 259 259
+28 -2
drivers/net/ethernet/sfc/tx.c
··· 431 431 efx_tx_maybe_stop_queue(tx_queue); 432 432 433 433 /* Pass off to hardware */ 434 - if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) 434 + if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) { 435 + struct efx_tx_queue *txq2 = efx_tx_queue_partner(tx_queue); 436 + 437 + /* There could be packets left on the partner queue if those 438 + * SKBs had skb->xmit_more set. If we do not push those they 439 + * could be left for a long time and cause a netdev watchdog. 440 + */ 441 + if (txq2->xmit_more_available) 442 + efx_nic_push_buffers(txq2); 443 + 435 444 efx_nic_push_buffers(tx_queue); 445 + } else { 446 + tx_queue->xmit_more_available = skb->xmit_more; 447 + } 436 448 437 449 tx_queue->tx_packets++; 438 450 ··· 734 722 tx_queue->read_count = 0; 735 723 tx_queue->old_read_count = 0; 736 724 tx_queue->empty_read_count = 0 | EFX_EMPTY_COUNT_VALID; 725 + tx_queue->xmit_more_available = false; 737 726 738 727 /* Set up TX descriptor ring */ 739 728 efx_nic_init_tx(tx_queue); ··· 760 747 761 748 ++tx_queue->read_count; 762 749 } 750 + tx_queue->xmit_more_available = false; 763 751 netdev_tx_reset_queue(tx_queue->core_txq); 764 752 } 765 753 ··· 1316 1302 efx_tx_maybe_stop_queue(tx_queue); 1317 1303 1318 1304 /* Pass off to hardware */ 1319 - if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) 1305 + if (!skb->xmit_more || netif_xmit_stopped(tx_queue->core_txq)) { 1306 + struct efx_tx_queue *txq2 = efx_tx_queue_partner(tx_queue); 1307 + 1308 + /* There could be packets left on the partner queue if those 1309 + * SKBs had skb->xmit_more set. If we do not push those they 1310 + * could be left for a long time and cause a netdev watchdog. 1311 + */ 1312 + if (txq2->xmit_more_available) 1313 + efx_nic_push_buffers(txq2); 1314 + 1320 1315 efx_nic_push_buffers(tx_queue); 1316 + } else { 1317 + tx_queue->xmit_more_available = skb->xmit_more; 1318 + } 1321 1319 1322 1320 tx_queue->tso_bursts++; 1323 1321 return NETDEV_TX_OK;
+1
drivers/net/ethernet/smsc/smsc911x.c
··· 1052 1052 #ifdef USE_PHY_WORK_AROUND 1053 1053 if (smsc911x_phy_loopbacktest(dev) < 0) { 1054 1054 SMSC_WARN(pdata, hw, "Failed Loop Back Test"); 1055 + phy_disconnect(phydev); 1055 1056 return -ENODEV; 1056 1057 } 1057 1058 SMSC_TRACE(pdata, hw, "Passed Loop Back Test");
+5 -2
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
··· 721 721 { 722 722 struct stmmac_priv *priv = netdev_priv(dev); 723 723 724 - if ((priv->hwts_tx_en) && (priv->hwts_rx_en)) { 724 + if ((priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) { 725 725 726 - info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | 726 + info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | 727 + SOF_TIMESTAMPING_TX_HARDWARE | 728 + SOF_TIMESTAMPING_RX_SOFTWARE | 727 729 SOF_TIMESTAMPING_RX_HARDWARE | 730 + SOF_TIMESTAMPING_SOFTWARE | 728 731 SOF_TIMESTAMPING_RAW_HARDWARE; 729 732 730 733 if (priv->ptp_clock)
+49 -25
drivers/net/phy/phy_device.c
··· 205 205 } 206 206 EXPORT_SYMBOL(phy_device_create); 207 207 208 + /* get_phy_c45_devs_in_pkg - reads a MMD's devices in package registers. 209 + * @bus: the target MII bus 210 + * @addr: PHY address on the MII bus 211 + * @dev_addr: MMD address in the PHY. 212 + * @devices_in_package: where to store the devices in package information. 213 + * 214 + * Description: reads devices in package registers of a MMD at @dev_addr 215 + * from PHY at @addr on @bus. 216 + * 217 + * Returns: 0 on success, -EIO on failure. 218 + */ 219 + static int get_phy_c45_devs_in_pkg(struct mii_bus *bus, int addr, int dev_addr, 220 + u32 *devices_in_package) 221 + { 222 + int phy_reg, reg_addr; 223 + 224 + reg_addr = MII_ADDR_C45 | dev_addr << 16 | MDIO_DEVS2; 225 + phy_reg = mdiobus_read(bus, addr, reg_addr); 226 + if (phy_reg < 0) 227 + return -EIO; 228 + *devices_in_package = (phy_reg & 0xffff) << 16; 229 + 230 + reg_addr = MII_ADDR_C45 | dev_addr << 16 | MDIO_DEVS1; 231 + phy_reg = mdiobus_read(bus, addr, reg_addr); 232 + if (phy_reg < 0) 233 + return -EIO; 234 + *devices_in_package |= (phy_reg & 0xffff); 235 + 236 + return 0; 237 + } 238 + 208 239 /** 209 240 * get_phy_c45_ids - reads the specified addr for its 802.3-c45 IDs. 210 241 * @bus: the target MII bus ··· 254 223 int phy_reg; 255 224 int i, reg_addr; 256 225 const int num_ids = ARRAY_SIZE(c45_ids->device_ids); 226 + u32 *devs = &c45_ids->devices_in_package; 257 227 258 - /* Find first non-zero Devices In package. Device 259 - * zero is reserved, so don't probe it. 228 + /* Find first non-zero Devices In package. Device zero is reserved 229 + * for 802.3 c45 complied PHYs, so don't probe it at first. 260 230 */ 261 - for (i = 1; 262 - i < num_ids && c45_ids->devices_in_package == 0; 263 - i++) { 264 - retry: reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS2; 265 - phy_reg = mdiobus_read(bus, addr, reg_addr); 231 + for (i = 1; i < num_ids && *devs == 0; i++) { 232 + phy_reg = get_phy_c45_devs_in_pkg(bus, addr, i, devs); 266 233 if (phy_reg < 0) 267 234 return -EIO; 268 - c45_ids->devices_in_package = (phy_reg & 0xffff) << 16; 269 235 270 - reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS1; 271 - phy_reg = mdiobus_read(bus, addr, reg_addr); 272 - if (phy_reg < 0) 273 - return -EIO; 274 - c45_ids->devices_in_package |= (phy_reg & 0xffff); 275 - 276 - if ((c45_ids->devices_in_package & 0x1fffffff) == 0x1fffffff) { 277 - if (i) { 278 - /* If mostly Fs, there is no device there, 279 - * then let's continue to probe more, as some 280 - * 10G PHYs have zero Devices In package, 281 - * e.g. Cortina CS4315/CS4340 PHY. 282 - */ 283 - i = 0; 284 - goto retry; 285 - } else { 286 - /* no device there, let's get out of here */ 236 + if ((*devs & 0x1fffffff) == 0x1fffffff) { 237 + /* If mostly Fs, there is no device there, 238 + * then let's continue to probe more, as some 239 + * 10G PHYs have zero Devices In package, 240 + * e.g. Cortina CS4315/CS4340 PHY. 241 + */ 242 + phy_reg = get_phy_c45_devs_in_pkg(bus, addr, 0, devs); 243 + if (phy_reg < 0) 244 + return -EIO; 245 + /* no device there, let's get out of here */ 246 + if ((*devs & 0x1fffffff) == 0x1fffffff) { 287 247 *phy_id = 0xffffffff; 288 248 return 0; 249 + } else { 250 + break; 289 251 } 290 252 } 291 253 }
+2 -4
drivers/net/ppp/ppp_generic.c
··· 721 721 val &= 0xffff; 722 722 } 723 723 vj = slhc_init(val2+1, val+1); 724 - if (!vj) { 725 - netdev_err(ppp->dev, 726 - "PPP: no memory (VJ compressor)\n"); 727 - err = -ENOMEM; 724 + if (IS_ERR(vj)) { 725 + err = PTR_ERR(vj); 728 726 break; 729 727 } 730 728 ppp_lock(ppp);
+8 -4
drivers/net/slip/slhc.c
··· 84 84 static unsigned char * put16(unsigned char *cp, unsigned short x); 85 85 static unsigned short pull16(unsigned char **cpp); 86 86 87 - /* Initialize compression data structure 87 + /* Allocate compression data structure 88 88 * slots must be in range 0 to 255 (zero meaning no compression) 89 + * Returns pointer to structure or ERR_PTR() on error. 89 90 */ 90 91 struct slcompress * 91 92 slhc_init(int rslots, int tslots) ··· 95 94 register struct cstate *ts; 96 95 struct slcompress *comp; 97 96 97 + if (rslots < 0 || rslots > 255 || tslots < 0 || tslots > 255) 98 + return ERR_PTR(-EINVAL); 99 + 98 100 comp = kzalloc(sizeof(struct slcompress), GFP_KERNEL); 99 101 if (! comp) 100 102 goto out_fail; 101 103 102 - if ( rslots > 0 && rslots < 256 ) { 104 + if (rslots > 0) { 103 105 size_t rsize = rslots * sizeof(struct cstate); 104 106 comp->rstate = kzalloc(rsize, GFP_KERNEL); 105 107 if (! comp->rstate) ··· 110 106 comp->rslot_limit = rslots - 1; 111 107 } 112 108 113 - if ( tslots > 0 && tslots < 256 ) { 109 + if (tslots > 0) { 114 110 size_t tsize = tslots * sizeof(struct cstate); 115 111 comp->tstate = kzalloc(tsize, GFP_KERNEL); 116 112 if (! comp->tstate) ··· 145 141 out_free: 146 142 kfree(comp); 147 143 out_fail: 148 - return NULL; 144 + return ERR_PTR(-ENOMEM); 149 145 } 150 146 151 147
+1 -1
drivers/net/slip/slip.c
··· 164 164 if (cbuff == NULL) 165 165 goto err_exit; 166 166 slcomp = slhc_init(16, 16); 167 - if (slcomp == NULL) 167 + if (IS_ERR(slcomp)) 168 168 goto err_exit; 169 169 #endif 170 170 spin_lock_bh(&sl->lock);
+4 -1
drivers/net/usb/qmi_wwan.c
··· 485 485 USB_CDC_PROTO_NONE), 486 486 .driver_info = (unsigned long)&qmi_wwan_info, 487 487 }, 488 + { /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */ 489 + USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7), 490 + .driver_info = (unsigned long)&qmi_wwan_info, 491 + }, 488 492 489 493 /* 3. Combined interface devices matching on interface number */ 490 494 {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ ··· 741 737 {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ 742 738 {QMI_FIXED_INTF(0x413c, 0x81b1, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */ 743 739 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ 744 - {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */ 745 740 746 741 /* 4. Gobi 1000 devices */ 747 742 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
+2 -1
include/net/inet_common.h
··· 41 41 42 42 static inline void inet_ctl_sock_destroy(struct sock *sk) 43 43 { 44 - sock_release(sk->sk_socket); 44 + if (sk) 45 + sock_release(sk->sk_socket); 45 46 } 46 47 47 48 #endif
+1 -1
include/net/ip_fib.h
··· 317 317 318 318 /* Exported by fib_semantics.c */ 319 319 int ip_fib_check_default(__be32 gw, struct net_device *dev); 320 - int fib_sync_down_dev(struct net_device *dev, unsigned long event); 320 + int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force); 321 321 int fib_sync_down_addr(struct net *net, __be32 local); 322 322 int fib_sync_up(struct net_device *dev, unsigned int nh_flags); 323 323
+7 -6
net/ipv4/fib_frontend.c
··· 1112 1112 net->ipv4.fibnl = NULL; 1113 1113 } 1114 1114 1115 - static void fib_disable_ip(struct net_device *dev, unsigned long event) 1115 + static void fib_disable_ip(struct net_device *dev, unsigned long event, 1116 + bool force) 1116 1117 { 1117 - if (fib_sync_down_dev(dev, event)) 1118 + if (fib_sync_down_dev(dev, event, force)) 1118 1119 fib_flush(dev_net(dev)); 1119 1120 rt_cache_flush(dev_net(dev)); 1120 1121 arp_ifdown(dev); ··· 1143 1142 /* Last address was deleted from this interface. 1144 1143 * Disable IP. 1145 1144 */ 1146 - fib_disable_ip(dev, event); 1145 + fib_disable_ip(dev, event, true); 1147 1146 } else { 1148 1147 rt_cache_flush(dev_net(dev)); 1149 1148 } ··· 1160 1159 unsigned int flags; 1161 1160 1162 1161 if (event == NETDEV_UNREGISTER) { 1163 - fib_disable_ip(dev, event); 1162 + fib_disable_ip(dev, event, true); 1164 1163 rt_flush_dev(dev); 1165 1164 return NOTIFY_DONE; 1166 1165 } ··· 1181 1180 rt_cache_flush(net); 1182 1181 break; 1183 1182 case NETDEV_DOWN: 1184 - fib_disable_ip(dev, event); 1183 + fib_disable_ip(dev, event, false); 1185 1184 break; 1186 1185 case NETDEV_CHANGE: 1187 1186 flags = dev_get_flags(dev); 1188 1187 if (flags & (IFF_RUNNING | IFF_LOWER_UP)) 1189 1188 fib_sync_up(dev, RTNH_F_LINKDOWN); 1190 1189 else 1191 - fib_sync_down_dev(dev, event); 1190 + fib_sync_down_dev(dev, event, false); 1192 1191 /* fall through */ 1193 1192 case NETDEV_CHANGEMTU: 1194 1193 rt_cache_flush(net);
+15 -3
net/ipv4/fib_semantics.c
··· 1343 1343 return ret; 1344 1344 } 1345 1345 1346 - int fib_sync_down_dev(struct net_device *dev, unsigned long event) 1346 + /* Event force Flags Description 1347 + * NETDEV_CHANGE 0 LINKDOWN Carrier OFF, not for scope host 1348 + * NETDEV_DOWN 0 LINKDOWN|DEAD Link down, not for scope host 1349 + * NETDEV_DOWN 1 LINKDOWN|DEAD Last address removed 1350 + * NETDEV_UNREGISTER 1 LINKDOWN|DEAD Device removed 1351 + */ 1352 + int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force) 1347 1353 { 1348 1354 int ret = 0; 1349 1355 int scope = RT_SCOPE_NOWHERE; ··· 1358 1352 struct hlist_head *head = &fib_info_devhash[hash]; 1359 1353 struct fib_nh *nh; 1360 1354 1361 - if (event == NETDEV_UNREGISTER || 1362 - event == NETDEV_DOWN) 1355 + if (force) 1363 1356 scope = -1; 1364 1357 1365 1358 hlist_for_each_entry(nh, head, nh_hash) { ··· 1502 1497 1503 1498 if (!(dev->flags & IFF_UP)) 1504 1499 return 0; 1500 + 1501 + if (nh_flags & RTNH_F_DEAD) { 1502 + unsigned int flags = dev_get_flags(dev); 1503 + 1504 + if (flags & (IFF_RUNNING | IFF_LOWER_UP)) 1505 + nh_flags |= RTNH_F_LINKDOWN; 1506 + } 1505 1507 1506 1508 prev_fi = NULL; 1507 1509 hash = fib_devindex_hashfn(dev->ifindex);
+3 -3
net/ipv4/ipmr.c
··· 1683 1683 { 1684 1684 struct ip_options *opt = &(IPCB(skb)->opt); 1685 1685 1686 - IP_INC_STATS_BH(net, IPSTATS_MIB_OUTFORWDATAGRAMS); 1687 - IP_ADD_STATS_BH(net, IPSTATS_MIB_OUTOCTETS, skb->len); 1686 + IP_INC_STATS(net, IPSTATS_MIB_OUTFORWDATAGRAMS); 1687 + IP_ADD_STATS(net, IPSTATS_MIB_OUTOCTETS, skb->len); 1688 1688 1689 1689 if (unlikely(opt->optlen)) 1690 1690 ip_forward_options(skb); ··· 1746 1746 * to blackhole. 1747 1747 */ 1748 1748 1749 - IP_INC_STATS_BH(net, IPSTATS_MIB_FRAGFAILS); 1749 + IP_INC_STATS(net, IPSTATS_MIB_FRAGFAILS); 1750 1750 ip_rt_put(rt); 1751 1751 goto out_free; 1752 1752 }
+1 -2
net/ipv6/route.c
··· 2080 2080 2081 2081 static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb) 2082 2082 { 2083 - struct net *net = dev_net(skb->dev); 2084 2083 struct netevent_redirect netevent; 2085 2084 struct rt6_info *rt, *nrt = NULL; 2086 2085 struct ndisc_options ndopts; ··· 2140 2141 } 2141 2142 2142 2143 rt = (struct rt6_info *) dst; 2143 - if (rt == net->ipv6.ip6_null_entry) { 2144 + if (rt->rt6i_flags & RTF_REJECT) { 2144 2145 net_dbg_ratelimited("rt6_redirect: source isn't a valid nexthop for redirect target\n"); 2145 2146 return; 2146 2147 }
+4 -22
net/ipv6/sit.c
··· 1394 1394 return 0; 1395 1395 } 1396 1396 1397 - static int __net_init ipip6_fb_tunnel_init(struct net_device *dev) 1397 + static void __net_init ipip6_fb_tunnel_init(struct net_device *dev) 1398 1398 { 1399 1399 struct ip_tunnel *tunnel = netdev_priv(dev); 1400 1400 struct iphdr *iph = &tunnel->parms.iph; 1401 1401 struct net *net = dev_net(dev); 1402 1402 struct sit_net *sitn = net_generic(net, sit_net_id); 1403 1403 1404 - tunnel->dev = dev; 1405 - tunnel->net = dev_net(dev); 1406 - 1407 1404 iph->version = 4; 1408 1405 iph->protocol = IPPROTO_IPV6; 1409 1406 iph->ihl = 5; 1410 1407 iph->ttl = 64; 1411 1408 1412 - dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); 1413 - if (!dev->tstats) 1414 - return -ENOMEM; 1415 - 1416 - tunnel->dst_cache = alloc_percpu(struct ip_tunnel_dst); 1417 - if (!tunnel->dst_cache) { 1418 - free_percpu(dev->tstats); 1419 - return -ENOMEM; 1420 - } 1421 - 1422 1409 dev_hold(dev); 1423 1410 rcu_assign_pointer(sitn->tunnels_wc[0], tunnel); 1424 - return 0; 1425 1411 } 1426 1412 1427 1413 static int ipip6_validate(struct nlattr *tb[], struct nlattr *data[]) ··· 1817 1831 */ 1818 1832 sitn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL; 1819 1833 1820 - err = ipip6_fb_tunnel_init(sitn->fb_tunnel_dev); 1821 - if (err) 1822 - goto err_dev_free; 1823 - 1824 - ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn); 1825 1834 err = register_netdev(sitn->fb_tunnel_dev); 1826 1835 if (err) 1827 1836 goto err_reg_dev; 1837 + 1838 + ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn); 1839 + ipip6_fb_tunnel_init(sitn->fb_tunnel_dev); 1828 1840 1829 1841 t = netdev_priv(sitn->fb_tunnel_dev); 1830 1842 ··· 1830 1846 return 0; 1831 1847 1832 1848 err_reg_dev: 1833 - dev_put(sitn->fb_tunnel_dev); 1834 - err_dev_free: 1835 1849 ipip6_dev_free(sitn->fb_tunnel_dev); 1836 1850 err_alloc_dev: 1837 1851 return err;
+11 -1
net/ipv6/tunnel6.c
··· 144 144 break; 145 145 } 146 146 147 + static void tunnel46_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 148 + u8 type, u8 code, int offset, __be32 info) 149 + { 150 + struct xfrm6_tunnel *handler; 151 + 152 + for_each_tunnel_rcu(tunnel46_handlers, handler) 153 + if (!handler->err_handler(skb, opt, type, code, offset, info)) 154 + break; 155 + } 156 + 147 157 static const struct inet6_protocol tunnel6_protocol = { 148 158 .handler = tunnel6_rcv, 149 159 .err_handler = tunnel6_err, ··· 162 152 163 153 static const struct inet6_protocol tunnel46_protocol = { 164 154 .handler = tunnel46_rcv, 165 - .err_handler = tunnel6_err, 155 + .err_handler = tunnel46_err, 166 156 .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, 167 157 }; 168 158
+5
net/tipc/udp_media.c
··· 48 48 #include <linux/tipc_netlink.h> 49 49 #include "core.h" 50 50 #include "bearer.h" 51 + #include "msg.h" 51 52 52 53 /* IANA assigned UDP port */ 53 54 #define UDP_PORT_DEFAULT 6118 ··· 221 220 { 222 221 struct udp_bearer *ub; 223 222 struct tipc_bearer *b; 223 + int usr = msg_user(buf_msg(skb)); 224 + 225 + if ((usr == LINK_PROTOCOL) || (usr == NAME_DISTRIBUTOR)) 226 + skb_linearize(skb); 224 227 225 228 ub = rcu_dereference_sk_user_data(sk); 226 229 if (!ub) {