netdevice: safe convert to netdev_priv() #part-1
We have some reasons to kill netdev->priv: 1. netdev->priv is equal to netdev_priv(). 2. netdev_priv() wraps the calculation of netdev->priv's offset, obviously netdev_priv() is more flexible than netdev->priv. But we cann't kill netdev->priv, because so many drivers reference to it directly. This patch is a safe convert for netdev->priv to netdev_priv(netdev). Since all of the netdev->priv is only for read. But it is too big to be sent in one mail. I split it to 4 parts and make every part smaller than 100,000 bytes, which is max size allowed by vger. Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
7a12122c7a
commit
454d7c9b14
@@ -952,7 +952,7 @@ static int veth_change_mtu(struct net_device *dev, int new_mtu)
|
||||
|
||||
static void veth_set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
struct veth_port *port = (struct veth_port *) dev->priv;
|
||||
struct veth_port *port = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
|
||||
write_lock_irqsave(&port->mcast_gate, flags);
|
||||
@@ -1044,7 +1044,7 @@ static struct net_device *veth_probe_one(int vlan,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
port = (struct veth_port *) dev->priv;
|
||||
port = netdev_priv(dev);
|
||||
|
||||
spin_lock_init(&port->queue_lock);
|
||||
rwlock_init(&port->mcast_gate);
|
||||
@@ -1102,7 +1102,7 @@ static int veth_transmit_to_one(struct sk_buff *skb, HvLpIndex rlp,
|
||||
struct net_device *dev)
|
||||
{
|
||||
struct veth_lpar_connection *cnx = veth_cnx[rlp];
|
||||
struct veth_port *port = (struct veth_port *) dev->priv;
|
||||
struct veth_port *port = netdev_priv(dev);
|
||||
HvLpEvent_Rc rc;
|
||||
struct veth_msg *msg = NULL;
|
||||
unsigned long flags;
|
||||
@@ -1191,7 +1191,7 @@ static void veth_transmit_to_many(struct sk_buff *skb,
|
||||
static int veth_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
unsigned char *frame = skb->data;
|
||||
struct veth_port *port = (struct veth_port *) dev->priv;
|
||||
struct veth_port *port = netdev_priv(dev);
|
||||
HvLpIndexMap lpmask;
|
||||
|
||||
if (! (frame[0] & 0x01)) {
|
||||
@@ -1255,7 +1255,7 @@ static void veth_wake_queues(struct veth_lpar_connection *cnx)
|
||||
if (! dev)
|
||||
continue;
|
||||
|
||||
port = (struct veth_port *)dev->priv;
|
||||
port = netdev_priv(dev);
|
||||
|
||||
if (! (port->lpar_map & (1<<cnx->remote_lp)))
|
||||
continue;
|
||||
@@ -1284,7 +1284,7 @@ static void veth_stop_queues(struct veth_lpar_connection *cnx)
|
||||
if (! dev)
|
||||
continue;
|
||||
|
||||
port = (struct veth_port *)dev->priv;
|
||||
port = netdev_priv(dev);
|
||||
|
||||
/* If this cnx is not on the vlan for this port, continue */
|
||||
if (! (port->lpar_map & (1 << cnx->remote_lp)))
|
||||
@@ -1506,7 +1506,7 @@ static void veth_receive(struct veth_lpar_connection *cnx,
|
||||
continue;
|
||||
}
|
||||
|
||||
port = (struct veth_port *)dev->priv;
|
||||
port = netdev_priv(dev);
|
||||
dest = *((u64 *) skb->data) & 0xFFFFFFFFFFFF0000;
|
||||
|
||||
if ((vlan > HVMAXARCHITECTEDVIRTUALLANS) || !port) {
|
||||
|
Reference in New Issue
Block a user