diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-19 23:29:13 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:26:28 -0400 |
commit | 27a884dc3cb63b93c2b3b643f5b31eed5f8a4d26 (patch) | |
tree | 5a267e40f9b94014be38dad5de0a52b6628834e0 /drivers/net | |
parent | be8bd86321fa7f06359d866ef61fb4d2f3e9dce9 (diff) |
[SK_BUFF]: Convert skb->tail to sk_buff_data_t
So that it is also an offset from skb->head, reduces its size from 8 to 4 bytes
on 64bit architectures, allowing us to combine the 4 bytes hole left by the
layer headers conversion, reducing struct sk_buff size to 256 bytes, i.e. 4
64byte cachelines, and since the sk_buff slab cache is SLAB_HWCACHE_ALIGN...
:-)
Many calculations that previously required that skb->{transport,network,
mac}_header be first converted to a pointer now can be done directly, being
meaningful as offsets or pointers.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/cris/eth_v10.c | 2 | ||||
-rw-r--r-- | drivers/net/cxgb3/sge.c | 6 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 4 | ||||
-rw-r--r-- | drivers/net/ibm_emac/ibm_emac_core.c | 2 | ||||
-rw-r--r-- | drivers/net/macb.c | 3 | ||||
-rw-r--r-- | drivers/net/pcmcia/nmclan_cs.c | 2 | ||||
-rw-r--r-- | drivers/net/s2io.c | 4 | ||||
-rw-r--r-- | drivers/net/tulip/uli526x.c | 14 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_fr.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/lmc/lmc_main.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_80211_rx.c | 2 |
11 files changed, 27 insertions, 18 deletions
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index 98643801a3b0..7feb9c561147 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -1348,7 +1348,7 @@ e100_rx(struct net_device *dev) | |||
1348 | 1348 | ||
1349 | #ifdef ETHDEBUG | 1349 | #ifdef ETHDEBUG |
1350 | printk("head = 0x%x, data = 0x%x, tail = 0x%x, end = 0x%x\n", | 1350 | printk("head = 0x%x, data = 0x%x, tail = 0x%x, end = 0x%x\n", |
1351 | skb->head, skb->data, skb->tail, skb->end); | 1351 | skb->head, skb->data, skb_tail_pointer(skb), skb->end); |
1352 | printk("copying packet to 0x%x.\n", skb_data_ptr); | 1352 | printk("copying packet to 0x%x.\n", skb_data_ptr); |
1353 | #endif | 1353 | #endif |
1354 | 1354 | ||
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 610e4769efa4..c5faf1380e15 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -1325,13 +1325,13 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, | |||
1325 | flits = skb_transport_offset(skb) / 8; | 1325 | flits = skb_transport_offset(skb) / 8; |
1326 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; | 1326 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; |
1327 | sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb), | 1327 | sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb), |
1328 | skb->tail - skb_transport_header(skb), | 1328 | skb->tail - skb->transport_header, |
1329 | adap->pdev); | 1329 | adap->pdev); |
1330 | if (need_skb_unmap()) { | 1330 | if (need_skb_unmap()) { |
1331 | setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); | 1331 | setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); |
1332 | skb->destructor = deferred_unmap_destructor; | 1332 | skb->destructor = deferred_unmap_destructor; |
1333 | ((struct unmap_info *)skb->cb)->len = (skb->tail - | 1333 | ((struct unmap_info *)skb->cb)->len = (skb->tail - |
1334 | skb_transport_header(skb)); | 1334 | skb->transport_header); |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, | 1337 | write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, |
@@ -1353,7 +1353,7 @@ static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb) | |||
1353 | return 1; /* packet fits as immediate data */ | 1353 | return 1; /* packet fits as immediate data */ |
1354 | 1354 | ||
1355 | flits = skb_transport_offset(skb) / 8; /* headers */ | 1355 | flits = skb_transport_offset(skb) / 8; /* headers */ |
1356 | if (skb->tail != skb_transport_header(skb)) | 1356 | if (skb->tail != skb->transport_header) |
1357 | cnt++; | 1357 | cnt++; |
1358 | return flits_to_desc(flits + sgl_len(cnt)); | 1358 | return flits_to_desc(flits + sgl_len(cnt)); |
1359 | } | 1359 | } |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index e86deb2ef823..e7c93f44f810 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -3304,7 +3304,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
3304 | * NOTE: this is a TSO only workaround | 3304 | * NOTE: this is a TSO only workaround |
3305 | * if end byte alignment not correct move us | 3305 | * if end byte alignment not correct move us |
3306 | * into the next dword */ | 3306 | * into the next dword */ |
3307 | if ((unsigned long)(skb->tail - 1) & 4) | 3307 | if ((unsigned long)(skb_tail_pointer(skb) - 1) & 4) |
3308 | break; | 3308 | break; |
3309 | /* fall through */ | 3309 | /* fall through */ |
3310 | case e1000_82571: | 3310 | case e1000_82571: |
@@ -4388,7 +4388,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
4388 | PCI_DMA_FROMDEVICE); | 4388 | PCI_DMA_FROMDEVICE); |
4389 | vaddr = kmap_atomic(ps_page->ps_page[0], | 4389 | vaddr = kmap_atomic(ps_page->ps_page[0], |
4390 | KM_SKB_DATA_SOFTIRQ); | 4390 | KM_SKB_DATA_SOFTIRQ); |
4391 | memcpy(skb->tail, vaddr, l1); | 4391 | memcpy(skb_tail_pointer(skb), vaddr, l1); |
4392 | kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); | 4392 | kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); |
4393 | pci_dma_sync_single_for_device(pdev, | 4393 | pci_dma_sync_single_for_device(pdev, |
4394 | ps_page_dma->ps_page_dma[0], | 4394 | ps_page_dma->ps_page_dma[0], |
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c index b1ad62d89eb9..3d82d46f4998 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.c +++ b/drivers/net/ibm_emac/ibm_emac_core.c | |||
@@ -1338,7 +1338,7 @@ static inline int emac_rx_sg_append(struct ocp_enet_private *dev, int slot) | |||
1338 | dev_kfree_skb(dev->rx_sg_skb); | 1338 | dev_kfree_skb(dev->rx_sg_skb); |
1339 | dev->rx_sg_skb = NULL; | 1339 | dev->rx_sg_skb = NULL; |
1340 | } else { | 1340 | } else { |
1341 | cacheable_memcpy(dev->rx_sg_skb->tail, | 1341 | cacheable_memcpy(skb_tail_pointer(dev->rx_sg_skb), |
1342 | dev->rx_skb[slot]->data, len); | 1342 | dev->rx_skb[slot]->data, len); |
1343 | skb_put(dev->rx_sg_skb, len); | 1343 | skb_put(dev->rx_sg_skb, len); |
1344 | emac_recycle_rx_skb(dev, slot, len); | 1344 | emac_recycle_rx_skb(dev, slot, len); |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 0c3649be0d05..98bf51afcee7 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -575,7 +575,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
575 | int i; | 575 | int i; |
576 | dev_dbg(&bp->pdev->dev, | 576 | dev_dbg(&bp->pdev->dev, |
577 | "start_xmit: len %u head %p data %p tail %p end %p\n", | 577 | "start_xmit: len %u head %p data %p tail %p end %p\n", |
578 | skb->len, skb->head, skb->data, skb->tail, skb->end); | 578 | skb->len, skb->head, skb->data, |
579 | skb_tail_pointer(skb), skb->end); | ||
579 | dev_dbg(&bp->pdev->dev, | 580 | dev_dbg(&bp->pdev->dev, |
580 | "data:"); | 581 | "data:"); |
581 | for (i = 0; i < 16; i++) | 582 | for (i = 0; i < 16; i++) |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index ec0af65cd5d7..73da611fd536 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -1185,7 +1185,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) | |||
1185 | skb_reserve(skb, 2); | 1185 | skb_reserve(skb, 2); |
1186 | insw(ioaddr + AM2150_RCV, skb_put(skb, pkt_len), pkt_len>>1); | 1186 | insw(ioaddr + AM2150_RCV, skb_put(skb, pkt_len), pkt_len>>1); |
1187 | if (pkt_len & 1) | 1187 | if (pkt_len & 1) |
1188 | *(skb->tail-1) = inb(ioaddr + AM2150_RCV); | 1188 | *(skb_tail_pointer(skb) - 1) = inb(ioaddr + AM2150_RCV); |
1189 | skb->protocol = eth_type_trans(skb, dev); | 1189 | skb->protocol = eth_type_trans(skb, dev); |
1190 | 1190 | ||
1191 | netif_rx(skb); /* Send the packet to the upper (protocol) layers. */ | 1191 | netif_rx(skb); /* Send the packet to the upper (protocol) layers. */ |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 46ebf141ee5a..600d3ff347fc 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -2195,7 +2195,7 @@ static int fill_rxd_3buf(struct s2io_nic *nic, struct RxD_t *rxdp, struct \ | |||
2195 | frag_list->next = NULL; | 2195 | frag_list->next = NULL; |
2196 | tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1); | 2196 | tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1); |
2197 | frag_list->data = tmp; | 2197 | frag_list->data = tmp; |
2198 | frag_list->tail = tmp; | 2198 | skb_reset_tail_pointer(frag_list); |
2199 | 2199 | ||
2200 | /* Buffer-2 receives L4 data payload */ | 2200 | /* Buffer-2 receives L4 data payload */ |
2201 | ((struct RxD3*)rxdp)->Buffer2_ptr = pci_map_single(nic->pdev, | 2201 | ((struct RxD3*)rxdp)->Buffer2_ptr = pci_map_single(nic->pdev, |
@@ -2349,7 +2349,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
2349 | tmp += ALIGN_SIZE; | 2349 | tmp += ALIGN_SIZE; |
2350 | tmp &= ~ALIGN_SIZE; | 2350 | tmp &= ~ALIGN_SIZE; |
2351 | skb->data = (void *) (unsigned long)tmp; | 2351 | skb->data = (void *) (unsigned long)tmp; |
2352 | skb->tail = (void *) (unsigned long)tmp; | 2352 | skb_reset_tail_pointer(skb); |
2353 | 2353 | ||
2354 | if (!(((struct RxD3*)rxdp)->Buffer0_ptr)) | 2354 | if (!(((struct RxD3*)rxdp)->Buffer0_ptr)) |
2355 | ((struct RxD3*)rxdp)->Buffer0_ptr = | 2355 | ((struct RxD3*)rxdp)->Buffer0_ptr = |
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 9a5850fa644a..e46f4cb02c15 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -829,7 +829,9 @@ static void uli526x_rx_packet(struct net_device *dev, struct uli526x_board_info | |||
829 | != NULL) ) { | 829 | != NULL) ) { |
830 | /* size less than COPY_SIZE, allocate a rxlen SKB */ | 830 | /* size less than COPY_SIZE, allocate a rxlen SKB */ |
831 | skb_reserve(skb, 2); /* 16byte align */ | 831 | skb_reserve(skb, 2); /* 16byte align */ |
832 | memcpy(skb_put(skb, rxlen), rxptr->rx_skb_ptr->tail, rxlen); | 832 | memcpy(skb_put(skb, rxlen), |
833 | skb_tail_pointer(rxptr->rx_skb_ptr), | ||
834 | rxlen); | ||
833 | uli526x_reuse_skb(db, rxptr->rx_skb_ptr); | 835 | uli526x_reuse_skb(db, rxptr->rx_skb_ptr); |
834 | } else | 836 | } else |
835 | skb_put(skb, rxlen); | 837 | skb_put(skb, rxlen); |
@@ -1175,7 +1177,10 @@ static void uli526x_reuse_skb(struct uli526x_board_info *db, struct sk_buff * sk | |||
1175 | 1177 | ||
1176 | if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) { | 1178 | if (!(rxptr->rdes0 & cpu_to_le32(0x80000000))) { |
1177 | rxptr->rx_skb_ptr = skb; | 1179 | rxptr->rx_skb_ptr = skb; |
1178 | rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); | 1180 | rxptr->rdes2 = cpu_to_le32(pci_map_single(db->pdev, |
1181 | skb_tail_pointer(skb), | ||
1182 | RX_ALLOC_SIZE, | ||
1183 | PCI_DMA_FROMDEVICE)); | ||
1179 | wmb(); | 1184 | wmb(); |
1180 | rxptr->rdes0 = cpu_to_le32(0x80000000); | 1185 | rxptr->rdes0 = cpu_to_le32(0x80000000); |
1181 | db->rx_avail_cnt++; | 1186 | db->rx_avail_cnt++; |
@@ -1339,7 +1344,10 @@ static void allocate_rx_buffer(struct uli526x_board_info *db) | |||
1339 | if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL ) | 1344 | if ( ( skb = dev_alloc_skb(RX_ALLOC_SIZE) ) == NULL ) |
1340 | break; | 1345 | break; |
1341 | rxptr->rx_skb_ptr = skb; /* FIXME (?) */ | 1346 | rxptr->rx_skb_ptr = skb; /* FIXME (?) */ |
1342 | rxptr->rdes2 = cpu_to_le32( pci_map_single(db->pdev, skb->tail, RX_ALLOC_SIZE, PCI_DMA_FROMDEVICE) ); | 1347 | rxptr->rdes2 = cpu_to_le32(pci_map_single(db->pdev, |
1348 | skb_tail_pointer(skb), | ||
1349 | RX_ALLOC_SIZE, | ||
1350 | PCI_DMA_FROMDEVICE)); | ||
1343 | wmb(); | 1351 | wmb(); |
1344 | rxptr->rdes0 = cpu_to_le32(0x80000000); | 1352 | rxptr->rdes0 = cpu_to_le32(0x80000000); |
1345 | rxptr = rxptr->next_rx_desc; | 1353 | rxptr = rxptr->next_rx_desc; |
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index b747228c7198..aeb2789adf26 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -533,7 +533,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep) | |||
533 | skb->protocol = __constant_htons(NLPID_CCITT_ANSI_LMI); | 533 | skb->protocol = __constant_htons(NLPID_CCITT_ANSI_LMI); |
534 | fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); | 534 | fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); |
535 | } | 535 | } |
536 | data = skb->tail; | 536 | data = skb_tail_pointer(skb); |
537 | data[i++] = LMI_CALLREF; | 537 | data[i++] = LMI_CALLREF; |
538 | data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; | 538 | data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; |
539 | if (lmi == LMI_ANSI) | 539 | if (lmi == LMI_ANSI) |
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index d4851465c83b..b731f3aae0df 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c | |||
@@ -1636,7 +1636,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1636 | if (nsb) { | 1636 | if (nsb) { |
1637 | sc->lmc_rxq[i] = nsb; | 1637 | sc->lmc_rxq[i] = nsb; |
1638 | nsb->dev = dev; | 1638 | nsb->dev = dev; |
1639 | sc->lmc_rxring[i].buffer1 = virt_to_bus (nsb->tail); | 1639 | sc->lmc_rxring[i].buffer1 = virt_to_bus(skb_tail_pointer(nsb)); |
1640 | } | 1640 | } |
1641 | sc->failed_recv_alloc = 1; | 1641 | sc->failed_recv_alloc = 1; |
1642 | goto skip_packet; | 1642 | goto skip_packet; |
@@ -1679,7 +1679,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ | |||
1679 | if (nsb) { | 1679 | if (nsb) { |
1680 | sc->lmc_rxq[i] = nsb; | 1680 | sc->lmc_rxq[i] = nsb; |
1681 | nsb->dev = dev; | 1681 | nsb->dev = dev; |
1682 | sc->lmc_rxring[i].buffer1 = virt_to_bus (nsb->tail); | 1682 | sc->lmc_rxring[i].buffer1 = virt_to_bus(skb_tail_pointer(nsb)); |
1683 | /* Transferred to 21140 below */ | 1683 | /* Transferred to 21140 below */ |
1684 | } | 1684 | } |
1685 | else { | 1685 | else { |
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c index 35a3a50724fe..5e3e9e262706 100644 --- a/drivers/net/wireless/hostap/hostap_80211_rx.c +++ b/drivers/net/wireless/hostap/hostap_80211_rx.c | |||
@@ -922,7 +922,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, | |||
922 | if (frag != 0) | 922 | if (frag != 0) |
923 | flen -= hdrlen; | 923 | flen -= hdrlen; |
924 | 924 | ||
925 | if (frag_skb->tail + flen > frag_skb->end) { | 925 | if (skb_tail_pointer(frag_skb) + flen > frag_skb->end) { |
926 | printk(KERN_WARNING "%s: host decrypted and " | 926 | printk(KERN_WARNING "%s: host decrypted and " |
927 | "reassembled frame did not fit skb\n", | 927 | "reassembled frame did not fit skb\n", |
928 | dev->name); | 928 | dev->name); |