diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2012-02-24 19:51:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-02-26 14:22:05 -0500 |
commit | 622121719934f60378279eb440d3cec2fc3176d2 (patch) | |
tree | ed5285b379efd994078cd2010968361bcc5759b3 | |
parent | 0f298a285f2e365cb34f69d1f79bb9fc996f683d (diff) |
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>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_tx.c | 15 | ||||
-rw-r--r-- | include/linux/mlx4/qp.h | 5 |
2 files changed, 7 insertions, 13 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index ff3250586584..2fd51405a509 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
@@ -601,8 +601,6 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) | |||
601 | struct skb_frag_struct *frag; | 601 | struct skb_frag_struct *frag; |
602 | struct mlx4_en_tx_info *tx_info; | 602 | struct mlx4_en_tx_info *tx_info; |
603 | struct ethhdr *ethh; | 603 | struct ethhdr *ethh; |
604 | u64 mac; | ||
605 | u32 mac_l, mac_h; | ||
606 | int tx_ind = 0; | 604 | int tx_ind = 0; |
607 | int nr_txbb; | 605 | int nr_txbb; |
608 | int desc_size; | 606 | int desc_size; |
@@ -687,16 +685,9 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) | |||
687 | } | 685 | } |
688 | 686 | ||
689 | /* Copy dst mac address to wqe */ | 687 | /* Copy dst mac address to wqe */ |
690 | skb_reset_mac_header(skb); | 688 | ethh = (struct ethhdr *)skb->data; |
691 | ethh = eth_hdr(skb); | 689 | tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((u16 *)ethh->h_dest); |
692 | if (ethh && ethh->h_dest) { | 690 | tx_desc->ctrl.imm = get_unaligned((u32 *)(ethh->h_dest + 2)); |
693 | mac = mlx4_en_mac_to_u64(ethh->h_dest); | ||
694 | mac_h = (u32) ((mac & 0xffff00000000ULL) >> 16); | ||
695 | mac_l = (u32) (mac & 0xffffffff); | ||
696 | tx_desc->ctrl.srcrb_flags |= cpu_to_be32(mac_h); | ||
697 | tx_desc->ctrl.imm = cpu_to_be32(mac_l); | ||
698 | } | ||
699 | |||
700 | /* Handle LSO (TSO) packets */ | 691 | /* Handle LSO (TSO) packets */ |
701 | if (lso_header_size) { | 692 | if (lso_header_size) { |
702 | /* Mark opcode as LSO */ | 693 | /* Mark opcode as LSO */ |
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index bee8fa231276..091f9e7dc8b9 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h | |||
@@ -212,7 +212,10 @@ struct mlx4_wqe_ctrl_seg { | |||
212 | * [1] SE (solicited event) | 212 | * [1] SE (solicited event) |
213 | * [0] FL (force loopback) | 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 | * imm is immediate data for send/RDMA write w/ immediate; | 220 | * imm is immediate data for send/RDMA write w/ immediate; |
218 | * also invalidation key for send with invalidate; input | 221 | * also invalidation key for send with invalidate; input |