Subject: [PATCH 29/33] ixgb: convert to net_device_ops

From: Stephen Hemminger <[email-masked]>
Date: Mon, 17 Nov 2008 15:42:36 -0800

Convert this driver to network device ops. Compile tested only.

Signed-off-by: Stephen Hemminger <[email-masked]>

--- a/drivers/net/ixgb/ixgb_main.c	2008-11-17 14:03:54.000000000 -0800
+++ b/drivers/net/ixgb/ixgb_main.c	2008-11-17 14:03:57.000000000 -0800
@@ -321,6 +321,23 @@ ixgb_reset(struct ixgb_adapter *adapter)
 	}
 }
 
+static const struct net_device_ops ixgb_netdev_ops = {
+	.open 			= ixgb_open,
+	.stop			= ixgb_close,
+	.get_stats		= ixgb_get_stats,
+	.set_multicast_list	= ixgb_set_multi,
+	.validate_addr		= eth_validate_addr,
+	.set_mac_address	= ixgb_set_mac,
+	.change_mtu		= ixgb_change_mtu,
+	.tx_timeout		= ixgb_tx_timeout,
+	.vlan_rx_register	= ixgb_vlan_rx_register,
+	.vlan_rx_add_vid	= ixgb_vlan_rx_add_vid,
+	.vlan_rx_kill_vid	= ixgb_vlan_rx_kill_vid,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.poll_controller	= ixgb_netpoll,
+#endif
+};
+
 /**
  * ixgb_probe - Device Initialization Routine
  * @pdev: PCI device information struct
@@ -396,23 +413,11 @@ ixgb_probe(struct pci_dev *pdev, const s
 		}
 	}
 
-	netdev->open = &ixgb_open;
-	netdev->stop = &ixgb_close;
+	netdev->netdev_ops = &ixgb_netdev_ops;
 	netdev->hard_start_xmit = &ixgb_xmit_frame;
-	netdev->get_stats = &ixgb_get_stats;
-	netdev->set_multicast_list = &ixgb_set_multi;
-	netdev->set_mac_address = &ixgb_set_mac;
-	netdev->change_mtu = &ixgb_change_mtu;
 	ixgb_set_ethtool_ops(netdev);
-	netdev->tx_timeout = &ixgb_tx_timeout;
 	netdev->watchdog_timeo = 5 * HZ;
 	netif_napi_add(netdev, &adapter->napi, ixgb_clean, 64);
-	netdev->vlan_rx_register = ixgb_vlan_rx_register;
-	netdev->vlan_rx_add_vid = ixgb_vlan_rx_add_vid;
-	netdev->vlan_rx_kill_vid = ixgb_vlan_rx_kill_vid;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	netdev->poll_controller = ixgb_netpoll;
-#endif
 
 	strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
 
--- a/drivers/net/ixgbe/ixgbe_main.c	2008-11-17 14:03:54.000000000 -0800
+++ b/drivers/net/ixgbe/ixgbe_main.c	2008-11-17 14:05:29.000000000 -0800
@@ -3727,6 +3727,23 @@ static int ixgbe_link_config(struct ixgb
 	return hw->mac.ops.setup_link_speed(hw, autoneg, true, true);
 }
 
+static const struct net_device_ops ixgbe_netdev_ops = {
+	.open 			= ixgbe_open,
+	.stop			= ixgbe_close,
+	.get_stats		= ixgbe_get_stats,
+	.set_multicast_list	= ixgbe_set_rx_mode,
+	.validate_addr		= eth_validate_addr,
+	.set_mac_address	= ixgbe_set_mac,
+	.change_mtu		= ixgbe_change_mtu,
+	.tx_timeout		= ixgbe_tx_timeout,
+	.vlan_rx_register	= ixgbe_vlan_rx_register,
+	.vlan_rx_add_vid	= ixgbe_vlan_rx_add_vid,
+	.vlan_rx_kill_vid	= ixgbe_vlan_rx_kill_vid,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.poll_controller	= ixgbe_netpoll,
+#endif
+};
+
 /**
  * ixgbe_probe - Device Initialization Routine
  * @pdev: PCI device information struct
@@ -3808,23 +3825,10 @@ static int __devinit ixgbe_probe(struct 
 			continue;
 	}
 
-	netdev->open = &ixgbe_open;
-	netdev->stop = &ixgbe_close;
+	netdev->netdev_ops = &ixgbe_netdev_ops;
 	netdev->hard_start_xmit = &ixgbe_xmit_frame;
-	netdev->get_stats = &ixgbe_get_stats;
-	netdev->set_rx_mode = &ixgbe_set_rx_mode;
-	netdev->set_multicast_list = &ixgbe_set_rx_mode;
-	netdev->set_mac_address = &ixgbe_set_mac;
-	netdev->change_mtu = &ixgbe_change_mtu;
 	ixgbe_set_ethtool_ops(netdev);
-	netdev->tx_timeout = &ixgbe_tx_timeout;
 	netdev->watchdog_timeo = 5 * HZ;
-	netdev->vlan_rx_register = ixgbe_vlan_rx_register;
-	netdev->vlan_rx_add_vid = ixgbe_vlan_rx_add_vid;
-	netdev->vlan_rx_kill_vid = ixgbe_vlan_rx_kill_vid;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	netdev->poll_controller = ixgbe_netpoll;
-#endif
 	strcpy(netdev->name, pci_name(pdev));
 
 	adapter->bd_number = cards_found;

--