Patchwork [30/33] tg3: convert to net_device_ops

login
register
mail settings
Submitter stephen hemminger
Date Nov. 18, 2008, 1:37 a.m.
Message ID <20081117173706.31960184@extreme>
Download mbox | patch
Permalink /patch/9316/
State Accepted
Delegated to: David Miller
Headers show

Comments

stephen hemminger - Nov. 18, 2008, 1:37 a.m.
Convert this driver to network device ops.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
Handle non-vlan build.

--
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
Matt Carlson - Nov. 19, 2008, 9:04 p.m.
On Mon, Nov 17, 2008 at 05:37:06PM -0800, Stephen Hemminger wrote:
> Convert this driver to network device ops.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> ---
> Handle non-vlan build.
> 
> --- a/drivers/net/tg3.c	2008-11-17 17:21:58.000000000 -0800
> +++ b/drivers/net/tg3.c	2008-11-17 17:26:45.000000000 -0800
> @@ -13343,6 +13343,24 @@ static void __devinit tg3_init_coal(stru
>  	}
>  }
>  
> +static const struct net_device_ops tg3_netdev_ops = {
> +	.open			= tg3_open,
> +	.stop			= tg3_close,

One more completely trivial nit.  Is there a reason why you chose
the verbs to be "open" and "stop" rather than "open" and "close" or
"start" and "stop"?

> +	.get_stats		= tg3_get_stats,
> +	.validate_addr		= eth_validate_addr,
> +	.set_multicast_list	= tg3_set_rx_mode,
> +	.set_mac_address	= tg3_set_mac_addr,
> +	.do_ioctl		= tg3_ioctl,
> +	.tx_timeout		= tg3_tx_timeout,
> +	.change_mtu		= tg3_change_mtu,
> +#if TG3_VLAN_TAG_USED
> +	.vlan_rx_register	= tg3_vlan_rx_register,
> +#endif
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> +	.poll_controller	= tg3_poll_controller,
> +#endif
> +};
> +
>  static int __devinit tg3_init_one(struct pci_dev *pdev,
>  				  const struct pci_device_id *ent)
>  {
> @@ -13400,7 +13418,6 @@ static int __devinit tg3_init_one(struct
>  
>  #if TG3_VLAN_TAG_USED
>  	dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
> -	dev->vlan_rx_register = tg3_vlan_rx_register;
>  #endif
>  
>  	tp = netdev_priv(dev);
> @@ -13458,21 +13475,11 @@ static int __devinit tg3_init_one(struct
>  	tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING;
>  	tp->tx_pending = TG3_DEF_TX_RING_PENDING;
>  
> -	dev->open = tg3_open;
> -	dev->stop = tg3_close;
> -	dev->get_stats = tg3_get_stats;
> -	dev->set_multicast_list = tg3_set_rx_mode;
> -	dev->set_mac_address = tg3_set_mac_addr;
> -	dev->do_ioctl = tg3_ioctl;
> -	dev->tx_timeout = tg3_tx_timeout;
> +	dev->netdev_ops = &tg3_netdev_ops;
>  	netif_napi_add(dev, &tp->napi, tg3_poll, 64);
>  	dev->ethtool_ops = &tg3_ethtool_ops;
>  	dev->watchdog_timeo = TG3_TX_TIMEOUT;
> -	dev->change_mtu = tg3_change_mtu;
>  	dev->irq = pdev->irq;
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -	dev->poll_controller = tg3_poll_controller;
> -#endif
>  
>  	err = tg3_get_invariants(tp);
>  	if (err) {
> --
> 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
> 


--
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
stephen hemminger - Nov. 19, 2008, 9:07 p.m.
On Wed, 19 Nov 2008 13:04:47 -0800
"Matt Carlson" <mcarlson@broadcom.com> wrote:

> On Mon, Nov 17, 2008 at 05:37:06PM -0800, Stephen Hemminger wrote:
> > Convert this driver to network device ops.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> > 
> > ---
> > Handle non-vlan build.
> > 
> > --- a/drivers/net/tg3.c	2008-11-17 17:21:58.000000000 -0800
> > +++ b/drivers/net/tg3.c	2008-11-17 17:26:45.000000000 -0800
> > @@ -13343,6 +13343,24 @@ static void __devinit tg3_init_coal(stru
> >  	}
> >  }
> >  
> > +static const struct net_device_ops tg3_netdev_ops = {
> > +	.open			= tg3_open,
> > +	.stop			= tg3_close,
> 
> One more completely trivial nit.  Is there a reason why you chose
> the verbs to be "open" and "stop" rather than "open" and "close" or
> "start" and "stop"?

Because that is what they were before (but in a different place).
--
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
David Miller - Nov. 20, 2008, 1:21 a.m.
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 19 Nov 2008 13:07:27 -0800

> On Wed, 19 Nov 2008 13:04:47 -0800
> "Matt Carlson" <mcarlson@broadcom.com> wrote:
> 
> > On Mon, Nov 17, 2008 at 05:37:06PM -0800, Stephen Hemminger wrote:
> > > Convert this driver to network device ops.
> > > 
> > > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> > > 
> > > ---
> > > Handle non-vlan build.
> > > 
> > > --- a/drivers/net/tg3.c	2008-11-17 17:21:58.000000000 -0800
> > > +++ b/drivers/net/tg3.c	2008-11-17 17:26:45.000000000 -0800
> > > @@ -13343,6 +13343,24 @@ static void __devinit tg3_init_coal(stru
> > >  	}
> > >  }
> > >  
> > > +static const struct net_device_ops tg3_netdev_ops = {
> > > +	.open			= tg3_open,
> > > +	.stop			= tg3_close,
> > 
> > One more completely trivial nit.  Is there a reason why you chose
> > the verbs to be "open" and "stop" rather than "open" and "close" or
> > "start" and "stop"?
> 
> Because that is what they were before (but in a different place).

Right.
--
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
David Miller - Nov. 20, 2008, 6:25 a.m.
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Mon, 17 Nov 2008 17:37:06 -0800

> Convert this driver to network device ops.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> ---
> Handle non-vlan build.

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

Patch

--- a/drivers/net/tg3.c	2008-11-17 17:21:58.000000000 -0800
+++ b/drivers/net/tg3.c	2008-11-17 17:26:45.000000000 -0800
@@ -13343,6 +13343,24 @@  static void __devinit tg3_init_coal(stru
 	}
 }
 
+static const struct net_device_ops tg3_netdev_ops = {
+	.open			= tg3_open,
+	.stop			= tg3_close,
+	.get_stats		= tg3_get_stats,
+	.validate_addr		= eth_validate_addr,
+	.set_multicast_list	= tg3_set_rx_mode,
+	.set_mac_address	= tg3_set_mac_addr,
+	.do_ioctl		= tg3_ioctl,
+	.tx_timeout		= tg3_tx_timeout,
+	.change_mtu		= tg3_change_mtu,
+#if TG3_VLAN_TAG_USED
+	.vlan_rx_register	= tg3_vlan_rx_register,
+#endif
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.poll_controller	= tg3_poll_controller,
+#endif
+};
+
 static int __devinit tg3_init_one(struct pci_dev *pdev,
 				  const struct pci_device_id *ent)
 {
@@ -13400,7 +13418,6 @@  static int __devinit tg3_init_one(struct
 
 #if TG3_VLAN_TAG_USED
 	dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
-	dev->vlan_rx_register = tg3_vlan_rx_register;
 #endif
 
 	tp = netdev_priv(dev);
@@ -13458,21 +13475,11 @@  static int __devinit tg3_init_one(struct
 	tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING;
 	tp->tx_pending = TG3_DEF_TX_RING_PENDING;
 
-	dev->open = tg3_open;
-	dev->stop = tg3_close;
-	dev->get_stats = tg3_get_stats;
-	dev->set_multicast_list = tg3_set_rx_mode;
-	dev->set_mac_address = tg3_set_mac_addr;
-	dev->do_ioctl = tg3_ioctl;
-	dev->tx_timeout = tg3_tx_timeout;
+	dev->netdev_ops = &tg3_netdev_ops;
 	netif_napi_add(dev, &tp->napi, tg3_poll, 64);
 	dev->ethtool_ops = &tg3_ethtool_ops;
 	dev->watchdog_timeo = TG3_TX_TIMEOUT;
-	dev->change_mtu = tg3_change_mtu;
 	dev->irq = pdev->irq;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	dev->poll_controller = tg3_poll_controller;
-#endif
 
 	err = tg3_get_invariants(tp);
 	if (err) {