Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3716179imu; Tue, 18 Dec 2018 03:03:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/WZhRujYUNFzaLpDRONFR5sCwtstJ4kSLMe3cfPvGLGltoM/JPpZMlQNEDSyxCCG3Mt/5GQ X-Received: by 2002:a17:902:a03:: with SMTP id 3mr16181474plo.112.1545131017240; Tue, 18 Dec 2018 03:03:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545131017; cv=none; d=google.com; s=arc-20160816; b=ZxU3SbWbEXiawE0DKLufNZEW6bJ2tXHl3xxwLLZT7y9RMdCHomcGHTI+CKvBnbfaTK RhrBHWF7V9enGn6yX+v1njdbJH7su3QUQU5qUOS5Hq6zZN40V7M7ZaS/ICYmZ9x/309J mWMS1RkQV11X5WdU1rIswJyI702J0/XzuAkuqt39UT/5SfK/2Yda0IFx+JOI6WKPcRTV RYlBYjIwVMi5t9pBW5gVkRhJztOajTrKa1QxxNFPwtzgnEaARSYnf75Lh2C+/PU5W7KE EI9Pc97Xr/ChJofWswhj8+NKR2Wd1lVkLh/jTtnzCRI4fJ91LyG9779i5Fc9tcx56k8q 6vZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=HpJymBXrrV08jyhFGsEgwjk2HDn6Cpef0enZaQ7OYQg=; b=Z+xS4WVXf9Y7H9U4a4fD2cOVXS+R9aXFa3S+e8B9X1Lj90xTK7uIsl8/Xrq3na2WeN Q6EAv1AewoavkBhHZxICZByxUZdXKYbN3jDW5w3VpLr0b8Jo2d06u6Mpok43JblKqZ97 K6OPRJszNgkL3F7LD75QDjSzOWKoNBMhB4ddhzcwIQ1Bx5l6qTpNjD/2O9QMK3sPxJr8 l9HuM9VptNHiczuAbGnpPIEC7Pp5m4el4JCNqJogKoMVB0E9ZFAsj06NJfvTZ24MciV3 nG/VLrYyrmHYvOACef8Une6zOAT4jyxgbk86TNpLFCRYOyo6fe7XZiycCbxevtjq5PqC UxLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q20si12660620pll.255.2018.12.18.03.03.19; Tue, 18 Dec 2018 03:03:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726807AbeLRLCR (ORCPT + 99 others); Tue, 18 Dec 2018 06:02:17 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:38224 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726691AbeLRLCI (ORCPT ); Tue, 18 Dec 2018 06:02:08 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D98A3B6677BC2; Tue, 18 Dec 2018 19:02:03 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.408.0; Tue, 18 Dec 2018 19:01:57 +0800 From: Peng Li To: CC: , , , , , Subject: [PATCH net-next 07/12] net: hns3: update coalesce param per second Date: Tue, 18 Dec 2018 19:37:54 +0800 Message-ID: <1545133079-79605-8-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1545133079-79605-1-git-send-email-lipeng321@huawei.com> References: <1545133079-79605-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org coalesce param updates every 100 napi times, it may update a little late if ping test after a high rate flow, may over napi poll is called 100 times as ping test sends packets every second. This patch updates coalesce param every second, instead with every 100 napi times. It can not update the param 100% in time, but the lag time is very short. Signed-off-by: Peng Li --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 8 +++----- drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 4 ---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 354eca8..d060029 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -240,7 +240,6 @@ static void hns3_vector_gl_rl_init(struct hns3_enet_tqp_vector *tqp_vector, tqp_vector->tx_group.coal.int_gl = HNS3_INT_GL_50K; tqp_vector->rx_group.coal.int_gl = HNS3_INT_GL_50K; - tqp_vector->int_adapt_down = HNS3_INT_ADAPT_DOWN_START; tqp_vector->rx_group.coal.flow_level = HNS3_FLOW_LOW; tqp_vector->tx_group.coal.flow_level = HNS3_FLOW_LOW; } @@ -2846,10 +2845,10 @@ static void hns3_update_new_int_gl(struct hns3_enet_tqp_vector *tqp_vector) struct hns3_enet_ring_group *tx_group = &tqp_vector->tx_group; bool rx_update, tx_update; - if (tqp_vector->int_adapt_down > 0) { - tqp_vector->int_adapt_down--; + /* update param every 1000ms */ + if (time_before(jiffies, + tqp_vector->last_jiffies + msecs_to_jiffies(1000))) return; - } if (rx_group->coal.gl_adapt_enable) { rx_update = hns3_get_new_int_gl(rx_group); @@ -2866,7 +2865,6 @@ static void hns3_update_new_int_gl(struct hns3_enet_tqp_vector *tqp_vector) } tqp_vector->last_jiffies = jiffies; - tqp_vector->int_adapt_down = HNS3_INT_ADAPT_DOWN_START; } static int hns3_nic_common_poll(struct napi_struct *napi, int budget) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h index 4e4b48b..e55995e 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -476,8 +476,6 @@ enum hns3_link_mode_bits { #define HNS3_INT_RL_MAX 0x00EC #define HNS3_INT_RL_ENABLE_MASK 0x40 -#define HNS3_INT_ADAPT_DOWN_START 100 - struct hns3_enet_coalesce { u16 int_gl; u8 gl_adapt_enable; @@ -512,8 +510,6 @@ struct hns3_enet_tqp_vector { char name[HNAE3_INT_NAME_LEN]; - /* when 0 should adjust interrupt coalesce parameter */ - u8 int_adapt_down; unsigned long last_jiffies; } ____cacheline_internodealigned_in_smp; -- 1.9.1