aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-11-21 20:32:15 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-21 20:32:15 -0500
commit1abd266f091e4f281a7c1e8813106fdf1528bb56 (patch)
tree931a1cd1bb3207abb077ee7125ac1dd87af8c234 /drivers/net/netxen
parent876526443e64ae15bc3715dd6fbe8b9deadf89bc (diff)
netxen: convert to net_device_ops
Convert driver to new net_device_ops. Compile tested only. Had to do some refactoring on multicast_list. Fix ethtool restart to propogate error code. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c10
-rw-r--r--drivers/net/netxen/netxen_nic_main.c43
2 files changed, 33 insertions, 20 deletions
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index b974ca0fc530..e45ce2951729 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -275,11 +275,11 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
275 } else 275 } else
276 return -EOPNOTSUPP; 276 return -EOPNOTSUPP;
277 277
278 if (netif_running(dev)) { 278 if (!netif_running(dev))
279 dev->stop(dev); 279 return 0;
280 dev->open(dev); 280
281 } 281 dev->netdev_ops->ndo_stop(dev);
282 return 0; 282 return dev->netdev_ops->ndo_open(dev);
283} 283}
284 284
285static int netxen_nic_get_regs_len(struct net_device *dev) 285static int netxen_nic_get_regs_len(struct net_device *dev)
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 25bfb3acf5e4..6876bfd4455a 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -469,6 +469,31 @@ netxen_read_mac_addr(struct netxen_adapter *adapter)
469 return 0; 469 return 0;
470} 470}
471 471
472static void netxen_set_multicast_list(struct net_device *dev)
473{
474 struct netxen_adapter *adapter = netdev_priv(dev);
475
476 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
477 netxen_p3_nic_set_multi(dev);
478 else
479 netxen_p2_nic_set_multi(dev);
480}
481
482static const struct net_device_ops netxen_netdev_ops = {
483 .ndo_open = netxen_nic_open,
484 .ndo_stop = netxen_nic_close,
485 .ndo_start_xmit = netxen_nic_xmit_frame,
486 .ndo_get_stats = netxen_nic_get_stats,
487 .ndo_validate_addr = eth_validate_addr,
488 .ndo_set_multicast_list = netxen_set_multicast_list,
489 .ndo_set_mac_address = netxen_nic_set_mac,
490 .ndo_change_mtu = netxen_nic_change_mtu,
491 .ndo_tx_timeout = netxen_tx_timeout,
492#ifdef CONFIG_NET_POLL_CONTROLLER
493 .ndo_poll_controller = netxen_nic_poll_controller,
494#endif
495};
496
472/* 497/*
473 * netxen_nic_probe() 498 * netxen_nic_probe()
474 * 499 *
@@ -680,25 +705,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
680 else 705 else
681 adapter->max_mc_count = 16; 706 adapter->max_mc_count = 16;
682 707
683 netdev->open = netxen_nic_open; 708 netdev->netdev_ops = &netxen_netdev_ops;
684 netdev->stop = netxen_nic_close;
685 netdev->hard_start_xmit = netxen_nic_xmit_frame;
686 netdev->get_stats = netxen_nic_get_stats;
687 if (NX_IS_REVISION_P3(revision_id))
688 netdev->set_multicast_list = netxen_p3_nic_set_multi;
689 else
690 netdev->set_multicast_list = netxen_p2_nic_set_multi;
691 netdev->set_mac_address = netxen_nic_set_mac;
692 netdev->change_mtu = netxen_nic_change_mtu;
693 netdev->tx_timeout = netxen_tx_timeout;
694 netdev->watchdog_timeo = 2*HZ; 709 netdev->watchdog_timeo = 2*HZ;
695 710
696 netxen_nic_change_mtu(netdev, netdev->mtu); 711 netxen_nic_change_mtu(netdev, netdev->mtu);
697 712
698 SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops); 713 SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops);
699#ifdef CONFIG_NET_POLL_CONTROLLER 714
700 netdev->poll_controller = netxen_nic_poll_controller;
701#endif
702 /* ScatterGather support */ 715 /* ScatterGather support */
703 netdev->features = NETIF_F_SG; 716 netdev->features = NETIF_F_SG;
704 netdev->features |= NETIF_F_IP_CSUM; 717 netdev->features |= NETIF_F_IP_CSUM;
@@ -1075,7 +1088,7 @@ static int netxen_nic_open(struct net_device *netdev)
1075 1088
1076 netxen_nic_set_link_parameters(adapter); 1089 netxen_nic_set_link_parameters(adapter);
1077 1090
1078 netdev->set_multicast_list(netdev); 1091 netxen_set_multicast_list(netdev);
1079 if (adapter->set_mtu) 1092 if (adapter->set_mtu)
1080 adapter->set_mtu(adapter, netdev->mtu); 1093 adapter->set_mtu(adapter, netdev->mtu);
1081 1094