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

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
igmp: Avoid zero delay when receiving odd mixture of IGMP queries
netdev: make net_device_ops const
bcm63xx: make ethtool_ops const
usbnet: make ethtool_ops const
net: Fix build with INET disabled.
net: introduce netif_addr_lock_nested() and call if when appropriate
net: correct lock name in dev_[uc/mc]_sync documentations.
net: sk_update_clone is only used in net/core/sock.c
8139cp: fix missing napi_gro_flush.
pktgen: set correct max and min in pktgen_setup_inject()
smsc911x: Unconditionally include linux/smscphy.h in smsc911x.h
asix: fix infinite loop in rx_fixup()
net: Default UDP and UNIX diag to 'n'.
r6040: fix typo in use of MCR0 register bits
net: fix sock_clone reference mismatch with tcp memcontrol

+57 -32
+1 -1
drivers/net/ethernet/broadcom/bcm63xx_enet.c
··· 1469 1469 return 0; 1470 1470 } 1471 1471 1472 - static struct ethtool_ops bcm_enet_ethtool_ops = { 1472 + static const struct ethtool_ops bcm_enet_ethtool_ops = { 1473 1473 .get_strings = bcm_enet_get_strings, 1474 1474 .get_sset_count = bcm_enet_get_sset_count, 1475 1475 .get_ethtool_stats = bcm_enet_get_ethtool_stats,
+1 -1
drivers/net/ethernet/emulex/benet/be_main.c
··· 3080 3080 return status; 3081 3081 } 3082 3082 3083 - static struct net_device_ops be_netdev_ops = { 3083 + static const struct net_device_ops be_netdev_ops = { 3084 3084 .ndo_open = be_open, 3085 3085 .ndo_stop = be_close, 3086 3086 .ndo_start_xmit = be_xmit,
+1 -1
drivers/net/ethernet/rdc/r6040.c
··· 1160 1160 lp->dev = dev; 1161 1161 1162 1162 /* Init RDC private data */ 1163 - lp->mcr0 = MCR0_XMTEN | MCR0; 1163 + lp->mcr0 = MCR0_XMTEN | MCR0_RCVEN; 1164 1164 1165 1165 /* The RDC-specific entries in the device structure. */ 1166 1166 dev->netdev_ops = &r6040_netdev_ops;
+1
drivers/net/ethernet/realtek/8139cp.c
··· 563 563 if (cpr16(IntrStatus) & cp_rx_intr_mask) 564 564 goto rx_status_loop; 565 565 566 + napi_gro_flush(napi); 566 567 spin_lock_irqsave(&cp->lock, flags); 567 568 __napi_complete(napi); 568 569 cpw16_f(IntrMask, cp_intr_mask);
-2
drivers/net/ethernet/smsc/smsc911x.h
··· 401 401 #include <asm/smsc911x.h> 402 402 #endif 403 403 404 - #ifdef CONFIG_SMSC_PHY 405 404 #include <linux/smscphy.h> 406 - #endif 407 405 408 406 #endif /* __SMSC911X_H__ */
+1 -2
drivers/net/ethernet/tile/tilepro.c
··· 2260 2260 return 0; 2261 2261 } 2262 2262 2263 - 2264 - static struct net_device_ops tile_net_ops = { 2263 + static const struct net_device_ops tile_net_ops = { 2265 2264 .ndo_open = tile_net_open, 2266 2265 .ndo_stop = tile_net_stop, 2267 2266 .ndo_start_xmit = tile_net_tx,
+2 -2
drivers/net/usb/asix.c
··· 376 376 377 377 skb_pull(skb, (size + 1) & 0xfffe); 378 378 379 - if (skb->len == 0) 379 + if (skb->len < sizeof(header)) 380 380 break; 381 381 382 382 head = (u8 *) skb->data; ··· 1152 1152 return 0; 1153 1153 } 1154 1154 1155 - static struct ethtool_ops ax88178_ethtool_ops = { 1155 + static const struct ethtool_ops ax88178_ethtool_ops = { 1156 1156 .get_drvinfo = asix_get_drvinfo, 1157 1157 .get_link = asix_get_link, 1158 1158 .get_msglevel = usbnet_get_msglevel,
+2 -2
drivers/net/usb/cdc_ncm.c
··· 138 138 static void cdc_ncm_tx_timeout(unsigned long arg); 139 139 static const struct driver_info cdc_ncm_info; 140 140 static struct usb_driver cdc_ncm_driver; 141 - static struct ethtool_ops cdc_ncm_ethtool_ops; 141 + static const struct ethtool_ops cdc_ncm_ethtool_ops; 142 142 143 143 static const struct usb_device_id cdc_devs[] = { 144 144 { USB_INTERFACE_INFO(USB_CLASS_COMM, ··· 1220 1220 .supports_autosuspend = 1, 1221 1221 }; 1222 1222 1223 - static struct ethtool_ops cdc_ncm_ethtool_ops = { 1223 + static const struct ethtool_ops cdc_ncm_ethtool_ops = { 1224 1224 .get_drvinfo = cdc_ncm_get_drvinfo, 1225 1225 .get_link = usbnet_get_link, 1226 1226 .get_msglevel = usbnet_get_msglevel,
+1 -1
drivers/net/usb/ipheth.c
··· 420 420 return netif_carrier_ok(dev->net); 421 421 } 422 422 423 - static struct ethtool_ops ops = { 423 + static const struct ethtool_ops ops = { 424 424 .get_link = ipheth_ethtool_op_get_link 425 425 }; 426 426
+1 -1
drivers/net/usb/sierra_net.c
··· 618 618 return sierra_net_get_private(dev)->link_up && netif_running(net); 619 619 } 620 620 621 - static struct ethtool_ops sierra_net_ethtool_ops = { 621 + static const struct ethtool_ops sierra_net_ethtool_ops = { 622 622 .get_drvinfo = sierra_net_get_drvinfo, 623 623 .get_link = sierra_net_get_link, 624 624 .get_msglevel = usbnet_get_msglevel,
-2
include/linux/memcontrol.h
··· 390 390 OVER_LIMIT, 391 391 }; 392 392 393 - #ifdef CONFIG_INET 394 393 struct sock; 395 394 #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM 396 395 void sock_update_memcg(struct sock *sk); ··· 402 403 { 403 404 } 404 405 #endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */ 405 - #endif /* CONFIG_INET */ 406 406 #endif /* _LINUX_MEMCONTROL_H */ 407 407
+5
include/linux/netdevice.h
··· 2450 2450 spin_lock(&dev->addr_list_lock); 2451 2451 } 2452 2452 2453 + static inline void netif_addr_lock_nested(struct net_device *dev) 2454 + { 2455 + spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING); 2456 + } 2457 + 2453 2458 static inline void netif_addr_lock_bh(struct net_device *dev) 2454 2459 { 2455 2460 spin_lock_bh(&dev->addr_list_lock);
+14 -5
mm/memcontrol.c
··· 381 381 static bool mem_cgroup_is_root(struct mem_cgroup *memcg); 382 382 void sock_update_memcg(struct sock *sk) 383 383 { 384 - /* A socket spends its whole life in the same cgroup */ 385 - if (sk->sk_cgrp) { 386 - WARN_ON(1); 387 - return; 388 - } 389 384 if (static_branch(&memcg_socket_limit_enabled)) { 390 385 struct mem_cgroup *memcg; 391 386 392 387 BUG_ON(!sk->sk_prot->proto_cgroup); 388 + 389 + /* Socket cloning can throw us here with sk_cgrp already 390 + * filled. It won't however, necessarily happen from 391 + * process context. So the test for root memcg given 392 + * the current task's memcg won't help us in this case. 393 + * 394 + * Respecting the original socket's memcg is a better 395 + * decision in this case. 396 + */ 397 + if (sk->sk_cgrp) { 398 + BUG_ON(mem_cgroup_is_root(sk->sk_cgrp->memcg)); 399 + mem_cgroup_get(sk->sk_cgrp->memcg); 400 + return; 401 + } 393 402 394 403 rcu_read_lock(); 395 404 memcg = mem_cgroup_from_task(current);
+8 -8
net/core/dev_addr_lists.c
··· 427 427 * 428 428 * Add newly added addresses to the destination device and release 429 429 * addresses that have no users left. The source device must be 430 - * locked by netif_tx_lock_bh. 430 + * locked by netif_addr_lock_bh. 431 431 * 432 432 * This function is intended to be called from the dev->set_rx_mode 433 433 * function of layered software devices. ··· 439 439 if (to->addr_len != from->addr_len) 440 440 return -EINVAL; 441 441 442 - netif_addr_lock_bh(to); 442 + netif_addr_lock_nested(to); 443 443 err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len); 444 444 if (!err) 445 445 __dev_set_rx_mode(to); 446 - netif_addr_unlock_bh(to); 446 + netif_addr_unlock(to); 447 447 return err; 448 448 } 449 449 EXPORT_SYMBOL(dev_uc_sync); ··· 463 463 return; 464 464 465 465 netif_addr_lock_bh(from); 466 - netif_addr_lock(to); 466 + netif_addr_lock_nested(to); 467 467 __hw_addr_unsync(&to->uc, &from->uc, to->addr_len); 468 468 __dev_set_rx_mode(to); 469 469 netif_addr_unlock(to); ··· 590 590 * 591 591 * Add newly added addresses to the destination device and release 592 592 * addresses that have no users left. The source device must be 593 - * locked by netif_tx_lock_bh. 593 + * locked by netif_addr_lock_bh. 594 594 * 595 595 * This function is intended to be called from the ndo_set_rx_mode 596 596 * function of layered software devices. ··· 602 602 if (to->addr_len != from->addr_len) 603 603 return -EINVAL; 604 604 605 - netif_addr_lock_bh(to); 605 + netif_addr_lock_nested(to); 606 606 err = __hw_addr_sync(&to->mc, &from->mc, to->addr_len); 607 607 if (!err) 608 608 __dev_set_rx_mode(to); 609 - netif_addr_unlock_bh(to); 609 + netif_addr_unlock(to); 610 610 return err; 611 611 } 612 612 EXPORT_SYMBOL(dev_mc_sync); ··· 626 626 return; 627 627 628 628 netif_addr_lock_bh(from); 629 - netif_addr_lock(to); 629 + netif_addr_lock_nested(to); 630 630 __hw_addr_unsync(&to->mc, &from->mc, to->addr_len); 631 631 __dev_set_rx_mode(to); 632 632 netif_addr_unlock(to);
+2 -2
net/core/pktgen.c
··· 2024 2024 pr_warning("WARNING: Requested queue_map_min (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n", 2025 2025 pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq, 2026 2026 pkt_dev->odevname); 2027 - pkt_dev->queue_map_min = ntxq - 1; 2027 + pkt_dev->queue_map_min = (ntxq ?: 1) - 1; 2028 2028 } 2029 2029 if (pkt_dev->queue_map_max >= ntxq) { 2030 2030 pr_warning("WARNING: Requested queue_map_max (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n", 2031 2031 pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq, 2032 2032 pkt_dev->odevname); 2033 - pkt_dev->queue_map_max = ntxq - 1; 2033 + pkt_dev->queue_map_max = (ntxq ?: 1) - 1; 2034 2034 } 2035 2035 2036 2036 /* Default to the interface's mac if not explicitly set. */
+9
net/core/sock.c
··· 112 112 #include <linux/highmem.h> 113 113 #include <linux/user_namespace.h> 114 114 #include <linux/jump_label.h> 115 + #include <linux/memcontrol.h> 115 116 116 117 #include <asm/uaccess.h> 117 118 #include <asm/system.h> ··· 1273 1272 } 1274 1273 EXPORT_SYMBOL(sk_release_kernel); 1275 1274 1275 + static void sk_update_clone(const struct sock *sk, struct sock *newsk) 1276 + { 1277 + if (mem_cgroup_sockets_enabled && sk->sk_cgrp) 1278 + sock_update_memcg(newsk); 1279 + } 1280 + 1276 1281 /** 1277 1282 * sk_clone_lock - clone a socket, and lock its clone 1278 1283 * @sk: the socket to clone ··· 1368 1361 sk_refcnt_debug_inc(newsk); 1369 1362 sk_set_socket(newsk, NULL); 1370 1363 newsk->sk_wq = NULL; 1364 + 1365 + sk_update_clone(sk, newsk); 1371 1366 1372 1367 if (newsk->sk_prot->sockets_allocated) 1373 1368 sk_sockets_allocated_inc(newsk);
+5 -1
net/ipv4/Kconfig
··· 408 408 def_tristate INET_DIAG 409 409 410 410 config INET_UDP_DIAG 411 + tristate "UDP: socket monitoring interface" 411 412 depends on INET_DIAG 412 - def_tristate INET_DIAG && IPV6 413 + default n 414 + ---help--- 415 + Support for UDP socket monitoring interface used by the ss tool. 416 + If unsure, say Y. 413 417 414 418 menuconfig TCP_CONG_ADVANCED 415 419 bool "TCP: advanced congestion control"
+2
net/ipv4/igmp.c
··· 880 880 * to be intended in a v3 query. 881 881 */ 882 882 max_delay = IGMPV3_MRC(ih3->code)*(HZ/IGMP_TIMER_SCALE); 883 + if (!max_delay) 884 + max_delay = 1; /* can't mod w/ 0 */ 883 885 } else { /* v3 */ 884 886 if (!pskb_may_pull(skb, sizeof(struct igmpv3_query))) 885 887 return;
+1 -1
net/unix/Kconfig
··· 22 22 config UNIX_DIAG 23 23 tristate "UNIX: socket monitoring interface" 24 24 depends on UNIX 25 - default UNIX 25 + default n 26 26 ---help--- 27 27 Support for UNIX socket monitoring interface used by the ss tool. 28 28 If unsure, say Y.