Thread (76 messages) 76 messages, 8 authors, 2019-09-13

Re: [patch net-next rfc 2/7] net: introduce name_node struct to be used in hashlist

From: Jiri Pirko <jiri@resnulli.us>
Date: 2019-07-20 07:15:42

Fri, Jul 19, 2019 at 10:26:49PM CEST, stephen@networkplumber.org wrote:
On Fri, 19 Jul 2019 21:17:40 +0200
Jiri Pirko [off-list ref] wrote:
quoted
Fri, Jul 19, 2019 at 06:29:36PM CEST, stephen@networkplumber.org wrote:
quoted
On Fri, 19 Jul 2019 13:00:24 +0200
Jiri Pirko [off-list ref] wrote:
 
quoted
From: Jiri Pirko <redacted>

Signed-off-by: Jiri Pirko <redacted>
---
 include/linux/netdevice.h | 10 +++-
 net/core/dev.c            | 96 +++++++++++++++++++++++++++++++--------
 2 files changed, 86 insertions(+), 20 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 88292953aa6f..74f99f127b0e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -918,6 +918,12 @@ struct dev_ifalias {
 struct devlink;
 struct tlsdev_ops;
 
+struct netdev_name_node {
+	struct hlist_node hlist;
+	struct net_device *dev;
+	char *name  
You probably can make this const char *  
Don't bother, it looks ok as is. the problem is you would have
to cast it when calling free.
quoted
quoted
Do you want to add __rcu to this list?  
Which list?
      struct netdev_name_node __rcu *name_node;

You might also want to explictly init the hlist node rather
than relying on the fact that zero is an empty node ptr.
Okay. Will process this in. Thanks!


static struct netdev_name_node *netdev_name_node_alloc(struct net_device *dev,
-                                                      char *name)
+                                                      const char *name)
{
       struct netdev_name_node *name_node;

-       name_node = kzalloc(sizeof(*name_node), GFP_KERNEL);
+       name_node = kmalloc(sizeof(*name_node));
       if (!name_node)
               return NULL;
+
+       INIT_HLIST_NODE(&name_node->hlist);
       name_node->dev = dev;
       name_node->name = name;
       return name_node;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help