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 719ec5a..90a5a7c 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 c213e0d..56c2e99 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 5f92fdb..9752530 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 b6605d4..7dd3377 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 0ebd820..33448a0 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 18e0a80..fa10f13 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 a8ffc1e..f01cfdb 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 47da5fc..974a02d 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 1bd581e..5f70c43 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 e2d25fb..3f445ef 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 8aa8094..a1c0e7b 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 960e985..f484161 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 4a231bd..cc0bc8a 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 958dc28..e0b47cc 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 bab0061..f155928 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 a38aede..e29f495 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 1292d23..a03730b 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];