Lines Matching refs:dev
54 typedef void switchdev_deferred_func_t(struct net_device *dev,
59 struct net_device *dev; member
95 dfitem->func(dfitem->dev, dfitem->data); in switchdev_deferred_process()
96 netdev_put(dfitem->dev, &dfitem->dev_tracker); in switchdev_deferred_process()
111 static int switchdev_deferred_enqueue(struct net_device *dev, in switchdev_deferred_enqueue() argument
120 dfitem->dev = dev; in switchdev_deferred_enqueue()
123 netdev_hold(dev, &dfitem->dev_tracker, GFP_ATOMIC); in switchdev_deferred_enqueue()
132 struct net_device *dev, in switchdev_port_attr_notify() argument
144 rc = call_switchdev_blocking_notifiers(nt, dev, in switchdev_port_attr_notify()
158 static int switchdev_port_attr_set_now(struct net_device *dev, in switchdev_port_attr_set_now() argument
162 return switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_SET, dev, attr, in switchdev_port_attr_set_now()
166 static void switchdev_port_attr_set_deferred(struct net_device *dev, in switchdev_port_attr_set_deferred() argument
172 err = switchdev_port_attr_set_now(dev, attr, NULL); in switchdev_port_attr_set_deferred()
174 netdev_err(dev, "failed (err=%d) to set attribute (id=%d)\n", in switchdev_port_attr_set_deferred()
177 attr->complete(dev, err, attr->complete_priv); in switchdev_port_attr_set_deferred()
180 static int switchdev_port_attr_set_defer(struct net_device *dev, in switchdev_port_attr_set_defer() argument
183 return switchdev_deferred_enqueue(dev, attr, sizeof(*attr), in switchdev_port_attr_set_defer()
197 int switchdev_port_attr_set(struct net_device *dev, in switchdev_port_attr_set() argument
202 return switchdev_port_attr_set_defer(dev, attr); in switchdev_port_attr_set()
204 return switchdev_port_attr_set_now(dev, attr, extack); in switchdev_port_attr_set()
224 struct net_device *dev, in switchdev_port_obj_notify() argument
236 rc = call_switchdev_blocking_notifiers(nt, dev, &obj_info.info, extack); in switchdev_port_obj_notify()
247 static void switchdev_port_obj_add_deferred(struct net_device *dev, in switchdev_port_obj_add_deferred() argument
255 dev, obj, NULL); in switchdev_port_obj_add_deferred()
257 netdev_err(dev, "failed (err=%d) to add object (id=%d)\n", in switchdev_port_obj_add_deferred()
260 obj->complete(dev, err, obj->complete_priv); in switchdev_port_obj_add_deferred()
263 static int switchdev_port_obj_add_defer(struct net_device *dev, in switchdev_port_obj_add_defer() argument
266 return switchdev_deferred_enqueue(dev, obj, switchdev_obj_size(obj), in switchdev_port_obj_add_defer()
280 int switchdev_port_obj_add(struct net_device *dev, in switchdev_port_obj_add() argument
285 return switchdev_port_obj_add_defer(dev, obj); in switchdev_port_obj_add()
288 dev, obj, extack); in switchdev_port_obj_add()
292 static int switchdev_port_obj_del_now(struct net_device *dev, in switchdev_port_obj_del_now() argument
296 dev, obj, NULL); in switchdev_port_obj_del_now()
299 static void switchdev_port_obj_del_deferred(struct net_device *dev, in switchdev_port_obj_del_deferred() argument
305 err = switchdev_port_obj_del_now(dev, obj); in switchdev_port_obj_del_deferred()
307 netdev_err(dev, "failed (err=%d) to del object (id=%d)\n", in switchdev_port_obj_del_deferred()
310 obj->complete(dev, err, obj->complete_priv); in switchdev_port_obj_del_deferred()
313 static int switchdev_port_obj_del_defer(struct net_device *dev, in switchdev_port_obj_del_defer() argument
316 return switchdev_deferred_enqueue(dev, obj, switchdev_obj_size(obj), in switchdev_port_obj_del_defer()
329 int switchdev_port_obj_del(struct net_device *dev, in switchdev_port_obj_del() argument
333 return switchdev_port_obj_del_defer(dev, obj); in switchdev_port_obj_del()
335 return switchdev_port_obj_del_now(dev, obj); in switchdev_port_obj_del()
351 bool switchdev_port_obj_act_is_deferred(struct net_device *dev, in switchdev_port_obj_act_is_deferred() argument
363 if (dfitem->dev != dev) in switchdev_port_obj_act_is_deferred()
418 int call_switchdev_notifiers(unsigned long val, struct net_device *dev, in call_switchdev_notifiers() argument
422 info->dev = dev; in call_switchdev_notifiers()
444 int call_switchdev_blocking_notifiers(unsigned long val, struct net_device *dev, in call_switchdev_blocking_notifiers() argument
448 info->dev = dev; in call_switchdev_blocking_notifiers()
456 bool (*check_cb)(const struct net_device *dev);
457 bool (*foreign_dev_check_cb)(const struct net_device *dev,
459 const struct net_device *dev; member
467 bool (*foreign_dev_check_cb)(const struct net_device *dev, in switchdev_lower_dev_walk()
469 bool (*check_cb)(const struct net_device *dev); in switchdev_lower_dev_walk()
470 const struct net_device *dev; in switchdev_lower_dev_walk() local
474 dev = switchdev_priv->dev; in switchdev_lower_dev_walk()
476 if (check_cb(lower_dev) && !foreign_dev_check_cb(lower_dev, dev)) { in switchdev_lower_dev_walk()
485 switchdev_lower_dev_find_rcu(struct net_device *dev, in switchdev_lower_dev_find_rcu() argument
486 bool (*check_cb)(const struct net_device *dev), in switchdev_lower_dev_find_rcu() argument
487 bool (*foreign_dev_check_cb)(const struct net_device *dev, in switchdev_lower_dev_find_rcu() argument
493 .dev = dev, in switchdev_lower_dev_find_rcu()
500 netdev_walk_all_lower_dev_rcu(dev, switchdev_lower_dev_walk, &priv); in switchdev_lower_dev_find_rcu()
506 switchdev_lower_dev_find(struct net_device *dev, in switchdev_lower_dev_find() argument
507 bool (*check_cb)(const struct net_device *dev), in switchdev_lower_dev_find() argument
508 bool (*foreign_dev_check_cb)(const struct net_device *dev, in switchdev_lower_dev_find() argument
514 .dev = dev, in switchdev_lower_dev_find()
521 netdev_walk_all_lower_dev(dev, switchdev_lower_dev_walk, &priv); in switchdev_lower_dev_find()
526 static int __switchdev_handle_fdb_event_to_device(struct net_device *dev, in __switchdev_handle_fdb_event_to_device() argument
529 bool (*check_cb)(const struct net_device *dev), in __switchdev_handle_fdb_event_to_device() argument
530 bool (*foreign_dev_check_cb)(const struct net_device *dev, in __switchdev_handle_fdb_event_to_device() argument
532 int (*mod_cb)(struct net_device *dev, struct net_device *orig_dev, in __switchdev_handle_fdb_event_to_device() argument
541 if (check_cb(dev)) in __switchdev_handle_fdb_event_to_device()
542 return mod_cb(dev, orig_dev, event, info->ctx, fdb_info); in __switchdev_handle_fdb_event_to_device()
547 netdev_for_each_lower_dev(dev, lower_dev, iter) { in __switchdev_handle_fdb_event_to_device()
571 br = netdev_master_upper_dev_get_rcu(dev); in __switchdev_handle_fdb_event_to_device()
579 if (!foreign_dev_check_cb(switchdev, dev)) in __switchdev_handle_fdb_event_to_device()
587 int switchdev_handle_fdb_event_to_device(struct net_device *dev, unsigned long event, in switchdev_handle_fdb_event_to_device() argument
589 bool (*check_cb)(const struct net_device *dev), in switchdev_handle_fdb_event_to_device() argument
590 bool (*foreign_dev_check_cb)(const struct net_device *dev, in switchdev_handle_fdb_event_to_device() argument
592 int (*mod_cb)(struct net_device *dev, struct net_device *orig_dev, in switchdev_handle_fdb_event_to_device() argument
598 err = __switchdev_handle_fdb_event_to_device(dev, dev, event, fdb_info, in switchdev_handle_fdb_event_to_device()
608 static int __switchdev_handle_port_obj_add(struct net_device *dev, in __switchdev_handle_port_obj_add() argument
610 bool (*check_cb)(const struct net_device *dev), in __switchdev_handle_port_obj_add() argument
611 bool (*foreign_dev_check_cb)(const struct net_device *dev, in __switchdev_handle_port_obj_add() argument
613 int (*add_cb)(struct net_device *dev, const void *ctx, in __switchdev_handle_port_obj_add() argument
625 if (check_cb(dev)) { in __switchdev_handle_port_obj_add()
626 err = add_cb(dev, info->ctx, port_obj_info->obj, extack); in __switchdev_handle_port_obj_add()
639 netdev_for_each_lower_dev(dev, lower_dev, iter) { in __switchdev_handle_port_obj_add()
664 br = netdev_master_upper_dev_get(dev); in __switchdev_handle_port_obj_add()
672 if (!foreign_dev_check_cb(switchdev, dev)) in __switchdev_handle_port_obj_add()
683 int switchdev_handle_port_obj_add(struct net_device *dev, in switchdev_handle_port_obj_add() argument
685 bool (*check_cb)(const struct net_device *dev), in switchdev_handle_port_obj_add() argument
686 int (*add_cb)(struct net_device *dev, const void *ctx, in switchdev_handle_port_obj_add() argument
692 err = __switchdev_handle_port_obj_add(dev, port_obj_info, check_cb, in switchdev_handle_port_obj_add()
704 int switchdev_handle_port_obj_add_foreign(struct net_device *dev, in switchdev_handle_port_obj_add_foreign() argument
706 bool (*check_cb)(const struct net_device *dev), in switchdev_handle_port_obj_add_foreign() argument
707 bool (*foreign_dev_check_cb)(const struct net_device *dev, in switchdev_handle_port_obj_add_foreign() argument
709 int (*add_cb)(struct net_device *dev, const void *ctx, in switchdev_handle_port_obj_add_foreign() argument
715 err = __switchdev_handle_port_obj_add(dev, port_obj_info, check_cb, in switchdev_handle_port_obj_add_foreign()
723 static int __switchdev_handle_port_obj_del(struct net_device *dev, in __switchdev_handle_port_obj_del() argument
725 bool (*check_cb)(const struct net_device *dev), in __switchdev_handle_port_obj_del() argument
726 bool (*foreign_dev_check_cb)(const struct net_device *dev, in __switchdev_handle_port_obj_del() argument
728 int (*del_cb)(struct net_device *dev, const void *ctx, in __switchdev_handle_port_obj_del() argument
736 if (check_cb(dev)) { in __switchdev_handle_port_obj_del()
737 err = del_cb(dev, info->ctx, port_obj_info->obj); in __switchdev_handle_port_obj_del()
750 netdev_for_each_lower_dev(dev, lower_dev, iter) { in __switchdev_handle_port_obj_del()
775 br = netdev_master_upper_dev_get(dev); in __switchdev_handle_port_obj_del()
783 if (!foreign_dev_check_cb(switchdev, dev)) in __switchdev_handle_port_obj_del()
794 int switchdev_handle_port_obj_del(struct net_device *dev, in switchdev_handle_port_obj_del() argument
796 bool (*check_cb)(const struct net_device *dev), in switchdev_handle_port_obj_del() argument
797 int (*del_cb)(struct net_device *dev, const void *ctx, in switchdev_handle_port_obj_del() argument
802 err = __switchdev_handle_port_obj_del(dev, port_obj_info, check_cb, in switchdev_handle_port_obj_del()
814 int switchdev_handle_port_obj_del_foreign(struct net_device *dev, in switchdev_handle_port_obj_del_foreign() argument
816 bool (*check_cb)(const struct net_device *dev), in switchdev_handle_port_obj_del_foreign() argument
817 bool (*foreign_dev_check_cb)(const struct net_device *dev, in switchdev_handle_port_obj_del_foreign() argument
819 int (*del_cb)(struct net_device *dev, const void *ctx, in switchdev_handle_port_obj_del_foreign() argument
824 err = __switchdev_handle_port_obj_del(dev, port_obj_info, check_cb, in switchdev_handle_port_obj_del_foreign()
832 static int __switchdev_handle_port_attr_set(struct net_device *dev, in __switchdev_handle_port_attr_set() argument
834 bool (*check_cb)(const struct net_device *dev), in __switchdev_handle_port_attr_set() argument
835 int (*set_cb)(struct net_device *dev, const void *ctx, in __switchdev_handle_port_attr_set() argument
847 if (check_cb(dev)) { in __switchdev_handle_port_attr_set()
848 err = set_cb(dev, info->ctx, port_attr_info->attr, extack); in __switchdev_handle_port_attr_set()
861 netdev_for_each_lower_dev(dev, lower_dev, iter) { in __switchdev_handle_port_attr_set()
874 int switchdev_handle_port_attr_set(struct net_device *dev, in switchdev_handle_port_attr_set() argument
876 bool (*check_cb)(const struct net_device *dev), in switchdev_handle_port_attr_set() argument
877 int (*set_cb)(struct net_device *dev, const void *ctx, in switchdev_handle_port_attr_set() argument
883 err = __switchdev_handle_port_attr_set(dev, port_attr_info, check_cb, in switchdev_handle_port_attr_set()
892 struct net_device *dev, const void *ctx, in switchdev_bridge_port_offload() argument
900 .dev = dev, in switchdev_bridge_port_offload()
940 struct net_device *dev, const void *ctx, in switchdev_bridge_port_replay() argument
947 .dev = dev, in switchdev_bridge_port_replay()