Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d626f62b authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller
Browse files

[SK_BUFF]: Introduce skb_copy_from_linear_data{_offset}



To clearly state the intent of copying from linear sk_buffs, _offset being a
overly long variant but interesting for the sake of saving some bytes.

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 2a123b86
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -566,7 +566,8 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
			msg->version = XPNET_VERSION_EMBED;
			dev_dbg(xpnet, "calling memcpy(0x%p, 0x%p, 0x%lx)\n",
				&msg->data, skb->data, (size_t) embedded_bytes);
			memcpy(&msg->data, skb->data, (size_t) embedded_bytes);
			skb_copy_from_linear_data(skb, &msg->data,
						  (size_t)embedded_bytes);
		} else {
			msg->version = XPNET_VERSION;
		}
+2 −2
Original line number Diff line number Diff line
@@ -221,7 +221,7 @@ static int atmtcp_v_send(struct atm_vcc *vcc,struct sk_buff *skb)
	hdr->vpi = htons(vcc->vpi);
	hdr->vci = htons(vcc->vci);
	hdr->length = htonl(skb->len);
	memcpy(skb_put(new_skb,skb->len),skb->data,skb->len);
	skb_copy_from_linear_data(skb, skb_put(new_skb, skb->len), skb->len);
	if (vcc->pop) vcc->pop(vcc,skb);
	else dev_kfree_skb(skb);
	out_vcc->push(out_vcc,new_skb);
@@ -310,7 +310,7 @@ static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb)
		goto done;
	}
	__net_timestamp(new_skb);
	memcpy(skb_put(new_skb,skb->len),skb->data,skb->len);
	skb_copy_from_linear_data(skb, skb_put(new_skb, skb->len), skb->len);
	out_vcc->push(out_vcc,new_skb);
	atomic_inc(&vcc->stats->tx);
	atomic_inc(&out_vcc->stats->rx);
+3 −3
Original line number Diff line number Diff line
@@ -2395,7 +2395,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
               skb->destructor = ns_lb_destructor;
#endif /* NS_USE_DESTRUCTORS */
               skb_push(skb, NS_SMBUFSIZE);
               memcpy(skb->data, sb->data, NS_SMBUFSIZE);
               skb_copy_from_linear_data(sb, skb->data, NS_SMBUFSIZE);
               skb_put(skb, len - NS_SMBUFSIZE);
               ATM_SKB(skb)->vcc = vcc;
	       __net_timestamp(skb);
@@ -2479,7 +2479,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
	 {
            /* Copy the small buffer to the huge buffer */
            sb = (struct sk_buff *) iov->iov_base;
            memcpy(hb->data, sb->data, iov->iov_len);
            skb_copy_from_linear_data(sb, hb->data, iov->iov_len);
            skb_put(hb, iov->iov_len);
            remaining = len - iov->iov_len;
            iov++;
@@ -2491,7 +2491,7 @@ static void dequeue_rx(ns_dev *card, ns_rsqe *rsqe)
            {
               lb = (struct sk_buff *) iov->iov_base;
               tocopy = min_t(int, remaining, iov->iov_len);
               memcpy(skb_tail_pointer(hb), lb->data, tocopy);
               skb_copy_from_linear_data(lb, skb_tail_pointer(hb), tocopy);
               skb_put(hb, tocopy);
               iov++;
               remaining -= tocopy;
+1 −1
Original line number Diff line number Diff line
@@ -527,7 +527,7 @@ static int bfusb_send_frame(struct sk_buff *skb)
		buf[2] = (size == BFUSB_MAX_BLOCK_SIZE) ? 0 : size;

		memcpy(skb_put(nskb, 3), buf, 3);
		memcpy(skb_put(nskb, size), skb->data + sent, size);
		skb_copy_from_linear_data_offset(skb, sent, skb_put(nskb, size), size);

		sent  += size;
		count -= size;
+2 −2
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ static void bpa10x_wakeup(struct bpa10x_data *data)
		cr = (struct usb_ctrlrequest *) urb->setup_packet;
		cr->wLength = __cpu_to_le16(skb->len);

		memcpy(urb->transfer_buffer, skb->data, skb->len);
		skb_copy_from_linear_data(skb, urb->transfer_buffer, skb->len);
		urb->transfer_buffer_length = skb->len;

		err = usb_submit_urb(urb, GFP_ATOMIC);
@@ -250,7 +250,7 @@ static void bpa10x_wakeup(struct bpa10x_data *data)
		skb = skb_dequeue(&data->tx_queue);

	if (skb) {
		memcpy(urb->transfer_buffer, skb->data, skb->len);
		skb_copy_from_linear_data(skb, urb->transfer_buffer, skb->len);
		urb->transfer_buffer_length = skb->len;

		err = usb_submit_urb(urb, GFP_ATOMIC);
Loading