switchdev.c (479c86dc551c9720765ed19433990eae6a1f899f) | switchdev.c (6921351359395a6c6ac72cd275a8393f399cecc7) |
---|---|
1/* 2 * net/switchdev/switchdev.c - Switch device API 3 * Copyright (c) 2014-2015 Jiri Pirko <jiri@resnulli.us> 4 * Copyright (c) 2014-2015 Scott Feldman <sfeldma@gmail.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 602 unchanged lines hidden (view full) --- 611} 612EXPORT_SYMBOL_GPL(switchdev_port_same_parent_id); 613 614static int __switchdev_handle_port_obj_add(struct net_device *dev, 615 struct switchdev_notifier_port_obj_info *port_obj_info, 616 bool (*check_cb)(const struct net_device *dev), 617 int (*add_cb)(struct net_device *dev, 618 const struct switchdev_obj *obj, | 1/* 2 * net/switchdev/switchdev.c - Switch device API 3 * Copyright (c) 2014-2015 Jiri Pirko <jiri@resnulli.us> 4 * Copyright (c) 2014-2015 Scott Feldman <sfeldma@gmail.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 602 unchanged lines hidden (view full) --- 611} 612EXPORT_SYMBOL_GPL(switchdev_port_same_parent_id); 613 614static int __switchdev_handle_port_obj_add(struct net_device *dev, 615 struct switchdev_notifier_port_obj_info *port_obj_info, 616 bool (*check_cb)(const struct net_device *dev), 617 int (*add_cb)(struct net_device *dev, 618 const struct switchdev_obj *obj, |
619 struct switchdev_trans *trans)) | 619 struct switchdev_trans *trans, 620 struct netlink_ext_ack *extack)) |
620{ | 621{ |
622 struct netlink_ext_ack *extack; |
|
621 struct net_device *lower_dev; 622 struct list_head *iter; 623 int err = -EOPNOTSUPP; 624 | 623 struct net_device *lower_dev; 624 struct list_head *iter; 625 int err = -EOPNOTSUPP; 626 |
627 extack = switchdev_notifier_info_to_extack(&port_obj_info->info); 628 |
|
625 if (check_cb(dev)) { 626 /* This flag is only checked if the return value is success. */ 627 port_obj_info->handled = true; | 629 if (check_cb(dev)) { 630 /* This flag is only checked if the return value is success. */ 631 port_obj_info->handled = true; |
628 return add_cb(dev, port_obj_info->obj, port_obj_info->trans); | 632 return add_cb(dev, port_obj_info->obj, port_obj_info->trans, 633 extack); |
629 } 630 631 /* Switch ports might be stacked under e.g. a LAG. Ignore the 632 * unsupported devices, another driver might be able to handle them. But 633 * propagate to the callers any hard errors. 634 * 635 * If the driver does its own bookkeeping of stacked ports, it's not 636 * necessary to go through this helper. --- 8 unchanged lines hidden (view full) --- 645 return err; 646} 647 648int switchdev_handle_port_obj_add(struct net_device *dev, 649 struct switchdev_notifier_port_obj_info *port_obj_info, 650 bool (*check_cb)(const struct net_device *dev), 651 int (*add_cb)(struct net_device *dev, 652 const struct switchdev_obj *obj, | 634 } 635 636 /* Switch ports might be stacked under e.g. a LAG. Ignore the 637 * unsupported devices, another driver might be able to handle them. But 638 * propagate to the callers any hard errors. 639 * 640 * If the driver does its own bookkeeping of stacked ports, it's not 641 * necessary to go through this helper. --- 8 unchanged lines hidden (view full) --- 650 return err; 651} 652 653int switchdev_handle_port_obj_add(struct net_device *dev, 654 struct switchdev_notifier_port_obj_info *port_obj_info, 655 bool (*check_cb)(const struct net_device *dev), 656 int (*add_cb)(struct net_device *dev, 657 const struct switchdev_obj *obj, |
653 struct switchdev_trans *trans)) | 658 struct switchdev_trans *trans, 659 struct netlink_ext_ack *extack)) |
654{ 655 int err; 656 657 err = __switchdev_handle_port_obj_add(dev, port_obj_info, check_cb, 658 add_cb); 659 if (err == -EOPNOTSUPP) 660 err = 0; 661 return err; --- 51 unchanged lines hidden --- | 660{ 661 int err; 662 663 err = __switchdev_handle_port_obj_add(dev, port_obj_info, check_cb, 664 add_cb); 665 if (err == -EOPNOTSUPP) 666 err = 0; 667 return err; --- 51 unchanged lines hidden --- |