Re: [PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-18 Thread Patrick McHardy
David Miller wrote:
> From: Patrick McHardy <[EMAIL PROTECTED]>
> Date: Wed, 18 Jul 2007 12:01:38 +0200
> 
> 
>>rae l wrote:
>>
>>>All in one word, I don't think the single file dev_mcast.c is needed
>>>anymore.
>>
>>Agreed. But dev.c is growing larger and larger, maybe dev_addr.c?
>>Or dev_config.c, with some of the other device configuration functions?
> 
> 
> I don't know, a sizable dev.c is inevitable, allows better refactoring
> and consolidation.  And the be honest you're going to have to likely
> touch things in dev.c whenever you make changes to dev_addr.c or
> whatever you want to name it. :-)


You're probably right. Killing dev_mcast.c makes sense to me though.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-18 Thread David Miller
From: Patrick McHardy <[EMAIL PROTECTED]>
Date: Wed, 18 Jul 2007 12:01:38 +0200

> rae l wrote:
> > All in one word, I don't think the single file dev_mcast.c is needed
> > anymore.
> 
> Agreed. But dev.c is growing larger and larger, maybe dev_addr.c?
> Or dev_config.c, with some of the other device configuration functions?

I don't know, a sizable dev.c is inevitable, allows better refactoring
and consolidation.  And the be honest you're going to have to likely
touch things in dev.c whenever you make changes to dev_addr.c or
whatever you want to name it. :-)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-18 Thread David Miller
From: "rae l" <[EMAIL PROTECTED]>
Date: Wed, 18 Jul 2007 17:59:52 +0800

> And then the dev_mcast.c is now only 256 lines long(versus dev.c 4052 lines),
> just left a few multicast related functions definition and "dev_mcast"
> procfs code,
> I have an idea to merge all code dev_mcast.c into dev.c, that would:
> 
> - remove two functions (__dev_addr_delete, __dev_set_rx_mode) from 
> netdevice.h,
>   and then tag them static,
>   those two are also defined in dev.c and only called from dev_mcast.c,
> 
> - reducing one file would benefit the compilation process.
> 
> All in one word, I don't think the single file dev_mcast.c is needed anymore.

Agreed.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-18 Thread Patrick McHardy
rae l wrote:
> All in one word, I don't think the single file dev_mcast.c is needed
> anymore.


Agreed. But dev.c is growing larger and larger, maybe dev_addr.c?
Or dev_config.c, with some of the other device configuration functions?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-18 Thread rae l

On 7/18/07, David Miller <[EMAIL PROTECTED]> wrote:

From: Denis Cheng <[EMAIL PROTECTED]>
Date: Wed, 18 Jul 2007 10:41:03 +0800

> Because this function is only called by unregister_netdevice,
> this moving could make this non-global function static,
> and also remove its declaration in netdevice.h;
>
> Any further, function __dev_addr_discard is also just called by
> dev_mc_discard and dev_unicast_discard, keeping this two functions
> both in one c file could make __dev_addr_discard also static
> and remove its declaration in netdevice.h;
>
> Futhermore, the sequential call to dev_unicast_discard and then
> dev_mc_discard in unregister_netdevice have a similar mechanism that:
> (netif_tx_lock_bh / __dev_addr_discard / netif_tx_unlock_bh),
> they should merged into one to eliminate duplicates in acquiring and
> releasing the dev->_xmit_lock, this would be done in my following patch.
>
> Signed-off-by: Denis Cheng <[EMAIL PROTECTED]>

Patch applied, thanks.

Thanks for applying, too.

And then the dev_mcast.c is now only 256 lines long(versus dev.c 4052 lines),
just left a few multicast related functions definition and "dev_mcast"
procfs code,
I have an idea to merge all code dev_mcast.c into dev.c, that would:

- remove two functions (__dev_addr_delete, __dev_set_rx_mode) from netdevice.h,
 and then tag them static,
 those two are also defined in dev.c and only called from dev_mcast.c,

- reducing one file would benefit the compilation process.

All in one word, I don't think the single file dev_mcast.c is needed anymore.






--
Denis Cheng
Linux Application Developer

"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-18 Thread David Miller
From: Denis Cheng <[EMAIL PROTECTED]>
Date: Wed, 18 Jul 2007 10:41:03 +0800

> Because this function is only called by unregister_netdevice,
> this moving could make this non-global function static,
> and also remove its declaration in netdevice.h;
> 
> Any further, function __dev_addr_discard is also just called by
> dev_mc_discard and dev_unicast_discard, keeping this two functions
> both in one c file could make __dev_addr_discard also static
> and remove its declaration in netdevice.h;
> 
> Futhermore, the sequential call to dev_unicast_discard and then
> dev_mc_discard in unregister_netdevice have a similar mechanism that:
> (netif_tx_lock_bh / __dev_addr_discard / netif_tx_unlock_bh),
> they should merged into one to eliminate duplicates in acquiring and
> releasing the dev->_xmit_lock, this would be done in my following patch.
> 
> Signed-off-by: Denis Cheng <[EMAIL PROTECTED]>

Patch applied, thanks.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-18 Thread David Miller
From: Denis Cheng [EMAIL PROTECTED]
Date: Wed, 18 Jul 2007 10:41:03 +0800

 Because this function is only called by unregister_netdevice,
 this moving could make this non-global function static,
 and also remove its declaration in netdevice.h;
 
 Any further, function __dev_addr_discard is also just called by
 dev_mc_discard and dev_unicast_discard, keeping this two functions
 both in one c file could make __dev_addr_discard also static
 and remove its declaration in netdevice.h;
 
 Futhermore, the sequential call to dev_unicast_discard and then
 dev_mc_discard in unregister_netdevice have a similar mechanism that:
 (netif_tx_lock_bh / __dev_addr_discard / netif_tx_unlock_bh),
 they should merged into one to eliminate duplicates in acquiring and
 releasing the dev-_xmit_lock, this would be done in my following patch.
 
 Signed-off-by: Denis Cheng [EMAIL PROTECTED]

Patch applied, thanks.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-18 Thread rae l

On 7/18/07, David Miller [EMAIL PROTECTED] wrote:

From: Denis Cheng [EMAIL PROTECTED]
Date: Wed, 18 Jul 2007 10:41:03 +0800

 Because this function is only called by unregister_netdevice,
 this moving could make this non-global function static,
 and also remove its declaration in netdevice.h;

 Any further, function __dev_addr_discard is also just called by
 dev_mc_discard and dev_unicast_discard, keeping this two functions
 both in one c file could make __dev_addr_discard also static
 and remove its declaration in netdevice.h;

 Futhermore, the sequential call to dev_unicast_discard and then
 dev_mc_discard in unregister_netdevice have a similar mechanism that:
 (netif_tx_lock_bh / __dev_addr_discard / netif_tx_unlock_bh),
 they should merged into one to eliminate duplicates in acquiring and
 releasing the dev-_xmit_lock, this would be done in my following patch.

 Signed-off-by: Denis Cheng [EMAIL PROTECTED]

Patch applied, thanks.

Thanks for applying, too.

And then the dev_mcast.c is now only 256 lines long(versus dev.c 4052 lines),
just left a few multicast related functions definition and dev_mcast
procfs code,
I have an idea to merge all code dev_mcast.c into dev.c, that would:

- remove two functions (__dev_addr_delete, __dev_set_rx_mode) from netdevice.h,
 and then tag them static,
 those two are also defined in dev.c and only called from dev_mcast.c,

- reducing one file would benefit the compilation process.

All in one word, I don't think the single file dev_mcast.c is needed anymore.






--
Denis Cheng
Linux Application Developer

One of my most productive days was throwing away 1000 lines of code.
- Ken Thompson.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-18 Thread Patrick McHardy
rae l wrote:
 All in one word, I don't think the single file dev_mcast.c is needed
 anymore.


Agreed. But dev.c is growing larger and larger, maybe dev_addr.c?
Or dev_config.c, with some of the other device configuration functions?
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-18 Thread David Miller
From: rae l [EMAIL PROTECTED]
Date: Wed, 18 Jul 2007 17:59:52 +0800

 And then the dev_mcast.c is now only 256 lines long(versus dev.c 4052 lines),
 just left a few multicast related functions definition and dev_mcast
 procfs code,
 I have an idea to merge all code dev_mcast.c into dev.c, that would:
 
 - remove two functions (__dev_addr_delete, __dev_set_rx_mode) from 
 netdevice.h,
   and then tag them static,
   those two are also defined in dev.c and only called from dev_mcast.c,
 
 - reducing one file would benefit the compilation process.
 
 All in one word, I don't think the single file dev_mcast.c is needed anymore.

Agreed.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-18 Thread David Miller
From: Patrick McHardy [EMAIL PROTECTED]
Date: Wed, 18 Jul 2007 12:01:38 +0200

 rae l wrote:
  All in one word, I don't think the single file dev_mcast.c is needed
  anymore.
 
 Agreed. But dev.c is growing larger and larger, maybe dev_addr.c?
 Or dev_config.c, with some of the other device configuration functions?

I don't know, a sizable dev.c is inevitable, allows better refactoring
and consolidation.  And the be honest you're going to have to likely
touch things in dev.c whenever you make changes to dev_addr.c or
whatever you want to name it. :-)

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-18 Thread Patrick McHardy
David Miller wrote:
 From: Patrick McHardy [EMAIL PROTECTED]
 Date: Wed, 18 Jul 2007 12:01:38 +0200
 
 
rae l wrote:

All in one word, I don't think the single file dev_mcast.c is needed
anymore.

Agreed. But dev.c is growing larger and larger, maybe dev_addr.c?
Or dev_config.c, with some of the other device configuration functions?
 
 
 I don't know, a sizable dev.c is inevitable, allows better refactoring
 and consolidation.  And the be honest you're going to have to likely
 touch things in dev.c whenever you make changes to dev_addr.c or
 whatever you want to name it. :-)


You're probably right. Killing dev_mcast.c makes sense to me though.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-17 Thread Denis Cheng
Because this function is only called by unregister_netdevice,
this moving could make this non-global function static,
and also remove its declaration in netdevice.h;

Any further, function __dev_addr_discard is also just called by
dev_mc_discard and dev_unicast_discard, keeping this two functions
both in one c file could make __dev_addr_discard also static
and remove its declaration in netdevice.h;

Futhermore, the sequential call to dev_unicast_discard and then
dev_mc_discard in unregister_netdevice have a similar mechanism that:
(netif_tx_lock_bh / __dev_addr_discard / netif_tx_unlock_bh),
they should merged into one to eliminate duplicates in acquiring and
releasing the dev->_xmit_lock, this would be done in my following patch.

Signed-off-by: Denis Cheng <[EMAIL PROTECTED]>
---
 include/linux/netdevice.h |2 --
 net/core/dev.c|   14 +-
 net/core/dev_mcast.c  |   12 
 3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index da7a13c..9820ca1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1098,10 +1098,8 @@ extern int   dev_mc_delete(struct net_device 
*dev, void *addr, int alen, int all
 extern int dev_mc_add(struct net_device *dev, void *addr, int 
alen, int newonly);
 extern int dev_mc_sync(struct net_device *to, struct net_device 
*from);
 extern voiddev_mc_unsync(struct net_device *to, struct net_device 
*from);
-extern voiddev_mc_discard(struct net_device *dev);
 extern int __dev_addr_delete(struct dev_addr_list **list, int 
*count, void *addr, int alen, int all);
 extern int __dev_addr_add(struct dev_addr_list **list, int *count, 
void *addr, int alen, int newonly);
-extern void__dev_addr_discard(struct dev_addr_list **list);
 extern voiddev_set_promiscuity(struct net_device *dev, int inc);
 extern voiddev_set_allmulti(struct net_device *dev, int inc);
 extern voidnetdev_state_change(struct net_device *dev);
diff --git a/net/core/dev.c b/net/core/dev.c
index 13a0d9f..3ba63aa 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2715,7 +2715,7 @@ int __dev_addr_add(struct dev_addr_list **list, int 
*count,
return 0;
 }
 
-void __dev_addr_discard(struct dev_addr_list **list)
+static void __dev_addr_discard(struct dev_addr_list **list)
 {
struct dev_addr_list *tmp;
 
@@ -2785,6 +2785,18 @@ static void dev_unicast_discard(struct net_device *dev)
netif_tx_unlock_bh(dev);
 }
 
+/*
+ * Discard multicast list when a device is downed
+ */
+
+static void dev_mc_discard(struct net_device *dev)
+{
+   netif_tx_lock_bh(dev);
+   __dev_addr_discard(>mc_list);
+   dev->mc_count = 0;
+   netif_tx_unlock_bh(dev);
+}
+
 unsigned dev_get_flags(const struct net_device *dev)
 {
unsigned flags;
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index 235a2a8..99aece1 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -177,18 +177,6 @@ void dev_mc_unsync(struct net_device *to, struct 
net_device *from)
 }
 EXPORT_SYMBOL(dev_mc_unsync);
 
-/*
- * Discard multicast list when a device is downed
- */
-
-void dev_mc_discard(struct net_device *dev)
-{
-   netif_tx_lock_bh(dev);
-   __dev_addr_discard(>mc_list);
-   dev->mc_count = 0;
-   netif_tx_unlock_bh(dev);
-}
-
 #ifdef CONFIG_PROC_FS
 static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos)
 {
-- 
1.5.2.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] [net/core] move dev_mc_discard from dev_mcast.c to dev.c

2007-07-17 Thread Denis Cheng
Because this function is only called by unregister_netdevice,
this moving could make this non-global function static,
and also remove its declaration in netdevice.h;

Any further, function __dev_addr_discard is also just called by
dev_mc_discard and dev_unicast_discard, keeping this two functions
both in one c file could make __dev_addr_discard also static
and remove its declaration in netdevice.h;

Futhermore, the sequential call to dev_unicast_discard and then
dev_mc_discard in unregister_netdevice have a similar mechanism that:
(netif_tx_lock_bh / __dev_addr_discard / netif_tx_unlock_bh),
they should merged into one to eliminate duplicates in acquiring and
releasing the dev-_xmit_lock, this would be done in my following patch.

Signed-off-by: Denis Cheng [EMAIL PROTECTED]
---
 include/linux/netdevice.h |2 --
 net/core/dev.c|   14 +-
 net/core/dev_mcast.c  |   12 
 3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index da7a13c..9820ca1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1098,10 +1098,8 @@ extern int   dev_mc_delete(struct net_device 
*dev, void *addr, int alen, int all
 extern int dev_mc_add(struct net_device *dev, void *addr, int 
alen, int newonly);
 extern int dev_mc_sync(struct net_device *to, struct net_device 
*from);
 extern voiddev_mc_unsync(struct net_device *to, struct net_device 
*from);
-extern voiddev_mc_discard(struct net_device *dev);
 extern int __dev_addr_delete(struct dev_addr_list **list, int 
*count, void *addr, int alen, int all);
 extern int __dev_addr_add(struct dev_addr_list **list, int *count, 
void *addr, int alen, int newonly);
-extern void__dev_addr_discard(struct dev_addr_list **list);
 extern voiddev_set_promiscuity(struct net_device *dev, int inc);
 extern voiddev_set_allmulti(struct net_device *dev, int inc);
 extern voidnetdev_state_change(struct net_device *dev);
diff --git a/net/core/dev.c b/net/core/dev.c
index 13a0d9f..3ba63aa 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2715,7 +2715,7 @@ int __dev_addr_add(struct dev_addr_list **list, int 
*count,
return 0;
 }
 
-void __dev_addr_discard(struct dev_addr_list **list)
+static void __dev_addr_discard(struct dev_addr_list **list)
 {
struct dev_addr_list *tmp;
 
@@ -2785,6 +2785,18 @@ static void dev_unicast_discard(struct net_device *dev)
netif_tx_unlock_bh(dev);
 }
 
+/*
+ * Discard multicast list when a device is downed
+ */
+
+static void dev_mc_discard(struct net_device *dev)
+{
+   netif_tx_lock_bh(dev);
+   __dev_addr_discard(dev-mc_list);
+   dev-mc_count = 0;
+   netif_tx_unlock_bh(dev);
+}
+
 unsigned dev_get_flags(const struct net_device *dev)
 {
unsigned flags;
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index 235a2a8..99aece1 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -177,18 +177,6 @@ void dev_mc_unsync(struct net_device *to, struct 
net_device *from)
 }
 EXPORT_SYMBOL(dev_mc_unsync);
 
-/*
- * Discard multicast list when a device is downed
- */
-
-void dev_mc_discard(struct net_device *dev)
-{
-   netif_tx_lock_bh(dev);
-   __dev_addr_discard(dev-mc_list);
-   dev-mc_count = 0;
-   netif_tx_unlock_bh(dev);
-}
-
 #ifdef CONFIG_PROC_FS
 static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos)
 {
-- 
1.5.2.2

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/