From patchwork Tue Apr 12 08:15:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: amit salecha X-Patchwork-Id: 90739 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 07250B6F1E for ; Tue, 12 Apr 2011 18:16:04 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754109Ab1DLIP6 (ORCPT ); Tue, 12 Apr 2011 04:15:58 -0400 Received: from mvnat01.qlogic.com ([198.186.3.73]:10859 "EHLO unm84.unminc.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753523Ab1DLIP4 (ORCPT ); Tue, 12 Apr 2011 04:15:56 -0400 Received: from unm84.unminc.com (localhost.localdomain [127.0.0.1]) by unm84.unminc.com (8.13.8/8.13.8) with ESMTP id p3C8Fpj4015211; Tue, 12 Apr 2011 01:15:51 -0700 Received: (from amit@localhost) by unm84.unminc.com (8.13.8/8.13.8/Submit) id p3C8FpN0015210; Tue, 12 Apr 2011 01:15:51 -0700 X-Authentication-Warning: unm84.unminc.com: amit set sender to amit.salecha@qlogic.com using -f From: Amit Kumar Salecha To: netdev@vger.kernel.org Cc: stable@kernel.org Subject: [PATCH NET-2.6 1/1] qlcnic: limit skb frags for non tso packet Date: Tue, 12 Apr 2011 01:15:51 -0700 Message-Id: <1302596151-15182-1-git-send-email-amit.salecha@qlogic.com> X-Mailer: git-send-email 1.7.3.2 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Machines are getting deadlock in four node cluster environment. All nodes are accessing (find /gfs2 -depth -print|cpio -ocv > /dev/null) 200 GB storage on a GFS2 filesystem. This result in memory fragmentation and driver receives 18 frags for 1448 byte packets. For non tso packet, fw drops the tx request, if it has >14 frags. Fixing it by pulling extra frags. Cc: stable@kernel.org Signed-off-by: Amit Kumar Salecha --- drivers/net/qlcnic/qlcnic.h | 1 + drivers/net/qlcnic/qlcnic_main.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h index dc44564..b0dead0 100644 --- a/drivers/net/qlcnic/qlcnic.h +++ b/drivers/net/qlcnic/qlcnic.h @@ -99,6 +99,7 @@ #define TX_UDPV6_PKT 0x0c /* Tx defines */ +#define QLCNIC_MAX_FRAGS_PER_TX 14 #define MAX_TSO_HEADER_DESC 2 #define MGMT_CMD_DESC_RESV 4 #define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + MAX_TSO_HEADER_DESC \ diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index cd88c7e..cb1a1ef 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c @@ -2099,6 +2099,7 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) struct cmd_desc_type0 *hwdesc, *first_desc; struct pci_dev *pdev; struct ethhdr *phdr; + int delta = 0; int i, k; u32 producer; @@ -2118,6 +2119,19 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) } frag_count = skb_shinfo(skb)->nr_frags + 1; + /* 14 frags supported for normal packet and + * 32 frags supported for TSO packet + */ + if (!skb_is_gso(skb) && frag_count > QLCNIC_MAX_FRAGS_PER_TX) { + + for (i = 0; i < (frag_count - QLCNIC_MAX_FRAGS_PER_TX); i++) + delta += skb_shinfo(skb)->frags[i].size; + + if (!__pskb_pull_tail(skb, delta)) + goto drop_packet; + + frag_count = 1 + skb_shinfo(skb)->nr_frags; + } /* 4 fragments per cmd des */ no_of_desc = (frag_count + 3) >> 2;