From patchwork Tue Dec 9 16:40:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 1898 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id CC13A68AE; Tue, 9 Dec 2014 17:43:12 +0100 (CET) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by dpdk.org (Postfix) with ESMTP id 34F35DE0 for ; Tue, 9 Dec 2014 17:43:09 +0100 (CET) Received: by mail-pd0-f172.google.com with SMTP id y13so865023pdi.17 for ; Tue, 09 Dec 2014 08:43:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=7I3ObgHGlN8+8o6zsibKqpUxfLDjhcVi3Eb7wlb1JMc=; b=k4LyhsZHsONVzA+gdCVQFTZFtFuu2zb0xQwlToyJwn33aojGYMxv+h4agfQPiqV2N3 cJ109/KlW4zRgIigEpcui221yL1aALrHM1abV7xQnGilEMVAyXvHzFgsL2LHcm2qfsyI mbeZohlx/RMOIPqCXtT0Rice9jARCiQKzA2bzR2aJAANFAFIoUrEcUl9xl5S/sY9S2cK ifdj/DhYqZo3FH6QQ29sQA0oIRhPOtSkSu7eiaB3fsNpRr1re1W5Azg22JjiCWS88E9l A5QLN5ZGU1kPO2opuHM0zwteSMEQJem8qUowWI3CNuEBQez1HO+iOf7kOLKUpRv5zgBK 8w9g== X-Gm-Message-State: ALoCoQncDYDzPwQKuzuub3PynDAk9RQIotFFEe6JUaSBVm6vhDs5mmfY/Fg+lCwfyOHFC65TcWFm X-Received: by 10.66.226.167 with SMTP id rt7mr7147355pac.12.1418143388329; Tue, 09 Dec 2014 08:43:08 -0800 (PST) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id 1sm1895305pdw.87.2014.12.09.08.43.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Dec 2014 08:43:07 -0800 (PST) Date: Tue, 9 Dec 2014 08:40:09 -0800 From: Stephen Hemminger To: dev@dpdk.org Message-ID: <20141209084009.4ebcd019@urahara> In-Reply-To: <20141209083851.6c491e92@urahara> References: <20141209083851.6c491e92@urahara> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/4] rte_sched: keep track of RED drops X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add new statistic to keep track of drops due to RED. Signed-off-by: Stephen Hemminger --- a/lib/librte_sched/rte_sched.c 2014-12-08 09:28:37.810590895 -0800 +++ b/lib/librte_sched/rte_sched.c 2014-12-08 09:28:37.810590895 -0800 @@ -1028,7 +1028,9 @@ rte_sched_port_update_subport_stats(stru } static inline void -rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port *port, uint32_t qindex, struct rte_mbuf *pkt) +rte_sched_port_update_subport_stats_on_drop(struct rte_sched_port *port, + uint32_t qindex, + struct rte_mbuf *pkt, uint32_t red) { struct rte_sched_subport *s = port->subport + (qindex / rte_sched_port_queues_per_subport(port)); uint32_t tc_index = (qindex >> 2) & 0x3; @@ -1036,6 +1038,9 @@ rte_sched_port_update_subport_stats_on_d s->stats.n_pkts_tc_dropped[tc_index] += 1; s->stats.n_bytes_tc_dropped[tc_index] += pkt_len; +#ifdef RTE_SCHED_RED + s->stats.n_pkts_red_dropped[tc_index] += red; +#endif } static inline void @@ -1206,12 +1211,20 @@ rte_sched_port_enqueue_qwa(struct rte_sc qlen = q->qw - q->qr; /* Drop the packet (and update drop stats) when queue is full */ - if (unlikely(rte_sched_port_red_drop(port, pkt, qindex, qlen) || (qlen >= qsize))) { + if (unlikely(rte_sched_port_red_drop(port, pkt, qindex, qlen))) { +#ifdef RTE_SCHED_COLLECT_STATS + rte_sched_port_update_subport_stats_on_drop(port, qindex, pkt, 1); + rte_sched_port_update_queue_stats_on_drop(port, qindex, pkt, 1); +#endif rte_pktmbuf_free(pkt); + } + + if (qlen >= qsize) { #ifdef RTE_SCHED_COLLECT_STATS - rte_sched_port_update_subport_stats_on_drop(port, qindex, pkt); - rte_sched_port_update_queue_stats_on_drop(port, qindex, pkt); + rte_sched_port_update_subport_stats_on_drop(port, qindex, pkt, 0); + rte_sched_port_update_queue_stats_on_drop(port, qindex, pkt, 0); #endif + rte_pktmbuf_free(pkt); return 0; } --- a/lib/librte_sched/rte_sched.h 2014-12-08 09:28:37.810590895 -0800 +++ b/lib/librte_sched/rte_sched.h 2014-12-08 09:29:11.402692026 -0800 @@ -140,6 +140,9 @@ struct rte_sched_subport_stats { subport for each traffic class*/ uint32_t n_bytes_tc_dropped[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; /**< Number of bytes dropped by the current subport for each traffic class due to subport queues being full or congested */ +#ifdef RTE_SCHED_RED + uint32_t n_pkts_red_dropped[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]; /**< Number of packets dropped by red */ +#endif }; /** Pipe configuration parameters. The period and credits_per_period parameters are measured @@ -168,7 +171,9 @@ struct rte_sched_queue_stats { /* Packets */ uint32_t n_pkts; /**< Number of packets successfully written to current queue */ uint32_t n_pkts_dropped; /**< Number of packets dropped due to current queue being full or congested */ - +#ifdef RTE_SCHED_RED + uint32_t n_pkts_red_dropped; +#endif /* Bytes */ uint32_t n_bytes; /**< Number of bytes successfully written to current queue */ uint32_t n_bytes_dropped; /**< Number of bytes dropped due to current queue being full or congested */