Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261984AbUFWWJR (ORCPT ); Wed, 23 Jun 2004 18:09:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261951AbUFWWJP (ORCPT ); Wed, 23 Jun 2004 18:09:15 -0400 Received: from siaag1ai.mx.compuserve.com ([149.174.40.24]:4479 "EHLO siaag1ai.mx.compuserve.com") by vger.kernel.org with ESMTP id S261984AbUFWWG6 (ORCPT ); Wed, 23 Jun 2004 18:06:58 -0400 Date: Wed, 23 Jun 2004 18:00:46 -0400 From: Chuck Ebbert <76306.1226@compuserve.com> Subject: [PATCH] Trivial loopback optimization for 2.6.7 To: Jeff Garzik Cc: linux-kernel Message-ID: <200406231803_MC3-1-854F-EC5E@compuserve.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1643 Lines: 48 This patch is for the network loopback driver: 1: Removes unnecessary include with misleading comment. 2: Optimizes device stats update in the transmit routine (saves 2 loads, one add, one increment per packet sent.) Why is there no stats counting in the TSO code in emulate_large_send_offload()? Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com> --- 267.0/drivers/net/loopback.c 2004-06-21 16:09:45.000000000 -0400 +++ 267.1/drivers/net/loopback.c 2004-06-21 16:16:20.000000000 -0400 @@ -51,7 +51,6 @@ #include #include #include -#include /* For the statistics structure. */ #include /* For ARPHRD_ETHER */ #include #include @@ -143,10 +142,14 @@ static int loopback_xmit(struct sk_buff dev->last_rx = jiffies; if (likely(stats)) { - stats->rx_bytes+=skb->len; - stats->tx_bytes+=skb->len; - stats->rx_packets++; - stats->tx_packets++; + /* + * Transmit/receive stats are identical; + * rx_packets is first in struct. + */ + stats->tx_packets = ++stats->rx_packets; + + stats->rx_bytes += skb->len; + stats->tx_bytes = stats->rx_bytes; } netif_rx(skb); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/