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/usb/atm/usbatm.c | |
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/usb/atm/usbatm.c')
-rw-r--r-- | drivers/usb/atm/usbatm.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index ec63b0ee0743..4d8f282b23d1 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -335,15 +335,15 @@ 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 (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) { | 338 | if (skb_tail_pointer(sarb) + 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(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end); | 343 | UDSL_ASSERT(skb_tail_pointer(sarb) + ATM_CELL_PAYLOAD <= sarb->end); |
344 | } | 344 | } |
345 | 345 | ||
346 | memcpy(sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); | 346 | memcpy(skb_tail_pointer(sarb), source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); |
347 | __skb_put(sarb, ATM_CELL_PAYLOAD); | 347 | __skb_put(sarb, ATM_CELL_PAYLOAD); |
348 | 348 | ||
349 | if (pti & 1) { | 349 | if (pti & 1) { |
@@ -370,7 +370,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char | |||
370 | goto out; | 370 | goto out; |
371 | } | 371 | } |
372 | 372 | ||
373 | if (crc32_be(~0, sarb->tail - pdu_length, pdu_length) != 0xc704dd7b) { | 373 | if (crc32_be(~0, skb_tail_pointer(sarb) - pdu_length, pdu_length) != 0xc704dd7b) { |
374 | atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", | 374 | atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", |
375 | __func__, vcc); | 375 | __func__, vcc); |
376 | atomic_inc(&vcc->stats->rx_err); | 376 | atomic_inc(&vcc->stats->rx_err); |
@@ -396,7 +396,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char | |||
396 | goto out; /* atm_charge increments rx_drop */ | 396 | goto out; /* atm_charge increments rx_drop */ |
397 | } | 397 | } |
398 | 398 | ||
399 | memcpy(skb->data, sarb->tail - pdu_length, length); | 399 | memcpy(skb->data, skb_tail_pointer(sarb) - pdu_length, length); |
400 | __skb_put(skb, length); | 400 | __skb_put(skb, length); |
401 | 401 | ||
402 | vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", | 402 | vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", |