diff options
author | Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 2007-03-31 10:55:19 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:28:29 -0400 |
commit | 27d7ff46a3498d3debc6ba68fb8014c702b81170 (patch) | |
tree | b5a0c617cf8339524d3b1f1633e08eae7b94cf86 /net/atm/mpc.c | |
parent | 3dbad80ac7632f243b824d469301abb97ec634a1 (diff) |
[SK_BUFF]: Introduce skb_copy_to_linear_data{_offset}
To clearly state the intent of copying to linear sk_buffs, _offset being a
overly long variant but interesting for the sake of saving some bytes.
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Diffstat (limited to 'net/atm/mpc.c')
-rw-r--r-- | net/atm/mpc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/atm/mpc.c b/net/atm/mpc.c index 4d2592c14090..813e08d6dc7c 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
@@ -504,11 +504,13 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) | |||
504 | tagged_llc_snap_hdr.tag = entry->ctrl_info.tag; | 504 | tagged_llc_snap_hdr.tag = entry->ctrl_info.tag; |
505 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ | 505 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ |
506 | skb_push(skb, sizeof(tagged_llc_snap_hdr)); /* add LLC/SNAP header */ | 506 | skb_push(skb, sizeof(tagged_llc_snap_hdr)); /* add LLC/SNAP header */ |
507 | memcpy(skb->data, &tagged_llc_snap_hdr, sizeof(tagged_llc_snap_hdr)); | 507 | skb_copy_to_linear_data(skb, &tagged_llc_snap_hdr, |
508 | sizeof(tagged_llc_snap_hdr)); | ||
508 | } else { | 509 | } else { |
509 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ | 510 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ |
510 | skb_push(skb, sizeof(struct llc_snap_hdr)); /* add LLC/SNAP header + tag */ | 511 | skb_push(skb, sizeof(struct llc_snap_hdr)); /* add LLC/SNAP header + tag */ |
511 | memcpy(skb->data, &llc_snap_mpoa_data, sizeof(struct llc_snap_hdr)); | 512 | skb_copy_to_linear_data(skb, &llc_snap_mpoa_data, |
513 | sizeof(struct llc_snap_hdr)); | ||
512 | } | 514 | } |
513 | 515 | ||
514 | atomic_add(skb->truesize, &sk_atm(entry->shortcut)->sk_wmem_alloc); | 516 | atomic_add(skb->truesize, &sk_atm(entry->shortcut)->sk_wmem_alloc); |
@@ -711,7 +713,8 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
711 | return; | 713 | return; |
712 | } | 714 | } |
713 | skb_push(new_skb, eg->ctrl_info.DH_length); /* add MAC header */ | 715 | skb_push(new_skb, eg->ctrl_info.DH_length); /* add MAC header */ |
714 | memcpy(new_skb->data, eg->ctrl_info.DLL_header, eg->ctrl_info.DH_length); | 716 | skb_copy_to_linear_data(new_skb, eg->ctrl_info.DLL_header, |
717 | eg->ctrl_info.DH_length); | ||
715 | new_skb->protocol = eth_type_trans(new_skb, dev); | 718 | new_skb->protocol = eth_type_trans(new_skb, dev); |
716 | skb_reset_network_header(new_skb); | 719 | skb_reset_network_header(new_skb); |
717 | 720 | ||
@@ -936,7 +939,7 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc) | |||
936 | if (skb == NULL) | 939 | if (skb == NULL) |
937 | return -ENOMEM; | 940 | return -ENOMEM; |
938 | skb_put(skb, sizeof(struct k_message)); | 941 | skb_put(skb, sizeof(struct k_message)); |
939 | memcpy(skb->data, mesg, sizeof(struct k_message)); | 942 | skb_copy_to_linear_data(skb, mesg, sizeof(*mesg)); |
940 | atm_force_charge(mpc->mpoad_vcc, skb->truesize); | 943 | atm_force_charge(mpc->mpoad_vcc, skb->truesize); |
941 | 944 | ||
942 | sk = sk_atm(mpc->mpoad_vcc); | 945 | sk = sk_atm(mpc->mpoad_vcc); |