| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2008-2011, Intel Corporation. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 5 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 6 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 9 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 10 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 11 | | - * more details. |
|---|
| 12 | | - * |
|---|
| 13 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 14 | | - * this program; if not, see <http://www.gnu.org/licenses/>. |
|---|
| 15 | 4 | * |
|---|
| 16 | 5 | * Description: Data Center Bridging netlink interface |
|---|
| 17 | 6 | * Author: Lucy Liu <lucy.liu@intel.com> |
|---|
| .. | .. |
|---|
| 241 | 230 | if (!netdev->dcbnl_ops->getpfccfg) |
|---|
| 242 | 231 | return -EOPNOTSUPP; |
|---|
| 243 | 232 | |
|---|
| 244 | | - ret = nla_parse_nested(data, DCB_PFC_UP_ATTR_MAX, |
|---|
| 245 | | - tb[DCB_ATTR_PFC_CFG], dcbnl_pfc_up_nest, NULL); |
|---|
| 233 | + ret = nla_parse_nested_deprecated(data, DCB_PFC_UP_ATTR_MAX, |
|---|
| 234 | + tb[DCB_ATTR_PFC_CFG], |
|---|
| 235 | + dcbnl_pfc_up_nest, NULL); |
|---|
| 246 | 236 | if (ret) |
|---|
| 247 | 237 | return ret; |
|---|
| 248 | 238 | |
|---|
| 249 | | - nest = nla_nest_start(skb, DCB_ATTR_PFC_CFG); |
|---|
| 239 | + nest = nla_nest_start_noflag(skb, DCB_ATTR_PFC_CFG); |
|---|
| 250 | 240 | if (!nest) |
|---|
| 251 | 241 | return -EMSGSIZE; |
|---|
| 252 | 242 | |
|---|
| .. | .. |
|---|
| 299 | 289 | if (!netdev->dcbnl_ops->getcap) |
|---|
| 300 | 290 | return -EOPNOTSUPP; |
|---|
| 301 | 291 | |
|---|
| 302 | | - ret = nla_parse_nested(data, DCB_CAP_ATTR_MAX, tb[DCB_ATTR_CAP], |
|---|
| 303 | | - dcbnl_cap_nest, NULL); |
|---|
| 292 | + ret = nla_parse_nested_deprecated(data, DCB_CAP_ATTR_MAX, |
|---|
| 293 | + tb[DCB_ATTR_CAP], dcbnl_cap_nest, |
|---|
| 294 | + NULL); |
|---|
| 304 | 295 | if (ret) |
|---|
| 305 | 296 | return ret; |
|---|
| 306 | 297 | |
|---|
| 307 | | - nest = nla_nest_start(skb, DCB_ATTR_CAP); |
|---|
| 298 | + nest = nla_nest_start_noflag(skb, DCB_ATTR_CAP); |
|---|
| 308 | 299 | if (!nest) |
|---|
| 309 | 300 | return -EMSGSIZE; |
|---|
| 310 | 301 | |
|---|
| .. | .. |
|---|
| 343 | 334 | if (!netdev->dcbnl_ops->getnumtcs) |
|---|
| 344 | 335 | return -EOPNOTSUPP; |
|---|
| 345 | 336 | |
|---|
| 346 | | - ret = nla_parse_nested(data, DCB_NUMTCS_ATTR_MAX, tb[DCB_ATTR_NUMTCS], |
|---|
| 347 | | - dcbnl_numtcs_nest, NULL); |
|---|
| 337 | + ret = nla_parse_nested_deprecated(data, DCB_NUMTCS_ATTR_MAX, |
|---|
| 338 | + tb[DCB_ATTR_NUMTCS], |
|---|
| 339 | + dcbnl_numtcs_nest, NULL); |
|---|
| 348 | 340 | if (ret) |
|---|
| 349 | 341 | return ret; |
|---|
| 350 | 342 | |
|---|
| 351 | | - nest = nla_nest_start(skb, DCB_ATTR_NUMTCS); |
|---|
| 343 | + nest = nla_nest_start_noflag(skb, DCB_ATTR_NUMTCS); |
|---|
| 352 | 344 | if (!nest) |
|---|
| 353 | 345 | return -EMSGSIZE; |
|---|
| 354 | 346 | |
|---|
| .. | .. |
|---|
| 388 | 380 | if (!netdev->dcbnl_ops->setnumtcs) |
|---|
| 389 | 381 | return -EOPNOTSUPP; |
|---|
| 390 | 382 | |
|---|
| 391 | | - ret = nla_parse_nested(data, DCB_NUMTCS_ATTR_MAX, tb[DCB_ATTR_NUMTCS], |
|---|
| 392 | | - dcbnl_numtcs_nest, NULL); |
|---|
| 383 | + ret = nla_parse_nested_deprecated(data, DCB_NUMTCS_ATTR_MAX, |
|---|
| 384 | + tb[DCB_ATTR_NUMTCS], |
|---|
| 385 | + dcbnl_numtcs_nest, NULL); |
|---|
| 393 | 386 | if (ret) |
|---|
| 394 | 387 | return ret; |
|---|
| 395 | 388 | |
|---|
| .. | .. |
|---|
| 447 | 440 | if (!tb[DCB_ATTR_APP]) |
|---|
| 448 | 441 | return -EINVAL; |
|---|
| 449 | 442 | |
|---|
| 450 | | - ret = nla_parse_nested(app_tb, DCB_APP_ATTR_MAX, tb[DCB_ATTR_APP], |
|---|
| 451 | | - dcbnl_app_nest, NULL); |
|---|
| 443 | + ret = nla_parse_nested_deprecated(app_tb, DCB_APP_ATTR_MAX, |
|---|
| 444 | + tb[DCB_ATTR_APP], dcbnl_app_nest, |
|---|
| 445 | + NULL); |
|---|
| 452 | 446 | if (ret) |
|---|
| 453 | 447 | return ret; |
|---|
| 454 | 448 | |
|---|
| .. | .. |
|---|
| 479 | 473 | up = dcb_getapp(netdev, &app); |
|---|
| 480 | 474 | } |
|---|
| 481 | 475 | |
|---|
| 482 | | - app_nest = nla_nest_start(skb, DCB_ATTR_APP); |
|---|
| 476 | + app_nest = nla_nest_start_noflag(skb, DCB_ATTR_APP); |
|---|
| 483 | 477 | if (!app_nest) |
|---|
| 484 | 478 | return -EMSGSIZE; |
|---|
| 485 | 479 | |
|---|
| .. | .. |
|---|
| 515 | 509 | if (!tb[DCB_ATTR_APP]) |
|---|
| 516 | 510 | return -EINVAL; |
|---|
| 517 | 511 | |
|---|
| 518 | | - ret = nla_parse_nested(app_tb, DCB_APP_ATTR_MAX, tb[DCB_ATTR_APP], |
|---|
| 519 | | - dcbnl_app_nest, NULL); |
|---|
| 512 | + ret = nla_parse_nested_deprecated(app_tb, DCB_APP_ATTR_MAX, |
|---|
| 513 | + tb[DCB_ATTR_APP], dcbnl_app_nest, |
|---|
| 514 | + NULL); |
|---|
| 520 | 515 | if (ret) |
|---|
| 521 | 516 | return ret; |
|---|
| 522 | 517 | |
|---|
| .. | .. |
|---|
| 573 | 568 | !netdev->dcbnl_ops->getpgbwgcfgrx) |
|---|
| 574 | 569 | return -EOPNOTSUPP; |
|---|
| 575 | 570 | |
|---|
| 576 | | - ret = nla_parse_nested(pg_tb, DCB_PG_ATTR_MAX, tb[DCB_ATTR_PG_CFG], |
|---|
| 577 | | - dcbnl_pg_nest, NULL); |
|---|
| 571 | + ret = nla_parse_nested_deprecated(pg_tb, DCB_PG_ATTR_MAX, |
|---|
| 572 | + tb[DCB_ATTR_PG_CFG], dcbnl_pg_nest, |
|---|
| 573 | + NULL); |
|---|
| 578 | 574 | if (ret) |
|---|
| 579 | 575 | return ret; |
|---|
| 580 | 576 | |
|---|
| 581 | | - pg_nest = nla_nest_start(skb, DCB_ATTR_PG_CFG); |
|---|
| 577 | + pg_nest = nla_nest_start_noflag(skb, DCB_ATTR_PG_CFG); |
|---|
| 582 | 578 | if (!pg_nest) |
|---|
| 583 | 579 | return -EMSGSIZE; |
|---|
| 584 | 580 | |
|---|
| .. | .. |
|---|
| 593 | 589 | data = pg_tb[DCB_PG_ATTR_TC_ALL]; |
|---|
| 594 | 590 | else |
|---|
| 595 | 591 | data = pg_tb[i]; |
|---|
| 596 | | - ret = nla_parse_nested(param_tb, DCB_TC_ATTR_PARAM_MAX, data, |
|---|
| 597 | | - dcbnl_tc_param_nest, NULL); |
|---|
| 592 | + ret = nla_parse_nested_deprecated(param_tb, |
|---|
| 593 | + DCB_TC_ATTR_PARAM_MAX, data, |
|---|
| 594 | + dcbnl_tc_param_nest, NULL); |
|---|
| 598 | 595 | if (ret) |
|---|
| 599 | 596 | goto err_pg; |
|---|
| 600 | 597 | |
|---|
| 601 | | - param_nest = nla_nest_start(skb, i); |
|---|
| 598 | + param_nest = nla_nest_start_noflag(skb, i); |
|---|
| 602 | 599 | if (!param_nest) |
|---|
| 603 | 600 | goto err_pg; |
|---|
| 604 | 601 | |
|---|
| .. | .. |
|---|
| 730 | 727 | if (!netdev->dcbnl_ops->setpfccfg) |
|---|
| 731 | 728 | return -EOPNOTSUPP; |
|---|
| 732 | 729 | |
|---|
| 733 | | - ret = nla_parse_nested(data, DCB_PFC_UP_ATTR_MAX, |
|---|
| 734 | | - tb[DCB_ATTR_PFC_CFG], dcbnl_pfc_up_nest, NULL); |
|---|
| 730 | + ret = nla_parse_nested_deprecated(data, DCB_PFC_UP_ATTR_MAX, |
|---|
| 731 | + tb[DCB_ATTR_PFC_CFG], |
|---|
| 732 | + dcbnl_pfc_up_nest, NULL); |
|---|
| 735 | 733 | if (ret) |
|---|
| 736 | 734 | return ret; |
|---|
| 737 | 735 | |
|---|
| .. | .. |
|---|
| 786 | 784 | !netdev->dcbnl_ops->setpgbwgcfgrx) |
|---|
| 787 | 785 | return -EOPNOTSUPP; |
|---|
| 788 | 786 | |
|---|
| 789 | | - ret = nla_parse_nested(pg_tb, DCB_PG_ATTR_MAX, tb[DCB_ATTR_PG_CFG], |
|---|
| 790 | | - dcbnl_pg_nest, NULL); |
|---|
| 787 | + ret = nla_parse_nested_deprecated(pg_tb, DCB_PG_ATTR_MAX, |
|---|
| 788 | + tb[DCB_ATTR_PG_CFG], dcbnl_pg_nest, |
|---|
| 789 | + NULL); |
|---|
| 791 | 790 | if (ret) |
|---|
| 792 | 791 | return ret; |
|---|
| 793 | 792 | |
|---|
| .. | .. |
|---|
| 795 | 794 | if (!pg_tb[i]) |
|---|
| 796 | 795 | continue; |
|---|
| 797 | 796 | |
|---|
| 798 | | - ret = nla_parse_nested(param_tb, DCB_TC_ATTR_PARAM_MAX, |
|---|
| 799 | | - pg_tb[i], dcbnl_tc_param_nest, NULL); |
|---|
| 797 | + ret = nla_parse_nested_deprecated(param_tb, |
|---|
| 798 | + DCB_TC_ATTR_PARAM_MAX, |
|---|
| 799 | + pg_tb[i], |
|---|
| 800 | + dcbnl_tc_param_nest, NULL); |
|---|
| 800 | 801 | if (ret) |
|---|
| 801 | 802 | return ret; |
|---|
| 802 | 803 | |
|---|
| .. | .. |
|---|
| 884 | 885 | !netdev->dcbnl_ops->getbcncfg) |
|---|
| 885 | 886 | return -EOPNOTSUPP; |
|---|
| 886 | 887 | |
|---|
| 887 | | - ret = nla_parse_nested(bcn_tb, DCB_BCN_ATTR_MAX, tb[DCB_ATTR_BCN], |
|---|
| 888 | | - dcbnl_bcn_nest, NULL); |
|---|
| 888 | + ret = nla_parse_nested_deprecated(bcn_tb, DCB_BCN_ATTR_MAX, |
|---|
| 889 | + tb[DCB_ATTR_BCN], dcbnl_bcn_nest, |
|---|
| 890 | + NULL); |
|---|
| 889 | 891 | if (ret) |
|---|
| 890 | 892 | return ret; |
|---|
| 891 | 893 | |
|---|
| 892 | | - bcn_nest = nla_nest_start(skb, DCB_ATTR_BCN); |
|---|
| 894 | + bcn_nest = nla_nest_start_noflag(skb, DCB_ATTR_BCN); |
|---|
| 893 | 895 | if (!bcn_nest) |
|---|
| 894 | 896 | return -EMSGSIZE; |
|---|
| 895 | 897 | |
|---|
| .. | .. |
|---|
| 943 | 945 | !netdev->dcbnl_ops->setbcnrp) |
|---|
| 944 | 946 | return -EOPNOTSUPP; |
|---|
| 945 | 947 | |
|---|
| 946 | | - ret = nla_parse_nested(data, DCB_BCN_ATTR_MAX, tb[DCB_ATTR_BCN], |
|---|
| 947 | | - dcbnl_pfc_up_nest, NULL); |
|---|
| 948 | + ret = nla_parse_nested_deprecated(data, DCB_BCN_ATTR_MAX, |
|---|
| 949 | + tb[DCB_ATTR_BCN], dcbnl_bcn_nest, |
|---|
| 950 | + NULL); |
|---|
| 948 | 951 | if (ret) |
|---|
| 949 | 952 | return ret; |
|---|
| 950 | 953 | |
|---|
| .. | .. |
|---|
| 1002 | 1005 | */ |
|---|
| 1003 | 1006 | err = -EMSGSIZE; |
|---|
| 1004 | 1007 | |
|---|
| 1005 | | - app = nla_nest_start(skb, app_nested_type); |
|---|
| 1008 | + app = nla_nest_start_noflag(skb, app_nested_type); |
|---|
| 1006 | 1009 | if (!app) |
|---|
| 1007 | 1010 | goto nla_put_failure; |
|---|
| 1008 | 1011 | |
|---|
| .. | .. |
|---|
| 1036 | 1039 | if (nla_put_string(skb, DCB_ATTR_IFNAME, netdev->name)) |
|---|
| 1037 | 1040 | return -EMSGSIZE; |
|---|
| 1038 | 1041 | |
|---|
| 1039 | | - ieee = nla_nest_start(skb, DCB_ATTR_IEEE); |
|---|
| 1042 | + ieee = nla_nest_start_noflag(skb, DCB_ATTR_IEEE); |
|---|
| 1040 | 1043 | if (!ieee) |
|---|
| 1041 | 1044 | return -EMSGSIZE; |
|---|
| 1042 | 1045 | |
|---|
| .. | .. |
|---|
| 1106 | 1109 | return -EMSGSIZE; |
|---|
| 1107 | 1110 | } |
|---|
| 1108 | 1111 | |
|---|
| 1109 | | - app = nla_nest_start(skb, DCB_ATTR_IEEE_APP_TABLE); |
|---|
| 1112 | + app = nla_nest_start_noflag(skb, DCB_ATTR_IEEE_APP_TABLE); |
|---|
| 1110 | 1113 | if (!app) |
|---|
| 1111 | 1114 | return -EMSGSIZE; |
|---|
| 1112 | 1115 | |
|---|
| .. | .. |
|---|
| 1174 | 1177 | u8 pgid, up_map, prio, tc_pct; |
|---|
| 1175 | 1178 | const struct dcbnl_rtnl_ops *ops = dev->dcbnl_ops; |
|---|
| 1176 | 1179 | int i = dir ? DCB_ATTR_CEE_TX_PG : DCB_ATTR_CEE_RX_PG; |
|---|
| 1177 | | - struct nlattr *pg = nla_nest_start(skb, i); |
|---|
| 1180 | + struct nlattr *pg = nla_nest_start_noflag(skb, i); |
|---|
| 1178 | 1181 | |
|---|
| 1179 | 1182 | if (!pg) |
|---|
| 1180 | 1183 | return -EMSGSIZE; |
|---|
| 1181 | 1184 | |
|---|
| 1182 | 1185 | for (i = DCB_PG_ATTR_TC_0; i <= DCB_PG_ATTR_TC_7; i++) { |
|---|
| 1183 | | - struct nlattr *tc_nest = nla_nest_start(skb, i); |
|---|
| 1186 | + struct nlattr *tc_nest = nla_nest_start_noflag(skb, i); |
|---|
| 1184 | 1187 | |
|---|
| 1185 | 1188 | if (!tc_nest) |
|---|
| 1186 | 1189 | return -EMSGSIZE; |
|---|
| .. | .. |
|---|
| 1231 | 1234 | |
|---|
| 1232 | 1235 | if (nla_put_string(skb, DCB_ATTR_IFNAME, netdev->name)) |
|---|
| 1233 | 1236 | goto nla_put_failure; |
|---|
| 1234 | | - cee = nla_nest_start(skb, DCB_ATTR_CEE); |
|---|
| 1237 | + cee = nla_nest_start_noflag(skb, DCB_ATTR_CEE); |
|---|
| 1235 | 1238 | if (!cee) |
|---|
| 1236 | 1239 | goto nla_put_failure; |
|---|
| 1237 | 1240 | |
|---|
| .. | .. |
|---|
| 1250 | 1253 | |
|---|
| 1251 | 1254 | /* local pfc */ |
|---|
| 1252 | 1255 | if (ops->getpfccfg) { |
|---|
| 1253 | | - struct nlattr *pfc_nest = nla_nest_start(skb, DCB_ATTR_CEE_PFC); |
|---|
| 1256 | + struct nlattr *pfc_nest = nla_nest_start_noflag(skb, |
|---|
| 1257 | + DCB_ATTR_CEE_PFC); |
|---|
| 1254 | 1258 | |
|---|
| 1255 | 1259 | if (!pfc_nest) |
|---|
| 1256 | 1260 | goto nla_put_failure; |
|---|
| .. | .. |
|---|
| 1265 | 1269 | |
|---|
| 1266 | 1270 | /* local app */ |
|---|
| 1267 | 1271 | spin_lock_bh(&dcb_lock); |
|---|
| 1268 | | - app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE); |
|---|
| 1272 | + app = nla_nest_start_noflag(skb, DCB_ATTR_CEE_APP_TABLE); |
|---|
| 1269 | 1273 | if (!app) |
|---|
| 1270 | 1274 | goto dcb_unlock; |
|---|
| 1271 | 1275 | |
|---|
| 1272 | 1276 | list_for_each_entry(itr, &dcb_app_list, list) { |
|---|
| 1273 | 1277 | if (itr->ifindex == netdev->ifindex) { |
|---|
| 1274 | | - struct nlattr *app_nest = nla_nest_start(skb, |
|---|
| 1275 | | - DCB_ATTR_APP); |
|---|
| 1278 | + struct nlattr *app_nest = nla_nest_start_noflag(skb, |
|---|
| 1279 | + DCB_ATTR_APP); |
|---|
| 1276 | 1280 | if (!app_nest) |
|---|
| 1277 | 1281 | goto dcb_unlock; |
|---|
| 1278 | 1282 | |
|---|
| .. | .. |
|---|
| 1305 | 1309 | |
|---|
| 1306 | 1310 | /* features flags */ |
|---|
| 1307 | 1311 | if (ops->getfeatcfg) { |
|---|
| 1308 | | - struct nlattr *feat = nla_nest_start(skb, DCB_ATTR_CEE_FEAT); |
|---|
| 1312 | + struct nlattr *feat = nla_nest_start_noflag(skb, |
|---|
| 1313 | + DCB_ATTR_CEE_FEAT); |
|---|
| 1309 | 1314 | if (!feat) |
|---|
| 1310 | 1315 | goto nla_put_failure; |
|---|
| 1311 | 1316 | |
|---|
| .. | .. |
|---|
| 1430 | 1435 | if (!tb[DCB_ATTR_IEEE]) |
|---|
| 1431 | 1436 | return -EINVAL; |
|---|
| 1432 | 1437 | |
|---|
| 1433 | | - err = nla_parse_nested(ieee, DCB_ATTR_IEEE_MAX, tb[DCB_ATTR_IEEE], |
|---|
| 1434 | | - dcbnl_ieee_policy, NULL); |
|---|
| 1438 | + err = nla_parse_nested_deprecated(ieee, DCB_ATTR_IEEE_MAX, |
|---|
| 1439 | + tb[DCB_ATTR_IEEE], |
|---|
| 1440 | + dcbnl_ieee_policy, NULL); |
|---|
| 1435 | 1441 | if (err) |
|---|
| 1436 | 1442 | return err; |
|---|
| 1437 | 1443 | |
|---|
| .. | .. |
|---|
| 1537 | 1543 | if (!tb[DCB_ATTR_IEEE]) |
|---|
| 1538 | 1544 | return -EINVAL; |
|---|
| 1539 | 1545 | |
|---|
| 1540 | | - err = nla_parse_nested(ieee, DCB_ATTR_IEEE_MAX, tb[DCB_ATTR_IEEE], |
|---|
| 1541 | | - dcbnl_ieee_policy, NULL); |
|---|
| 1546 | + err = nla_parse_nested_deprecated(ieee, DCB_ATTR_IEEE_MAX, |
|---|
| 1547 | + tb[DCB_ATTR_IEEE], |
|---|
| 1548 | + dcbnl_ieee_policy, NULL); |
|---|
| 1542 | 1549 | if (err) |
|---|
| 1543 | 1550 | return err; |
|---|
| 1544 | 1551 | |
|---|
| .. | .. |
|---|
| 1610 | 1617 | if (!tb[DCB_ATTR_FEATCFG]) |
|---|
| 1611 | 1618 | return -EINVAL; |
|---|
| 1612 | 1619 | |
|---|
| 1613 | | - ret = nla_parse_nested(data, DCB_FEATCFG_ATTR_MAX, |
|---|
| 1614 | | - tb[DCB_ATTR_FEATCFG], dcbnl_featcfg_nest, NULL); |
|---|
| 1620 | + ret = nla_parse_nested_deprecated(data, DCB_FEATCFG_ATTR_MAX, |
|---|
| 1621 | + tb[DCB_ATTR_FEATCFG], |
|---|
| 1622 | + dcbnl_featcfg_nest, NULL); |
|---|
| 1615 | 1623 | if (ret) |
|---|
| 1616 | 1624 | return ret; |
|---|
| 1617 | 1625 | |
|---|
| 1618 | | - nest = nla_nest_start(skb, DCB_ATTR_FEATCFG); |
|---|
| 1626 | + nest = nla_nest_start_noflag(skb, DCB_ATTR_FEATCFG); |
|---|
| 1619 | 1627 | if (!nest) |
|---|
| 1620 | 1628 | return -EMSGSIZE; |
|---|
| 1621 | 1629 | |
|---|
| .. | .. |
|---|
| 1654 | 1662 | if (!tb[DCB_ATTR_FEATCFG]) |
|---|
| 1655 | 1663 | return -EINVAL; |
|---|
| 1656 | 1664 | |
|---|
| 1657 | | - ret = nla_parse_nested(data, DCB_FEATCFG_ATTR_MAX, |
|---|
| 1658 | | - tb[DCB_ATTR_FEATCFG], dcbnl_featcfg_nest, NULL); |
|---|
| 1665 | + ret = nla_parse_nested_deprecated(data, DCB_FEATCFG_ATTR_MAX, |
|---|
| 1666 | + tb[DCB_ATTR_FEATCFG], |
|---|
| 1667 | + dcbnl_featcfg_nest, NULL); |
|---|
| 1659 | 1668 | |
|---|
| 1660 | 1669 | if (ret) |
|---|
| 1661 | 1670 | goto err; |
|---|
| .. | .. |
|---|
| 1735 | 1744 | struct net_device *netdev; |
|---|
| 1736 | 1745 | struct dcbmsg *dcb = nlmsg_data(nlh); |
|---|
| 1737 | 1746 | struct nlattr *tb[DCB_ATTR_MAX + 1]; |
|---|
| 1738 | | - u32 portid = skb ? NETLINK_CB(skb).portid : 0; |
|---|
| 1747 | + u32 portid = NETLINK_CB(skb).portid; |
|---|
| 1739 | 1748 | int ret = -EINVAL; |
|---|
| 1740 | 1749 | struct sk_buff *reply_skb; |
|---|
| 1741 | 1750 | struct nlmsghdr *reply_nlh = NULL; |
|---|
| .. | .. |
|---|
| 1744 | 1753 | if ((nlh->nlmsg_type == RTM_SETDCB) && !netlink_capable(skb, CAP_NET_ADMIN)) |
|---|
| 1745 | 1754 | return -EPERM; |
|---|
| 1746 | 1755 | |
|---|
| 1747 | | - ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX, |
|---|
| 1748 | | - dcbnl_rtnl_policy, extack); |
|---|
| 1756 | + ret = nlmsg_parse_deprecated(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX, |
|---|
| 1757 | + dcbnl_rtnl_policy, extack); |
|---|
| 1749 | 1758 | if (ret < 0) |
|---|
| 1750 | 1759 | return ret; |
|---|
| 1751 | 1760 | |
|---|
| .. | .. |
|---|
| 2054 | 2063 | } |
|---|
| 2055 | 2064 | EXPORT_SYMBOL(dcb_ieee_getapp_default_prio_mask); |
|---|
| 2056 | 2065 | |
|---|
| 2066 | +static void dcbnl_flush_dev(struct net_device *dev) |
|---|
| 2067 | +{ |
|---|
| 2068 | + struct dcb_app_type *itr, *tmp; |
|---|
| 2069 | + |
|---|
| 2070 | + spin_lock_bh(&dcb_lock); |
|---|
| 2071 | + |
|---|
| 2072 | + list_for_each_entry_safe(itr, tmp, &dcb_app_list, list) { |
|---|
| 2073 | + if (itr->ifindex == dev->ifindex) { |
|---|
| 2074 | + list_del(&itr->list); |
|---|
| 2075 | + kfree(itr); |
|---|
| 2076 | + } |
|---|
| 2077 | + } |
|---|
| 2078 | + |
|---|
| 2079 | + spin_unlock_bh(&dcb_lock); |
|---|
| 2080 | +} |
|---|
| 2081 | + |
|---|
| 2082 | +static int dcbnl_netdevice_event(struct notifier_block *nb, |
|---|
| 2083 | + unsigned long event, void *ptr) |
|---|
| 2084 | +{ |
|---|
| 2085 | + struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
|---|
| 2086 | + |
|---|
| 2087 | + switch (event) { |
|---|
| 2088 | + case NETDEV_UNREGISTER: |
|---|
| 2089 | + if (!dev->dcbnl_ops) |
|---|
| 2090 | + return NOTIFY_DONE; |
|---|
| 2091 | + |
|---|
| 2092 | + dcbnl_flush_dev(dev); |
|---|
| 2093 | + |
|---|
| 2094 | + return NOTIFY_OK; |
|---|
| 2095 | + default: |
|---|
| 2096 | + return NOTIFY_DONE; |
|---|
| 2097 | + } |
|---|
| 2098 | +} |
|---|
| 2099 | + |
|---|
| 2100 | +static struct notifier_block dcbnl_nb __read_mostly = { |
|---|
| 2101 | + .notifier_call = dcbnl_netdevice_event, |
|---|
| 2102 | +}; |
|---|
| 2103 | + |
|---|
| 2057 | 2104 | static int __init dcbnl_init(void) |
|---|
| 2058 | 2105 | { |
|---|
| 2106 | + int err; |
|---|
| 2107 | + |
|---|
| 2059 | 2108 | INIT_LIST_HEAD(&dcb_app_list); |
|---|
| 2060 | 2109 | |
|---|
| 2110 | + err = register_netdevice_notifier(&dcbnl_nb); |
|---|
| 2111 | + if (err) |
|---|
| 2112 | + return err; |
|---|
| 2113 | + |
|---|
| 2061 | 2114 | rtnl_register(PF_UNSPEC, RTM_GETDCB, dcb_doit, NULL, 0); |
|---|
| 2062 | 2115 | rtnl_register(PF_UNSPEC, RTM_SETDCB, dcb_doit, NULL, 0); |
|---|
| 2063 | 2116 | |
|---|