Skip to content

Commit

Permalink
netxen: convert to net_device_ops
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Nov 22, 2008
1 parent 8765264 commit 1abd266
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
10 changes: 5 additions & 5 deletions drivers/net/netxen/netxen_nic_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
} else
return -EOPNOTSUPP;

if (netif_running(dev)) {
dev->stop(dev);
dev->open(dev);
}
return 0;
if (!netif_running(dev))
return 0;

dev->netdev_ops->ndo_stop(dev);
return dev->netdev_ops->ndo_open(dev);
}

static int netxen_nic_get_regs_len(struct net_device *dev)
Expand Down
43 changes: 28 additions & 15 deletions drivers/net/netxen/netxen_nic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,31 @@ netxen_read_mac_addr(struct netxen_adapter *adapter)
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()
*
Expand Down Expand Up @@ -680,25 +705,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
else
adapter->max_mc_count = 16;

netdev->open = netxen_nic_open;
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->netdev_ops = &netxen_netdev_ops;
netdev->watchdog_timeo = 2*HZ;

netxen_nic_change_mtu(netdev, netdev->mtu);

SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops);
#ifdef CONFIG_NET_POLL_CONTROLLER
netdev->poll_controller = netxen_nic_poll_controller;
#endif

/* ScatterGather support */
netdev->features = NETIF_F_SG;
netdev->features |= NETIF_F_IP_CSUM;
Expand Down Expand Up @@ -1075,7 +1088,7 @@ static int netxen_nic_open(struct net_device *netdev)

netxen_nic_set_link_parameters(adapter);

netdev->set_multicast_list(netdev);
netxen_set_multicast_list(netdev);
if (adapter->set_mtu)
adapter->set_mtu(adapter, netdev->mtu);

Expand Down

0 comments on commit 1abd266

Please sign in to comment.