From: Aurelio <sk...@us...> - 2007-08-20 16:16:18
|
Update of /cvsroot/zyxel630-11/amedyn2/module In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv17372 Modified Files: usbatm.c Log Message: >From Linux Kernel: 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. http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.22.y.git;a=commitdiff;h=27a884dc3cb63b93c2b3b643f5b31eed5f8a4d26 Index: usbatm.c =================================================================== RCS file: /cvsroot/zyxel630-11/amedyn2/module/usbatm.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** usbatm.c 20 Aug 2007 15:31:59 -0000 1.20 --- usbatm.c 20 Aug 2007 16:16:16 -0000 1.21 *************** *** 408,420 **** sarb = instance->cached_vcc->sarb; ! if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) { atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", __func__, sarb->len, vcc); /* discard cells already received */ skb_trim(sarb, 0); ! UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end); } ! memcpy(sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); __skb_put(sarb, ATM_CELL_PAYLOAD); --- 408,420 ---- sarb = instance->cached_vcc->sarb; ! if (skb_tail_pointer(sarb) + ATM_CELL_PAYLOAD > sarb->end) { atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", __func__, sarb->len, vcc); /* discard cells already received */ skb_trim(sarb, 0); ! UDSL_ASSERT(skb_tail_pointer(sarb) + ATM_CELL_PAYLOAD <= sarb->end); } ! memcpy(skb_tail_pointer(sarb), source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); __skb_put(sarb, ATM_CELL_PAYLOAD); *************** *** 443,447 **** } ! if (crc32_be(~0, sarb->tail - pdu_length, pdu_length) != 0xc704dd7b) { atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", __func__, vcc); --- 443,447 ---- } ! if (crc32_be(~0, skb_tail_pointer(sarb) - pdu_length, pdu_length) != 0xc704dd7b) { atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", __func__, vcc); *************** *** 469,473 **** } ! memcpy(skb->data, sarb->tail - pdu_length, length); __skb_put(skb, length); --- 469,473 ---- } ! memcpy(skb->data, skb_tail_pointer(sarb) - pdu_length, length); __skb_put(skb, length); |