Tue, Sep 22, 2015 at 06:10:24PM CEST, sfel...@gmail.com wrote: >On Tue, Sep 22, 2015 at 6:53 AM, Jiri Pirko <j...@resnulli.us> wrote: >> From: Jiri Pirko <j...@mellanox.com> >> >> Now, the memory allocation in prepare/commit state is done separatelly >> in each driver (rocker). Introduce the similar mechanism in generic >> switchdev code, in form of queue. That can be used not only for memory >> allocations, but also for different items. Commit/abort item destruction >> is handled as well. >> >> Signed-off-by: Jiri Pirko <j...@mellanox.com> > >> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c >> index df5a544..55a8411 100644 >> --- a/net/switchdev/switchdev.c >> +++ b/net/switchdev/switchdev.c >> @@ -1,6 +1,6 @@ >> /* >> * net/switchdev/switchdev.c - Switch device API >> - * Copyright (c) 2014 Jiri Pirko <j...@resnulli.us> >> + * Copyright (c) 2014-2015 Jiri Pirko <j...@resnulli.us> >> * Copyright (c) 2014-2015 Scott Feldman <sfel...@gmail.com> >> * >> * This program is free software; you can redistribute it and/or modify >> @@ -16,9 +16,56 @@ >> #include <linux/notifier.h> >> #include <linux/netdevice.h> >> #include <linux/if_bridge.h> >> +#include <linux/list.h> >> #include <net/ip_fib.h> >> #include <net/switchdev.h> >> >> +void switchdev_trans_item_enqueue(struct switchdev_trans *trans, >> + void *data, void (*destructor)(void const >> *), >> + struct switchdev_trans_item *tritem) >> +{ >> + tritem->data = data; >> + tritem->destructor = destructor; >> + list_add_tail(&tritem->list, &trans->item_list); >> +} >> +EXPORT_SYMBOL_GPL(switchdev_trans_item_enqueue); >> + >> +static struct switchdev_trans_item * >> +__switchdev_trans_item_dequeue(struct switchdev_trans *trans) >> +{ >> + struct switchdev_trans_item *tritem; >> + >> + if (list_empty(&trans->item_list)) >> + return NULL; >> + tritem = list_first_entry(&trans->item_list, >> + struct switchdev_trans_item, list); >> + list_del(&tritem->list); >> + return tritem; >> +} >> + >> +void *switchdev_trans_item_dequeue(struct switchdev_trans *trans) >> +{ >> + struct switchdev_trans_item *tritem; >> + >> + tritem = __switchdev_trans_item_dequeue(trans); >> + BUG_ON(!tritem); >> + return tritem->data; >> +} >> +EXPORT_SYMBOL_GPL(switchdev_trans_item_dequeue); > >Please add header comment block for these EXPORT_SYMBOL_GPL funcs.
Right, will do. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html