netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 3c59x: convert to net_device_ops
@ 2009-03-21 11:35 Jiri Pirko
  2009-03-21 11:51 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2009-03-21 11:35 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, klassert, Ingo Molnar, linux-kernel

Hi

I converted this driver to use net_device_ops. I made two structures, one for
vortex and one for boomerang start_xmit function. Tested on my test system with
3Com PCI 3c905C Tornado.

Jirka

Signed-off-by: Jiri Pirko <jpirko@redhat.com>

 drivers/net/3c59x.c |   50 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index cdbbb62..6c3d66b 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -992,6 +992,38 @@ out:
 	return rc;
 }
 
+static const struct net_device_ops vortex_netdev_ops = {
+	.ndo_open               = vortex_open,
+	.ndo_stop               = vortex_close,
+	.ndo_start_xmit         = vortex_start_xmit,
+	.ndo_set_multicast_list = set_rx_mode,
+	.ndo_validate_addr      = eth_validate_addr,
+#ifdef CONFIG_PCI
+	.ndo_do_ioctl		= vortex_ioctl,
+#endif
+	.ndo_tx_timeout         = vortex_tx_timeout,
+	.ndo_get_stats		= vortex_get_stats,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.ndo_poll_controller    = poll_vortex,
+#endif
+};
+
+static const struct net_device_ops boomerang_netdev_ops = {
+	.ndo_open               = vortex_open,
+	.ndo_stop               = vortex_close,
+	.ndo_start_xmit         = boomerang_start_xmit,
+	.ndo_set_multicast_list = set_rx_mode,
+	.ndo_validate_addr      = eth_validate_addr,
+#ifdef CONFIG_PCI
+	.ndo_do_ioctl		= vortex_ioctl,
+#endif
+	.ndo_tx_timeout         = vortex_tx_timeout,
+	.ndo_get_stats		= vortex_get_stats,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.ndo_poll_controller    = poll_vortex,
+#endif
+};
+
 /*
  * Start up the PCI/EISA device which is described by *gendev.
  * Return 0 on success.
@@ -1366,17 +1398,17 @@ static int __devinit vortex_probe1(struct device *gendev,
 	}
 
 	/* The 3c59x-specific entries in the device structure. */
-	dev->open = vortex_open;
 	if (vp->full_bus_master_tx) {
-		dev->hard_start_xmit = boomerang_start_xmit;
+		dev->netdev_ops = &boomerang_netdev_ops;
 		/* Actually, it still should work with iommu. */
 		if (card_idx < MAX_UNITS &&
 		    ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) ||
 				hw_checksums[card_idx] == 1)) {
 			dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
 		}
-	} else {
-		dev->hard_start_xmit = vortex_start_xmit;
+	}
+	else {
+		dev->netdev_ops = &vortex_netdev_ops;
 	}
 
 	if (print_info) {
@@ -1386,18 +1418,8 @@ static int __devinit vortex_probe1(struct device *gendev,
 				(dev->features & NETIF_F_IP_CSUM) ? "en":"dis");
 	}
 
-	dev->stop = vortex_close;
-	dev->get_stats = vortex_get_stats;
-#ifdef CONFIG_PCI
-	dev->do_ioctl = vortex_ioctl;
-#endif
 	dev->ethtool_ops = &vortex_ethtool_ops;
-	dev->set_multicast_list = set_rx_mode;
-	dev->tx_timeout = vortex_tx_timeout;
 	dev->watchdog_timeo = (watchdog * HZ) / 1000;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	dev->poll_controller = poll_vortex;
-#endif
 	if (pdev) {
 		vp->pm_state_valid = 1;
  		pci_save_state(VORTEX_PCI(vp));

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

* Re: [PATCH] 3c59x: convert to net_device_ops
  2009-03-21 11:35 [PATCH] 3c59x: convert to net_device_ops Jiri Pirko
@ 2009-03-21 11:51 ` Andrew Morton
  2009-03-21 16:26   ` Jiri Pirko
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2009-03-21 11:51 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, David Miller, klassert, Ingo Molnar, linux-kernel

On Sat, 21 Mar 2009 12:35:53 +0100 Jiri Pirko <jpirko@redhat.com> wrote:

> I converted this driver to use net_device_ops. I made two structures, one for
> vortex and one for boomerang start_xmit function. Tested on my test system with
> 3Com PCI 3c905C Tornado.

linux-next already contains

commit 48b47a5e306c1c119ee81ccd24d487c2df656410
Author:     Stephen Hemminger <shemminger@linux-foundation.org>
AuthorDate: Fri Jan 9 13:01:18 2009 +0000
Commit:     David S. Miller <davem@davemloft.net>
CommitDate: Wed Jan 21 14:02:25 2009 -0800

    3c59x: convert to net_device_ops
    
    Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index cdbbb62..b2563d3 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -992,6 +992,42 @@ out:
 	return rc;
 }
 
+static const struct net_device_ops boomrang_netdev_ops = {
+	.ndo_open		= vortex_open,
+	.ndo_stop		= vortex_close,
+	.ndo_start_xmit		= boomerang_start_xmit,
+	.ndo_tx_timeout		= vortex_tx_timeout,
+	.ndo_get_stats		= vortex_get_stats,
+#ifdef CONFIG_PCI
+	.ndo_do_ioctl 		= vortex_ioctl,
+#endif
+	.ndo_set_multicast_list = set_rx_mode,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.ndo_poll_controller	= poll_vortex,
+#endif
+};
+
+static const struct net_device_ops vortex_netdev_ops = {
+	.ndo_open		= vortex_open,
+	.ndo_stop		= vortex_close,
+	.ndo_start_xmit		= vortex_start_xmit,
+	.ndo_tx_timeout		= vortex_tx_timeout,
+	.ndo_get_stats		= vortex_get_stats,
+#ifdef CONFIG_PCI
+	.ndo_do_ioctl 		= vortex_ioctl,
+#endif
+	.ndo_set_multicast_list = set_rx_mode,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.ndo_poll_controller	= poll_vortex,
+#endif
+};
+
 /*
  * Start up the PCI/EISA device which is described by *gendev.
  * Return 0 on success.
@@ -1366,18 +1402,16 @@ static int __devinit vortex_probe1(struct device *gendev,
 	}
 
 	/* The 3c59x-specific entries in the device structure. */
-	dev->open = vortex_open;
 	if (vp->full_bus_master_tx) {
-		dev->hard_start_xmit = boomerang_start_xmit;
+		dev->netdev_ops = &boomrang_netdev_ops;
 		/* Actually, it still should work with iommu. */
 		if (card_idx < MAX_UNITS &&
 		    ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) ||
 				hw_checksums[card_idx] == 1)) {
 			dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
 		}
-	} else {
-		dev->hard_start_xmit = vortex_start_xmit;
-	}
+	} else
+		dev->netdev_ops =  &vortex_netdev_ops;
 
 	if (print_info) {
 		printk(KERN_INFO "%s: scatter/gather %sabled. h/w checksums %sabled\n",
@@ -1386,18 +1420,9 @@ static int __devinit vortex_probe1(struct device *gendev,
 				(dev->features & NETIF_F_IP_CSUM) ? "en":"dis");
 	}
 
-	dev->stop = vortex_close;
-	dev->get_stats = vortex_get_stats;
-#ifdef CONFIG_PCI
-	dev->do_ioctl = vortex_ioctl;
-#endif
 	dev->ethtool_ops = &vortex_ethtool_ops;
-	dev->set_multicast_list = set_rx_mode;
-	dev->tx_timeout = vortex_tx_timeout;
 	dev->watchdog_timeo = (watchdog * HZ) / 1000;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	dev->poll_controller = poll_vortex;
-#endif
+
 	if (pdev) {
 		vp->pm_state_valid = 1;
  		pci_save_state(VORTEX_PCI(vp));


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

* Re: [PATCH] 3c59x: convert to net_device_ops
  2009-03-21 11:51 ` Andrew Morton
@ 2009-03-21 16:26   ` Jiri Pirko
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2009-03-21 16:26 UTC (permalink / raw)
  To: Andrew Morton; +Cc: netdev, David Miller, klassert, Ingo Molnar, linux-kernel

Sat, Mar 21, 2009 at 12:51:55PM CET, akpm@linux-foundation.org wrote:
>On Sat, 21 Mar 2009 12:35:53 +0100 Jiri Pirko <jpirko@redhat.com> wrote:
>
>> I converted this driver to use net_device_ops. I made two structures, one for
>> vortex and one for boomerang start_xmit function. Tested on my test system with
>> 3Com PCI 3c905C Tornado.
>
>linux-next already contains
Oh, I've missed that, sorry. It seems pretty similar :)
>
>commit 48b47a5e306c1c119ee81ccd24d487c2df656410
>Author:     Stephen Hemminger <shemminger@linux-foundation.org>
>AuthorDate: Fri Jan 9 13:01:18 2009 +0000
>Commit:     David S. Miller <davem@davemloft.net>
>CommitDate: Wed Jan 21 14:02:25 2009 -0800
>
>    3c59x: convert to net_device_ops
>    
>    Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>    Signed-off-by: David S. Miller <davem@davemloft.net>
>
>diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
>index cdbbb62..b2563d3 100644
>--- a/drivers/net/3c59x.c
>+++ b/drivers/net/3c59x.c
>@@ -992,6 +992,42 @@ out:
> 	return rc;
> }
> 
>+static const struct net_device_ops boomrang_netdev_ops = {
>+	.ndo_open		= vortex_open,
>+	.ndo_stop		= vortex_close,
>+	.ndo_start_xmit		= boomerang_start_xmit,
>+	.ndo_tx_timeout		= vortex_tx_timeout,
>+	.ndo_get_stats		= vortex_get_stats,
>+#ifdef CONFIG_PCI
>+	.ndo_do_ioctl 		= vortex_ioctl,
>+#endif
>+	.ndo_set_multicast_list = set_rx_mode,
>+	.ndo_change_mtu		= eth_change_mtu,
>+	.ndo_set_mac_address 	= eth_mac_addr,
>+	.ndo_validate_addr	= eth_validate_addr,
>+#ifdef CONFIG_NET_POLL_CONTROLLER
>+	.ndo_poll_controller	= poll_vortex,
>+#endif
>+};
>+
>+static const struct net_device_ops vortex_netdev_ops = {
>+	.ndo_open		= vortex_open,
>+	.ndo_stop		= vortex_close,
>+	.ndo_start_xmit		= vortex_start_xmit,
>+	.ndo_tx_timeout		= vortex_tx_timeout,
>+	.ndo_get_stats		= vortex_get_stats,
>+#ifdef CONFIG_PCI
>+	.ndo_do_ioctl 		= vortex_ioctl,
>+#endif
>+	.ndo_set_multicast_list = set_rx_mode,
>+	.ndo_change_mtu		= eth_change_mtu,
>+	.ndo_set_mac_address 	= eth_mac_addr,
>+	.ndo_validate_addr	= eth_validate_addr,
>+#ifdef CONFIG_NET_POLL_CONTROLLER
>+	.ndo_poll_controller	= poll_vortex,
>+#endif
>+};
>+
> /*
>  * Start up the PCI/EISA device which is described by *gendev.
>  * Return 0 on success.
>@@ -1366,18 +1402,16 @@ static int __devinit vortex_probe1(struct device *gendev,
> 	}
> 
> 	/* The 3c59x-specific entries in the device structure. */
>-	dev->open = vortex_open;
> 	if (vp->full_bus_master_tx) {
>-		dev->hard_start_xmit = boomerang_start_xmit;
>+		dev->netdev_ops = &boomrang_netdev_ops;
> 		/* Actually, it still should work with iommu. */
> 		if (card_idx < MAX_UNITS &&
> 		    ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) ||
> 				hw_checksums[card_idx] == 1)) {
> 			dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
> 		}
>-	} else {
>-		dev->hard_start_xmit = vortex_start_xmit;
>-	}
>+	} else
>+		dev->netdev_ops =  &vortex_netdev_ops;
> 
> 	if (print_info) {
> 		printk(KERN_INFO "%s: scatter/gather %sabled. h/w checksums %sabled\n",
>@@ -1386,18 +1420,9 @@ static int __devinit vortex_probe1(struct device *gendev,
> 				(dev->features & NETIF_F_IP_CSUM) ? "en":"dis");
> 	}
> 
>-	dev->stop = vortex_close;
>-	dev->get_stats = vortex_get_stats;
>-#ifdef CONFIG_PCI
>-	dev->do_ioctl = vortex_ioctl;
>-#endif
> 	dev->ethtool_ops = &vortex_ethtool_ops;
>-	dev->set_multicast_list = set_rx_mode;
>-	dev->tx_timeout = vortex_tx_timeout;
> 	dev->watchdog_timeo = (watchdog * HZ) / 1000;
>-#ifdef CONFIG_NET_POLL_CONTROLLER
>-	dev->poll_controller = poll_vortex;
>-#endif
>+
> 	if (pdev) {
> 		vp->pm_state_valid = 1;
>  		pci_save_state(VORTEX_PCI(vp));
>

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

end of thread, other threads:[~2009-03-21 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-21 11:35 [PATCH] 3c59x: convert to net_device_ops Jiri Pirko
2009-03-21 11:51 ` Andrew Morton
2009-03-21 16:26   ` Jiri Pirko

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).