提交 d0929553 编写于 作者: S Stephen Hemminger 提交者: David S. Miller

infiniband: convert nes driver to net_device_ops

Also, removed unnecessary memset() since alloc_netdev returns
zeroed memory.
Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 687c75dc
...@@ -1568,6 +1568,19 @@ static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_g ...@@ -1568,6 +1568,19 @@ static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_g
spin_unlock_irqrestore(&nesadapter->phy_lock, flags); spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
} }
static const struct net_device_ops nes_netdev_ops = {
.ndo_open = nes_netdev_open,
.ndo_stop = nes_netdev_stop,
.ndo_start_xmit = nes_netdev_start_xmit,
.ndo_get_stats = nes_netdev_get_stats,
.ndo_tx_timeout = nes_netdev_tx_timeout,
.ndo_set_mac_address = nes_netdev_set_mac_address,
.ndo_set_multicast_list = nes_netdev_set_multicast_list,
.ndo_change_mtu = nes_netdev_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
.ndo_vlan_rx_register = nes_netdev_vlan_rx_register,
};
/** /**
* nes_netdev_init - initialize network device * nes_netdev_init - initialize network device
...@@ -1593,17 +1606,6 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev, ...@@ -1593,17 +1606,6 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
SET_NETDEV_DEV(netdev, &nesdev->pcidev->dev); SET_NETDEV_DEV(netdev, &nesdev->pcidev->dev);
nesvnic = netdev_priv(netdev);
memset(nesvnic, 0, sizeof(*nesvnic));
netdev->open = nes_netdev_open;
netdev->stop = nes_netdev_stop;
netdev->hard_start_xmit = nes_netdev_start_xmit;
netdev->get_stats = nes_netdev_get_stats;
netdev->tx_timeout = nes_netdev_tx_timeout;
netdev->set_mac_address = nes_netdev_set_mac_address;
netdev->set_multicast_list = nes_netdev_set_multicast_list;
netdev->change_mtu = nes_netdev_change_mtu;
netdev->watchdog_timeo = NES_TX_TIMEOUT; netdev->watchdog_timeo = NES_TX_TIMEOUT;
netdev->irq = nesdev->pcidev->irq; netdev->irq = nesdev->pcidev->irq;
netdev->mtu = ETH_DATA_LEN; netdev->mtu = ETH_DATA_LEN;
...@@ -1611,14 +1613,15 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev, ...@@ -1611,14 +1613,15 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
netdev->addr_len = ETH_ALEN; netdev->addr_len = ETH_ALEN;
netdev->type = ARPHRD_ETHER; netdev->type = ARPHRD_ETHER;
netdev->features = NETIF_F_HIGHDMA; netdev->features = NETIF_F_HIGHDMA;
netdev->netdev_ops = &nes_netdev_ops;
netdev->ethtool_ops = &nes_ethtool_ops; netdev->ethtool_ops = &nes_ethtool_ops;
netif_napi_add(netdev, &nesvnic->napi, nes_netdev_poll, 128); netif_napi_add(netdev, &nesvnic->napi, nes_netdev_poll, 128);
nes_debug(NES_DBG_INIT, "Enabling VLAN Insert/Delete.\n"); nes_debug(NES_DBG_INIT, "Enabling VLAN Insert/Delete.\n");
netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
netdev->vlan_rx_register = nes_netdev_vlan_rx_register;
netdev->features |= NETIF_F_LLTX; netdev->features |= NETIF_F_LLTX;
/* Fill in the port structure */ /* Fill in the port structure */
nesvnic = netdev_priv(netdev);
nesvnic->netdev = netdev; nesvnic->netdev = netdev;
nesvnic->nesdev = nesdev; nesvnic->nesdev = nesdev;
nesvnic->msg_enable = netif_msg_init(debug, default_msg); nesvnic->msg_enable = netif_msg_init(debug, default_msg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册