From patchwork Fri Jan 5 22:58:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Gospodarek X-Patchwork-Id: 856202 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@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; dkim=pass (2048-bit key; unprotected) header.d=greyhouse-net.20150623.gappssmtp.com header.i=@greyhouse-net.20150623.gappssmtp.com header.b="KM9mLq4B"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zD0TK3RBkz9ryQ for ; Sat, 6 Jan 2018 09:58:45 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752268AbeAEW6m (ORCPT ); Fri, 5 Jan 2018 17:58:42 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:34800 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752112AbeAEW6j (ORCPT ); Fri, 5 Jan 2018 17:58:39 -0500 Received: by mail-qt0-f193.google.com with SMTP id 33so7570104qtv.1 for ; Fri, 05 Jan 2018 14:58:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greyhouse-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zoeznA32yq7tIZXjaLsH3k1WGqbSw2jp5om/YL8hiZY=; b=KM9mLq4Buo7qyRxmPH7J2c11iCTZ3F7P9OpcsIzh8mEkWallrPQVCtX6Pc5dqe2HCt RUglAA816MI8RALwLZjERDb2EoyM+/x2vWw6LrZtp+Jq9YwVlURtVj8Tfkl7/F5aJ+S0 skjlkZ84gm/UmfYmbFXLp96TD3CJ+XFEE4PagTYRq722so8DVYOT2G9TaRwx6+h53CS7 92PYTmJvrtPNS7CplQDwBbNNsu75g8A2ZnikNVyMwVG3iIHKfYt65gw0gFE9a9oAq8Wf gGTebrt6h7y/+OCWWvBAitJthjQYofZK4TSR9PTNchim02tplxMz+PlbblizyV+bIHyt j1Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zoeznA32yq7tIZXjaLsH3k1WGqbSw2jp5om/YL8hiZY=; b=Q1qy32gtbV4N3RnipQWREZ2HA7faRpzNdUm8QhEwInFEI1n9bqg3wu85cXFMxyOmaq L0QnACK+w7dJtxI9G/KiHTd4E5VQIy4j5zUVLMCgejw934gXo545tbz/CQhsrYj8S6nb cazPTEHgUGB7g7aXcISI2wnYgyelysAa8wSV3J4UVgrgOS409+z3qhWlNy7GNpDOSFuK P9YE9/KrVm6Dn1kfoVWX3AbTooMYk/KVvdiNCNVwTPB1f712YkvVEyYcCeekJSreCqVu KfWkIZlEhj4CX8W0GfhBUySQUwn0Pdnz4Opsz8394bQKp3n5YpjaJLWqqBxOTp+l5Ihl VS6g== X-Gm-Message-State: AKwxytfpFxGDMndx5zDr9/kMzfhnTbxR+btMPaasYEuqTVFhbsSKlqu0 22EwZSuUykn/4YBgTB2OeUPuPPyF5XE= X-Google-Smtp-Source: ACJfBovux8f5gVtvq2pwlzbKn6TtcccKKjPeXkovO+IIR3UUBqb0gS7UYQ6K0CIT+ETwgS14Q2Q61A== X-Received: by 10.237.33.1 with SMTP id 1mr6492609qtc.106.1515193118254; Fri, 05 Jan 2018 14:58:38 -0800 (PST) Received: from localhost.localdomain ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id g9sm4195189qtg.2.2018.01.05.14.58.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Jan 2018 14:58:37 -0800 (PST) From: Andy Gospodarek To: netdev@vger.kernel.org Cc: mchan@broadcom.com, talgi@mellanox.com, ogerlitz@mellanox.com, Andy Gospodarek Subject: [PATCH net-next v2 01/10] net/mlx5e: Move interrupt moderation structs to new file Date: Fri, 5 Jan 2018 17:58:05 -0500 Message-Id: <1515193094-9554-2-git-send-email-andy@greyhouse.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515193094-9554-1-git-send-email-andy@greyhouse.net> References: <1515193094-9554-1-git-send-email-andy@greyhouse.net> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Andy Gospodarek Create new header file to prepare to move code that handles irq moderation to a library that lives in a header file. Signed-off-by: Andy Gospodarek Acked-by: Tal Gilboa Acked-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 33 +---------- drivers/net/ethernet/mellanox/mlx5/core/en_dim.h | 75 ++++++++++++++++++++++++ include/linux/mlx5/mlx5_ifc.h | 6 -- 3 files changed, 76 insertions(+), 38 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_dim.h diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 543060c..ddb5429 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -49,6 +49,7 @@ #include "wq.h" #include "mlx5_core.h" #include "en_stats.h" +#include "en_dim.h" #define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v) @@ -226,12 +227,6 @@ enum mlx5e_priv_flag { #define MLX5E_MAX_BW_ALLOC 100 /* Max percentage of BW allocation */ #endif -struct mlx5e_cq_moder { - u16 usec; - u16 pkts; - u8 cq_period_mode; -}; - struct mlx5e_params { u8 log_sq_size; u8 rq_wq_type; @@ -472,32 +467,6 @@ struct mlx5e_mpw_info { u16 skbs_frags[MLX5_MPWRQ_PAGES_PER_WQE]; }; -struct mlx5e_rx_am_stats { - int ppms; /* packets per msec */ - int bpms; /* bytes per msec */ - int epms; /* events per msec */ -}; - -struct mlx5e_rx_am_sample { - ktime_t time; - u32 pkt_ctr; - u32 byte_ctr; - u16 event_ctr; -}; - -struct mlx5e_rx_am { /* Adaptive Moderation */ - u8 state; - struct mlx5e_rx_am_stats prev_stats; - struct mlx5e_rx_am_sample start_sample; - struct work_struct work; - u8 profile_ix; - u8 mode; - u8 tune_state; - u8 steps_right; - u8 steps_left; - u8 tired; -}; - /* a single cache unit is capable to serve one napi call (for non-striding rq) * or a MPWQE (for striding rq). */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dim.h b/drivers/net/ethernet/mellanox/mlx5/core/en_dim.h new file mode 100644 index 0000000..84b8524 --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dim.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2017, Broadcom Limited + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. +*/ + +#ifndef MLX5_AM_H +#define MLX5_AM_H + +struct mlx5e_cq_moder { + u16 usec; + u16 pkts; + u8 cq_period_mode; +}; + +struct mlx5e_rx_am_sample { + ktime_t time; + u32 pkt_ctr; + u32 byte_ctr; + u16 event_ctr; +}; + +struct mlx5e_rx_am_stats { + int ppms; /* packets per msec */ + int bpms; /* bytes per msec */ + int epms; /* events per msec */ +}; + +struct mlx5e_rx_am { /* Adaptive Moderation */ + u8 state; + struct mlx5e_rx_am_stats prev_stats; + struct mlx5e_rx_am_sample start_sample; + struct work_struct work; + u8 profile_ix; + u8 mode; + u8 tune_state; + u8 steps_right; + u8 steps_left; + u8 tired; +}; + +enum { + MLX5_CQ_PERIOD_MODE_START_FROM_EQE = 0x0, + MLX5_CQ_PERIOD_MODE_START_FROM_CQE = 0x1, + MLX5_CQ_PERIOD_NUM_MODES +}; + +#endif /* MLX5_AM_H */ diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index d44ec5f..60d17e5 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -2918,12 +2918,6 @@ enum { MLX5_CQC_ST_FIRED = 0xa, }; -enum { - MLX5_CQ_PERIOD_MODE_START_FROM_EQE = 0x0, - MLX5_CQ_PERIOD_MODE_START_FROM_CQE = 0x1, - MLX5_CQ_PERIOD_NUM_MODES -}; - struct mlx5_ifc_cqc_bits { u8 status[0x4]; u8 reserved_at_4[0x4];