* [PATCH] Move eth_mac_addr and eth_change_mtu
@ 2003-07-11 18:19 Matthew Wilcox
2003-07-11 18:23 ` Jeff Garzik
0 siblings, 1 reply; 7+ messages in thread
From: Matthew Wilcox @ 2003-07-11 18:19 UTC (permalink / raw)
To: netdev
Move eth_mac_addr() and eth_change_mtu() from drivers/net/net_init.c
to net/ethernet/eth.c
Index: drivers/net/net_init.c
===================================================================
RCS file: /var/cvs/linux-2.5/drivers/net/net_init.c,v
retrieving revision 1.4
diff -u -p -r1.4 net_init.c
--- drivers/net/net_init.c 14 Jun 2003 22:15:21 -0000 1.4
+++ drivers/net/net_init.c 10 Jul 2003 20:57:55 -0000
@@ -222,23 +222,6 @@ struct net_device *alloc_etherdev(int si
EXPORT_SYMBOL(init_etherdev);
EXPORT_SYMBOL(alloc_etherdev);
-static int eth_mac_addr(struct net_device *dev, void *p)
-{
- struct sockaddr *addr=p;
- if (netif_running(dev))
- return -EBUSY;
- memcpy(dev->dev_addr, addr->sa_data,dev->addr_len);
- return 0;
-}
-
-static int eth_change_mtu(struct net_device *dev, int new_mtu)
-{
- if ((new_mtu < 68) || (new_mtu > 1500))
- return -EINVAL;
- dev->mtu = new_mtu;
- return 0;
-}
-
#ifdef CONFIG_FDDI
/**
Index: include/linux/etherdevice.h
===================================================================
RCS file: /var/cvs/linux-2.5/include/linux/etherdevice.h,v
retrieving revision 1.3
diff -u -p -r1.3 etherdevice.h
--- include/linux/etherdevice.h 14 Jun 2003 22:16:01 -0000 1.3
+++ include/linux/etherdevice.h 10 Jul 2003 21:00:23 -0000
@@ -38,6 +38,8 @@ extern int eth_header_cache(struct neig
struct hh_cache *hh);
extern int eth_header_parse(struct sk_buff *skb,
unsigned char *haddr);
+extern int eth_mac_addr(struct net_device *dev, void *p);
+extern int eth_change_mtu(struct net_device *dev, int new_mtu);
extern struct net_device *init_etherdev(struct net_device *dev, int sizeof_priv);
extern struct net_device *alloc_etherdev(int sizeof_priv);
static inline void eth_copy_and_sum (struct sk_buff *dest, unsigned char *src, int len, int base)
Index: net/ethernet/eth.c
===================================================================
RCS file: /var/cvs/linux-2.5/net/ethernet/eth.c,v
retrieving revision 1.4
diff -u -p -r1.4 eth.c
--- net/ethernet/eth.c 23 Jun 2003 03:30:58 -0000 1.4
+++ net/ethernet/eth.c 10 Jul 2003 20:58:54 -0000
@@ -241,3 +241,20 @@ void eth_header_cache_update(struct hh_c
memcpy(((u8*)hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)),
haddr, dev->addr_len);
}
+
+int eth_mac_addr(struct net_device *dev, void *p)
+{
+ struct sockaddr *addr=p;
+ if (netif_running(dev))
+ return -EBUSY;
+ memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+ return 0;
+}
+
+int eth_change_mtu(struct net_device *dev, int new_mtu)
+{
+ if ((new_mtu < 68) || (new_mtu > 1500))
+ return -EINVAL;
+ dev->mtu = new_mtu;
+ return 0;
+}
--
"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Move eth_mac_addr and eth_change_mtu
2003-07-11 18:19 [PATCH] Move eth_mac_addr and eth_change_mtu Matthew Wilcox
@ 2003-07-11 18:23 ` Jeff Garzik
2003-07-11 18:25 ` Matthew Wilcox
0 siblings, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2003-07-11 18:23 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: netdev
On Fri, Jul 11, 2003 at 07:19:46PM +0100, Matthew Wilcox wrote:
> Move eth_mac_addr() and eth_change_mtu() from drivers/net/net_init.c
> to net/ethernet/eth.c
Why? It's not used outside of net_init.c AFAICS.
And even so, don't you want to export those symbols?
Jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Move eth_mac_addr and eth_change_mtu
2003-07-11 18:23 ` Jeff Garzik
@ 2003-07-11 18:25 ` Matthew Wilcox
2003-07-11 20:57 ` Jeff Garzik
0 siblings, 1 reply; 7+ messages in thread
From: Matthew Wilcox @ 2003-07-11 18:25 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Matthew Wilcox, netdev
On Fri, Jul 11, 2003 at 02:23:30PM -0400, Jeff Garzik wrote:
> On Fri, Jul 11, 2003 at 07:19:46PM +0100, Matthew Wilcox wrote:
> > Move eth_mac_addr() and eth_change_mtu() from drivers/net/net_init.c
> > to net/ethernet/eth.c
>
> Why? It's not used outside of net_init.c AFAICS.
Preparation for the next stage of netdev_ops
> And even so, don't you want to export those symbols?
Yep, you're right, I'll need to do that too.
--
"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Move eth_mac_addr and eth_change_mtu
2003-07-11 18:25 ` Matthew Wilcox
@ 2003-07-11 20:57 ` Jeff Garzik
2003-07-11 21:05 ` Matthew Wilcox
0 siblings, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2003-07-11 20:57 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: netdev
Matthew Wilcox wrote:
> On Fri, Jul 11, 2003 at 02:23:30PM -0400, Jeff Garzik wrote:
>
>>On Fri, Jul 11, 2003 at 07:19:46PM +0100, Matthew Wilcox wrote:
>>
>>>Move eth_mac_addr() and eth_change_mtu() from drivers/net/net_init.c
>>>to net/ethernet/eth.c
>>
>>Why? It's not used outside of net_init.c AFAICS.
>
>
> Preparation for the next stage of netdev_ops
Well, I don't see/understand this next-stage, so elaboration would be
nice. As-is, I do not support merging this patch.
Jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Move eth_mac_addr and eth_change_mtu
2003-07-11 20:57 ` Jeff Garzik
@ 2003-07-11 21:05 ` Matthew Wilcox
2003-07-11 21:17 ` Jeff Garzik
0 siblings, 1 reply; 7+ messages in thread
From: Matthew Wilcox @ 2003-07-11 21:05 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Matthew Wilcox, netdev
On Fri, Jul 11, 2003 at 04:57:21PM -0400, Jeff Garzik wrote:
> Well, I don't see/understand this next-stage, so elaboration would be
> nice. As-is, I do not support merging this patch.
It's the next stage you're calling for -- move these functions:
dev->change_mtu = eth_change_mtu;
dev->hard_header = eth_header;
dev->rebuild_header = eth_rebuild_header;
dev->set_mac_address = eth_mac_addr;
dev->hard_header_cache = eth_header_cache;
dev->header_cache_update= eth_header_cache_update;
dev->hard_header_parse = eth_header_parse;
into netdev_ops. Which means each driver will need to see them.
I thought I could justify moving these functions already on the grounds
that if you were looking for the definition of eth_change_mtu(),
net_init.c would be a much less likely place to look than
net/ethernet/eth.c
--
"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Move eth_mac_addr and eth_change_mtu
2003-07-11 21:05 ` Matthew Wilcox
@ 2003-07-11 21:17 ` Jeff Garzik
2003-07-11 21:56 ` Matthew Wilcox
0 siblings, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2003-07-11 21:17 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: netdev
Matthew Wilcox wrote:
> On Fri, Jul 11, 2003 at 04:57:21PM -0400, Jeff Garzik wrote:
>
>>Well, I don't see/understand this next-stage, so elaboration would be
>>nice. As-is, I do not support merging this patch.
>
>
> It's the next stage you're calling for -- move these functions:
>
> dev->change_mtu = eth_change_mtu;
> dev->hard_header = eth_header;
> dev->rebuild_header = eth_rebuild_header;
> dev->set_mac_address = eth_mac_addr;
> dev->hard_header_cache = eth_header_cache;
> dev->header_cache_update= eth_header_cache_update;
> dev->hard_header_parse = eth_header_parse;
>
> into netdev_ops. Which means each driver will need to see them.
Drivers don't need to see them now, they shouldn't need to see them
after netdev_ops.
It's hidden by ether_setup.
> I thought I could justify moving these functions already on the grounds
> that if you were looking for the definition of eth_change_mtu(),
> net_init.c would be a much less likely place to look than
> net/ethernet/eth.c
If you're gonna do that, move all of ether_setup, alloc_etherdev, etc.
Don't just move two out of ~10 functions.
Jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Move eth_mac_addr and eth_change_mtu
2003-07-11 21:17 ` Jeff Garzik
@ 2003-07-11 21:56 ` Matthew Wilcox
0 siblings, 0 replies; 7+ messages in thread
From: Matthew Wilcox @ 2003-07-11 21:56 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Matthew Wilcox, netdev
On Fri, Jul 11, 2003 at 05:17:03PM -0400, Jeff Garzik wrote:
> Matthew Wilcox wrote:
> >On Fri, Jul 11, 2003 at 04:57:21PM -0400, Jeff Garzik wrote:
> >
> >>Well, I don't see/understand this next-stage, so elaboration would be
> >>nice. As-is, I do not support merging this patch.
> >
> >
> >It's the next stage you're calling for -- move these functions:
> >
> > dev->change_mtu = eth_change_mtu;
> > dev->hard_header = eth_header;
> > dev->rebuild_header = eth_rebuild_header;
> > dev->set_mac_address = eth_mac_addr;
> > dev->hard_header_cache = eth_header_cache;
> > dev->header_cache_update= eth_header_cache_update;
> > dev->hard_header_parse = eth_header_parse;
> >
> >into netdev_ops. Which means each driver will need to see them.
>
> Drivers don't need to see them now, they shouldn't need to see them
> after netdev_ops.
>
> It's hidden by ether_setup.
Umm. Technically, yes. Seems a bit ugly to assign to the netdev_ops
struct which is shared between the devices. Won't _break_ anything
(unless some crazed person has a driver which drives the ethernet and
token ring versions of the same chip ;-)
--
"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-07-11 21:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-11 18:19 [PATCH] Move eth_mac_addr and eth_change_mtu Matthew Wilcox
2003-07-11 18:23 ` Jeff Garzik
2003-07-11 18:25 ` Matthew Wilcox
2003-07-11 20:57 ` Jeff Garzik
2003-07-11 21:05 ` Matthew Wilcox
2003-07-11 21:17 ` Jeff Garzik
2003-07-11 21:56 ` Matthew Wilcox
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).