Patchwork [29/33] ixgb: convert to net_device_ops

login
register
mail settings
Submitter stephen hemminger
Date Nov. 17, 2008, 11:42 p.m.
Message ID <20081117234357.262431493@vyatta.com>
Download mbox | patch
Permalink /patch/9281/
State Accepted
Delegated to: David Miller
Headers show

Comments

stephen hemminger - Nov. 17, 2008, 11:42 p.m.
Convert this driver to network device ops. Compile tested only.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
David Miller - Nov. 20, 2008, 6:24 a.m.
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Mon, 17 Nov 2008 15:42:36 -0800

> Convert this driver to network device ops. Compile tested only.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

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/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;