Commit 30e2e90b authored by Anton Blanchard's avatar Anton Blanchard Committed by David S. Miller

ehea: Simplify type 3 transmit routine

If a nonlinear skb fits within the immediate area, use skb_copy_bits
instead of copying the frags by hand.

v3:
[cascardo] fixed conflict with use of skb frag API
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 13946f5e
...@@ -2087,27 +2087,14 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev, ...@@ -2087,27 +2087,14 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev, static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
struct ehea_swqe *swqe) struct ehea_swqe *swqe)
{ {
int nfrags = skb_shinfo(skb)->nr_frags;
u8 *imm_data = &swqe->u.immdata_nodesc.immediate_data[0]; u8 *imm_data = &swqe->u.immdata_nodesc.immediate_data[0];
skb_frag_t *frag;
int i;
xmit_common(skb, swqe); xmit_common(skb, swqe);
if (nfrags == 0) { if (!skb->data_len)
skb_copy_from_linear_data(skb, imm_data, skb->len); skb_copy_from_linear_data(skb, imm_data, skb->len);
} else { else
skb_copy_from_linear_data(skb, imm_data, skb_copy_bits(skb, 0, imm_data, skb->len);
skb_headlen(skb));
imm_data += skb_headlen(skb);
/* ... then copy data from the fragments */
for (i = 0; i < nfrags; i++) {
frag = &skb_shinfo(skb)->frags[i];
memcpy(imm_data, skb_frag_address(frag), frag->size);
imm_data += frag->size;
}
}
swqe->immediate_data_length = skb->len; swqe->immediate_data_length = skb->len;
dev_kfree_skb(skb); dev_kfree_skb(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment