netdevice: Kill netdev->priv
This is the last shoot of this series. After I removing all directly reference of netdev->priv, I am killing "priv" of "struct net_device" and fixing relative comments/docs. Anyone will not be allowed to reference netdev->priv directly. If you want to reference the memory of private data, use netdev_priv() instead. If the private data is not allocted when alloc_netdev(), use netdev->ml_priv to point that memory after you creating that private data. Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
5a001a070e
Коммит
b74ca3a896
|
@ -13,7 +13,7 @@ Transmit path guidelines:
|
|||
static int drv_hard_start_xmit(struct sk_buff *skb,
|
||||
struct net_device *dev)
|
||||
{
|
||||
struct drv *dp = dev->priv;
|
||||
struct drv *dp = netdev_priv(dev);
|
||||
|
||||
lock_tx(dp);
|
||||
...
|
||||
|
|
|
@ -18,7 +18,7 @@ There are routines in net_init.c to handle the common cases of
|
|||
alloc_etherdev, alloc_netdev. These reserve extra space for driver
|
||||
private data which gets freed when the network device is freed. If
|
||||
separately allocated data is attached to the network device
|
||||
(dev->priv) then it is up to the module exit handler to free that.
|
||||
(netdev_priv(dev)) then it is up to the module exit handler to free that.
|
||||
|
||||
MTU
|
||||
===
|
||||
|
|
|
@ -23,7 +23,7 @@ static const struct ethtool_ops netdev_ethtool_ops;
|
|||
static int el_debug = EL_DEBUG;
|
||||
|
||||
/*
|
||||
* Board-specific info in dev->priv.
|
||||
* Board-specific info in netdev_priv(dev).
|
||||
*/
|
||||
|
||||
struct net_local
|
||||
|
|
|
@ -420,7 +420,7 @@ static unsigned short __init eeprom_op(long ioaddr, u32 cmd)
|
|||
registers that "should" only need to be set once at boot, so that
|
||||
there is non-reboot way to recover if something goes wrong.
|
||||
|
||||
This is an attachable device: if there is no dev->priv entry then it wasn't
|
||||
This is an attachable device: if there is no private entry then it wasn't
|
||||
probed for at boot-time, and we need to probe for it again.
|
||||
*/
|
||||
static int net_open(struct net_device *dev)
|
||||
|
|
|
@ -1046,7 +1046,7 @@ static void eexp_hw_tx_pio(struct net_device *dev, unsigned short *buf,
|
|||
/*
|
||||
* Sanity check the suspected EtherExpress card
|
||||
* Read hardware address, reset card, size memory and initialize buffer
|
||||
* memory pointers. These are held in dev->priv, in case someone has more
|
||||
* memory pointers. These are held in netdev_priv(), in case someone has more
|
||||
* than one card in a machine.
|
||||
*/
|
||||
|
||||
|
|
|
@ -712,12 +712,12 @@ struct nv_skb_map {
|
|||
|
||||
/*
|
||||
* SMP locking:
|
||||
* All hardware access under dev->priv->lock, except the performance
|
||||
* All hardware access under netdev_priv(dev)->lock, except the performance
|
||||
* critical parts:
|
||||
* - rx is (pseudo-) lockless: it relies on the single-threading provided
|
||||
* by the arch code for interrupts.
|
||||
* - tx setup is lockless: it relies on netif_tx_lock. Actual submission
|
||||
* needs dev->priv->lock :-(
|
||||
* needs netdev_priv(dev)->lock :-(
|
||||
* - set_multicast_list: preparation lockless, relies on netif_tx_lock.
|
||||
*/
|
||||
|
||||
|
|
|
@ -519,7 +519,7 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int
|
|||
}
|
||||
}
|
||||
|
||||
/* We can't allocate dev->priv from alloc_etherdev() because it must
|
||||
/* We can't allocate private data from alloc_etherdev() because it must
|
||||
a ISA DMA-able region. */
|
||||
chipname = chip_table[lance_version].name;
|
||||
printk("%s: %s at %#3x, ", dev->name, chipname, ioaddr);
|
||||
|
|
|
@ -1091,7 +1091,7 @@ static int __devinit myri_sbus_probe(struct of_device *op, const struct of_devic
|
|||
err_free_irq:
|
||||
free_irq(dev->irq, dev);
|
||||
err:
|
||||
/* This will also free the co-allocated 'dev->priv' */
|
||||
/* This will also free the co-allocated private data*/
|
||||
free_netdev(dev);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
|
@ -781,7 +781,7 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev,
|
|||
dev->irq = pdev->irq;
|
||||
dev->base_addr = (unsigned long) ioaddr;
|
||||
|
||||
/* dev->priv/tp zeroed and aligned in alloc_etherdev */
|
||||
/* netdev_priv()/tp zeroed and aligned in alloc_etherdev */
|
||||
tp = netdev_priv(dev);
|
||||
|
||||
/* note: tp->chipset set in netdrv_init_board */
|
||||
|
|
|
@ -209,7 +209,7 @@ static int sun3_82586_open(struct net_device *dev)
|
|||
static int check586(struct net_device *dev,char *where,unsigned size)
|
||||
{
|
||||
struct priv pb;
|
||||
struct priv *p = /* (struct priv *) dev->priv*/ &pb;
|
||||
struct priv *p = &pb;
|
||||
char *iscp_addr;
|
||||
int i;
|
||||
|
||||
|
|
|
@ -1233,7 +1233,7 @@ fail_and_cleanup:
|
|||
bp->bmac_block,
|
||||
bp->bblock_dvma);
|
||||
|
||||
/* This also frees the co-located 'dev->priv' */
|
||||
/* This also frees the co-located private data */
|
||||
free_netdev(dev);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
|
@ -296,8 +296,9 @@ static int __devinit xl_probe(struct pci_dev *pdev,
|
|||
} ;
|
||||
|
||||
/*
|
||||
* Allowing init_trdev to allocate the dev->priv structure will align xl_private
|
||||
* on a 32 bytes boundary which we need for the rx/tx descriptors
|
||||
* Allowing init_trdev to allocate the private data will align
|
||||
* xl_private on a 32 bytes boundary which we need for the rx/tx
|
||||
* descriptors
|
||||
*/
|
||||
|
||||
dev = alloc_trdev(sizeof(struct xl_private)) ;
|
||||
|
|
|
@ -191,12 +191,13 @@ IIId. Synchronization
|
|||
|
||||
The driver runs as two independent, single-threaded flows of control. One
|
||||
is the send-packet routine, which enforces single-threaded use by the
|
||||
dev->priv->lock spinlock. The other thread is the interrupt handler, which
|
||||
is single threaded by the hardware and interrupt handling software.
|
||||
netdev_priv(dev)->lock spinlock. The other thread is the interrupt handler,
|
||||
which is single threaded by the hardware and interrupt handling software.
|
||||
|
||||
The send packet thread has partial control over the Tx ring. It locks the
|
||||
dev->priv->lock whenever it's queuing a Tx packet. If the next slot in the ring
|
||||
is not available it stops the transmit queue by calling netif_stop_queue.
|
||||
netdev_priv(dev)->lock whenever it's queuing a Tx packet. If the next slot in
|
||||
the ring is not available it stops the transmit queue by
|
||||
calling netif_stop_queue.
|
||||
|
||||
The interrupt handler has exclusive control over the Rx ring and records stats
|
||||
from the Tx ring. After reaping the stats, it marks the Tx queue entry as
|
||||
|
|
|
@ -2494,7 +2494,7 @@ static void strip_dev_setup(struct net_device *dev)
|
|||
dev->type = ARPHRD_METRICOM; /* dtang */
|
||||
dev->hard_header_len = sizeof(STRIP_Header);
|
||||
/*
|
||||
* dev->priv Already holds a pointer to our struct strip
|
||||
* netdev_priv(dev) Already holds a pointer to our struct strip
|
||||
*/
|
||||
|
||||
*(MetricomAddress *) & dev->broadcast = broadcast_address;
|
||||
|
|
|
@ -43,7 +43,7 @@ struct hdlc_proto {
|
|||
};
|
||||
|
||||
|
||||
/* Pointed to by dev->priv */
|
||||
/* Pointed to by netdev_priv(dev) */
|
||||
typedef struct hdlc_device {
|
||||
/* used by HDLC layer to take control over HDLC device from hw driver*/
|
||||
int (*attach)(struct net_device *dev,
|
||||
|
|
|
@ -785,7 +785,6 @@ struct net_device
|
|||
/*
|
||||
* One part is mostly used on xmit path (device)
|
||||
*/
|
||||
void *priv; /* pointer to private data */
|
||||
/* These may be needed for future network-power-down code. */
|
||||
unsigned long trans_start; /* Time (in jiffies) of last Tx */
|
||||
|
||||
|
|
|
@ -341,8 +341,8 @@ static const char *mpoa_device_type_string(char type)
|
|||
}
|
||||
|
||||
/*
|
||||
* lec device calls this via its dev->priv->lane2_ops->associate_indicator()
|
||||
* when it sees a TLV in LE_ARP packet.
|
||||
* lec device calls this via its netdev_priv(dev)->lane2_ops
|
||||
* ->associate_indicator() when it sees a TLV in LE_ARP packet.
|
||||
* We fill in the pointer above when we see a LANE2 lec initializing
|
||||
* See LANE2 spec 3.1.5
|
||||
*
|
||||
|
|
|
@ -4378,12 +4378,6 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
|
|||
dev->num_tx_queues = queue_count;
|
||||
dev->real_num_tx_queues = queue_count;
|
||||
|
||||
if (sizeof_priv) {
|
||||
dev->priv = ((char *)dev +
|
||||
((sizeof(struct net_device) + NETDEV_ALIGN_CONST)
|
||||
& ~NETDEV_ALIGN_CONST));
|
||||
}
|
||||
|
||||
dev->gso_max_size = GSO_MAX_SIZE;
|
||||
|
||||
netdev_init_queues(dev);
|
||||
|
|
Загрузка…
Ссылка в новой задаче