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 | |
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')
-rw-r--r-- | net/atm/br2684.c | 2 | ||||
-rw-r--r-- | net/atm/lec.c | 8 | ||||
-rw-r--r-- | net/atm/mpc.c | 11 |
3 files changed, 12 insertions, 9 deletions
diff --git a/net/atm/br2684.c b/net/atm/br2684.c index a1686dfcbb9a..0e9f00c5c899 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c | |||
@@ -173,7 +173,7 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev, | |||
173 | } | 173 | } |
174 | skb_push(skb, minheadroom); | 174 | skb_push(skb, minheadroom); |
175 | if (brvcc->encaps == e_llc) | 175 | if (brvcc->encaps == e_llc) |
176 | memcpy(skb->data, llc_oui_pid_pad, 10); | 176 | skb_copy_to_linear_data(skb, llc_oui_pid_pad, 10); |
177 | else | 177 | else |
178 | memset(skb->data, 0, 2); | 178 | memset(skb->data, 0, 2); |
179 | #endif /* FASTER_VERSION */ | 179 | #endif /* FASTER_VERSION */ |
diff --git a/net/atm/lec.c b/net/atm/lec.c index 4b3e72f31b3b..6d63afa5764d 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -576,8 +576,8 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb) | |||
576 | break; | 576 | break; |
577 | } | 577 | } |
578 | skb2->len = sizeof(struct atmlec_msg); | 578 | skb2->len = sizeof(struct atmlec_msg); |
579 | memcpy(skb2->data, mesg, | 579 | skb_copy_to_linear_data(skb2, mesg, |
580 | sizeof(struct atmlec_msg)); | 580 | sizeof(*mesg)); |
581 | atm_force_charge(priv->lecd, skb2->truesize); | 581 | atm_force_charge(priv->lecd, skb2->truesize); |
582 | sk = sk_atm(priv->lecd); | 582 | sk = sk_atm(priv->lecd); |
583 | skb_queue_tail(&sk->sk_receive_queue, skb2); | 583 | skb_queue_tail(&sk->sk_receive_queue, skb2); |
@@ -1337,7 +1337,7 @@ static int lane2_resolve(struct net_device *dev, u8 *dst_mac, int force, | |||
1337 | if (skb == NULL) | 1337 | if (skb == NULL) |
1338 | return -1; | 1338 | return -1; |
1339 | skb->len = *sizeoftlvs; | 1339 | skb->len = *sizeoftlvs; |
1340 | memcpy(skb->data, *tlvs, *sizeoftlvs); | 1340 | skb_copy_to_linear_data(skb, *tlvs, *sizeoftlvs); |
1341 | retval = send_to_lecd(priv, l_arp_xmt, dst_mac, NULL, skb); | 1341 | retval = send_to_lecd(priv, l_arp_xmt, dst_mac, NULL, skb); |
1342 | } | 1342 | } |
1343 | return retval; | 1343 | return retval; |
@@ -1371,7 +1371,7 @@ static int lane2_associate_req(struct net_device *dev, u8 *lan_dst, | |||
1371 | if (skb == NULL) | 1371 | if (skb == NULL) |
1372 | return 0; | 1372 | return 0; |
1373 | skb->len = sizeoftlvs; | 1373 | skb->len = sizeoftlvs; |
1374 | memcpy(skb->data, tlvs, sizeoftlvs); | 1374 | skb_copy_to_linear_data(skb, tlvs, sizeoftlvs); |
1375 | retval = send_to_lecd(priv, l_associate_req, NULL, NULL, skb); | 1375 | retval = send_to_lecd(priv, l_associate_req, NULL, NULL, skb); |
1376 | if (retval != 0) | 1376 | if (retval != 0) |
1377 | printk("lec.c: lane2_associate_req() failed\n"); | 1377 | printk("lec.c: lane2_associate_req() failed\n"); |
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); |