drivers: net: use skb_headlen()
authorEric Dumazet <eric.dumazet@gmail.com>
Wed, 14 Apr 2010 22:59:40 +0000 (15:59 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 14 Apr 2010 23:11:33 +0000 (16:11 -0700)
replaces (skb->len - skb->data_len) occurrences by skb_headlen(skb)

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 files changed:
drivers/atm/eni.c
drivers/atm/he.c
drivers/net/3c59x.c
drivers/net/atl1e/atl1e_main.c
drivers/net/atlx/atl1.c
drivers/net/benet/be_main.c
drivers/net/chelsio/sge.c
drivers/net/e1000/e1000_main.c
drivers/net/e1000e/netdev.c
drivers/net/ehea/ehea_main.c
drivers/net/forcedeth.c
drivers/net/ixgbevf/ixgbevf_main.c
drivers/net/ksz884x.c
drivers/net/myri10ge/myri10ge.c
drivers/net/s2io.c
drivers/net/tehuti.c
drivers/net/tsi108_eth.c

index 719ec5a0dca547091df22ef8464a5bf2dcbfe241..90a5a7cac740ed195c9a73b62d3288ec3db697fe 100644 (file)
@@ -1131,7 +1131,7 @@ DPRINTK("doing direct send\n"); /* @@@ well, this doesn't work anyway */
                        if (i == -1)
                                put_dma(tx->index,eni_dev->dma,&j,(unsigned long)
                                    skb->data,
-                                   skb->len - skb->data_len);
+                                   skb_headlen(skb));
                        else
                                put_dma(tx->index,eni_dev->dma,&j,(unsigned long)
                                    skb_shinfo(skb)->frags[i].page + skb_shinfo(skb)->frags[i].page_offset,
index c213e0da0343d4d9cda4d7283664537939a3ab8a..56c2e99e458fd7ea85e25f4ee3d5b7e0ed9aa261 100644 (file)
@@ -2664,8 +2664,8 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
 
 #ifdef USE_SCATTERGATHER
        tpd->iovec[slot].addr = pci_map_single(he_dev->pci_dev, skb->data,
-                               skb->len - skb->data_len, PCI_DMA_TODEVICE);
-       tpd->iovec[slot].len = skb->len - skb->data_len;
+                               skb_headlen(skb), PCI_DMA_TODEVICE);
+       tpd->iovec[slot].len = skb_headlen(skb);
        ++slot;
 
        for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
index 5f92fdbe66e2d3d43ab79f839e408adfd3978c6e..97525307ed27c508da243d890948217ec3ccd6ed 100644 (file)
@@ -2129,8 +2129,8 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
                int i;
 
                vp->tx_ring[entry].frag[0].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data,
-                                                                               skb->len-skb->data_len, PCI_DMA_TODEVICE));
-               vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb->len-skb->data_len);
+                                                                               skb_headlen(skb), PCI_DMA_TODEVICE));
+               vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb_headlen(skb));
 
                for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
                        skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
index b6605d433e91bfb21c11e3f3bdafd7894fa1c156..7dd33776de008c07a810a5652a6021530c131779 100644 (file)
@@ -1679,7 +1679,7 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
 {
        struct atl1e_tpd_desc *use_tpd = NULL;
        struct atl1e_tx_buffer *tx_buffer = NULL;
-       u16 buf_len = skb->len - skb->data_len;
+       u16 buf_len = skb_headlen(skb);
        u16 map_len = 0;
        u16 mapped_len = 0;
        u16 hdr_len = 0;
index 0ebd8208f606afdaf0f387ad3353ccb7b3d958e8..33448a09b47f6b5c00ffc5e4df217988cb48980f 100644 (file)
@@ -2347,7 +2347,7 @@ static netdev_tx_t atl1_xmit_frame(struct sk_buff *skb,
 {
        struct atl1_adapter *adapter = netdev_priv(netdev);
        struct atl1_tpd_ring *tpd_ring = &adapter->tpd_ring;
-       int len = skb->len;
+       int len;
        int tso;
        int count = 1;
        int ret_val;
@@ -2359,7 +2359,7 @@ static netdev_tx_t atl1_xmit_frame(struct sk_buff *skb,
        unsigned int f;
        unsigned int proto_hdr_len;
 
-       len -= skb->data_len;
+       len = skb_headlen(skb);
 
        if (unlikely(skb->len <= 0)) {
                dev_kfree_skb_any(skb);
index 18e0a80d3e61e0ba9dd77afbf6ce69849f0dded8..fa10f13242c31cd67f6713b1d649d4074b165307 100644 (file)
@@ -432,7 +432,7 @@ static int make_tx_wrbs(struct be_adapter *adapter,
        map_head = txq->head;
 
        if (skb->len > skb->data_len) {
-               int len = skb->len - skb->data_len;
+               int len = skb_headlen(skb);
                busaddr = pci_map_single(pdev, skb->data, len,
                                         PCI_DMA_TODEVICE);
                if (pci_dma_mapping_error(pdev, busaddr))
@@ -1098,7 +1098,7 @@ static void be_tx_compl_process(struct be_adapter *adapter, u16 last_index)
                cur_index = txq->tail;
                wrb = queue_tail_node(txq);
                unmap_tx_frag(adapter->pdev, wrb, (unmap_skb_hdr &&
-                                       sent_skb->len > sent_skb->data_len));
+                                       skb_headlen(sent_skb)));
                unmap_skb_hdr = false;
 
                num_wrbs++;
index a8ffc1e11c5fd6fd218377fd6217602f65574f69..f01cfdb995deaef8a04d74b5d997a8fb1e74b6dd 100644 (file)
@@ -1123,7 +1123,7 @@ static inline unsigned int compute_large_page_tx_descs(struct sk_buff *skb)
 
        if (PAGE_SIZE > SGE_TX_DESC_MAX_PLEN) {
                unsigned int nfrags = skb_shinfo(skb)->nr_frags;
-               unsigned int i, len = skb->len - skb->data_len;
+               unsigned int i, len = skb_headlen(skb);
                while (len > SGE_TX_DESC_MAX_PLEN) {
                        count++;
                        len -= SGE_TX_DESC_MAX_PLEN;
@@ -1219,10 +1219,10 @@ static inline void write_tx_descs(struct adapter *adapter, struct sk_buff *skb,
        ce = &q->centries[pidx];
 
        mapping = pci_map_single(adapter->pdev, skb->data,
-                               skb->len - skb->data_len, PCI_DMA_TODEVICE);
+                                skb_headlen(skb), PCI_DMA_TODEVICE);
 
        desc_mapping = mapping;
-       desc_len = skb->len - skb->data_len;
+       desc_len = skb_headlen(skb);
 
        flags = F_CMD_DATAVALID | F_CMD_SOP |
            V_CMD_EOP(nfrags == 0 && desc_len <= SGE_TX_DESC_MAX_PLEN) |
@@ -1258,7 +1258,7 @@ static inline void write_tx_descs(struct adapter *adapter, struct sk_buff *skb,
 
        ce->skb = NULL;
        dma_unmap_addr_set(ce, dma_addr, mapping);
-       dma_unmap_len_set(ce, dma_len, skb->len - skb->data_len);
+       dma_unmap_len_set(ce, dma_len, skb_headlen(skb));
 
        for (i = 0; nfrags--; i++) {
                skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
index 47da5fc1e9f41ffd2ce57ba364d5446d8f958fd3..974a02d818234306b0f679069a6292d21c5a7a55 100644 (file)
@@ -2929,7 +2929,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
        unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD;
        unsigned int max_txd_pwr = E1000_MAX_TXD_PWR;
        unsigned int tx_flags = 0;
-       unsigned int len = skb->len - skb->data_len;
+       unsigned int len = skb_headlen(skb);
        unsigned int nr_frags;
        unsigned int mss;
        int count = 0;
@@ -2980,7 +2980,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
                                        dev_kfree_skb_any(skb);
                                        return NETDEV_TX_OK;
                                }
-                               len = skb->len - skb->data_len;
+                               len = skb_headlen(skb);
                                break;
                        default:
                                /* do nothing */
index 1bd581eedd06b0cf3ab6d836cddc86a8bb233c31..5f70c437fa41052f90ded16a092cb75e38981603 100644 (file)
@@ -4132,7 +4132,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
        unsigned int max_per_txd = E1000_MAX_PER_TXD;
        unsigned int max_txd_pwr = E1000_MAX_TXD_PWR;
        unsigned int tx_flags = 0;
-       unsigned int len = skb->len - skb->data_len;
+       unsigned int len = skb_headlen(skb);
        unsigned int nr_frags;
        unsigned int mss;
        int count = 0;
@@ -4182,7 +4182,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
                                dev_kfree_skb_any(skb);
                                return NETDEV_TX_OK;
                        }
-                       len = skb->len - skb->data_len;
+                       len = skb_headlen(skb);
                }
        }
 
index e2d25fbb6d28d6fde02d7a8052df833bcfad30ff..3f445efa94828bf97f48fd0ccdd925d10f1a1070 100644 (file)
@@ -1618,7 +1618,7 @@ static void write_swqe2_TSO(struct sk_buff *skb,
 {
        struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry;
        u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0];
-       int skb_data_size = skb->len - skb->data_len;
+       int skb_data_size = skb_headlen(skb);
        int headersize;
 
        /* Packet is TCP with TSO enabled */
@@ -1629,7 +1629,7 @@ static void write_swqe2_TSO(struct sk_buff *skb,
         */
        headersize = ETH_HLEN + ip_hdrlen(skb) + tcp_hdrlen(skb);
 
-       skb_data_size = skb->len - skb->data_len;
+       skb_data_size = skb_headlen(skb);
 
        if (skb_data_size >= headersize) {
                /* copy immediate data */
@@ -1651,7 +1651,7 @@ static void write_swqe2_TSO(struct sk_buff *skb,
 static void write_swqe2_nonTSO(struct sk_buff *skb,
                               struct ehea_swqe *swqe, u32 lkey)
 {
-       int skb_data_size = skb->len - skb->data_len;
+       int skb_data_size = skb_headlen(skb);
        u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0];
        struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry;
 
@@ -2108,8 +2108,8 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
        } else {
                /* first copy data from the skb->data buffer ... */
                skb_copy_from_linear_data(skb, imm_data,
-                                         skb->len - skb->data_len);
-               imm_data += skb->len - skb->data_len;
+                                         skb_headlen(skb));
+               imm_data += skb_headlen(skb);
 
                /* ... then copy data from the fragments */
                for (i = 0; i < nfrags; i++) {
index 8aa80946d835c5657a98219fffe26009e7e26489..a1c0e7bb70e88f71fa19cd9eede14668ec5c24ea 100644 (file)
@@ -2148,7 +2148,7 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
        unsigned int i;
        u32 offset = 0;
        u32 bcnt;
-       u32 size = skb->len-skb->data_len;
+       u32 size = skb_headlen(skb);
        u32 entries = (size >> NV_TX2_TSO_MAX_SHIFT) + ((size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
        u32 empty_slots;
        struct ring_desc* put_tx;
@@ -2269,7 +2269,7 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb,
        unsigned int i;
        u32 offset = 0;
        u32 bcnt;
-       u32 size = skb->len-skb->data_len;
+       u32 size = skb_headlen(skb);
        u32 entries = (size >> NV_TX2_TSO_MAX_SHIFT) + ((size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
        u32 empty_slots;
        struct ring_desc_ex* put_tx;
index 960e98532ee26d4885d8b77666f6ec528a6c7dee..f484161418b61976ae540517fe47145657731f9c 100644 (file)
@@ -604,7 +604,7 @@ static bool ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
                 * packets not getting split correctly
                 */
                if (staterr & IXGBE_RXD_STAT_LB) {
-                       u32 header_fixup_len = skb->len - skb->data_len;
+                       u32 header_fixup_len = skb_headlen(skb);
                        if (header_fixup_len < 14)
                                skb_push(skb, header_fixup_len);
                }
index 4a231bdb5671dbf7ce0f7f83288147b2ee1afabc..cc0bc8a260859a72b0d87acb78328450f5af7aac 100644 (file)
@@ -4684,7 +4684,7 @@ static void send_packet(struct sk_buff *skb, struct net_device *dev)
                int frag;
                skb_frag_t *this_frag;
 
-               dma_buf->len = skb->len - skb->data_len;
+               dma_buf->len = skb_headlen(skb);
 
                dma_buf->dma = pci_map_single(
                        hw_priv->pdev, skb->data, dma_buf->len,
index 958dc283d0e79aff5daa528acb5b8e089c61f945..e0b47cc8a86e7600da43d0cb4915d7e58feb06b4 100644 (file)
@@ -2757,7 +2757,7 @@ again:
        }
 
        /* map the skb for DMA */
-       len = skb->len - skb->data_len;
+       len = skb_headlen(skb);
        idx = tx->req & tx->mask;
        tx->info[idx].skb = skb;
        bus = pci_map_single(mgp->pdev, skb->data, len, PCI_DMA_TODEVICE);
index bab0061f30f1ddbae98c0049ffde4da64824333b..f155928bf14ecfbbfc5db1daa1d5936b2a29fa2f 100644 (file)
@@ -2400,7 +2400,7 @@ static struct sk_buff *s2io_txdl_getskb(struct fifo_info *fifo_data,
                return NULL;
        }
        pci_unmap_single(nic->pdev, (dma_addr_t)txds->Buffer_Pointer,
-                        skb->len - skb->data_len, PCI_DMA_TODEVICE);
+                        skb_headlen(skb), PCI_DMA_TODEVICE);
        frg_cnt = skb_shinfo(skb)->nr_frags;
        if (frg_cnt) {
                txds++;
@@ -4202,7 +4202,7 @@ static netdev_tx_t s2io_xmit(struct sk_buff *skb, struct net_device *dev)
                txdp->Control_2 |= TXD_VLAN_TAG(vlan_tag);
        }
 
-       frg_len = skb->len - skb->data_len;
+       frg_len = skb_headlen(skb);
        if (offload_type == SKB_GSO_UDP) {
                int ufo_size;
 
index a38aede5c8d676735b474aad90f3116b018040cb..e29f495c6a2beb94140e58b9a5f8deddb8558258 100644 (file)
@@ -1508,7 +1508,7 @@ bdx_tx_map_skb(struct bdx_priv *priv, struct sk_buff *skb,
        int nr_frags = skb_shinfo(skb)->nr_frags;
        int i;
 
-       db->wptr->len = skb->len - skb->data_len;
+       db->wptr->len = skb_headlen(skb);
        db->wptr->addr.dma = pci_map_single(priv->pdev, skb->data,
                                            db->wptr->len, PCI_DMA_TODEVICE);
        pbl->len = CPU_CHIP_SWAP32(db->wptr->len);
index 1292d2344a3435848c0f35c9ce3fa4ac74246163..a03730bd1da54aaee6073921e2a6ddd08a137e36 100644 (file)
@@ -704,8 +704,8 @@ static int tsi108_send_packet(struct sk_buff * skb, struct net_device *dev)
 
                if (i == 0) {
                        data->txring[tx].buf0 = dma_map_single(NULL, skb->data,
-                                       skb->len - skb->data_len, DMA_TO_DEVICE);
-                       data->txring[tx].len = skb->len - skb->data_len;
+                                       skb_headlen(skb), DMA_TO_DEVICE);
+                       data->txring[tx].len = skb_headlen(skb);
                        misc |= TSI108_TX_SOF;
                } else {
                        skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1];