* [patch net 0/2] team: fix port list dump for big number of ports
@ 2013-05-29 15:02 Jiri Pirko
2013-05-29 15:02 ` [patch net 1/2] list: introduce list_first_entry_or_null Jiri Pirko
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jiri Pirko @ 2013-05-29 15:02 UTC (permalink / raw)
To: netdev; +Cc: davem, eric.dumazet, paulmck, sasha.levin, akpm
Jiri Pirko (2):
list: introduce list_first_entry_or_null
team: fix port list dump for big number of ports
drivers/net/team/team.c | 7 ++++---
include/linux/list.h | 11 +++++++++++
2 files changed, 15 insertions(+), 3 deletions(-)
--
1.7.11.7
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch net 1/2] list: introduce list_first_entry_or_null
2013-05-29 15:02 [patch net 0/2] team: fix port list dump for big number of ports Jiri Pirko
@ 2013-05-29 15:02 ` Jiri Pirko
2013-05-29 15:02 ` [patch net 2/2] team: fix port list dump for big number of ports Jiri Pirko
2013-06-01 0:32 ` [patch net 0/2] " David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Jiri Pirko @ 2013-05-29 15:02 UTC (permalink / raw)
To: netdev; +Cc: davem, eric.dumazet, paulmck, sasha.levin, akpm
non-rcu variant of list_first_or_null_rcu
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
include/linux/list.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/list.h b/include/linux/list.h
index 6a1f8df..b83e565 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -362,6 +362,17 @@ static inline void list_splice_tail_init(struct list_head *list,
list_entry((ptr)->next, type, member)
/**
+ * list_first_entry_or_null - get the first element from a list
+ * @ptr: the list head to take the element from.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Note that if the list is empty, it returns NULL.
+ */
+#define list_first_entry_or_null(ptr, type, member) \
+ (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
+
+/**
* list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [patch net 2/2] team: fix port list dump for big number of ports
2013-05-29 15:02 [patch net 0/2] team: fix port list dump for big number of ports Jiri Pirko
2013-05-29 15:02 ` [patch net 1/2] list: introduce list_first_entry_or_null Jiri Pirko
@ 2013-05-29 15:02 ` Jiri Pirko
2013-06-01 0:32 ` [patch net 0/2] " David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Jiri Pirko @ 2013-05-29 15:02 UTC (permalink / raw)
To: netdev; +Cc: davem, eric.dumazet, paulmck, sasha.levin, akpm
In case the port list dump does not fit into one skb currently the
dump would start over again. Fix this by continue from the last dumped
port.
Introduced by commit d90f889e9c (team: handle sending port list in the
same way option list is sent)
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
drivers/net/team/team.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 7c43261..d016a76 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -2374,7 +2374,8 @@ static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq,
bool incomplete;
int i;
- port = list_first_entry(&team->port_list, struct team_port, list);
+ port = list_first_entry_or_null(&team->port_list,
+ struct team_port, list);
start_again:
err = __send_and_alloc_skb(&skb, team, portid, send_func);
@@ -2402,8 +2403,8 @@ start_again:
err = team_nl_fill_one_port_get(skb, one_port);
if (err)
goto errout;
- } else {
- list_for_each_entry(port, &team->port_list, list) {
+ } else if (port) {
+ list_for_each_entry_from(port, &team->port_list, list) {
err = team_nl_fill_one_port_get(skb, port);
if (err) {
if (err == -EMSGSIZE) {
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch net 0/2] team: fix port list dump for big number of ports
2013-05-29 15:02 [patch net 0/2] team: fix port list dump for big number of ports Jiri Pirko
2013-05-29 15:02 ` [patch net 1/2] list: introduce list_first_entry_or_null Jiri Pirko
2013-05-29 15:02 ` [patch net 2/2] team: fix port list dump for big number of ports Jiri Pirko
@ 2013-06-01 0:32 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-06-01 0:32 UTC (permalink / raw)
To: jiri; +Cc: netdev, eric.dumazet, paulmck, sasha.levin, akpm
From: Jiri Pirko <jiri@resnulli.us>
Date: Wed, 29 May 2013 17:02:55 +0200
> Jiri Pirko (2):
> list: introduce list_first_entry_or_null
> team: fix port list dump for big number of ports
Both applied, thanks Jiri.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-01 0:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-29 15:02 [patch net 0/2] team: fix port list dump for big number of ports Jiri Pirko
2013-05-29 15:02 ` [patch net 1/2] list: introduce list_first_entry_or_null Jiri Pirko
2013-05-29 15:02 ` [patch net 2/2] team: fix port list dump for big number of ports Jiri Pirko
2013-06-01 0:32 ` [patch net 0/2] " David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).