mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
net/mlx4_en: Use local var for skb_headlen(skb)
Access skb_headlen() once in tx flow Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b9d8839a44
commit
e533ac7ea0
1 changed files with 11 additions and 10 deletions
|
@ -612,6 +612,7 @@ static void build_inline_wqe(struct mlx4_en_tx_desc *tx_desc,
|
||||||
{
|
{
|
||||||
struct mlx4_wqe_inline_seg *inl = &tx_desc->inl;
|
struct mlx4_wqe_inline_seg *inl = &tx_desc->inl;
|
||||||
int spc = MLX4_INLINE_ALIGN - CTRL_SIZE - sizeof *inl;
|
int spc = MLX4_INLINE_ALIGN - CTRL_SIZE - sizeof *inl;
|
||||||
|
unsigned int hlen = skb_headlen(skb);
|
||||||
|
|
||||||
if (skb->len <= spc) {
|
if (skb->len <= spc) {
|
||||||
if (likely(skb->len >= MIN_PKT_LEN)) {
|
if (likely(skb->len >= MIN_PKT_LEN)) {
|
||||||
|
@ -621,19 +622,19 @@ static void build_inline_wqe(struct mlx4_en_tx_desc *tx_desc,
|
||||||
memset(((void *)(inl + 1)) + skb->len, 0,
|
memset(((void *)(inl + 1)) + skb->len, 0,
|
||||||
MIN_PKT_LEN - skb->len);
|
MIN_PKT_LEN - skb->len);
|
||||||
}
|
}
|
||||||
skb_copy_from_linear_data(skb, inl + 1, skb_headlen(skb));
|
skb_copy_from_linear_data(skb, inl + 1, hlen);
|
||||||
if (shinfo->nr_frags)
|
if (shinfo->nr_frags)
|
||||||
memcpy(((void *)(inl + 1)) + skb_headlen(skb), fragptr,
|
memcpy(((void *)(inl + 1)) + hlen, fragptr,
|
||||||
skb_frag_size(&shinfo->frags[0]));
|
skb_frag_size(&shinfo->frags[0]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
inl->byte_count = cpu_to_be32(1 << 31 | spc);
|
inl->byte_count = cpu_to_be32(1 << 31 | spc);
|
||||||
if (skb_headlen(skb) <= spc) {
|
if (hlen <= spc) {
|
||||||
skb_copy_from_linear_data(skb, inl + 1, skb_headlen(skb));
|
skb_copy_from_linear_data(skb, inl + 1, hlen);
|
||||||
if (skb_headlen(skb) < spc) {
|
if (hlen < spc) {
|
||||||
memcpy(((void *)(inl + 1)) + skb_headlen(skb),
|
memcpy(((void *)(inl + 1)) + hlen,
|
||||||
fragptr, spc - skb_headlen(skb));
|
fragptr, spc - hlen);
|
||||||
fragptr += spc - skb_headlen(skb);
|
fragptr += spc - hlen;
|
||||||
}
|
}
|
||||||
inl = (void *) (inl + 1) + spc;
|
inl = (void *) (inl + 1) + spc;
|
||||||
memcpy(((void *)(inl + 1)), fragptr, skb->len - spc);
|
memcpy(((void *)(inl + 1)), fragptr, skb->len - spc);
|
||||||
|
@ -641,9 +642,9 @@ static void build_inline_wqe(struct mlx4_en_tx_desc *tx_desc,
|
||||||
skb_copy_from_linear_data(skb, inl + 1, spc);
|
skb_copy_from_linear_data(skb, inl + 1, spc);
|
||||||
inl = (void *) (inl + 1) + spc;
|
inl = (void *) (inl + 1) + spc;
|
||||||
skb_copy_from_linear_data_offset(skb, spc, inl + 1,
|
skb_copy_from_linear_data_offset(skb, spc, inl + 1,
|
||||||
skb_headlen(skb) - spc);
|
hlen - spc);
|
||||||
if (shinfo->nr_frags)
|
if (shinfo->nr_frags)
|
||||||
memcpy(((void *)(inl + 1)) + skb_headlen(skb) - spc,
|
memcpy(((void *)(inl + 1)) + hlen - spc,
|
||||||
fragptr,
|
fragptr,
|
||||||
skb_frag_size(&shinfo->frags[0]));
|
skb_frag_size(&shinfo->frags[0]));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue