Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts were easy to resolve using immediate context mostly, except the cls_u32.c one where I simply too the entire HEAD chunk. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -1752,6 +1752,28 @@ int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
|
||||
}
|
||||
EXPORT_SYMBOL(call_netdevice_notifiers);
|
||||
|
||||
/**
|
||||
* call_netdevice_notifiers_mtu - call all network notifier blocks
|
||||
* @val: value passed unmodified to notifier function
|
||||
* @dev: net_device pointer passed unmodified to notifier function
|
||||
* @arg: additional u32 argument passed to the notifier function
|
||||
*
|
||||
* Call all network notifier blocks. Parameters and return value
|
||||
* are as for raw_notifier_call_chain().
|
||||
*/
|
||||
static int call_netdevice_notifiers_mtu(unsigned long val,
|
||||
struct net_device *dev, u32 arg)
|
||||
{
|
||||
struct netdev_notifier_info_ext info = {
|
||||
.info.dev = dev,
|
||||
.ext.mtu = arg,
|
||||
};
|
||||
|
||||
BUILD_BUG_ON(offsetof(struct netdev_notifier_info_ext, info) != 0);
|
||||
|
||||
return call_netdevice_notifiers_info(val, &info.info);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET_INGRESS
|
||||
static DEFINE_STATIC_KEY_FALSE(ingress_needed_key);
|
||||
|
||||
@@ -7575,14 +7597,16 @@ int dev_set_mtu_ext(struct net_device *dev, int new_mtu,
|
||||
err = __dev_set_mtu(dev, new_mtu);
|
||||
|
||||
if (!err) {
|
||||
err = call_netdevice_notifiers(NETDEV_CHANGEMTU, dev);
|
||||
err = call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev,
|
||||
orig_mtu);
|
||||
err = notifier_to_errno(err);
|
||||
if (err) {
|
||||
/* setting mtu back and notifying everyone again,
|
||||
* so that they have a chance to revert changes.
|
||||
*/
|
||||
__dev_set_mtu(dev, orig_mtu);
|
||||
call_netdevice_notifiers(NETDEV_CHANGEMTU, dev);
|
||||
call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev,
|
||||
new_mtu);
|
||||
}
|
||||
}
|
||||
return err;
|
||||
|
||||
@@ -3012,6 +3012,8 @@ devlink_param_value_get_from_info(const struct devlink_param *param,
|
||||
struct genl_info *info,
|
||||
union devlink_param_value *value)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (param->type != DEVLINK_PARAM_TYPE_BOOL &&
|
||||
!info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA])
|
||||
return -EINVAL;
|
||||
@@ -3027,10 +3029,13 @@ devlink_param_value_get_from_info(const struct devlink_param *param,
|
||||
value->vu32 = nla_get_u32(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]);
|
||||
break;
|
||||
case DEVLINK_PARAM_TYPE_STRING:
|
||||
if (nla_len(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]) >
|
||||
DEVLINK_PARAM_MAX_STRING_VALUE)
|
||||
len = strnlen(nla_data(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]),
|
||||
nla_len(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]));
|
||||
if (len == nla_len(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]) ||
|
||||
len >= __DEVLINK_PARAM_MAX_STRING_VALUE)
|
||||
return -EINVAL;
|
||||
value->vstr = nla_data(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]);
|
||||
strcpy(value->vstr,
|
||||
nla_data(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]));
|
||||
break;
|
||||
case DEVLINK_PARAM_TYPE_BOOL:
|
||||
value->vbool = info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA] ?
|
||||
@@ -3117,7 +3122,10 @@ static int devlink_nl_cmd_param_set_doit(struct sk_buff *skb,
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (cmode == DEVLINK_PARAM_CMODE_DRIVERINIT) {
|
||||
param_item->driverinit_value = value;
|
||||
if (param->type == DEVLINK_PARAM_TYPE_STRING)
|
||||
strcpy(param_item->driverinit_value.vstr, value.vstr);
|
||||
else
|
||||
param_item->driverinit_value = value;
|
||||
param_item->driverinit_value_valid = true;
|
||||
} else {
|
||||
if (!param->set)
|
||||
@@ -4557,7 +4565,10 @@ int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
|
||||
DEVLINK_PARAM_CMODE_DRIVERINIT))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
*init_val = param_item->driverinit_value;
|
||||
if (param_item->param->type == DEVLINK_PARAM_TYPE_STRING)
|
||||
strcpy(init_val->vstr, param_item->driverinit_value.vstr);
|
||||
else
|
||||
*init_val = param_item->driverinit_value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -4588,7 +4599,10 @@ int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
|
||||
DEVLINK_PARAM_CMODE_DRIVERINIT))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
param_item->driverinit_value = init_val;
|
||||
if (param_item->param->type == DEVLINK_PARAM_TYPE_STRING)
|
||||
strcpy(param_item->driverinit_value.vstr, init_val.vstr);
|
||||
else
|
||||
param_item->driverinit_value = init_val;
|
||||
param_item->driverinit_value_valid = true;
|
||||
|
||||
devlink_param_notify(devlink, param_item, DEVLINK_CMD_PARAM_NEW);
|
||||
@@ -4620,6 +4634,23 @@ void devlink_param_value_changed(struct devlink *devlink, u32 param_id)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devlink_param_value_changed);
|
||||
|
||||
/**
|
||||
* devlink_param_value_str_fill - Safely fill-up the string preventing
|
||||
* from overflow of the preallocated buffer
|
||||
*
|
||||
* @dst_val: destination devlink_param_value
|
||||
* @src: source buffer
|
||||
*/
|
||||
void devlink_param_value_str_fill(union devlink_param_value *dst_val,
|
||||
const char *src)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = strlcpy(dst_val->vstr, src, __DEVLINK_PARAM_MAX_STRING_VALUE);
|
||||
WARN_ON(len >= __DEVLINK_PARAM_MAX_STRING_VALUE);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devlink_param_value_str_fill);
|
||||
|
||||
/**
|
||||
* devlink_region_create - create a new address region
|
||||
*
|
||||
|
||||
@@ -4394,14 +4394,16 @@ EXPORT_SYMBOL_GPL(skb_complete_wifi_ack);
|
||||
*/
|
||||
bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off)
|
||||
{
|
||||
if (unlikely(start > skb_headlen(skb)) ||
|
||||
unlikely((int)start + off > skb_headlen(skb) - 2)) {
|
||||
net_warn_ratelimited("bad partial csum: csum=%u/%u len=%u\n",
|
||||
start, off, skb_headlen(skb));
|
||||
u32 csum_end = (u32)start + (u32)off + sizeof(__sum16);
|
||||
u32 csum_start = skb_headroom(skb) + (u32)start;
|
||||
|
||||
if (unlikely(csum_start > U16_MAX || csum_end > skb_headlen(skb))) {
|
||||
net_warn_ratelimited("bad partial csum: csum=%u/%u headroom=%u headlen=%u\n",
|
||||
start, off, skb_headroom(skb), skb_headlen(skb));
|
||||
return false;
|
||||
}
|
||||
skb->ip_summed = CHECKSUM_PARTIAL;
|
||||
skb->csum_start = skb_headroom(skb) + start;
|
||||
skb->csum_start = csum_start;
|
||||
skb->csum_offset = off;
|
||||
skb_set_transport_header(skb, start);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user