Commit 1abd266f authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

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: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 87652644
...@@ -275,11 +275,11 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -275,11 +275,11 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
} else } else
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (netif_running(dev)) { if (!netif_running(dev))
dev->stop(dev); return 0;
dev->open(dev);
} dev->netdev_ops->ndo_stop(dev);
return 0; return dev->netdev_ops->ndo_open(dev);
} }
static int netxen_nic_get_regs_len(struct net_device *dev) static int netxen_nic_get_regs_len(struct net_device *dev)
......
...@@ -469,6 +469,31 @@ netxen_read_mac_addr(struct netxen_adapter *adapter) ...@@ -469,6 +469,31 @@ netxen_read_mac_addr(struct netxen_adapter *adapter)
return 0; return 0;
} }
static void netxen_set_multicast_list(struct net_device *dev)
{
struct netxen_adapter *adapter = netdev_priv(dev);
if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
netxen_p3_nic_set_multi(dev);
else
netxen_p2_nic_set_multi(dev);
}
static const struct net_device_ops netxen_netdev_ops = {
.ndo_open = netxen_nic_open,
.ndo_stop = netxen_nic_close,
.ndo_start_xmit = netxen_nic_xmit_frame,
.ndo_get_stats = netxen_nic_get_stats,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_multicast_list = netxen_set_multicast_list,
.ndo_set_mac_address = netxen_nic_set_mac,
.ndo_change_mtu = netxen_nic_change_mtu,
.ndo_tx_timeout = netxen_tx_timeout,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = netxen_nic_poll_controller,
#endif
};
/* /*
* netxen_nic_probe() * netxen_nic_probe()
* *
...@@ -680,25 +705,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -680,25 +705,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
else else
adapter->max_mc_count = 16; adapter->max_mc_count = 16;
netdev->open = netxen_nic_open; netdev->netdev_ops = &netxen_netdev_ops;
netdev->stop = netxen_nic_close;
netdev->hard_start_xmit = netxen_nic_xmit_frame;
netdev->get_stats = netxen_nic_get_stats;
if (NX_IS_REVISION_P3(revision_id))
netdev->set_multicast_list = netxen_p3_nic_set_multi;
else
netdev->set_multicast_list = netxen_p2_nic_set_multi;
netdev->set_mac_address = netxen_nic_set_mac;
netdev->change_mtu = netxen_nic_change_mtu;
netdev->tx_timeout = netxen_tx_timeout;
netdev->watchdog_timeo = 2*HZ; netdev->watchdog_timeo = 2*HZ;
netxen_nic_change_mtu(netdev, netdev->mtu); netxen_nic_change_mtu(netdev, netdev->mtu);
SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops); SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops);
#ifdef CONFIG_NET_POLL_CONTROLLER
netdev->poll_controller = netxen_nic_poll_controller;
#endif
/* ScatterGather support */ /* ScatterGather support */
netdev->features = NETIF_F_SG; netdev->features = NETIF_F_SG;
netdev->features |= NETIF_F_IP_CSUM; netdev->features |= NETIF_F_IP_CSUM;
...@@ -1075,7 +1088,7 @@ static int netxen_nic_open(struct net_device *netdev) ...@@ -1075,7 +1088,7 @@ static int netxen_nic_open(struct net_device *netdev)
netxen_nic_set_link_parameters(adapter); netxen_nic_set_link_parameters(adapter);
netdev->set_multicast_list(netdev); netxen_set_multicast_list(netdev);
if (adapter->set_mtu) if (adapter->set_mtu)
adapter->set_mtu(adapter, netdev->mtu); adapter->set_mtu(adapter, netdev->mtu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment