From patchwork Wed Nov 21 14:28:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tal Gilboa X-Patchwork-Id: 1001177 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 430Q0w4k34z9s3C for ; Thu, 22 Nov 2018 01:28:32 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730909AbeKVBDI (ORCPT ); Wed, 21 Nov 2018 20:03:08 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:41395 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728367AbeKVBDI (ORCPT ); Wed, 21 Nov 2018 20:03:08 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from talgi@mellanox.com) with ESMTPS (AES256-SHA encrypted); 21 Nov 2018 16:34:11 +0200 Received: from gen-l-vrt-692.mtl.labs.mlnx (gen-l-vrt-692.mtl.labs.mlnx [10.141.69.20]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wALESSav027673; Wed, 21 Nov 2018 16:28:28 +0200 Received: from gen-l-vrt-692.mtl.labs.mlnx (localhost [127.0.0.1]) by gen-l-vrt-692.mtl.labs.mlnx (8.14.7/8.14.7) with ESMTP id wALESSrF051585; Wed, 21 Nov 2018 16:28:28 +0200 Received: (from talgi@localhost) by gen-l-vrt-692.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id wALESR5T051584; Wed, 21 Nov 2018 16:28:27 +0200 From: Tal Gilboa To: David Miller Cc: netdev@vger.kernel.org, Tariq Toukan , Tal Gilboa , Saeed Mahameed , Florian Fainelli , Andy Gospodarek Subject: [PATCH net] net/dim: Update DIM start sample after each DIM iteration Date: Wed, 21 Nov 2018 16:28:23 +0200 Message-Id: <1542810503-51548-1-git-send-email-talgi@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On every iteration of net_dim, the algorithm may choose to check for the system state by comparing current data sample with previous data sample. After each of these comparison, regardless of the action taken, the sample used as baseline is needed to be updated. This patch fixes a bug that causes DIM to take wrong decisions, due to never updating the baseline sample for comparison between iterations. This way, DIM always compares current sample with zeros. Although this is a functional fix, it also improves and stabilizes performance as the algorithm works properly now. Performance: Tested single UDP TX stream with pktgen: samples/pktgen/pktgen_sample03_burst_single_flow.sh -i p4p2 -d 1.1.1.1 -m 24:8a:07:88:26:8b -f 3 -b 128 ConnectX-5 100GbE packet rate improved from 15-19Mpps to 19-20Mpps. Also, toggling between profiles is less frequent with the fix. Fixes: 8115b750dbcb ("net/dim: use struct net_dim_sample as arg to net_dim") Signed-off-by: Tal Gilboa Reviewed-by: Tariq Toukan --- include/linux/net_dim.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/net_dim.h b/include/linux/net_dim.h index c79e859..fd45838 100644 --- a/include/linux/net_dim.h +++ b/include/linux/net_dim.h @@ -406,6 +406,8 @@ static inline void net_dim(struct net_dim *dim, } /* fall through */ case NET_DIM_START_MEASURE: + net_dim_sample(end_sample.event_ctr, end_sample.pkt_ctr, end_sample.byte_ctr, + &dim->start_sample); dim->state = NET_DIM_MEASURE_IN_PROGRESS; break; case NET_DIM_APPLY_NEW_PROFILE: