Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759409AbcLUJVw (ORCPT ); Wed, 21 Dec 2016 04:21:52 -0500 Received: from mail-bn3nam01on0064.outbound.protection.outlook.com ([104.47.33.64]:64827 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755842AbcLUJVi (ORCPT ); Wed, 21 Dec 2016 04:21:38 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Satha.Rao@cavium.com; From: Satha Koteswara Rao To: CC: , , , , , , , , , Subject: [RFC PATCH 3/7] Enable pause frame support Date: Wed, 21 Dec 2016 14:16:47 +0530 Message-ID: <1482310011-1862-4-git-send-email-satha.rao@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1482310011-1862-1-git-send-email-satha.rao@caviumnetworks.com> References: <1482310011-1862-1-git-send-email-satha.rao@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MAXPR01CA0030.INDPRD01.PROD.OUTLOOK.COM (10.164.147.37) To CY4PR07MB2838.namprd07.prod.outlook.com (10.169.252.16) X-MS-Office365-Filtering-Correlation-Id: 0f590592-9d22-414b-ea0b-08d4297e1bb2 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR07MB2838; X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2838;3:Aj5D1GZrqEUN6FVSlMowNozsI6fax4qtKmq6hlUN+Y0vDLlln4tCPrk3JFJzXCj8nWPX/CTPjJ0qQIZBwIc6uRkv5BpvwIaSO3MUAiFHkdgyd6fPs6wC3fEfxXVq5bFOPLCEcPGkP5NTtqF0ROufgJHnrwPAeTUATu4r7YXYC38t8uA/lUB7dpLBwQjS+8JN3wUz0C62lIjzO93Nw5x6WK8Xrv9sgLfEkcH/n4Tp31CL+dfgdZyprl3AOnN/3CtMcb8sdgUa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+jUH0W6+WKPEWcSBm/xKCjRNK8lZzpo+24xSadzFPSiWOF6TBMr/cu/xnqbB3saJqzvsrwGMS1dhistHRb2XffOhs;20:amnP5J7uDaCMTTaNC8TCSr34vGW9tHx8TGn4nO9vZy+INtQEJ/MWK3CjUwFHa2suFdmmtnThZRbu3WN3STfgY+EvTcnWbq+D0Vwk1TPHatwvi7YQjDqJtZiNlSZLFVDWGsXV5MCiaoMgNk+UcMrqkIFbva37qZnTuBdTIZBOINiOC8MrGOfjOBbSFkbxAImc0fRoBR9YDmYUc+hHmNh4PY773Y63HjDsbv/8iDVmmCMWyRAC9YeYlW7pK+BpGGkwpLFUrlwW5bcQX/niBV7G4L59tUXqPRxTnuajwnYqWztBo9QZN1rTbNX3wpvQ3Y1IVfi6u5waXf2RQ1jyJAz0SOhE+t0bwKsPhBIu1ND7Nr3iiwEEUq54OxPbyXqvoJRyNKMFW7TqP8e5DyNmbPvAW46IIAh8YKuK0glUrP2hLQmf9xrjKJwv53MtL4fG1W73ACcrmvfiTPyq4ikiDJJ09M/j/GPsOQC8FmDY3Y/DKH6Wzs4xxTS0gBOeaVH7w3FFb52eDCe6kGQfPtB5SbGFgULnW9GeUIojYDyjhboMlwuPldEwGDpuArOQvvpuFtWtnEewlhe5jJpHbgmAMEjsRrShRhTSSc4LEoxb/bFMCQw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(6072148);SRVR:CY4PR07MB2838;BCL:0;PCL:0;RULEID:;SRVR:CY4PR07MB2838; X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2838;4:cXA3d/XHfRRikgJDy1vX5xcwFgN7VhGxuWD50O246iRqui7o82KYr6uW13PEc/MzH/5l6/XxGwvJ0BT9LV46ODGav1a1BHOAlILSFoaJUR96ugupDvQrWkEz96jTjN89L1uYqVtDSorzoJqVKHh1fYTsrkX31nYF3GQcjub+7OBS8fI8jZOQHcxYBNkXcrWBgkykzFYRYIQ8p9N1R/yz/DPGLj8W7zUCeqmGZsqBGM53nce+ot28BDu+A3/3k5wocSKypJ0tRAPTMhTRLmKSwG2QDDxhHRNW4hY78rZ1ZKkPZs3wCb18G1iWGc9su+tOaCFZFp8WXtxfloIJd0NgwJNGgMnJgMpUCxDUVj3iMXFp7TMjLTjOjyTjV2RuLD08/IruVwk26yNSflPS1J3dIOh8BdCPrzVS1OWQjXBKIX4rYeRwOY4P2WGCM+OUY9Zv/qY5XzHlCRBGvpAObDDfyvpy2N/X7y1txXSxyrY/1UlnvL7nSY3Oew6yuimfcj/cgVesJmbRrKrA8EVW6CtU59nZQpD2gy/8WejPDrL8jWj/A+zrTV9mJFDgTpow2GKB1JnCcsY/Ec2kBWO2Hugc+Q== X-Forefront-PRVS: 01630974C0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(189002)(199003)(2906002)(4326007)(101416001)(33646002)(5009440100003)(106356001)(2351001)(68736007)(105586002)(8676002)(50986999)(5003940100001)(53416004)(76506005)(76176999)(48376002)(81156014)(81166006)(42186005)(66066001)(5660300001)(92566002)(50466002)(6506006)(110136003)(7736002)(6916009)(47776003)(189998001)(36756003)(6116002)(6666003)(50226002)(3846002)(97736004)(42882006)(25786008)(2950100002)(305945005)(6512006)(69596002)(38730400001)(6486002)(4720700003)(7099028)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR07MB2838;H:localhost.caveonetworks.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR07MB2838;23:OTN4x+IaSS/TsWW4tbpx1uN4Hclk4hAdBYkVRZZZl?= =?us-ascii?Q?6AqjhKa137h0+e5iFLYSa86ZzG/ywm+DeXK9ZFeB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LIdt8i3mMAT7CZCf+INsGhuKv+6n+nAvquSVqDsLzB5en4z9jtoe0PDa7hyM7BjUU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2838;7:ghm3hdbWWNJFOPEGB0n6DUtcLKk4rYsATRXUfCbQQ4Y7QAxam9Do6fSny53yKHgUdvAXdy46rwLfhh0Gb6kNbd/vTYSRit4P4qosZDQkpnvav3bfNmGDGjZPc0vWhaLk0QMdLLM9eUbPVhNLFz+wiuBGuF2WuQohE5DdPvKS27jAn5jZ02dUNpxSLtDDueRODFcaAY6RrHKbwvhbbg7UMmH1LaLa0+doQqyB3CYsg8JN951nHxM6rl2fNRTCxsWLP6YHfxjIPPXXxBVMpbLQIM3yTMI9S1kwlFIgcxcXh9W6MDA3k3DeqGje7mhthzFShgdMHww21WJNKRzqbs+5L2Xym6l9kRiNTuUc2XLYbXhpwlWIsyf3+DdHD3UnZRPsW5QF8E861VY3vVIpx1gRUQuIK24kna0NRHrpj9Rp2Knqqlfc4eADgB8pEWsI2B+Cd7u8+C52tu6wCRp2JXZuSg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2016 08:48:14.1884 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB2838 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2582 Lines: 68 --- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 25 +++++++++++++++++++++++ drivers/net/ethernet/cavium/thunder/thunder_bgx.h | 7 +++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index 050e21f..92d7e04 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c @@ -121,6 +121,31 @@ static int bgx_poll_reg(struct bgx *bgx, u8 lmac, u64 reg, u64 mask, bool zero) return 1; } +void enable_pause_frames(int node, int bgx_idx, int lmac) +{ + u64 reg_value = 0; + struct bgx *bgx = bgx_vnic[(node * MAX_BGX_PER_NODE) + bgx_idx]; + + reg_value = bgx_reg_read(bgx, lmac, BGX_SMUX_TX_CTL); + /* Enable BGX()_SMU()_TX_CTL */ + if (!(reg_value & L2P_BP_CONV)) + bgx_reg_write(bgx, lmac, BGX_SMUX_TX_CTL, + (reg_value | (L2P_BP_CONV))); + + reg_value = bgx_reg_read(bgx, lmac, BGX_SMUX_HG2_CTL); + /* Clear if BGX()_SMU()_HG2_CONTROL[HG2TX_EN] is set */ + if (reg_value & SMUX_HG2_CTL_HG2TX_EN) + bgx_reg_write(bgx, lmac, BGX_SMUX_HG2_CTL, + (reg_value & (~SMUX_HG2_CTL_HG2TX_EN))); + + reg_value = bgx_reg_read(bgx, lmac, BGX_SMUX_CBFC_CTL); + /* Clear if BGX()_SMU()_CBFC_CTL[TX_EN] is set */ + if (reg_value & CBFC_CTL_TX_EN) + bgx_reg_write(bgx, lmac, BGX_SMUX_CBFC_CTL, + (reg_value & (~CBFC_CTL_TX_EN))); +} +EXPORT_SYMBOL(enable_pause_frames); + /* Return number of BGX present in HW */ unsigned bgx_get_map(int node) { diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h index 01cc7c8..5b57bd1 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h @@ -131,6 +131,11 @@ #define BGX_SMUX_TX_CTL 0x20178 #define SMU_TX_CTL_DIC_EN BIT_ULL(0) #define SMU_TX_CTL_UNI_EN BIT_ULL(1) +#define L2P_BP_CONV BIT_ULL(7) +#define BGX_SMUX_CBFC_CTL 0x20218 +#define CBFC_CTL_TX_EN BIT_ULL(1) +#define BGX_SMUX_HG2_CTL 0x20210 +#define SMUX_HG2_CTL_HG2TX_EN BIT_ULL(18) #define SMU_TX_CTL_LNK_STATUS (3ull << 4) #define BGX_SMUX_TX_THRESH 0x20180 #define BGX_SMUX_CTL 0x20200 @@ -212,6 +217,8 @@ void bgx_lmac_internal_loopback(int node, int bgx_idx, u64 bgx_get_rx_stats(int node, int bgx_idx, int lmac, int idx); u64 bgx_get_tx_stats(int node, int bgx_idx, int lmac, int idx); +void enable_pause_frames(int node, int bgx_idx, int lmac); + #define BGX_RX_STATS_COUNT 11 #define BGX_TX_STATS_COUNT 18 -- 1.8.3.1