]> Pileus Git - ~andy/linux/blobdiff - net/8021q/vlan_dev.c
net: use skb_fill_page_desc() in zerocopy_sg_from_iovec()
[~andy/linux] / net / 8021q / vlan_dev.c
index 3a8c8fd63c88e2c204a8f1ac3b6dc4eb3f15cc63..9ab8a7ed99c0e983c1d6a0c97b378f3b70c4397f 100644 (file)
@@ -73,6 +73,8 @@ vlan_dev_get_egress_qos_mask(struct net_device *dev, struct sk_buff *skb)
 {
        struct vlan_priority_tci_mapping *mp;
 
+       smp_rmb(); /* coupled with smp_wmb() in vlan_dev_set_egress_priority() */
+
        mp = vlan_dev_priv(dev)->egress_priority_map[(skb->priority & 0xF)];
        while (mp) {
                if (mp->priority == skb->priority) {
@@ -105,10 +107,10 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
        u16 vlan_tci = 0;
        int rc;
 
-       if (!(vlan_dev_priv(dev)->flags & VLAN_FLAG_REORDER_HDR)) {
+       if (!(vlan->flags & VLAN_FLAG_REORDER_HDR)) {
                vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN);
 
-               vlan_tci = vlan_dev_priv(dev)->vlan_id;
+               vlan_tci = vlan->vlan_id;
                vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
                vhdr->h_vlan_TCI = htons(vlan_tci);
 
@@ -131,7 +133,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
                saddr = dev->dev_addr;
 
        /* Now make the underlying real hard header */
-       dev = vlan_dev_priv(dev)->real_dev;
+       dev = vlan->real_dev;
        rc = dev_hard_header(skb, dev, type, daddr, saddr, len + vhdrlen);
        if (rc > 0)
                rc += vhdrlen;
@@ -249,6 +251,11 @@ int vlan_dev_set_egress_priority(const struct net_device *dev,
        np->next = mp;
        np->priority = skb_prio;
        np->vlan_qos = vlan_qos;
+       /* Before inserting this element in hash table, make sure all its fields
+        * are committed to memory.
+        * coupled with smp_rmb() in vlan_dev_get_egress_qos_mask()
+        */
+       smp_wmb();
        vlan->egress_priority_map[skb_prio & 0xF] = np;
        if (vlan_qos)
                vlan->nr_egress_mappings++;