diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-19 23:43:29 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:26:29 -0400 |
commit | 4305b541357ddbd205aa145dc378926b7cb12283 (patch) | |
tree | 9b1f57ee4ee757a9324c48a7dea84bc8c279ad82 | |
parent | 27a884dc3cb63b93c2b3b643f5b31eed5f8a4d26 (diff) |
[SK_BUFF]: Convert skb->end to sk_buff_data_t
Now to convert the last one, skb->data, that will allow many simplifications
and removal of some of the offset helpers.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/ia64/sn/kernel/xpnet.c | 6 | ||||
-rw-r--r-- | drivers/atm/ambassador.c | 2 | ||||
-rw-r--r-- | drivers/atm/idt77252.c | 24 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb3/iwch_cm.c | 2 | ||||
-rw-r--r-- | drivers/net/cris/eth_v10.c | 3 | ||||
-rw-r--r-- | drivers/net/forcedeth.c | 30 | ||||
-rw-r--r-- | drivers/net/macb.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/lmc/lmc_main.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_80211_rx.c | 2 | ||||
-rw-r--r-- | drivers/usb/atm/usbatm.c | 4 | ||||
-rw-r--r-- | include/linux/skbuff.h | 23 | ||||
-rw-r--r-- | net/atm/lec.c | 2 | ||||
-rw-r--r-- | net/core/skbuff.c | 51 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_rx.c | 2 | ||||
-rw-r--r-- | net/netlink/af_netlink.c | 2 |
15 files changed, 101 insertions, 56 deletions
diff --git a/arch/ia64/sn/kernel/xpnet.c b/arch/ia64/sn/kernel/xpnet.c index eb416c95967d..98d79142f32b 100644 --- a/arch/ia64/sn/kernel/xpnet.c +++ b/arch/ia64/sn/kernel/xpnet.c | |||
@@ -264,7 +264,7 @@ xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg) | |||
264 | 264 | ||
265 | dev_dbg(xpnet, "<skb->head=0x%p skb->data=0x%p skb->tail=0x%p " | 265 | dev_dbg(xpnet, "<skb->head=0x%p skb->data=0x%p skb->tail=0x%p " |
266 | "skb->end=0x%p skb->len=%d\n", (void *) skb->head, | 266 | "skb->end=0x%p skb->len=%d\n", (void *) skb->head, |
267 | (void *)skb->data, skb_tail_pointer(skb), (void *)skb->end, | 267 | (void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), |
268 | skb->len); | 268 | skb->len); |
269 | 269 | ||
270 | skb->protocol = eth_type_trans(skb, xpnet_device); | 270 | skb->protocol = eth_type_trans(skb, xpnet_device); |
@@ -273,7 +273,7 @@ xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg) | |||
273 | dev_dbg(xpnet, "passing skb to network layer; \n\tskb->head=0x%p " | 273 | dev_dbg(xpnet, "passing skb to network layer; \n\tskb->head=0x%p " |
274 | "skb->data=0x%p skb->tail=0x%p skb->end=0x%p skb->len=%d\n", | 274 | "skb->data=0x%p skb->tail=0x%p skb->end=0x%p skb->len=%d\n", |
275 | (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb), | 275 | (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb), |
276 | (void *) skb->end, skb->len); | 276 | skb_end_pointer(skb), skb->len); |
277 | 277 | ||
278 | 278 | ||
279 | xpnet_device->last_rx = jiffies; | 279 | xpnet_device->last_rx = jiffies; |
@@ -475,7 +475,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
475 | 475 | ||
476 | dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p " | 476 | dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p " |
477 | "skb->end=0x%p skb->len=%d\n", (void *) skb->head, | 477 | "skb->end=0x%p skb->len=%d\n", (void *) skb->head, |
478 | (void *)skb->data, skb_tail_pointer(skb), (void *)skb->end, | 478 | (void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), |
479 | skb->len); | 479 | skb->len); |
480 | 480 | ||
481 | 481 | ||
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c index 3c372e08f77d..59651abfa4f8 100644 --- a/drivers/atm/ambassador.c +++ b/drivers/atm/ambassador.c | |||
@@ -821,7 +821,7 @@ static inline void fill_rx_pool (amb_dev * dev, unsigned char pool, | |||
821 | } | 821 | } |
822 | // cast needed as there is no %? for pointer differences | 822 | // cast needed as there is no %? for pointer differences |
823 | PRINTD (DBG_SKB, "allocated skb at %p, head %p, area %li", | 823 | PRINTD (DBG_SKB, "allocated skb at %p, head %p, area %li", |
824 | skb, skb->head, (long) (skb->end - skb->head)); | 824 | skb, skb->head, (long) (skb_end_pointer(skb) - skb->head)); |
825 | rx.handle = virt_to_bus (skb); | 825 | rx.handle = virt_to_bus (skb); |
826 | rx.host_address = cpu_to_be32 (virt_to_bus (skb->data)); | 826 | rx.host_address = cpu_to_be32 (virt_to_bus (skb->data)); |
827 | if (rx_give (dev, &rx, pool)) | 827 | if (rx_give (dev, &rx, pool)) |
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index 1e49799cd6cf..20f2a3a82656 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c | |||
@@ -1065,7 +1065,8 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) | |||
1065 | vcc = vc->rx_vcc; | 1065 | vcc = vc->rx_vcc; |
1066 | 1066 | ||
1067 | pci_dma_sync_single_for_cpu(card->pcidev, IDT77252_PRV_PADDR(skb), | 1067 | pci_dma_sync_single_for_cpu(card->pcidev, IDT77252_PRV_PADDR(skb), |
1068 | skb->end - skb->data, PCI_DMA_FROMDEVICE); | 1068 | skb_end_pointer(skb) - skb->data, |
1069 | PCI_DMA_FROMDEVICE); | ||
1069 | 1070 | ||
1070 | if ((vcc->qos.aal == ATM_AAL0) || | 1071 | if ((vcc->qos.aal == ATM_AAL0) || |
1071 | (vcc->qos.aal == ATM_AAL34)) { | 1072 | (vcc->qos.aal == ATM_AAL34)) { |
@@ -1194,7 +1195,8 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) | |||
1194 | } | 1195 | } |
1195 | 1196 | ||
1196 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), | 1197 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), |
1197 | skb->end - skb->data, PCI_DMA_FROMDEVICE); | 1198 | skb_end_pointer(skb) - skb->data, |
1199 | PCI_DMA_FROMDEVICE); | ||
1198 | sb_pool_remove(card, skb); | 1200 | sb_pool_remove(card, skb); |
1199 | 1201 | ||
1200 | skb_trim(skb, len); | 1202 | skb_trim(skb, len); |
@@ -1267,7 +1269,7 @@ idt77252_rx_raw(struct idt77252_dev *card) | |||
1267 | tail = readl(SAR_REG_RAWCT); | 1269 | tail = readl(SAR_REG_RAWCT); |
1268 | 1270 | ||
1269 | pci_dma_sync_single_for_cpu(card->pcidev, IDT77252_PRV_PADDR(queue), | 1271 | pci_dma_sync_single_for_cpu(card->pcidev, IDT77252_PRV_PADDR(queue), |
1270 | queue->end - queue->head - 16, | 1272 | skb_end_pointer(queue) - queue->head - 16, |
1271 | PCI_DMA_FROMDEVICE); | 1273 | PCI_DMA_FROMDEVICE); |
1272 | 1274 | ||
1273 | while (head != tail) { | 1275 | while (head != tail) { |
@@ -1363,7 +1365,8 @@ drop: | |||
1363 | queue = card->raw_cell_head; | 1365 | queue = card->raw_cell_head; |
1364 | pci_dma_sync_single_for_cpu(card->pcidev, | 1366 | pci_dma_sync_single_for_cpu(card->pcidev, |
1365 | IDT77252_PRV_PADDR(queue), | 1367 | IDT77252_PRV_PADDR(queue), |
1366 | queue->end - queue->data, | 1368 | (skb_end_pointer(queue) - |
1369 | queue->data), | ||
1367 | PCI_DMA_FROMDEVICE); | 1370 | PCI_DMA_FROMDEVICE); |
1368 | } else { | 1371 | } else { |
1369 | card->raw_cell_head = NULL; | 1372 | card->raw_cell_head = NULL; |
@@ -1875,7 +1878,7 @@ add_rx_skb(struct idt77252_dev *card, int queue, | |||
1875 | } | 1878 | } |
1876 | 1879 | ||
1877 | paddr = pci_map_single(card->pcidev, skb->data, | 1880 | paddr = pci_map_single(card->pcidev, skb->data, |
1878 | skb->end - skb->data, | 1881 | skb_end_pointer(skb) - skb->data, |
1879 | PCI_DMA_FROMDEVICE); | 1882 | PCI_DMA_FROMDEVICE); |
1880 | IDT77252_PRV_PADDR(skb) = paddr; | 1883 | IDT77252_PRV_PADDR(skb) = paddr; |
1881 | 1884 | ||
@@ -1889,7 +1892,7 @@ add_rx_skb(struct idt77252_dev *card, int queue, | |||
1889 | 1892 | ||
1890 | outunmap: | 1893 | outunmap: |
1891 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), | 1894 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), |
1892 | skb->end - skb->data, PCI_DMA_FROMDEVICE); | 1895 | skb_end_pointer(skb) - skb->data, PCI_DMA_FROMDEVICE); |
1893 | 1896 | ||
1894 | handle = IDT77252_PRV_POOL(skb); | 1897 | handle = IDT77252_PRV_POOL(skb); |
1895 | card->sbpool[POOL_QUEUE(handle)].skb[POOL_INDEX(handle)] = NULL; | 1898 | card->sbpool[POOL_QUEUE(handle)].skb[POOL_INDEX(handle)] = NULL; |
@@ -1906,12 +1909,14 @@ recycle_rx_skb(struct idt77252_dev *card, struct sk_buff *skb) | |||
1906 | int err; | 1909 | int err; |
1907 | 1910 | ||
1908 | pci_dma_sync_single_for_device(card->pcidev, IDT77252_PRV_PADDR(skb), | 1911 | pci_dma_sync_single_for_device(card->pcidev, IDT77252_PRV_PADDR(skb), |
1909 | skb->end - skb->data, PCI_DMA_FROMDEVICE); | 1912 | skb_end_pointer(skb) - skb->data, |
1913 | PCI_DMA_FROMDEVICE); | ||
1910 | 1914 | ||
1911 | err = push_rx_skb(card, skb, POOL_QUEUE(handle)); | 1915 | err = push_rx_skb(card, skb, POOL_QUEUE(handle)); |
1912 | if (err) { | 1916 | if (err) { |
1913 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), | 1917 | pci_unmap_single(card->pcidev, IDT77252_PRV_PADDR(skb), |
1914 | skb->end - skb->data, PCI_DMA_FROMDEVICE); | 1918 | skb_end_pointer(skb) - skb->data, |
1919 | PCI_DMA_FROMDEVICE); | ||
1915 | sb_pool_remove(card, skb); | 1920 | sb_pool_remove(card, skb); |
1916 | dev_kfree_skb(skb); | 1921 | dev_kfree_skb(skb); |
1917 | } | 1922 | } |
@@ -3123,7 +3128,8 @@ deinit_card(struct idt77252_dev *card) | |||
3123 | if (skb) { | 3128 | if (skb) { |
3124 | pci_unmap_single(card->pcidev, | 3129 | pci_unmap_single(card->pcidev, |
3125 | IDT77252_PRV_PADDR(skb), | 3130 | IDT77252_PRV_PADDR(skb), |
3126 | skb->end - skb->data, | 3131 | (skb_end_pointer(skb) - |
3132 | skb->data), | ||
3127 | PCI_DMA_FROMDEVICE); | 3133 | PCI_DMA_FROMDEVICE); |
3128 | card->sbpool[i].skb[j] = NULL; | 3134 | card->sbpool[i].skb[j] = NULL; |
3129 | dev_kfree_skb(skb); | 3135 | dev_kfree_skb(skb); |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index 66ad4d40ba1d..e842c65a3f4d 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c | |||
@@ -477,7 +477,7 @@ static void send_mpa_req(struct iwch_ep *ep, struct sk_buff *skb) | |||
477 | BUG_ON(skb_cloned(skb)); | 477 | BUG_ON(skb_cloned(skb)); |
478 | 478 | ||
479 | mpalen = sizeof(*mpa) + ep->plen; | 479 | mpalen = sizeof(*mpa) + ep->plen; |
480 | if (skb->data + mpalen + sizeof(*req) > skb->end) { | 480 | if (skb->data + mpalen + sizeof(*req) > skb_end_pointer(skb)) { |
481 | kfree_skb(skb); | 481 | kfree_skb(skb); |
482 | skb=alloc_skb(mpalen + sizeof(*req), GFP_KERNEL); | 482 | skb=alloc_skb(mpalen + sizeof(*req), GFP_KERNEL); |
483 | if (!skb) { | 483 | if (!skb) { |
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index 7feb9c561147..5bdf5ca85a65 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -1348,7 +1348,8 @@ 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_pointer(skb), skb->end); | 1351 | skb->head, skb->data, skb_tail_pointer(skb), |
1352 | skb_end_pointer(skb)); | ||
1352 | printk("copying packet to 0x%x.\n", skb_data_ptr); | 1353 | printk("copying packet to 0x%x.\n", skb_data_ptr); |
1353 | #endif | 1354 | #endif |
1354 | 1355 | ||
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index d5d458c3421f..d3f4bcaa9692 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -1386,9 +1386,13 @@ static int nv_alloc_rx(struct net_device *dev) | |||
1386 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); | 1386 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); |
1387 | if (skb) { | 1387 | if (skb) { |
1388 | np->put_rx_ctx->skb = skb; | 1388 | np->put_rx_ctx->skb = skb; |
1389 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, skb->data, | 1389 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, |
1390 | skb->end-skb->data, PCI_DMA_FROMDEVICE); | 1390 | skb->data, |
1391 | np->put_rx_ctx->dma_len = skb->end-skb->data; | 1391 | (skb_end_pointer(skb) - |
1392 | skb->data), | ||
1393 | PCI_DMA_FROMDEVICE); | ||
1394 | np->put_rx_ctx->dma_len = (skb_end_pointer(skb) - | ||
1395 | skb->data); | ||
1392 | np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); | 1396 | np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); |
1393 | wmb(); | 1397 | wmb(); |
1394 | np->put_rx.orig->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); | 1398 | np->put_rx.orig->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL); |
@@ -1416,9 +1420,13 @@ static int nv_alloc_rx_optimized(struct net_device *dev) | |||
1416 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); | 1420 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + NV_RX_ALLOC_PAD); |
1417 | if (skb) { | 1421 | if (skb) { |
1418 | np->put_rx_ctx->skb = skb; | 1422 | np->put_rx_ctx->skb = skb; |
1419 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, skb->data, | 1423 | np->put_rx_ctx->dma = pci_map_single(np->pci_dev, |
1420 | skb->end-skb->data, PCI_DMA_FROMDEVICE); | 1424 | skb->data, |
1421 | np->put_rx_ctx->dma_len = skb->end-skb->data; | 1425 | (skb_end_pointer(skb) - |
1426 | skb->data), | ||
1427 | PCI_DMA_FROMDEVICE); | ||
1428 | np->put_rx_ctx->dma_len = (skb_end_pointer(skb) - | ||
1429 | skb->data); | ||
1422 | np->put_rx.ex->bufhigh = cpu_to_le64(np->put_rx_ctx->dma) >> 32; | 1430 | np->put_rx.ex->bufhigh = cpu_to_le64(np->put_rx_ctx->dma) >> 32; |
1423 | np->put_rx.ex->buflow = cpu_to_le64(np->put_rx_ctx->dma) & 0x0FFFFFFFF; | 1431 | np->put_rx.ex->buflow = cpu_to_le64(np->put_rx_ctx->dma) & 0x0FFFFFFFF; |
1424 | wmb(); | 1432 | wmb(); |
@@ -1602,8 +1610,9 @@ static void nv_drain_rx(struct net_device *dev) | |||
1602 | wmb(); | 1610 | wmb(); |
1603 | if (np->rx_skb[i].skb) { | 1611 | if (np->rx_skb[i].skb) { |
1604 | pci_unmap_single(np->pci_dev, np->rx_skb[i].dma, | 1612 | pci_unmap_single(np->pci_dev, np->rx_skb[i].dma, |
1605 | np->rx_skb[i].skb->end-np->rx_skb[i].skb->data, | 1613 | (skb_end_pointer(np->rx_skb[i].skb) - |
1606 | PCI_DMA_FROMDEVICE); | 1614 | np->rx_skb[i].skb->data), |
1615 | PCI_DMA_FROMDEVICE); | ||
1607 | dev_kfree_skb(np->rx_skb[i].skb); | 1616 | dev_kfree_skb(np->rx_skb[i].skb); |
1608 | np->rx_skb[i].skb = NULL; | 1617 | np->rx_skb[i].skb = NULL; |
1609 | } | 1618 | } |
@@ -4378,7 +4387,8 @@ static int nv_loopback_test(struct net_device *dev) | |||
4378 | for (i = 0; i < pkt_len; i++) | 4387 | for (i = 0; i < pkt_len; i++) |
4379 | pkt_data[i] = (u8)(i & 0xff); | 4388 | pkt_data[i] = (u8)(i & 0xff); |
4380 | test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, | 4389 | test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, |
4381 | tx_skb->end-tx_skb->data, PCI_DMA_FROMDEVICE); | 4390 | (skb_end_pointer(tx_skb) - |
4391 | tx_skb->data), PCI_DMA_FROMDEVICE); | ||
4382 | 4392 | ||
4383 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 4393 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
4384 | np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr); | 4394 | np->tx_ring.orig[0].buf = cpu_to_le32(test_dma_addr); |
@@ -4435,7 +4445,7 @@ static int nv_loopback_test(struct net_device *dev) | |||
4435 | } | 4445 | } |
4436 | 4446 | ||
4437 | pci_unmap_page(np->pci_dev, test_dma_addr, | 4447 | pci_unmap_page(np->pci_dev, test_dma_addr, |
4438 | tx_skb->end-tx_skb->data, | 4448 | (skb_end_pointer(tx_skb) - tx_skb->data), |
4439 | PCI_DMA_TODEVICE); | 4449 | PCI_DMA_TODEVICE); |
4440 | dev_kfree_skb_any(tx_skb); | 4450 | dev_kfree_skb_any(tx_skb); |
4441 | out: | 4451 | out: |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 98bf51afcee7..9e233f8216a7 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -576,7 +576,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
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, | 578 | skb->len, skb->head, skb->data, |
579 | skb_tail_pointer(skb), skb->end); | 579 | skb_tail_pointer(skb), skb_end_pointer(skb)); |
580 | dev_dbg(&bp->pdev->dev, | 580 | dev_dbg(&bp->pdev->dev, |
581 | "data:"); | 581 | "data:"); |
582 | for (i = 0; i < 16; i++) | 582 | for (i = 0; i < 16; i++) |
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index b731f3aae0df..5bb18c0955bc 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c | |||
@@ -1932,7 +1932,7 @@ static void lmc_softreset (lmc_softc_t * const sc) /*fold00*/ | |||
1932 | sc->lmc_rxring[i].status = 0x80000000; | 1932 | sc->lmc_rxring[i].status = 0x80000000; |
1933 | 1933 | ||
1934 | /* used to be PKT_BUF_SZ now uses skb since we lose some to head room */ | 1934 | /* used to be PKT_BUF_SZ now uses skb since we lose some to head room */ |
1935 | sc->lmc_rxring[i].length = skb->end - skb->data; | 1935 | sc->lmc_rxring[i].length = skb_end_pointer(skb) - skb->data; |
1936 | 1936 | ||
1937 | /* use to be tail which is dumb since you're thinking why write | 1937 | /* use to be tail which is dumb since you're thinking why write |
1938 | * to the end of the packj,et but since there's nothing there tail == data | 1938 | * to the end of the packj,et but since there's nothing there tail == data |
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c index 5e3e9e262706..35a3a50724fe 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 (skb_tail_pointer(frag_skb) + flen > frag_skb->end) { | 925 | if (frag_skb->tail + 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); |
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index 4d8f282b23d1..a076f735a7bc 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -335,12 +335,12 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char | |||
335 | 335 | ||
336 | sarb = instance->cached_vcc->sarb; | 336 | sarb = instance->cached_vcc->sarb; |
337 | 337 | ||
338 | if (skb_tail_pointer(sarb) + ATM_CELL_PAYLOAD > sarb->end) { | 338 | if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) { |
339 | atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", | 339 | atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", |
340 | __func__, sarb->len, vcc); | 340 | __func__, sarb->len, vcc); |
341 | /* discard cells already received */ | 341 | /* discard cells already received */ |
342 | skb_trim(sarb, 0); | 342 | skb_trim(sarb, 0); |
343 | UDSL_ASSERT(skb_tail_pointer(sarb) + ATM_CELL_PAYLOAD <= sarb->end); | 343 | UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end); |
344 | } | 344 | } |
345 | 345 | ||
346 | memcpy(skb_tail_pointer(sarb), source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); | 346 | memcpy(skb_tail_pointer(sarb), source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index e1c2392ecb56..656dc0e901cc 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -305,9 +305,9 @@ struct sk_buff { | |||
305 | sk_buff_data_t mac_header; | 305 | sk_buff_data_t mac_header; |
306 | /* These elements must be at the end, see alloc_skb() for details. */ | 306 | /* These elements must be at the end, see alloc_skb() for details. */ |
307 | sk_buff_data_t tail; | 307 | sk_buff_data_t tail; |
308 | sk_buff_data_t end; | ||
308 | unsigned char *head, | 309 | unsigned char *head, |
309 | *data, | 310 | *data; |
310 | *end; | ||
311 | unsigned int truesize; | 311 | unsigned int truesize; |
312 | atomic_t users; | 312 | atomic_t users; |
313 | }; | 313 | }; |
@@ -392,8 +392,20 @@ extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, | |||
392 | unsigned int to, struct ts_config *config, | 392 | unsigned int to, struct ts_config *config, |
393 | struct ts_state *state); | 393 | struct ts_state *state); |
394 | 394 | ||
395 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | ||
396 | static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) | ||
397 | { | ||
398 | return skb->head + skb->end; | ||
399 | } | ||
400 | #else | ||
401 | static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) | ||
402 | { | ||
403 | return skb->end; | ||
404 | } | ||
405 | #endif | ||
406 | |||
395 | /* Internal */ | 407 | /* Internal */ |
396 | #define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) | 408 | #define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB))) |
397 | 409 | ||
398 | /** | 410 | /** |
399 | * skb_queue_empty - check if a queue is empty | 411 | * skb_queue_empty - check if a queue is empty |
@@ -843,6 +855,7 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) | |||
843 | { | 855 | { |
844 | skb->tail = skb->data + offset; | 856 | skb->tail = skb->data + offset; |
845 | } | 857 | } |
858 | |||
846 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ | 859 | #endif /* NET_SKBUFF_DATA_USES_OFFSET */ |
847 | 860 | ||
848 | /* | 861 | /* |
@@ -872,7 +885,7 @@ static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) | |||
872 | SKB_LINEAR_ASSERT(skb); | 885 | SKB_LINEAR_ASSERT(skb); |
873 | skb->tail += len; | 886 | skb->tail += len; |
874 | skb->len += len; | 887 | skb->len += len; |
875 | if (unlikely(skb_tail_pointer(skb) > skb->end)) | 888 | if (unlikely(skb->tail > skb->end)) |
876 | skb_over_panic(skb, len, current_text_addr()); | 889 | skb_over_panic(skb, len, current_text_addr()); |
877 | return tmp; | 890 | return tmp; |
878 | } | 891 | } |
@@ -968,7 +981,7 @@ static inline int skb_headroom(const struct sk_buff *skb) | |||
968 | */ | 981 | */ |
969 | static inline int skb_tailroom(const struct sk_buff *skb) | 982 | static inline int skb_tailroom(const struct sk_buff *skb) |
970 | { | 983 | { |
971 | return skb_is_nonlinear(skb) ? 0 : skb->end - skb_tail_pointer(skb); | 984 | return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail; |
972 | } | 985 | } |
973 | 986 | ||
974 | /** | 987 | /** |
diff --git a/net/atm/lec.c b/net/atm/lec.c index a8c6b285e06c..4b3e72f31b3b 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -284,7 +284,7 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
284 | 284 | ||
285 | DPRINTK("skbuff head:%lx data:%lx tail:%lx end:%lx\n", | 285 | DPRINTK("skbuff head:%lx data:%lx tail:%lx end:%lx\n", |
286 | (long)skb->head, (long)skb->data, (long)skb_tail_pointer(skb), | 286 | (long)skb->head, (long)skb->data, (long)skb_tail_pointer(skb), |
287 | (long)skb->end); | 287 | (long)skb_end_pointer(skb)); |
288 | #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) | 288 | #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) |
289 | if (memcmp(skb->data, bridge_ula_lec, sizeof(bridge_ula_lec)) == 0) | 289 | if (memcmp(skb->data, bridge_ula_lec, sizeof(bridge_ula_lec)) == 0) |
290 | lec_handle_bridge(skb, dev); | 290 | lec_handle_bridge(skb, dev); |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index ddcbc4d10dab..a203bedefe09 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -87,9 +87,9 @@ static struct kmem_cache *skbuff_fclone_cache __read_mostly; | |||
87 | void skb_over_panic(struct sk_buff *skb, int sz, void *here) | 87 | void skb_over_panic(struct sk_buff *skb, int sz, void *here) |
88 | { | 88 | { |
89 | printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p " | 89 | printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p " |
90 | "data:%p tail:%#lx end:%p dev:%s\n", | 90 | "data:%p tail:%#lx end:%#lx dev:%s\n", |
91 | here, skb->len, sz, skb->head, skb->data, | 91 | here, skb->len, sz, skb->head, skb->data, |
92 | (unsigned long)skb->tail, skb->end, | 92 | (unsigned long)skb->tail, (unsigned long)skb->end, |
93 | skb->dev ? skb->dev->name : "<NULL>"); | 93 | skb->dev ? skb->dev->name : "<NULL>"); |
94 | BUG(); | 94 | BUG(); |
95 | } | 95 | } |
@@ -106,9 +106,9 @@ void skb_over_panic(struct sk_buff *skb, int sz, void *here) | |||
106 | void skb_under_panic(struct sk_buff *skb, int sz, void *here) | 106 | void skb_under_panic(struct sk_buff *skb, int sz, void *here) |
107 | { | 107 | { |
108 | printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p " | 108 | printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p " |
109 | "data:%p tail:%#lx end:%p dev:%s\n", | 109 | "data:%p tail:%#lx end:%#lx dev:%s\n", |
110 | here, skb->len, sz, skb->head, skb->data, | 110 | here, skb->len, sz, skb->head, skb->data, |
111 | (unsigned long)skb->tail, skb->end, | 111 | (unsigned long)skb->tail, (unsigned long)skb->end, |
112 | skb->dev ? skb->dev->name : "<NULL>"); | 112 | skb->dev ? skb->dev->name : "<NULL>"); |
113 | BUG(); | 113 | BUG(); |
114 | } | 114 | } |
@@ -170,7 +170,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, | |||
170 | skb->head = data; | 170 | skb->head = data; |
171 | skb->data = data; | 171 | skb->data = data; |
172 | skb_reset_tail_pointer(skb); | 172 | skb_reset_tail_pointer(skb); |
173 | skb->end = data + size; | 173 | skb->end = skb->tail + size; |
174 | /* make sure we initialize shinfo sequentially */ | 174 | /* make sure we initialize shinfo sequentially */ |
175 | shinfo = skb_shinfo(skb); | 175 | shinfo = skb_shinfo(skb); |
176 | atomic_set(&shinfo->dataref, 1); | 176 | atomic_set(&shinfo->dataref, 1); |
@@ -520,8 +520,12 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask) | |||
520 | /* | 520 | /* |
521 | * Allocate the copy buffer | 521 | * Allocate the copy buffer |
522 | */ | 522 | */ |
523 | struct sk_buff *n = alloc_skb(skb->end - skb->head + skb->data_len, | 523 | struct sk_buff *n; |
524 | gfp_mask); | 524 | #ifdef NET_SKBUFF_DATA_USES_OFFSET |
525 | n = alloc_skb(skb->end + skb->data_len, gfp_mask); | ||
526 | #else | ||
527 | n = alloc_skb(skb->end - skb->head + skb->data_len, gfp_mask); | ||
528 | #endif | ||
525 | if (!n) | 529 | if (!n) |
526 | return NULL; | 530 | return NULL; |
527 | 531 | ||
@@ -558,8 +562,12 @@ struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask) | |||
558 | /* | 562 | /* |
559 | * Allocate the copy buffer | 563 | * Allocate the copy buffer |
560 | */ | 564 | */ |
561 | struct sk_buff *n = alloc_skb(skb->end - skb->head, gfp_mask); | 565 | struct sk_buff *n; |
562 | 566 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | |
567 | n = alloc_skb(skb->end, gfp_mask); | ||
568 | #else | ||
569 | n = alloc_skb(skb->end - skb->head, gfp_mask); | ||
570 | #endif | ||
563 | if (!n) | 571 | if (!n) |
564 | goto out; | 572 | goto out; |
565 | 573 | ||
@@ -617,7 +625,11 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | |||
617 | { | 625 | { |
618 | int i; | 626 | int i; |
619 | u8 *data; | 627 | u8 *data; |
628 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | ||
629 | int size = nhead + skb->end + ntail; | ||
630 | #else | ||
620 | int size = nhead + (skb->end - skb->head) + ntail; | 631 | int size = nhead + (skb->end - skb->head) + ntail; |
632 | #endif | ||
621 | long off; | 633 | long off; |
622 | 634 | ||
623 | if (skb_shared(skb)) | 635 | if (skb_shared(skb)) |
@@ -632,12 +644,13 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | |||
632 | /* Copy only real data... and, alas, header. This should be | 644 | /* Copy only real data... and, alas, header. This should be |
633 | * optimized for the cases when header is void. */ | 645 | * optimized for the cases when header is void. */ |
634 | memcpy(data + nhead, skb->head, | 646 | memcpy(data + nhead, skb->head, |
635 | skb->tail | 647 | #ifdef NET_SKBUFF_DATA_USES_OFFSET |
636 | #ifndef NET_SKBUFF_DATA_USES_OFFSET | 648 | skb->tail); |
637 | - skb->head | 649 | #else |
650 | skb->tail - skb->head); | ||
638 | #endif | 651 | #endif |
639 | ); | 652 | memcpy(data + size, skb_end_pointer(skb), |
640 | memcpy(data + size, skb->end, sizeof(struct skb_shared_info)); | 653 | sizeof(struct skb_shared_info)); |
641 | 654 | ||
642 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) | 655 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) |
643 | get_page(skb_shinfo(skb)->frags[i].page); | 656 | get_page(skb_shinfo(skb)->frags[i].page); |
@@ -650,9 +663,11 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | |||
650 | off = (data + nhead) - skb->head; | 663 | off = (data + nhead) - skb->head; |
651 | 664 | ||
652 | skb->head = data; | 665 | skb->head = data; |
653 | skb->end = data + size; | ||
654 | skb->data += off; | 666 | skb->data += off; |
655 | #ifndef NET_SKBUFF_DATA_USES_OFFSET | 667 | #ifdef NET_SKBUFF_DATA_USES_OFFSET |
668 | skb->end = size; | ||
669 | #else | ||
670 | skb->end = skb->head + size; | ||
656 | /* {transport,network,mac}_header and tail are relative to skb->head */ | 671 | /* {transport,network,mac}_header and tail are relative to skb->head */ |
657 | skb->tail += off; | 672 | skb->tail += off; |
658 | skb->transport_header += off; | 673 | skb->transport_header += off; |
@@ -769,7 +784,7 @@ int skb_pad(struct sk_buff *skb, int pad) | |||
769 | return 0; | 784 | return 0; |
770 | } | 785 | } |
771 | 786 | ||
772 | ntail = skb->data_len + pad - (skb->end - skb_tail_pointer(skb)); | 787 | ntail = skb->data_len + pad - (skb->end - skb->tail); |
773 | if (likely(skb_cloned(skb) || ntail > 0)) { | 788 | if (likely(skb_cloned(skb) || ntail > 0)) { |
774 | err = pskb_expand_head(skb, 0, ntail, GFP_ATOMIC); | 789 | err = pskb_expand_head(skb, 0, ntail, GFP_ATOMIC); |
775 | if (unlikely(err)) | 790 | if (unlikely(err)) |
@@ -907,7 +922,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta) | |||
907 | * plus 128 bytes for future expansions. If we have enough | 922 | * plus 128 bytes for future expansions. If we have enough |
908 | * room at tail, reallocate without expansion only if skb is cloned. | 923 | * room at tail, reallocate without expansion only if skb is cloned. |
909 | */ | 924 | */ |
910 | int i, k, eat = (skb_tail_pointer(skb) + delta) - skb->end; | 925 | int i, k, eat = (skb->tail + delta) - skb->end; |
911 | 926 | ||
912 | if (eat > 0 || skb_cloned(skb)) { | 927 | if (eat > 0 || skb_cloned(skb)) { |
913 | if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0, | 928 | if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0, |
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 2b854941e06c..59a765c49cf9 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -595,7 +595,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
595 | if (frag != 0) | 595 | if (frag != 0) |
596 | flen -= hdrlen; | 596 | flen -= hdrlen; |
597 | 597 | ||
598 | if (skb_tail_pointer(frag_skb) + flen > frag_skb->end) { | 598 | if (frag_skb->tail + flen > frag_skb->end) { |
599 | printk(KERN_WARNING "%s: host decrypted and " | 599 | printk(KERN_WARNING "%s: host decrypted and " |
600 | "reassembled frame did not fit skb\n", | 600 | "reassembled frame did not fit skb\n", |
601 | dev->name); | 601 | dev->name); |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index fdb6eb13cbcb..50dc5edb7752 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -785,7 +785,7 @@ static inline struct sk_buff *netlink_trim(struct sk_buff *skb, | |||
785 | 785 | ||
786 | skb_orphan(skb); | 786 | skb_orphan(skb); |
787 | 787 | ||
788 | delta = skb->end - skb_tail_pointer(skb); | 788 | delta = skb->end - skb->tail; |
789 | if (delta * 2 < skb->truesize) | 789 | if (delta * 2 < skb->truesize) |
790 | return skb; | 790 | return skb; |
791 | 791 | ||