Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mlx4_en: dont change mac_header on xmit

A driver xmit function is not allowed to change skb without special
care.

mlx4_en_xmit() should not call skb_reset_mac_header() and instead should
use skb->data to access ethernet header.

This removes a dumb test : if (ethh && ethh->h_dest)

Also remove this slow mlx4_en_mac_to_u64() call, we can use
get_unaligned() to get faster code.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
62212171 0f298a28

+7 -13
+3 -12
drivers/net/ethernet/mellanox/mlx4/en_tx.c
··· 601 601 struct skb_frag_struct *frag; 602 602 struct mlx4_en_tx_info *tx_info; 603 603 struct ethhdr *ethh; 604 - u64 mac; 605 - u32 mac_l, mac_h; 606 604 int tx_ind = 0; 607 605 int nr_txbb; 608 606 int desc_size; ··· 685 687 } 686 688 687 689 /* Copy dst mac address to wqe */ 688 - skb_reset_mac_header(skb); 689 - ethh = eth_hdr(skb); 690 - if (ethh && ethh->h_dest) { 691 - mac = mlx4_en_mac_to_u64(ethh->h_dest); 692 - mac_h = (u32) ((mac & 0xffff00000000ULL) >> 16); 693 - mac_l = (u32) (mac & 0xffffffff); 694 - tx_desc->ctrl.srcrb_flags |= cpu_to_be32(mac_h); 695 - tx_desc->ctrl.imm = cpu_to_be32(mac_l); 696 - } 697 - 690 + ethh = (struct ethhdr *)skb->data; 691 + tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((u16 *)ethh->h_dest); 692 + tx_desc->ctrl.imm = get_unaligned((u32 *)(ethh->h_dest + 2)); 698 693 /* Handle LSO (TSO) packets */ 699 694 if (lso_header_size) { 700 695 /* Mark opcode as LSO */
+4 -1
include/linux/mlx4/qp.h
··· 212 212 * [1] SE (solicited event) 213 213 * [0] FL (force loopback) 214 214 */ 215 - __be32 srcrb_flags; 215 + union { 216 + __be32 srcrb_flags; 217 + __be16 srcrb_flags16[2]; 218 + }; 216 219 /* 217 220 * imm is immediate data for send/RDMA write w/ immediate; 218 221 * also invalidation key for send with invalidate; input