Skip to contentSkip to conversation

netcore: minor cleanup for register_netdevice

PATCH In review FNST-Wang Chen 3 participants 4 messages Sep 6, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netcore: minor cleanup for register_netdevice

- minor logic cleanup

net/core/dev.c 2007-09-06 13:27:35.000000000 +0800 renamed from net/core/dev.c 2007-08-22 15:33:40.000000000 +0800 +1 -4
diff -Nurp linux-2.6.22.4.org/net/core/dev.c  linux-2.6.22.4/net/core/dev.c
@@ -3075,8 +3075,6 @@ int register_netdevice(struct net_device
   dev->xmit_lock_owner = -1;
   spin_lock_init(&dev->ingress_lock);
 
-    dev->iflink = -1;
-
   /* Init, if this function is available */
   if (dev->init) {
       ret = dev->init(dev);
@@ -3093,8 +3091,7 @@ int register_netdevice(struct net_device
   }
 
   dev->ifindex = dev_new_index();
-    if (dev->iflink == -1)
-        dev->iflink = dev->ifindex;
+    dev->iflink = dev->ifindex;
 
   /* Check for existence of name */
   head = dev_name_hash(dev->name);
#1 lore raw

I disagree. Some of "dev->init()" functions set up dev->iflink; e.g., ipip_tunnel_init() etc.

In article <[email protected]> (at Thu, 06 Sep 2007 13:27:24 +0800), FNST-Wang Chen <[email protected]> says:

Quoted 36 lines

- minor logic cleanup

diff -Nurp linux-2.6.22.4.org/net/core/dev.c linux-2.6.22.4/net/core/dev.c
--- linux-2.6.22.4.org/net/core/dev.c 2007-08-22 15:33:40.000000000
+0800
+++ linux-2.6.22.4/net/core/dev.c 2007-09-06 13:27:35.000000000 +0800

net/core/dev.c 2007-09-06 13:27:35.000000000 +0800 renamed from net/core/dev.c 2007-08-22 15:33:40.000000000 +0800 +1 -5
@@ -3075,8 +3075,6 @@ int register_netdevice(struct net_device
    dev->xmit_lock_owner = -1;
    spin_lock_init(&dev->ingress_lock);
 
-    dev->iflink = -1;
-
    /* Init, if this function is available */
    if (dev->init) {
        ret = dev->init(dev);
@@ -3093,8 +3091,7 @@ int register_netdevice(struct net_device
    }
 
    dev->ifindex = dev_new_index();
-    if (dev->iflink == -1)
-        dev->iflink = dev->ifindex;
+    dev->iflink = dev->ifindex;
 
    /* Check for existence of name */
    head = dev_name_hash(dev->name);
 
 
 
 
 
-

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

oops
i am wrong

YOSHIFUJI Hideaki / 吉藤英明 said the following on 2007-9-6 13:34:

Quoted 47 lines

I disagree. Some of "dev->init()" functions set up dev->iflink; e.g., ipip_tunnel_init() etc.

In article <[email protected]> (at Thu, 06 Sep 2007 13:27:24 +0800), FNST-Wang Chen <[email protected]> says:

Quoted 37 lines

- minor logic cleanup

diff -Nurp linux-2.6.22.4.org/net/core/dev.c linux-2.6.22.4/net/core/dev.c
--- linux-2.6.22.4.org/net/core/dev.c 2007-08-22 15:33:40.000000000
+0800
+++ linux-2.6.22.4/net/core/dev.c 2007-09-06 13:27:35.000000000 +0800

net/core/dev.c 2007-09-06 13:27:35.000000000 +0800 renamed from net/core/dev.c 2007-08-22 15:33:40.000000000 +0800 +1 -5
@@ -3075,8 +3075,6 @@ int register_netdevice(struct net_device
    dev->xmit_lock_owner = -1;
    spin_lock_init(&dev->ingress_lock);
 
-    dev->iflink = -1;
-
    /* Init, if this function is available */
    if (dev->init) {
        ret = dev->init(dev);
@@ -3093,8 +3091,7 @@ int register_netdevice(struct net_device
    }
 
    dev->ifindex = dev_new_index();
-    if (dev->iflink == -1)
-        dev->iflink = dev->ifindex;
+    dev->iflink = dev->ifindex;
 
    /* Check for existence of name */
    head = dev_name_hash(dev->name);
 
 
 
 
 
-

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 14 lines
Best Regards,
A new email address of FJWAN is launched from Apr.1 2007.
The updated address is: [email protected]
--------------------------------------------------
Wang Chen
Development Dept.I
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
8/F., Civil Defense Building, No.189 Guangzhou Road,
Nanjing, 210029, China
TEL:+86+25-86630566-850
FUJITSU INTERNAL:79955-850
FAX:+86+25-83317685
MAIL:[email protected]
--------------------------------------------------
#3 lore raw
In reply to FNST-Wang Chen

Some init handlers set iflink, and hence it is required. See tunnel init routines (ipip_tunnel_init), macvlan_init(), etc

[email protected] wrote on 09/06/2007 10:57:24 AM:

Quoted 5 lines

- minor logic cleanup

diff -Nurp linux-2.6.22.4.org/net/core/dev.c linux-2.6.22.4

/net/core/dev.c

Quoted 31 lines

--- linux-2.6.22.4.org/net/core/dev.c 2007-08-22 15:33:40.000000000
+0800
+++ linux-2.6.22.4/net/core/dev.c 2007-09-06 13:27:35.000000000 +0800

net/core/dev.c 2007-09-06 13:27:35.000000000 +0800 renamed from net/core/dev.c 2007-08-22 15:33:40.000000000 +0800 +1 -5
@@ -3075,8 +3075,6 @@ int register_netdevice(struct net_device
    dev->xmit_lock_owner = -1;
    spin_lock_init(&dev->ingress_lock);
 
-    dev->iflink = -1;
-
    /* Init, if this function is available */
    if (dev->init) {
        ret = dev->init(dev);
@@ -3093,8 +3091,7 @@ int register_netdevice(struct net_device
    }
 
    dev->ifindex = dev_new_index();
-    if (dev->iflink == -1)
-        dev->iflink = dev->ifindex;
+    dev->iflink = dev->ifindex;
 
    /* Check for existence of name */
    head = dev_name_hash(dev->name);
 
 
 
 
 
-

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html