From patchwork Wed Aug 19 01:17:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stephen hemminger X-Patchwork-Id: 31615 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id C6274B7079 for ; Wed, 19 Aug 2009 11:23:03 +1000 (EST) Received: by ozlabs.org (Postfix) id B9BEDDDD0B; Wed, 19 Aug 2009 11:23:03 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 3E83ADDD01 for ; Wed, 19 Aug 2009 11:23:03 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751314AbZHSBWu (ORCPT ); Tue, 18 Aug 2009 21:22:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751227AbZHSBWt (ORCPT ); Tue, 18 Aug 2009 21:22:49 -0400 Received: from suva.vyatta.com ([76.74.103.44]:50672 "EHLO suva.vyatta.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751014AbZHSBWp (ORCPT ); Tue, 18 Aug 2009 21:22:45 -0400 Received: from suva.vyatta.com (suva [127.0.0.1]) by suva.vyatta.com (8.13.7/8.13.7) with ESMTP id n7J1MkWu026281; Tue, 18 Aug 2009 18:22:46 -0700 Received: (from shemminger@localhost) by suva.vyatta.com (8.13.7/8.13.7/Submit) id n7J1MkMQ026280; Tue, 18 Aug 2009 18:22:46 -0700 Message-Id: <20090819011738.993523293@vyatta.com> References: <20090819011704.685802801@vyatta.com> User-Agent: quilt/0.46-1 Date: Tue, 18 Aug 2009 18:17:10 -0700 From: Stephen Hemminger To: David Miller Cc: netdev@vger.kernel.org Subject: [PATCH 6/7] sky2: no recycling Content-Disposition: inline; filename=sky2-no-recycle.patch Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Recycling turns out to be a bad idea! For most use cases, the packet can not be reused: TCP packets are cloned. Even for the ideal case of forwarding, it hurts performance because of CPU ping/pong. On a multi-core system forwarding of 64 byte packets is worse much worse: recycling = 24% forwarded vs no recycling = 42% forwarded Signed-off-by: Stephen Hemminger --- a/drivers/net/sky2.c 2009-08-18 17:50:31.591887510 -0700 +++ b/drivers/net/sky2.c 2009-08-18 17:53:04.506927814 -0700 @@ -1177,7 +1177,6 @@ static void sky2_rx_clean(struct sky2_po re->skb = NULL; } } - skb_queue_purge(&sky2->rx_recycle); } /* Basic MII support */ @@ -1269,10 +1268,8 @@ static struct sk_buff *sky2_rx_alloc(str struct sk_buff *skb; int i; - skb = __skb_dequeue(&sky2->rx_recycle); - if (!skb) - skb = netdev_alloc_skb(sky2->netdev, sky2->rx_data_size - + sky2_rx_pad(sky2->hw)); + skb = netdev_alloc_skb(sky2->netdev, + sky2->rx_data_size + sky2_rx_pad(sky2->hw)); if (!skb) goto nomem; @@ -1364,8 +1361,6 @@ static int sky2_rx_start(struct sky2_por sky2->rx_data_size = size; - skb_queue_head_init(&sky2->rx_recycle); - /* Fill Rx ring */ for (i = 0; i < sky2->rx_pending; i++) { re = sky2->rx_ring + i; @@ -1776,12 +1771,7 @@ static void sky2_tx_complete(struct sky2 dev->stats.tx_packets++; dev->stats.tx_bytes += skb->len; - if (skb_queue_len(&sky2->rx_recycle) < sky2->rx_pending - && skb_recycle_check(skb, sky2->rx_data_size - + sky2_rx_pad(sky2->hw))) - __skb_queue_head(&sky2->rx_recycle, skb); - else - dev_kfree_skb_any(skb); + dev_kfree_skb_any(skb); sky2->tx_next = RING_NEXT(idx, sky2->tx_ring_size); } --- a/drivers/net/sky2.h 2009-08-18 17:50:34.706665948 -0700 +++ b/drivers/net/sky2.h 2009-08-18 17:51:02.596652122 -0700 @@ -2032,7 +2032,6 @@ struct sky2_port { u16 rx_pending; u16 rx_data_size; u16 rx_nfrags; - struct sk_buff_head rx_recycle; #ifdef SKY2_VLAN_TAG_USED u16 rx_tag;