[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150922162557.GC2255@nanopsycho.orion>
Date: Tue, 22 Sep 2015 18:25:57 +0200
From: Jiri Pirko <jiri@...lanox.com>
To: Scott Feldman <sfeldma@...il.com>
CC: Jiri Pirko <jiri@...nulli.us>, Netdev <netdev@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Ido Schimmel <idosch@...lanox.com>, <eladr@...lanox.com>,
Florian Fainelli <f.fainelli@...il.com>,
Guenter Roeck <linux@...ck-us.net>,
Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
"Rosen, Rami" <rami.rosen@...el.com>,
Roopa Prabhu <roopa@...ulusnetworks.com>,
Premkumar Jonnala <pjonnala@...adcom.com>,
"andrew@...n.ch" <andrew@...n.ch>,
Andy Gospodarek <gospo@...ulusnetworks.com>
Subject: Re: [patch net-next 02/10] switchdev: introduce transaction item
queue for attr_set and obj_add
Tue, Sep 22, 2015 at 06:10:24PM CEST, sfeldma@...il.com wrote:
>On Tue, Sep 22, 2015 at 6:53 AM, Jiri Pirko <jiri@...nulli.us> wrote:
>> From: Jiri Pirko <jiri@...lanox.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 <jiri@...lanox.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 <jiri@...nulli.us>
>> + * Copyright (c) 2014-2015 Jiri Pirko <jiri@...nulli.us>
>> * Copyright (c) 2014-2015 Scott Feldman <sfeldma@...il.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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists