Commit f1b91e20 authored by Jeff Garzik's avatar Jeff Garzik

[netdrvr tg3] netdev_priv

parent 3dc567d8
...@@ -2435,7 +2435,7 @@ static int tg3_rx(struct tg3 *tp, int budget) ...@@ -2435,7 +2435,7 @@ static int tg3_rx(struct tg3 *tp, int budget)
static int tg3_poll(struct net_device *netdev, int *budget) static int tg3_poll(struct net_device *netdev, int *budget)
{ {
struct tg3 *tp = netdev->priv; struct tg3 *tp = netdev_priv(netdev);
struct tg3_hw_status *sblk = tp->hw_status; struct tg3_hw_status *sblk = tp->hw_status;
unsigned long flags; unsigned long flags;
int done; int done;
...@@ -2517,7 +2517,7 @@ static inline unsigned int tg3_has_work(struct net_device *dev, struct tg3 *tp) ...@@ -2517,7 +2517,7 @@ static inline unsigned int tg3_has_work(struct net_device *dev, struct tg3 *tp)
static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs) static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
struct net_device *dev = dev_id; struct net_device *dev = dev_id;
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
struct tg3_hw_status *sblk = tp->hw_status; struct tg3_hw_status *sblk = tp->hw_status;
unsigned long flags; unsigned long flags;
unsigned int handled = 1; unsigned int handled = 1;
...@@ -2597,7 +2597,7 @@ static void tg3_reset_task(void *_data) ...@@ -2597,7 +2597,7 @@ static void tg3_reset_task(void *_data)
static void tg3_tx_timeout(struct net_device *dev) static void tg3_tx_timeout(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
printk(KERN_ERR PFX "%s: transmit timed out, resetting\n", printk(KERN_ERR PFX "%s: transmit timed out, resetting\n",
dev->name); dev->name);
...@@ -2713,7 +2713,7 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len) ...@@ -2713,7 +2713,7 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len)
static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev) static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
dma_addr_t mapping; dma_addr_t mapping;
unsigned int i; unsigned int i;
u32 len, entry, base_flags, mss; u32 len, entry, base_flags, mss;
...@@ -2913,7 +2913,7 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev) ...@@ -2913,7 +2913,7 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
dma_addr_t mapping; dma_addr_t mapping;
u32 len, entry, base_flags, mss; u32 len, entry, base_flags, mss;
unsigned long flags; unsigned long flags;
...@@ -3079,7 +3079,7 @@ static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp, ...@@ -3079,7 +3079,7 @@ static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp,
static int tg3_change_mtu(struct net_device *dev, int new_mtu) static int tg3_change_mtu(struct net_device *dev, int new_mtu)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (new_mtu < TG3_MIN_MTU || new_mtu > TG3_MAX_MTU(tp)) if (new_mtu < TG3_MIN_MTU || new_mtu > TG3_MAX_MTU(tp))
return -EINVAL; return -EINVAL;
...@@ -4563,7 +4563,7 @@ static void __tg3_set_mac_addr(struct tg3 *tp) ...@@ -4563,7 +4563,7 @@ static void __tg3_set_mac_addr(struct tg3 *tp)
static int tg3_set_mac_addr(struct net_device *dev, void *p) static int tg3_set_mac_addr(struct net_device *dev, void *p)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
struct sockaddr *addr = p; struct sockaddr *addr = p;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
...@@ -5321,7 +5321,7 @@ static void tg3_timer(unsigned long __opaque) ...@@ -5321,7 +5321,7 @@ static void tg3_timer(unsigned long __opaque)
static int tg3_open(struct net_device *dev) static int tg3_open(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
int err; int err;
spin_lock_irq(&tp->lock); spin_lock_irq(&tp->lock);
...@@ -5624,7 +5624,7 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *); ...@@ -5624,7 +5624,7 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *);
static int tg3_close(struct net_device *dev) static int tg3_close(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
netif_stop_queue(dev); netif_stop_queue(dev);
...@@ -5741,7 +5741,7 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp) ...@@ -5741,7 +5741,7 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp)
static struct net_device_stats *tg3_get_stats(struct net_device *dev) static struct net_device_stats *tg3_get_stats(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
struct net_device_stats *stats = &tp->net_stats; struct net_device_stats *stats = &tp->net_stats;
struct net_device_stats *old_stats = &tp->net_stats_prev; struct net_device_stats *old_stats = &tp->net_stats_prev;
struct tg3_hw_stats *hw_stats = tp->hw_stats; struct tg3_hw_stats *hw_stats = tp->hw_stats;
...@@ -5832,7 +5832,7 @@ static void tg3_set_multi(struct tg3 *tp, unsigned int accept_all) ...@@ -5832,7 +5832,7 @@ static void tg3_set_multi(struct tg3 *tp, unsigned int accept_all)
static void __tg3_set_rx_mode(struct net_device *dev) static void __tg3_set_rx_mode(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
u32 rx_mode; u32 rx_mode;
rx_mode = tp->rx_mode & ~(RX_MODE_PROMISC | rx_mode = tp->rx_mode & ~(RX_MODE_PROMISC |
...@@ -5896,7 +5896,7 @@ static void __tg3_set_rx_mode(struct net_device *dev) ...@@ -5896,7 +5896,7 @@ static void __tg3_set_rx_mode(struct net_device *dev)
static void tg3_set_rx_mode(struct net_device *dev) static void tg3_set_rx_mode(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
spin_lock_irq(&tp->lock); spin_lock_irq(&tp->lock);
__tg3_set_rx_mode(dev); __tg3_set_rx_mode(dev);
...@@ -5914,7 +5914,7 @@ static void tg3_get_regs(struct net_device *dev, ...@@ -5914,7 +5914,7 @@ static void tg3_get_regs(struct net_device *dev,
struct ethtool_regs *regs, void *_p) struct ethtool_regs *regs, void *_p)
{ {
u32 *p = _p; u32 *p = _p;
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
u8 *orig_p = _p; u8 *orig_p = _p;
int i; int i;
...@@ -5979,7 +5979,7 @@ do { p = (u32 *)(orig_p + (reg)); \ ...@@ -5979,7 +5979,7 @@ do { p = (u32 *)(orig_p + (reg)); \
static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) || if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) ||
tp->link_config.phy_is_low_power) tp->link_config.phy_is_low_power)
...@@ -6014,7 +6014,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -6014,7 +6014,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) || if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) ||
tp->link_config.phy_is_low_power) tp->link_config.phy_is_low_power)
...@@ -6053,7 +6053,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -6053,7 +6053,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
static void tg3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) static void tg3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
strcpy(info->driver, DRV_MODULE_NAME); strcpy(info->driver, DRV_MODULE_NAME);
strcpy(info->version, DRV_MODULE_VERSION); strcpy(info->version, DRV_MODULE_VERSION);
...@@ -6062,7 +6062,7 @@ static void tg3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info ...@@ -6062,7 +6062,7 @@ static void tg3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info
static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
wol->supported = WAKE_MAGIC; wol->supported = WAKE_MAGIC;
wol->wolopts = 0; wol->wolopts = 0;
...@@ -6073,7 +6073,7 @@ static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) ...@@ -6073,7 +6073,7 @@ static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (wol->wolopts & ~WAKE_MAGIC) if (wol->wolopts & ~WAKE_MAGIC)
return -EINVAL; return -EINVAL;
...@@ -6094,20 +6094,20 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) ...@@ -6094,20 +6094,20 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
static u32 tg3_get_msglevel(struct net_device *dev) static u32 tg3_get_msglevel(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
return tp->msg_enable; return tp->msg_enable;
} }
static void tg3_set_msglevel(struct net_device *dev, u32 value) static void tg3_set_msglevel(struct net_device *dev, u32 value)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
tp->msg_enable = value; tp->msg_enable = value;
} }
#if TG3_TSO_SUPPORT != 0 #if TG3_TSO_SUPPORT != 0
static int tg3_set_tso(struct net_device *dev, u32 value) static int tg3_set_tso(struct net_device *dev, u32 value)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (!(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) { if (!(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) {
if (value) if (value)
...@@ -6120,7 +6120,7 @@ static int tg3_set_tso(struct net_device *dev, u32 value) ...@@ -6120,7 +6120,7 @@ static int tg3_set_tso(struct net_device *dev, u32 value)
static int tg3_nway_reset(struct net_device *dev) static int tg3_nway_reset(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
u32 bmcr; u32 bmcr;
int r; int r;
...@@ -6139,7 +6139,7 @@ static int tg3_nway_reset(struct net_device *dev) ...@@ -6139,7 +6139,7 @@ static int tg3_nway_reset(struct net_device *dev)
static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
ering->rx_max_pending = TG3_RX_RING_SIZE - 1; ering->rx_max_pending = TG3_RX_RING_SIZE - 1;
ering->rx_mini_max_pending = 0; ering->rx_mini_max_pending = 0;
...@@ -6153,7 +6153,7 @@ static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam * ...@@ -6153,7 +6153,7 @@ static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam *
static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) || if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) ||
(ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) || (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) ||
...@@ -6184,7 +6184,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e ...@@ -6184,7 +6184,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
epause->autoneg = (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) != 0; epause->autoneg = (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) != 0;
epause->rx_pause = (tp->tg3_flags & TG3_FLAG_PAUSE_RX) != 0; epause->rx_pause = (tp->tg3_flags & TG3_FLAG_PAUSE_RX) != 0;
...@@ -6193,7 +6193,7 @@ static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam ...@@ -6193,7 +6193,7 @@ static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam
static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
tg3_netif_stop(tp); tg3_netif_stop(tp);
spin_lock_irq(&tp->lock); spin_lock_irq(&tp->lock);
...@@ -6221,13 +6221,13 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam ...@@ -6221,13 +6221,13 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
static u32 tg3_get_rx_csum(struct net_device *dev) static u32 tg3_get_rx_csum(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
return (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0; return (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0;
} }
static int tg3_set_rx_csum(struct net_device *dev, u32 data) static int tg3_set_rx_csum(struct net_device *dev, u32 data)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) { if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) {
if (data != 0) if (data != 0)
...@@ -6247,7 +6247,7 @@ static int tg3_set_rx_csum(struct net_device *dev, u32 data) ...@@ -6247,7 +6247,7 @@ static int tg3_set_rx_csum(struct net_device *dev, u32 data)
static int tg3_set_tx_csum(struct net_device *dev, u32 data) static int tg3_set_tx_csum(struct net_device *dev, u32 data)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) { if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) {
if (data != 0) if (data != 0)
...@@ -6290,7 +6290,7 @@ static void tg3_get_ethtool_stats (struct net_device *dev, ...@@ -6290,7 +6290,7 @@ static void tg3_get_ethtool_stats (struct net_device *dev,
static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{ {
struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data;
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
int err; int err;
switch(cmd) { switch(cmd) {
...@@ -6330,7 +6330,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -6330,7 +6330,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
#if TG3_VLAN_TAG_USED #if TG3_VLAN_TAG_USED
static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
spin_lock_irq(&tp->lock); spin_lock_irq(&tp->lock);
spin_lock(&tp->tx_lock); spin_lock(&tp->tx_lock);
...@@ -6346,7 +6346,7 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) ...@@ -6346,7 +6346,7 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
spin_lock_irq(&tp->lock); spin_lock_irq(&tp->lock);
spin_lock(&tp->tx_lock); spin_lock(&tp->tx_lock);
...@@ -7750,7 +7750,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, ...@@ -7750,7 +7750,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
dev->vlan_rx_kill_vid = tg3_vlan_rx_kill_vid; dev->vlan_rx_kill_vid = tg3_vlan_rx_kill_vid;
#endif #endif
tp = dev->priv; tp = netdev_priv(dev);
tp->pdev = pdev; tp->pdev = pdev;
tp->dev = dev; tp->dev = dev;
tp->pm_cap = pm_cap; tp->pm_cap = pm_cap;
...@@ -7970,8 +7970,10 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev) ...@@ -7970,8 +7970,10 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
if (dev) { if (dev) {
struct tg3 *tp = netdev_priv(dev);
unregister_netdev(dev); unregister_netdev(dev);
iounmap((void *) ((struct tg3 *)(dev->priv))->regs); iounmap((void *)tp->regs);
free_netdev(dev); free_netdev(dev);
pci_release_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
...@@ -7982,7 +7984,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev) ...@@ -7982,7 +7984,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev)
static int tg3_suspend(struct pci_dev *pdev, u32 state) static int tg3_suspend(struct pci_dev *pdev, u32 state)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
int err; int err;
if (!netif_running(dev)) if (!netif_running(dev))
...@@ -8029,7 +8031,7 @@ static int tg3_suspend(struct pci_dev *pdev, u32 state) ...@@ -8029,7 +8031,7 @@ static int tg3_suspend(struct pci_dev *pdev, u32 state)
static int tg3_resume(struct pci_dev *pdev) static int tg3_resume(struct pci_dev *pdev)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
int err; int err;
if (!netif_running(dev)) if (!netif_running(dev))
......
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