From patchwork Sat Feb 25 10:51:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 143045 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 03305B6FB9 for ; Sat, 25 Feb 2012 21:51:41 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756132Ab2BYKvM (ORCPT ); Sat, 25 Feb 2012 05:51:12 -0500 Received: from mail-ww0-f44.google.com ([74.125.82.44]:54078 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754833Ab2BYKvL (ORCPT ); Sat, 25 Feb 2012 05:51:11 -0500 Received: by wgbdr13 with SMTP id dr13so397546wgb.1 for ; Sat, 25 Feb 2012 02:51:10 -0800 (PST) Received-SPF: pass (google.com: domain of eric.dumazet@gmail.com designates 10.180.24.166 as permitted sender) client-ip=10.180.24.166; Authentication-Results: mr.google.com; spf=pass (google.com: domain of eric.dumazet@gmail.com designates 10.180.24.166 as permitted sender) smtp.mail=eric.dumazet@gmail.com; dkim=pass header.i=eric.dumazet@gmail.com Received: from mr.google.com ([10.180.24.166]) by 10.180.24.166 with SMTP id v6mr3157733wif.10.1330167070189 (num_hops = 1); Sat, 25 Feb 2012 02:51:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:subject:from:to:cc:date:content-type:x-mailer :content-transfer-encoding:mime-version; bh=Rw6UeBaKrAMjaYcX6/dk7QAM7IpiqWIWFXdZ4Rf3LgI=; b=cznZvOcK6SmQEE7CMdsWSQ/vPrP3Sfv8HkeiHsDgGghThO4+DP6WWwIa4iPuYSAYzo f3ZDcFQA1/Vpu9yWKibf+YmHW+YTDOdvxhf9OoH7jJiABYYnUHb93Cjazg0E5BQ70woK 9m7LhQl7ErX02WrhFsEeaDaK0cNqWdSUJP8Qw= Received: by 10.180.24.166 with SMTP id v6mr2477165wif.10.1330167070064; Sat, 25 Feb 2012 02:51:10 -0800 (PST) Received: from [10.170.237.2] ([87.255.129.107]) by mx.google.com with ESMTPS id dr5sm22485902wib.0.2012.02.25.02.51.07 (version=SSLv3 cipher=OTHER); Sat, 25 Feb 2012 02:51:09 -0800 (PST) Message-ID: <1330167065.2462.53.camel@edumazet-laptop> Subject: [PATCH net-next] mlx4_en: dont change mac_header on xmit From: Eric Dumazet To: David Miller Cc: netdev , Yevgeny Petrilin Date: Sat, 25 Feb 2012 11:51:05 +0100 X-Mailer: Evolution 3.2.2- Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Cc: Yevgeny Petrilin --- Please test this patch before we can commit it, thanks ! drivers/net/ethernet/mellanox/mlx4/en_tx.c | 15 +++------------ include/linux/mlx4/qp.h | 5 ++++- 2 files changed, 7 insertions(+), 13 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index ff32505..2fd5140 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) struct skb_frag_struct *frag; struct mlx4_en_tx_info *tx_info; struct ethhdr *ethh; - u64 mac; - u32 mac_l, mac_h; int tx_ind = 0; int nr_txbb; int desc_size; @@ -687,16 +685,9 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) } /* Copy dst mac address to wqe */ - skb_reset_mac_header(skb); - ethh = eth_hdr(skb); - if (ethh && ethh->h_dest) { - mac = mlx4_en_mac_to_u64(ethh->h_dest); - mac_h = (u32) ((mac & 0xffff00000000ULL) >> 16); - mac_l = (u32) (mac & 0xffffffff); - tx_desc->ctrl.srcrb_flags |= cpu_to_be32(mac_h); - tx_desc->ctrl.imm = cpu_to_be32(mac_l); - } - + ethh = (struct ethhdr *)skb->data; + tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((u16 *)ethh->h_dest); + tx_desc->ctrl.imm = get_unaligned((u32 *)(ethh->h_dest + 2)); /* Handle LSO (TSO) packets */ if (lso_header_size) { /* Mark opcode as LSO */ diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index bee8fa2..091f9e7 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h @@ -212,7 +212,10 @@ struct mlx4_wqe_ctrl_seg { * [1] SE (solicited event) * [0] FL (force loopback) */ - __be32 srcrb_flags; + union { + __be32 srcrb_flags; + __be16 srcrb_flags16[2]; + }; /* * imm is immediate data for send/RDMA write w/ immediate; * also invalidation key for send with invalidate; input