Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 225449
b: refs/heads/master
c: 7f891cf
h: refs/heads/master
i:
  225447: 30fbe8c
v: v3
  • Loading branch information
Shmulik Ravid authored and David S. Miller committed Jan 3, 2011
1 parent fb1d5dc commit e6f49f4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 45 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 87e609760b5304ef0c0c53cf4d0b29fde9812e1b
refs/heads/master: 7f891cf1fc0d5d5c5b359caec77e5383e1d55986
81 changes: 37 additions & 44 deletions trunk/net/dcb/dcbnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,10 +1286,10 @@ static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb,
static int dcbnl_getdcbx(struct net_device *netdev, struct nlattr **tb,
u32 pid, u32 seq, u16 flags)
{
int ret = -EINVAL;
int ret;

if (!netdev->dcbnl_ops->getdcbx)
return ret;
return -EOPNOTSUPP;

ret = dcbnl_reply(netdev->dcbnl_ops->getdcbx(netdev), RTM_GETDCB,
DCB_CMD_GDCBX, DCB_ATTR_DCBX, pid, seq, flags);
Expand All @@ -1300,11 +1300,14 @@ static int dcbnl_getdcbx(struct net_device *netdev, struct nlattr **tb,
static int dcbnl_setdcbx(struct net_device *netdev, struct nlattr **tb,
u32 pid, u32 seq, u16 flags)
{
int ret = -EINVAL;
int ret;
u8 value;

if (!tb[DCB_ATTR_DCBX] || !netdev->dcbnl_ops->setdcbx)
return ret;
if (!netdev->dcbnl_ops->setdcbx)
return -EOPNOTSUPP;

if (!tb[DCB_ATTR_DCBX])
return -EINVAL;

value = nla_get_u8(tb[DCB_ATTR_DCBX]);

Expand All @@ -1323,23 +1326,23 @@ static int dcbnl_getfeatcfg(struct net_device *netdev, struct nlattr **tb,
struct dcbmsg *dcb;
struct nlattr *data[DCB_FEATCFG_ATTR_MAX + 1], *nest;
u8 value;
int ret = -EINVAL;
int i;
int ret, i;
int getall = 0;

if (!tb[DCB_ATTR_FEATCFG] || !netdev->dcbnl_ops->getfeatcfg)
return ret;
if (!netdev->dcbnl_ops->getfeatcfg)
return -EOPNOTSUPP;

if (!tb[DCB_ATTR_FEATCFG])
return -EINVAL;

ret = nla_parse_nested(data, DCB_FEATCFG_ATTR_MAX, tb[DCB_ATTR_FEATCFG],
dcbnl_featcfg_nest);
if (ret) {
ret = -EINVAL;
if (ret)
goto err_out;
}

dcbnl_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!dcbnl_skb) {
ret = -EINVAL;
ret = -ENOBUFS;
goto err_out;
}

Expand All @@ -1351,8 +1354,8 @@ static int dcbnl_getfeatcfg(struct net_device *netdev, struct nlattr **tb,

nest = nla_nest_start(dcbnl_skb, DCB_ATTR_FEATCFG);
if (!nest) {
ret = -EINVAL;
goto err;
ret = -EMSGSIZE;
goto nla_put_failure;
}

if (data[DCB_FEATCFG_ATTR_ALL])
Expand All @@ -1363,30 +1366,22 @@ static int dcbnl_getfeatcfg(struct net_device *netdev, struct nlattr **tb,
continue;

ret = netdev->dcbnl_ops->getfeatcfg(netdev, i, &value);
if (!ret) {
if (!ret)
ret = nla_put_u8(dcbnl_skb, i, value);

if (ret) {
nla_nest_cancel(dcbnl_skb, nest);
ret = -EINVAL;
goto err;
}
} else
goto err;
if (ret) {
nla_nest_cancel(dcbnl_skb, nest);
goto nla_put_failure;
}
}
nla_nest_end(dcbnl_skb, nest);

nlmsg_end(dcbnl_skb, nlh);

ret = rtnl_unicast(dcbnl_skb, &init_net, pid);
if (ret) {
ret = -EINVAL;
goto err_out;
}

return 0;
return rtnl_unicast(dcbnl_skb, &init_net, pid);
nla_put_failure:
nlmsg_cancel(dcbnl_skb, nlh);
nlmsg_failure:
err:
kfree_skb(dcbnl_skb);
err_out:
return ret;
Expand All @@ -1396,20 +1391,20 @@ static int dcbnl_setfeatcfg(struct net_device *netdev, struct nlattr **tb,
u32 pid, u32 seq, u16 flags)
{
struct nlattr *data[DCB_FEATCFG_ATTR_MAX + 1];
int ret = -EINVAL;
int ret, i;
u8 value;
int i;

if (!tb[DCB_ATTR_FEATCFG] || !netdev->dcbnl_ops->setfeatcfg)
return ret;
if (!netdev->dcbnl_ops->setfeatcfg)
return -ENOTSUPP;

if (!tb[DCB_ATTR_FEATCFG])
return -EINVAL;

ret = nla_parse_nested(data, DCB_FEATCFG_ATTR_MAX, tb[DCB_ATTR_FEATCFG],
dcbnl_featcfg_nest);

if (ret) {
ret = -EINVAL;
if (ret)
goto err;
}

for (i = DCB_FEATCFG_ATTR_ALL+1; i <= DCB_FEATCFG_ATTR_MAX; i++) {
if (data[i] == NULL)
Expand All @@ -1420,14 +1415,12 @@ static int dcbnl_setfeatcfg(struct net_device *netdev, struct nlattr **tb,
ret = netdev->dcbnl_ops->setfeatcfg(netdev, i, value);

if (ret)
goto operr;
goto err;
}

operr:
ret = dcbnl_reply(!!ret, RTM_SETDCB, DCB_CMD_SFEATCFG,
DCB_ATTR_FEATCFG, pid, seq, flags);

err:
dcbnl_reply(ret, RTM_SETDCB, DCB_CMD_SFEATCFG, DCB_ATTR_FEATCFG,
pid, seq, flags);

return ret;
}

Expand Down

0 comments on commit e6f49f4

Please sign in to comment.