From patchwork Wed Apr 24 21:53:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 239324 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 B1B202C009C for ; Thu, 25 Apr 2013 07:53:15 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758295Ab3DXVxM (ORCPT ); Wed, 24 Apr 2013 17:53:12 -0400 Received: from cmexedge2.ext.emulex.com ([138.239.224.100]:30394 "EHLO CMEXEDGE2.ext.emulex.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757864Ab3DXVxL (ORCPT ); Wed, 24 Apr 2013 17:53:11 -0400 Received: from CMEXHTCAS2.ad.emulex.com (138.239.115.218) by CMEXEDGE2.ext.emulex.com (138.239.224.100) with Microsoft SMTP Server (TLS) id 14.2.318.4; Wed, 24 Apr 2013 14:54:02 -0700 Received: from emulex.com (138.239.131.191) by smtp.emulex.com (138.239.115.208) with Microsoft SMTP Server (TLS) id 14.2.318.4; Wed, 24 Apr 2013 14:53:11 -0700 Date: Wed, 24 Apr 2013 16:53:08 -0500 From: Ajit Khaparde To: Subject: [PATCH net 3/3] be2net: Fix PVID tag offload for packets with inline VLAN tag. Message-ID: <20130424215308.GA5829@emulex.com> Reply-To: Ajit Khaparde MIME-Version: 1.0 Content-Disposition: inline X-URL: http://www.emulex.com Organization: Emulex Corp User-Agent: "Ajit's Mutt" X-OS: Linux i686 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org BE3 HW in UMC mode could wrongly double tag a packet with PVID when the packet already has a inlined VLAN tag. In UMC mode, When HW finds that a packet is already VLAN tagged PVID should not be inserted into the packet. To fix this use the FW hack to instruct the HW to skip PVID tagging. Signed-off-by: Ajit Khaparde --- drivers/net/ethernet/emulex/benet/be_main.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 21109b5..1232e91 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -834,6 +834,7 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, u32 start = txq->head, eth_hdr_len; bool dummy_wrb, stopped = false; bool skip_hw_vlan = false; + struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; eth_hdr_len = ntohs(skb->protocol) == ETH_P_8021Q ? VLAN_ETH_HLEN : ETH_HLEN; @@ -846,6 +847,13 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len)); } + /* If vlan tag is already inlined in the packet, skip HW VLAN + * tagging in UMC mode + */ + if ((adapter->function_mode & UMC_ENABLED) && + veh->h_vlan_proto == htons(ETH_P_8021Q)) + skip_hw_vlan = true; + /* HW has a bug wherein it will calculate CSUM for VLAN * pkts even though it is disabled. * Manually insert VLAN in pkt.