Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
This commit is contained in:
@@ -1190,6 +1190,8 @@ static noinline_for_stack int ethtool_flash_device(struct net_device *dev,
|
||||
if (!dev->ethtool_ops->flash_device)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
efl.data[ETHTOOL_FLASH_MAX_FILENAME - 1] = 0;
|
||||
|
||||
return dev->ethtool_ops->flash_device(dev, &efl);
|
||||
}
|
||||
|
||||
|
@@ -30,6 +30,20 @@ EXPORT_SYMBOL(init_net);
|
||||
|
||||
#define INITIAL_NET_GEN_PTRS 13 /* +1 for len +2 for rcu_head */
|
||||
|
||||
static unsigned int max_gen_ptrs = INITIAL_NET_GEN_PTRS;
|
||||
|
||||
static struct net_generic *net_alloc_generic(void)
|
||||
{
|
||||
struct net_generic *ng;
|
||||
size_t generic_size = offsetof(struct net_generic, ptr[max_gen_ptrs]);
|
||||
|
||||
ng = kzalloc(generic_size, GFP_KERNEL);
|
||||
if (ng)
|
||||
ng->len = max_gen_ptrs;
|
||||
|
||||
return ng;
|
||||
}
|
||||
|
||||
static int net_assign_generic(struct net *net, int id, void *data)
|
||||
{
|
||||
struct net_generic *ng, *old_ng;
|
||||
@@ -43,8 +57,7 @@ static int net_assign_generic(struct net *net, int id, void *data)
|
||||
if (old_ng->len >= id)
|
||||
goto assign;
|
||||
|
||||
ng = kzalloc(sizeof(struct net_generic) +
|
||||
id * sizeof(void *), GFP_KERNEL);
|
||||
ng = net_alloc_generic();
|
||||
if (ng == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -59,7 +72,6 @@ static int net_assign_generic(struct net *net, int id, void *data)
|
||||
* the old copy for kfree after a grace period.
|
||||
*/
|
||||
|
||||
ng->len = id;
|
||||
memcpy(&ng->ptr, &old_ng->ptr, old_ng->len * sizeof(void*));
|
||||
|
||||
rcu_assign_pointer(net->gen, ng);
|
||||
@@ -161,18 +173,6 @@ out_undo:
|
||||
goto out;
|
||||
}
|
||||
|
||||
static struct net_generic *net_alloc_generic(void)
|
||||
{
|
||||
struct net_generic *ng;
|
||||
size_t generic_size = sizeof(struct net_generic) +
|
||||
INITIAL_NET_GEN_PTRS * sizeof(void *);
|
||||
|
||||
ng = kzalloc(generic_size, GFP_KERNEL);
|
||||
if (ng)
|
||||
ng->len = INITIAL_NET_GEN_PTRS;
|
||||
|
||||
return ng;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET_NS
|
||||
static struct kmem_cache *net_cachep;
|
||||
@@ -483,6 +483,7 @@ again:
|
||||
}
|
||||
return error;
|
||||
}
|
||||
max_gen_ptrs = max_t(unsigned int, max_gen_ptrs, *ops->id);
|
||||
}
|
||||
error = __register_pernet_operations(list, ops);
|
||||
if (error) {
|
||||
|
@@ -58,11 +58,12 @@ static int get_prioidx(u32 *prio)
|
||||
|
||||
spin_lock_irqsave(&prioidx_map_lock, flags);
|
||||
prioidx = find_first_zero_bit(prioidx_map, sizeof(unsigned long) * PRIOIDX_SZ);
|
||||
if (prioidx == sizeof(unsigned long) * PRIOIDX_SZ) {
|
||||
spin_unlock_irqrestore(&prioidx_map_lock, flags);
|
||||
return -ENOSPC;
|
||||
}
|
||||
set_bit(prioidx, prioidx_map);
|
||||
spin_unlock_irqrestore(&prioidx_map_lock, flags);
|
||||
if (prioidx == sizeof(unsigned long) * PRIOIDX_SZ)
|
||||
return -ENOSPC;
|
||||
|
||||
atomic_set(&max_prioidx, prioidx);
|
||||
*prio = prioidx;
|
||||
return 0;
|
||||
|
@@ -1509,6 +1509,9 @@ errout:
|
||||
|
||||
if (send_addr_notify)
|
||||
call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
|
||||
min_ifinfo_dump_size = max_t(u16, if_nlmsg_size(dev),
|
||||
min_ifinfo_dump_size);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user