From patchwork Tue May 19 05:43:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 27388 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 D0F8CB7067 for ; Tue, 19 May 2009 15:43:26 +1000 (EST) Received: by ozlabs.org (Postfix) id B7F42DE0E4; Tue, 19 May 2009 15:43:26 +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 4D927DE0E1 for ; Tue, 19 May 2009 15:43:26 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751520AbZESFnS (ORCPT ); Tue, 19 May 2009 01:43:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751104AbZESFnR (ORCPT ); Tue, 19 May 2009 01:43:17 -0400 Received: from gw1.cosmosbay.com ([212.99.114.194]:39431 "EHLO gw1.cosmosbay.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750849AbZESFnQ convert rfc822-to-8bit (ORCPT ); Tue, 19 May 2009 01:43:16 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) by gw1.cosmosbay.com (8.13.7/8.13.7) with ESMTP id n4J5hASU028674; Tue, 19 May 2009 07:43:10 +0200 Message-ID: <4A1246ED.3080203@cosmosbay.com> Date: Tue, 19 May 2009 07:43:09 +0200 From: Eric Dumazet User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: David Miller CC: netdev@vger.kernel.org Subject: [PATCH] sch_teql: Use net_device internal stats References: <4A11391D.8060503@cosmosbay.com> <20090518.151256.217066131.davem@davemloft.net> <4A120C8B.80108@cosmosbay.com> <20090518.193438.158960584.davem@davemloft.net> In-Reply-To: <20090518.193438.158960584.davem@davemloft.net> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.6 (gw1.cosmosbay.com [0.0.0.0]); Tue, 19 May 2009 07:43:11 +0200 (CEST) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org David Miller a écrit : > From: Eric Dumazet > Date: Tue, 19 May 2009 03:34:03 +0200 > >> Looking again at teql_master_xmit(), I wonder if there is another >> problem in it. >> >> int subq = skb_get_queue_mapping(skb); >> >> But as a matter of fact, following code assumes subq is 0 >> >> struct netdev_queue *slave_txq = netdev_get_tx_queue(slave, 0); >> ... >> if (__netif_subqueue_stopped(slave, subq) || >> ... >> >> Either we should set subq to 0, or call dev_pick_tx() to better >> take into account multi queue slaves ? >> >> (As teqlN has one queue, I assume original dev_queue_xmit() will >> set skb queue_mapping to 0 before entering teql_master_xmit(), but >> maybe other paths could call teql_master_xmit() not through dev_queue_xmit() ? >> >> Oh well, time for sleeping a bit... > > I was admittedly very hasty with the multiqueue conversion here. > I'll take a closer look at this. Thanks David In the meantime, I did the master->stats removal for teqlN devices, for net-next-2.6, if you dont mind :) [PATCH] sch_teql: Use net_device internal stats We can slightly reduce size of teqlN structure, not duplicating stats structure in teql_master but using stats field from net_device.stats for tx_errors and from netdev_queue for tx_bytes/tx_packets/tx_dropped values. Signed-off-by: Eric Dumazet --- net/sched/sch_teql.c | 17 +++++------------ 1 files changed, 5 insertions(+), 12 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/net/sched/sch_teql.c b/net/sched/sch_teql.c index 3b64182..428a5ef 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c @@ -58,7 +58,6 @@ struct teql_master struct net_device *dev; struct Qdisc *slaves; struct list_head master_list; - struct net_device_stats stats; }; struct teql_sched_data @@ -272,6 +271,7 @@ static inline int teql_resolve(struct sk_buff *skb, static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev) { struct teql_master *master = netdev_priv(dev); + struct netdev_queue *txq = netdev_get_tx_queue(dev, 0); struct Qdisc *start, *q; int busy; int nores; @@ -311,8 +311,8 @@ restart: __netif_tx_unlock(slave_txq); master->slaves = NEXT_SLAVE(q); netif_wake_queue(dev); - master->stats.tx_packets++; - master->stats.tx_bytes += length; + txq->tx_packets++; + txq->tx_bytes += length; return 0; } __netif_tx_unlock(slave_txq); @@ -339,10 +339,10 @@ restart: netif_stop_queue(dev); return 1; } - master->stats.tx_errors++; + dev->stats.tx_errors++; drop: - master->stats.tx_dropped++; + txq->tx_dropped++; dev_kfree_skb(skb); return 0; } @@ -395,12 +395,6 @@ static int teql_master_close(struct net_device *dev) return 0; } -static struct net_device_stats *teql_master_stats(struct net_device *dev) -{ - struct teql_master *m = netdev_priv(dev); - return &m->stats; -} - static int teql_master_mtu(struct net_device *dev, int new_mtu) { struct teql_master *m = netdev_priv(dev); @@ -425,7 +419,6 @@ static const struct net_device_ops teql_netdev_ops = { .ndo_open = teql_master_open, .ndo_stop = teql_master_close, .ndo_start_xmit = teql_master_xmit, - .ndo_get_stats = teql_master_stats, .ndo_change_mtu = teql_master_mtu, };