netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]: sunvnet netdev ops conversion...
@ 2009-03-20  7:52 David Miller
  2009-03-20  8:30 ` Yang Hongyang
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2009-03-20  7:52 UTC (permalink / raw)
  To: netdev


Committed to net-next-2.6...

sunvnet: Convert to net_device_ops.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/sunvnet.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/net/sunvnet.c b/drivers/net/sunvnet.c
index 611230f..a82fb2a 100644
--- a/drivers/net/sunvnet.c
+++ b/drivers/net/sunvnet.c
@@ -1012,6 +1012,16 @@ err_out:
 static LIST_HEAD(vnet_list);
 static DEFINE_MUTEX(vnet_list_mutex);
 
+static const struct net_device_ops vnet_ops = {
+	.ndo_open		= vnet_open,
+	.ndo_stop		= vnet_close,
+	.ndo_set_multicast_list	= vnet_set_rx_mode,
+	.ndo_set_mac_address	= vnet_set_mac_addr,
+	.ndo_tx_timeout		= vnet_tx_timeout,
+	.ndo_change_mtu		= vnet_change_mtu,
+	.ndo_start_xmit		= vnet_start_xmit,
+};
+
 static struct vnet * __devinit vnet_new(const u64 *local_mac)
 {
 	struct net_device *dev;
@@ -1040,15 +1050,9 @@ static struct vnet * __devinit vnet_new(const u64 *local_mac)
 	INIT_LIST_HEAD(&vp->list);
 	vp->local_mac = *local_mac;
 
-	dev->open = vnet_open;
-	dev->stop = vnet_close;
-	dev->set_multicast_list = vnet_set_rx_mode;
-	dev->set_mac_address = vnet_set_mac_addr;
-	dev->tx_timeout = vnet_tx_timeout;
+	dev->netdev_ops = &vnet_ops;
 	dev->ethtool_ops = &vnet_ethtool_ops;
 	dev->watchdog_timeo = VNET_TX_TIMEOUT;
-	dev->change_mtu = vnet_change_mtu;
-	dev->hard_start_xmit = vnet_start_xmit;
 
 	err = register_netdev(dev);
 	if (err) {
-- 
1.6.2.1.222.g570cc


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH]: sunvnet netdev ops conversion...
  2009-03-20  7:52 [PATCH]: sunvnet netdev ops conversion David Miller
@ 2009-03-20  8:30 ` Yang Hongyang
  2009-03-20  8:34   ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Yang Hongyang @ 2009-03-20  8:30 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

David Miller wrote:
> Committed to net-next-2.6...
> 
> sunvnet: Convert to net_device_ops.

I noticed that there are other drivers's  net_device_ops 
need to be converted,is these convert nessary?

> 
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
>  drivers/net/sunvnet.c |   18 +++++++++++-------
>  1 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/sunvnet.c b/drivers/net/sunvnet.c
> index 611230f..a82fb2a 100644
> --- a/drivers/net/sunvnet.c
> +++ b/drivers/net/sunvnet.c
> @@ -1012,6 +1012,16 @@ err_out:
>  static LIST_HEAD(vnet_list);
>  static DEFINE_MUTEX(vnet_list_mutex);
>  
> +static const struct net_device_ops vnet_ops = {
> +	.ndo_open		= vnet_open,
> +	.ndo_stop		= vnet_close,
> +	.ndo_set_multicast_list	= vnet_set_rx_mode,
> +	.ndo_set_mac_address	= vnet_set_mac_addr,
> +	.ndo_tx_timeout		= vnet_tx_timeout,
> +	.ndo_change_mtu		= vnet_change_mtu,
> +	.ndo_start_xmit		= vnet_start_xmit,
> +};
> +
>  static struct vnet * __devinit vnet_new(const u64 *local_mac)
>  {
>  	struct net_device *dev;
> @@ -1040,15 +1050,9 @@ static struct vnet * __devinit vnet_new(const u64 *local_mac)
>  	INIT_LIST_HEAD(&vp->list);
>  	vp->local_mac = *local_mac;
>  
> -	dev->open = vnet_open;
> -	dev->stop = vnet_close;
> -	dev->set_multicast_list = vnet_set_rx_mode;
> -	dev->set_mac_address = vnet_set_mac_addr;
> -	dev->tx_timeout = vnet_tx_timeout;
> +	dev->netdev_ops = &vnet_ops;
>  	dev->ethtool_ops = &vnet_ethtool_ops;
>  	dev->watchdog_timeo = VNET_TX_TIMEOUT;
> -	dev->change_mtu = vnet_change_mtu;
> -	dev->hard_start_xmit = vnet_start_xmit;
>  
>  	err = register_netdev(dev);
>  	if (err) {


-- 
Regards
Yang Hongyang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]: sunvnet netdev ops conversion...
  2009-03-20  8:30 ` Yang Hongyang
@ 2009-03-20  8:34   ` David Miller
  2009-03-20 11:43     ` Bjørn Mork
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2009-03-20  8:34 UTC (permalink / raw)
  To: yanghy; +Cc: netdev

From: Yang Hongyang <yanghy@cn.fujitsu.com>
Date: Fri, 20 Mar 2009 16:30:59 +0800

> David Miller wrote:
> > Committed to net-next-2.6...
> > 
> > sunvnet: Convert to net_device_ops.
> 
> I noticed that there are other drivers's  net_device_ops 
> need to be converted,is these convert nessary?

Not necessary, but desirable.  Once all drivers are
converted we can remove the compatability code.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]: sunvnet netdev ops conversion...
  2009-03-20  8:34   ` David Miller
@ 2009-03-20 11:43     ` Bjørn Mork
  2009-03-20 14:19       ` Jiri Pirko
  0 siblings, 1 reply; 7+ messages in thread
From: Bjørn Mork @ 2009-03-20 11:43 UTC (permalink / raw)
  To: netdev

David Miller <davem@davemloft.net> writes:
> From: Yang Hongyang <yanghy@cn.fujitsu.com>
> Date: Fri, 20 Mar 2009 16:30:59 +0800
>
>> David Miller wrote:
>> > Committed to net-next-2.6...
>> > 
>> > sunvnet: Convert to net_device_ops.
>> 
>> I noticed that there are other drivers's  net_device_ops 
>> need to be converted,is these convert nessary?
>
> Not necessary, but desirable.  Once all drivers are
> converted we can remove the compatability code.

Just thinking... Would it make sense, at some point before removing the
compatibility layer, to add tests for partial conversions?  I noticed
the sungem bug just fixed by Stephen Hemminger 
( http://permalink.gmane.org/gmane.linux.network/122756 )
which could have been caught by the patch below.

This will also ease the transition of "driver sets", like usbnet and
it's children, where a number of drivers need to make the conversion
together.  Don't know if that's a big problem, but it did stop my first
attempt to convert usbnet because I was uncertain whether I had caught
all of the necessary mini driver conversions.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
---

 net/core/dev.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index f112970..ad3e780 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4359,6 +4359,34 @@ int register_netdevice(struct net_device *dev)
 	 * This is temporary until all network devices are converted.
 	 */
 	if (dev->netdev_ops) {
+		/* drivers using netdev_ops should not set any of these */
+		if (dev->init ||
+		    dev->uninit ||
+		    dev->open ||
+		    dev->change_rx_flags ||
+		    dev->set_rx_mode ||
+		    dev->set_multicast_list ||
+		    dev->set_mac_address ||
+		    dev->validate_addr ||
+		    dev->do_ioctl ||
+		    dev->set_config ||
+		    dev->change_mtu ||
+		    dev->neigh_setup ||
+		    dev->tx_timeout ||
+		    dev->get_stats ||
+		    dev->vlan_rx_register ||
+		    dev->vlan_rx_add_vid ||
+		    dev->vlan_rx_kill_vid
+#ifdef CONFIG_NET_POLL_CONTROLLER
+		    || dev->poll_controller
+#endif
+			) {
+			char drivername[64];
+
+			pr_info("%s (%s): mixing netdev_ops and old API\n",
+				dev->name, netdev_drivername(dev, drivername, 
+							     64));
+		}
 		netdev_resync_ops(dev);
 	} else {
 		char drivername[64];


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH]: sunvnet netdev ops conversion...
  2009-03-20 11:43     ` Bjørn Mork
@ 2009-03-20 14:19       ` Jiri Pirko
  2009-03-20 16:16         ` Stephen Hemminger
  0 siblings, 1 reply; 7+ messages in thread
From: Jiri Pirko @ 2009-03-20 14:19 UTC (permalink / raw)
  To: Bjørn Mork; +Cc: netdev, davem

Fri, Mar 20, 2009 at 12:43:00PM CET, bjorn@mork.no wrote:
>David Miller <davem@davemloft.net> writes:
>> From: Yang Hongyang <yanghy@cn.fujitsu.com>
>> Date: Fri, 20 Mar 2009 16:30:59 +0800
>>
>>> David Miller wrote:
>>> > Committed to net-next-2.6...
>>> > 
>>> > sunvnet: Convert to net_device_ops.
>>> 
>>> I noticed that there are other drivers's  net_device_ops 
>>> need to be converted,is these convert nessary?
>>
>> Not necessary, but desirable.  Once all drivers are
>> converted we can remove the compatability code.
>
>Just thinking... Would it make sense, at some point before removing the
>compatibility layer, to add tests for partial conversions?  I noticed
>the sungem bug just fixed by Stephen Hemminger 
>( http://permalink.gmane.org/gmane.linux.network/122756 )
>which could have been caught by the patch below.
>
>This will also ease the transition of "driver sets", like usbnet and
>it's children, where a number of drivers need to make the conversion
>together.  Don't know if that's a big problem, but it did stop my first
>attempt to convert usbnet because I was uncertain whether I had caught
>all of the necessary mini driver conversions.
>
>Signed-off-by: Bjørn Mork <bjorn@mork.no>
>---
>
> net/core/dev.c |   28 ++++++++++++++++++++++++++++
> 1 files changed, 28 insertions(+), 0 deletions(-)
>
>diff --git a/net/core/dev.c b/net/core/dev.c
>index f112970..ad3e780 100644
>--- a/net/core/dev.c
>+++ b/net/core/dev.c
>@@ -4359,6 +4359,34 @@ int register_netdevice(struct net_device *dev)
> 	 * This is temporary until all network devices are converted.
> 	 */
> 	if (dev->netdev_ops) {
>+		/* drivers using netdev_ops should not set any of these */
>+		if (dev->init ||
>+		    dev->uninit ||
>+		    dev->open ||
>+		    dev->change_rx_flags ||
>+		    dev->set_rx_mode ||
>+		    dev->set_multicast_list ||
>+		    dev->set_mac_address ||
>+		    dev->validate_addr ||
>+		    dev->do_ioctl ||
>+		    dev->set_config ||
>+		    dev->change_mtu ||
>+		    dev->neigh_setup ||
>+		    dev->tx_timeout ||
>+		    dev->get_stats ||
>+		    dev->vlan_rx_register ||
>+		    dev->vlan_rx_add_vid ||
>+		    dev->vlan_rx_kill_vid
>+#ifdef CONFIG_NET_POLL_CONTROLLER
>+		    || dev->poll_controller
>+#endif
>+			) {
>+			char drivername[64];
>+
>+			pr_info("%s (%s): mixing netdev_ops and old API\n",
>+				dev->name, netdev_drivername(dev, drivername, 
>+							     64));
>+		}
> 		netdev_resync_ops(dev);
> 	} else {
> 		char drivername[64];
>
cc'ing Dave.

This seems like a good idea. It would make it more visible. Besides, it's
temporary so why not?

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]: sunvnet netdev ops conversion...
  2009-03-20 14:19       ` Jiri Pirko
@ 2009-03-20 16:16         ` Stephen Hemminger
  2009-03-20 22:54           ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2009-03-20 16:16 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: Bjørn Mork, netdev, davem

On Fri, 20 Mar 2009 15:19:50 +0100
Jiri Pirko <jpirko@redhat.com> wrote:

> Fri, Mar 20, 2009 at 12:43:00PM CET, bjorn@mork.no wrote:
> >David Miller <davem@davemloft.net> writes:
> >> From: Yang Hongyang <yanghy@cn.fujitsu.com>
> >> Date: Fri, 20 Mar 2009 16:30:59 +0800
> >>
> >>> David Miller wrote:
> >>> > Committed to net-next-2.6...
> >>> > 
> >>> > sunvnet: Convert to net_device_ops.
> >>> 
> >>> I noticed that there are other drivers's  net_device_ops 
> >>> need to be converted,is these convert nessary?
> >>
> >> Not necessary, but desirable.  Once all drivers are
> >> converted we can remove the compatability code.
> >
> >Just thinking... Would it make sense, at some point before removing the
> >compatibility layer, to add tests for partial conversions?  I noticed
> >the sungem bug just fixed by Stephen Hemminger 
> >( http://permalink.gmane.org/gmane.linux.network/122756 )
> >which could have been caught by the patch below.
> >
> >This will also ease the transition of "driver sets", like usbnet and
> >it's children, where a number of drivers need to make the conversion
> >together.  Don't know if that's a big problem, but it did stop my first
> >attempt to convert usbnet because I was uncertain whether I had caught
> >all of the necessary mini driver conversions.
> >
> >Signed-off-by: Bjørn Mork <bjorn@mork.no>
> >---

I intend to get all drivers in x86 allmodconfig converted, then
change expose the COMPAT_NETDEV_OPS as a config option (which is how
I test). Need to wait until after in tree drivers all converted
because kernel developers expect random configurations to build.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH]: sunvnet netdev ops conversion...
  2009-03-20 16:16         ` Stephen Hemminger
@ 2009-03-20 22:54           ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2009-03-20 22:54 UTC (permalink / raw)
  To: shemminger; +Cc: jpirko, bjorn, netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Fri, 20 Mar 2009 09:16:18 -0700

> I intend to get all drivers in x86 allmodconfig converted, then
> change expose the COMPAT_NETDEV_OPS as a config option (which is how
> I test).

If it were not for the randconfig maniacs I would say that I think you
should expose it somehow now.

Turning it off is how I personally do conversions in fact.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-03-20 22:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-20  7:52 [PATCH]: sunvnet netdev ops conversion David Miller
2009-03-20  8:30 ` Yang Hongyang
2009-03-20  8:34   ` David Miller
2009-03-20 11:43     ` Bjørn Mork
2009-03-20 14:19       ` Jiri Pirko
2009-03-20 16:16         ` Stephen Hemminger
2009-03-20 22:54           ` 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).