From patchwork Wed Apr 6 15:10:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 607053 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3qg8LR6gk3z9t3h for ; Thu, 7 Apr 2016 01:10:55 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b=LbkKDRzY; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754375AbcDFPKj (ORCPT ); Wed, 6 Apr 2016 11:10:39 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36001 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754210AbcDFPKh (ORCPT ); Wed, 6 Apr 2016 11:10:37 -0400 Received: by mail-wm0-f66.google.com with SMTP id o129so4683604wmo.3 for ; Wed, 06 Apr 2016 08:10:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vht5ZB/AePpOTuszBF0RKtI4TnKNOtKqCJZiG6mURWk=; b=LbkKDRzYilydMNgxgLc4x4ewOT16olZmhLpLsNAL+Ac4Vup6H2BWzNCY1yQUx6dKjc EPFfIfaHhE2nI/7tHUq/6m7hqlpNsAg3pY9VGlZ2BF3r3aq7rDFiKabKSWo+NKVaNPsJ ewJwkHwtobjz9cVEbryezemvI9Fd9o3A7I75LwcpBH/wSPhl5Kx2Oe2KZmPj/9j4tZjY +n+6jClfCg9kcWlrwlQSb0vxczNWCMB8+J58uKiW/AJNLPzpYKNdGSNzQt8R//yAwOsP WOYNdQQbzn8V+cuWImd0TFH9ZI9iZN8ZVcGtcDW5jgmmxsSPg28DKtnPK8HST/ZJoVT1 u1Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vht5ZB/AePpOTuszBF0RKtI4TnKNOtKqCJZiG6mURWk=; b=UjSVEmAMiWPNKcki4coJIkP91MCUmTOk+hOlZMYwiPa3WF3m19G8sDNQWzx9bwSHLI ozPDaRJ/g833ehFifE8G1V/Erp5wac3g/RPCY59J+mlrsN/cqX2CW1xUpQ9pd9wqPO9S 9K2cDScfRpw4wMKP52wPGZfWzfaiIM31+QaEEuK/XFkdgmNUTcXNemVoSc2QEav8lmuH H1pFupHJh608NZHDHn/bZN47mxIiZU5HRcKG0+t1I7hNx7wweYHwXPheDu/aMhbc0/NA LQT+PuQmu9euWmgRiA35LNxEc1Q3pHT2qthovG0URhMNj6NDz341D8F2tpVMq1SCvtJn NduA== X-Gm-Message-State: AD7BkJLLErp7Nd7yDk5tt5Hucu/qqNUVixVhc9LTJ38OokmvoyirMq5lQKZbXhzgz1ovmw== X-Received: by 10.28.19.140 with SMTP id 134mr25328577wmt.73.1459955435839; Wed, 06 Apr 2016 08:10:35 -0700 (PDT) Received: from localhost (ip-94-113-120-206.net.upcbroadband.cz. [94.113.120.206]) by smtp.gmail.com with ESMTPSA id ys9sm3738266wjc.35.2016.04.06.08.10.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Apr 2016 08:10:35 -0700 (PDT) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, idosch@mellanox.com, eladr@mellanox.com, yotamg@mellanox.com, ogerlitz@mellanox.com, roopa@cumulusnetworks.com, gospo@cumulusnetworks.com Subject: [patch net-next 14/17] mlxsw: reg: Add lossless settings for PBMC register Date: Wed, 6 Apr 2016 17:10:13 +0200 Message-Id: <1459955416-23786-15-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1459955416-23786-1-git-send-email-jiri@resnulli.us> References: <1459955416-23786-1-git-send-email-jiri@resnulli.us> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel When configuring PAUSE frames and PFC we'll need to configure the Xon/Xoff threshold for the priority group (PG) buffers. Add the Xon/Xoff threshold fields to the PBMC register so that we can configure these when needed. Signed-off-by: Ido Schimmel Signed-off-by: Jiri Pirko --- drivers/net/ethernet/mellanox/mlxsw/reg.h | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index b83514a..bcd38ff 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -2788,6 +2788,30 @@ MLXSW_ITEM32_INDEXED(reg, pbmc, buf_epsb, 0x0C, 24, 1, 0x08, 0x00, false); */ MLXSW_ITEM32_INDEXED(reg, pbmc, buf_size, 0x0C, 0, 16, 0x08, 0x00, false); +/* reg_pbmc_buf_xoff_threshold + * Once the amount of data in the buffer goes above this value, device + * starts sending PFC frames for all priorities associated with the + * buffer. Units are represented in cells. Reserved in case of lossy + * buffer. + * Access: RW + * + * Note: In Spectrum, reserved for buffer[9]. + */ +MLXSW_ITEM32_INDEXED(reg, pbmc, buf_xoff_threshold, 0x0C, 16, 16, + 0x08, 0x04, false); + +/* reg_pbmc_buf_xon_threshold + * When the amount of data in the buffer goes below this value, device + * stops sending PFC frames for the priorities associated with the + * buffer. Units are represented in cells. Reserved in case of lossy + * buffer. + * Access: RW + * + * Note: In Spectrum, reserved for buffer[9]. + */ +MLXSW_ITEM32_INDEXED(reg, pbmc, buf_xon_threshold, 0x0C, 0, 16, + 0x08, 0x04, false); + static inline void mlxsw_reg_pbmc_pack(char *payload, u8 local_port, u16 xoff_timer_value, u16 xoff_refresh) { @@ -2806,6 +2830,17 @@ static inline void mlxsw_reg_pbmc_lossy_buffer_pack(char *payload, mlxsw_reg_pbmc_buf_size_set(payload, buf_index, size); } +static inline void mlxsw_reg_pbmc_lossless_buffer_pack(char *payload, + int buf_index, u16 size, + u16 threshold) +{ + mlxsw_reg_pbmc_buf_lossy_set(payload, buf_index, 0); + mlxsw_reg_pbmc_buf_epsb_set(payload, buf_index, 0); + mlxsw_reg_pbmc_buf_size_set(payload, buf_index, size); + mlxsw_reg_pbmc_buf_xoff_threshold_set(payload, buf_index, threshold); + mlxsw_reg_pbmc_buf_xon_threshold_set(payload, buf_index, threshold); +} + /* PSPA - Port Switch Partition Allocation * --------------------------------------- * Controls the association of a port with a switch partition and enables