Commit 38e5781b authored by Linus Torvalds's avatar Linus Torvalds

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
parents 979ecef5 a8c1f65c
...@@ -1469,7 +1469,7 @@ static int bcm_enet_set_pauseparam(struct net_device *dev, ...@@ -1469,7 +1469,7 @@ static int bcm_enet_set_pauseparam(struct net_device *dev,
return 0; return 0;
} }
static struct ethtool_ops bcm_enet_ethtool_ops = { static const struct ethtool_ops bcm_enet_ethtool_ops = {
.get_strings = bcm_enet_get_strings, .get_strings = bcm_enet_get_strings,
.get_sset_count = bcm_enet_get_sset_count, .get_sset_count = bcm_enet_get_sset_count,
.get_ethtool_stats = bcm_enet_get_ethtool_stats, .get_ethtool_stats = bcm_enet_get_ethtool_stats,
......
...@@ -3080,7 +3080,7 @@ int be_load_fw(struct be_adapter *adapter, u8 *fw_file) ...@@ -3080,7 +3080,7 @@ int be_load_fw(struct be_adapter *adapter, u8 *fw_file)
return status; return status;
} }
static struct net_device_ops be_netdev_ops = { static const struct net_device_ops be_netdev_ops = {
.ndo_open = be_open, .ndo_open = be_open,
.ndo_stop = be_close, .ndo_stop = be_close,
.ndo_start_xmit = be_xmit, .ndo_start_xmit = be_xmit,
......
...@@ -1160,7 +1160,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, ...@@ -1160,7 +1160,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
lp->dev = dev; lp->dev = dev;
/* Init RDC private data */ /* Init RDC private data */
lp->mcr0 = MCR0_XMTEN | MCR0; lp->mcr0 = MCR0_XMTEN | MCR0_RCVEN;
/* The RDC-specific entries in the device structure. */ /* The RDC-specific entries in the device structure. */
dev->netdev_ops = &r6040_netdev_ops; dev->netdev_ops = &r6040_netdev_ops;
......
...@@ -563,6 +563,7 @@ static int cp_rx_poll(struct napi_struct *napi, int budget) ...@@ -563,6 +563,7 @@ static int cp_rx_poll(struct napi_struct *napi, int budget)
if (cpr16(IntrStatus) & cp_rx_intr_mask) if (cpr16(IntrStatus) & cp_rx_intr_mask)
goto rx_status_loop; goto rx_status_loop;
napi_gro_flush(napi);
spin_lock_irqsave(&cp->lock, flags); spin_lock_irqsave(&cp->lock, flags);
__napi_complete(napi); __napi_complete(napi);
cpw16_f(IntrMask, cp_intr_mask); cpw16_f(IntrMask, cp_intr_mask);
......
...@@ -401,8 +401,6 @@ ...@@ -401,8 +401,6 @@
#include <asm/smsc911x.h> #include <asm/smsc911x.h>
#endif #endif
#ifdef CONFIG_SMSC_PHY
#include <linux/smscphy.h> #include <linux/smscphy.h>
#endif
#endif /* __SMSC911X_H__ */ #endif /* __SMSC911X_H__ */
...@@ -2260,8 +2260,7 @@ static int tile_net_get_mac(struct net_device *dev) ...@@ -2260,8 +2260,7 @@ static int tile_net_get_mac(struct net_device *dev)
return 0; return 0;
} }
static const struct net_device_ops tile_net_ops = {
static struct net_device_ops tile_net_ops = {
.ndo_open = tile_net_open, .ndo_open = tile_net_open,
.ndo_stop = tile_net_stop, .ndo_stop = tile_net_stop,
.ndo_start_xmit = tile_net_tx, .ndo_start_xmit = tile_net_tx,
......
...@@ -376,7 +376,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb) ...@@ -376,7 +376,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
skb_pull(skb, (size + 1) & 0xfffe); skb_pull(skb, (size + 1) & 0xfffe);
if (skb->len == 0) if (skb->len < sizeof(header))
break; break;
head = (u8 *) skb->data; head = (u8 *) skb->data;
...@@ -1152,7 +1152,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) ...@@ -1152,7 +1152,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
return 0; return 0;
} }
static struct ethtool_ops ax88178_ethtool_ops = { static const struct ethtool_ops ax88178_ethtool_ops = {
.get_drvinfo = asix_get_drvinfo, .get_drvinfo = asix_get_drvinfo,
.get_link = asix_get_link, .get_link = asix_get_link,
.get_msglevel = usbnet_get_msglevel, .get_msglevel = usbnet_get_msglevel,
......
...@@ -138,7 +138,7 @@ struct cdc_ncm_ctx { ...@@ -138,7 +138,7 @@ struct cdc_ncm_ctx {
static void cdc_ncm_tx_timeout(unsigned long arg); static void cdc_ncm_tx_timeout(unsigned long arg);
static const struct driver_info cdc_ncm_info; static const struct driver_info cdc_ncm_info;
static struct usb_driver cdc_ncm_driver; static struct usb_driver cdc_ncm_driver;
static struct ethtool_ops cdc_ncm_ethtool_ops; static const struct ethtool_ops cdc_ncm_ethtool_ops;
static const struct usb_device_id cdc_devs[] = { static const struct usb_device_id cdc_devs[] = {
{ USB_INTERFACE_INFO(USB_CLASS_COMM, { USB_INTERFACE_INFO(USB_CLASS_COMM,
...@@ -1220,7 +1220,7 @@ static struct usb_driver cdc_ncm_driver = { ...@@ -1220,7 +1220,7 @@ static struct usb_driver cdc_ncm_driver = {
.supports_autosuspend = 1, .supports_autosuspend = 1,
}; };
static struct ethtool_ops cdc_ncm_ethtool_ops = { static const struct ethtool_ops cdc_ncm_ethtool_ops = {
.get_drvinfo = cdc_ncm_get_drvinfo, .get_drvinfo = cdc_ncm_get_drvinfo,
.get_link = usbnet_get_link, .get_link = usbnet_get_link,
.get_msglevel = usbnet_get_msglevel, .get_msglevel = usbnet_get_msglevel,
......
...@@ -420,7 +420,7 @@ static u32 ipheth_ethtool_op_get_link(struct net_device *net) ...@@ -420,7 +420,7 @@ static u32 ipheth_ethtool_op_get_link(struct net_device *net)
return netif_carrier_ok(dev->net); return netif_carrier_ok(dev->net);
} }
static struct ethtool_ops ops = { static const struct ethtool_ops ops = {
.get_link = ipheth_ethtool_op_get_link .get_link = ipheth_ethtool_op_get_link
}; };
......
...@@ -618,7 +618,7 @@ static u32 sierra_net_get_link(struct net_device *net) ...@@ -618,7 +618,7 @@ static u32 sierra_net_get_link(struct net_device *net)
return sierra_net_get_private(dev)->link_up && netif_running(net); return sierra_net_get_private(dev)->link_up && netif_running(net);
} }
static struct ethtool_ops sierra_net_ethtool_ops = { static const struct ethtool_ops sierra_net_ethtool_ops = {
.get_drvinfo = sierra_net_get_drvinfo, .get_drvinfo = sierra_net_get_drvinfo,
.get_link = sierra_net_get_link, .get_link = sierra_net_get_link,
.get_msglevel = usbnet_get_msglevel, .get_msglevel = usbnet_get_msglevel,
......
...@@ -390,7 +390,6 @@ enum { ...@@ -390,7 +390,6 @@ enum {
OVER_LIMIT, OVER_LIMIT,
}; };
#ifdef CONFIG_INET
struct sock; struct sock;
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
void sock_update_memcg(struct sock *sk); void sock_update_memcg(struct sock *sk);
...@@ -403,6 +402,5 @@ static inline void sock_release_memcg(struct sock *sk) ...@@ -403,6 +402,5 @@ static inline void sock_release_memcg(struct sock *sk)
{ {
} }
#endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */ #endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */
#endif /* CONFIG_INET */
#endif /* _LINUX_MEMCONTROL_H */ #endif /* _LINUX_MEMCONTROL_H */
...@@ -2450,6 +2450,11 @@ static inline void netif_addr_lock(struct net_device *dev) ...@@ -2450,6 +2450,11 @@ static inline void netif_addr_lock(struct net_device *dev)
spin_lock(&dev->addr_list_lock); spin_lock(&dev->addr_list_lock);
} }
static inline void netif_addr_lock_nested(struct net_device *dev)
{
spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING);
}
static inline void netif_addr_lock_bh(struct net_device *dev) static inline void netif_addr_lock_bh(struct net_device *dev)
{ {
spin_lock_bh(&dev->addr_list_lock); spin_lock_bh(&dev->addr_list_lock);
......
...@@ -381,16 +381,25 @@ static void mem_cgroup_put(struct mem_cgroup *memcg); ...@@ -381,16 +381,25 @@ static void mem_cgroup_put(struct mem_cgroup *memcg);
static bool mem_cgroup_is_root(struct mem_cgroup *memcg); static bool mem_cgroup_is_root(struct mem_cgroup *memcg);
void sock_update_memcg(struct sock *sk) void sock_update_memcg(struct sock *sk)
{ {
/* A socket spends its whole life in the same cgroup */
if (sk->sk_cgrp) {
WARN_ON(1);
return;
}
if (static_branch(&memcg_socket_limit_enabled)) { if (static_branch(&memcg_socket_limit_enabled)) {
struct mem_cgroup *memcg; struct mem_cgroup *memcg;
BUG_ON(!sk->sk_prot->proto_cgroup); BUG_ON(!sk->sk_prot->proto_cgroup);
/* Socket cloning can throw us here with sk_cgrp already
* filled. It won't however, necessarily happen from
* process context. So the test for root memcg given
* the current task's memcg won't help us in this case.
*
* Respecting the original socket's memcg is a better
* decision in this case.
*/
if (sk->sk_cgrp) {
BUG_ON(mem_cgroup_is_root(sk->sk_cgrp->memcg));
mem_cgroup_get(sk->sk_cgrp->memcg);
return;
}
rcu_read_lock(); rcu_read_lock();
memcg = mem_cgroup_from_task(current); memcg = mem_cgroup_from_task(current);
if (!mem_cgroup_is_root(memcg)) { if (!mem_cgroup_is_root(memcg)) {
......
...@@ -427,7 +427,7 @@ EXPORT_SYMBOL(dev_uc_del); ...@@ -427,7 +427,7 @@ EXPORT_SYMBOL(dev_uc_del);
* *
* Add newly added addresses to the destination device and release * Add newly added addresses to the destination device and release
* addresses that have no users left. The source device must be * addresses that have no users left. The source device must be
* locked by netif_tx_lock_bh. * locked by netif_addr_lock_bh.
* *
* This function is intended to be called from the dev->set_rx_mode * This function is intended to be called from the dev->set_rx_mode
* function of layered software devices. * function of layered software devices.
...@@ -439,11 +439,11 @@ int dev_uc_sync(struct net_device *to, struct net_device *from) ...@@ -439,11 +439,11 @@ int dev_uc_sync(struct net_device *to, struct net_device *from)
if (to->addr_len != from->addr_len) if (to->addr_len != from->addr_len)
return -EINVAL; return -EINVAL;
netif_addr_lock_bh(to); netif_addr_lock_nested(to);
err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len); err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len);
if (!err) if (!err)
__dev_set_rx_mode(to); __dev_set_rx_mode(to);
netif_addr_unlock_bh(to); netif_addr_unlock(to);
return err; return err;
} }
EXPORT_SYMBOL(dev_uc_sync); EXPORT_SYMBOL(dev_uc_sync);
...@@ -463,7 +463,7 @@ void dev_uc_unsync(struct net_device *to, struct net_device *from) ...@@ -463,7 +463,7 @@ void dev_uc_unsync(struct net_device *to, struct net_device *from)
return; return;
netif_addr_lock_bh(from); netif_addr_lock_bh(from);
netif_addr_lock(to); netif_addr_lock_nested(to);
__hw_addr_unsync(&to->uc, &from->uc, to->addr_len); __hw_addr_unsync(&to->uc, &from->uc, to->addr_len);
__dev_set_rx_mode(to); __dev_set_rx_mode(to);
netif_addr_unlock(to); netif_addr_unlock(to);
...@@ -590,7 +590,7 @@ EXPORT_SYMBOL(dev_mc_del_global); ...@@ -590,7 +590,7 @@ EXPORT_SYMBOL(dev_mc_del_global);
* *
* Add newly added addresses to the destination device and release * Add newly added addresses to the destination device and release
* addresses that have no users left. The source device must be * addresses that have no users left. The source device must be
* locked by netif_tx_lock_bh. * locked by netif_addr_lock_bh.
* *
* This function is intended to be called from the ndo_set_rx_mode * This function is intended to be called from the ndo_set_rx_mode
* function of layered software devices. * function of layered software devices.
...@@ -602,11 +602,11 @@ int dev_mc_sync(struct net_device *to, struct net_device *from) ...@@ -602,11 +602,11 @@ int dev_mc_sync(struct net_device *to, struct net_device *from)
if (to->addr_len != from->addr_len) if (to->addr_len != from->addr_len)
return -EINVAL; return -EINVAL;
netif_addr_lock_bh(to); netif_addr_lock_nested(to);
err = __hw_addr_sync(&to->mc, &from->mc, to->addr_len); err = __hw_addr_sync(&to->mc, &from->mc, to->addr_len);
if (!err) if (!err)
__dev_set_rx_mode(to); __dev_set_rx_mode(to);
netif_addr_unlock_bh(to); netif_addr_unlock(to);
return err; return err;
} }
EXPORT_SYMBOL(dev_mc_sync); EXPORT_SYMBOL(dev_mc_sync);
...@@ -626,7 +626,7 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from) ...@@ -626,7 +626,7 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from)
return; return;
netif_addr_lock_bh(from); netif_addr_lock_bh(from);
netif_addr_lock(to); netif_addr_lock_nested(to);
__hw_addr_unsync(&to->mc, &from->mc, to->addr_len); __hw_addr_unsync(&to->mc, &from->mc, to->addr_len);
__dev_set_rx_mode(to); __dev_set_rx_mode(to);
netif_addr_unlock(to); netif_addr_unlock(to);
......
...@@ -2024,13 +2024,13 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) ...@@ -2024,13 +2024,13 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
pr_warning("WARNING: Requested queue_map_min (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n", pr_warning("WARNING: Requested queue_map_min (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n",
pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq, pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq,
pkt_dev->odevname); pkt_dev->odevname);
pkt_dev->queue_map_min = ntxq - 1; pkt_dev->queue_map_min = (ntxq ?: 1) - 1;
} }
if (pkt_dev->queue_map_max >= ntxq) { if (pkt_dev->queue_map_max >= ntxq) {
pr_warning("WARNING: Requested queue_map_max (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n", pr_warning("WARNING: Requested queue_map_max (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n",
pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq, pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq,
pkt_dev->odevname); pkt_dev->odevname);
pkt_dev->queue_map_max = ntxq - 1; pkt_dev->queue_map_max = (ntxq ?: 1) - 1;
} }
/* Default to the interface's mac if not explicitly set. */ /* Default to the interface's mac if not explicitly set. */
......
...@@ -112,6 +112,7 @@ ...@@ -112,6 +112,7 @@
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/user_namespace.h> #include <linux/user_namespace.h>
#include <linux/jump_label.h> #include <linux/jump_label.h>
#include <linux/memcontrol.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/system.h> #include <asm/system.h>
...@@ -1272,6 +1273,12 @@ void sk_release_kernel(struct sock *sk) ...@@ -1272,6 +1273,12 @@ void sk_release_kernel(struct sock *sk)
} }
EXPORT_SYMBOL(sk_release_kernel); EXPORT_SYMBOL(sk_release_kernel);
static void sk_update_clone(const struct sock *sk, struct sock *newsk)
{
if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
sock_update_memcg(newsk);
}
/** /**
* sk_clone_lock - clone a socket, and lock its clone * sk_clone_lock - clone a socket, and lock its clone
* @sk: the socket to clone * @sk: the socket to clone
...@@ -1362,6 +1369,8 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) ...@@ -1362,6 +1369,8 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
sk_set_socket(newsk, NULL); sk_set_socket(newsk, NULL);
newsk->sk_wq = NULL; newsk->sk_wq = NULL;
sk_update_clone(sk, newsk);
if (newsk->sk_prot->sockets_allocated) if (newsk->sk_prot->sockets_allocated)
sk_sockets_allocated_inc(newsk); sk_sockets_allocated_inc(newsk);
......
...@@ -408,8 +408,12 @@ config INET_TCP_DIAG ...@@ -408,8 +408,12 @@ config INET_TCP_DIAG
def_tristate INET_DIAG def_tristate INET_DIAG
config INET_UDP_DIAG config INET_UDP_DIAG
tristate "UDP: socket monitoring interface"
depends on INET_DIAG depends on INET_DIAG
def_tristate INET_DIAG && IPV6 default n
---help---
Support for UDP socket monitoring interface used by the ss tool.
If unsure, say Y.
menuconfig TCP_CONG_ADVANCED menuconfig TCP_CONG_ADVANCED
bool "TCP: advanced congestion control" bool "TCP: advanced congestion control"
......
...@@ -880,6 +880,8 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, ...@@ -880,6 +880,8 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
* to be intended in a v3 query. * to be intended in a v3 query.
*/ */
max_delay = IGMPV3_MRC(ih3->code)*(HZ/IGMP_TIMER_SCALE); max_delay = IGMPV3_MRC(ih3->code)*(HZ/IGMP_TIMER_SCALE);
if (!max_delay)
max_delay = 1; /* can't mod w/ 0 */
} else { /* v3 */ } else { /* v3 */
if (!pskb_may_pull(skb, sizeof(struct igmpv3_query))) if (!pskb_may_pull(skb, sizeof(struct igmpv3_query)))
return; return;
......
...@@ -22,7 +22,7 @@ config UNIX ...@@ -22,7 +22,7 @@ config UNIX
config UNIX_DIAG config UNIX_DIAG
tristate "UNIX: socket monitoring interface" tristate "UNIX: socket monitoring interface"
depends on UNIX depends on UNIX
default UNIX default n
---help--- ---help---
Support for UNIX socket monitoring interface used by the ss tool. Support for UNIX socket monitoring interface used by the ss tool.
If unsure, say Y. If unsure, say Y.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment