Received: by 10.213.65.68 with SMTP id h4csp756931imn; Tue, 27 Mar 2018 08:13:32 -0700 (PDT) X-Google-Smtp-Source: AG47ELuTWBjfiYniVRreAAeGOK6N2G+/gBb2alRh4YlwpUDM7/uQgPxnRPJKfoWCYHh0P3E82Hxy X-Received: by 2002:a17:902:43a4:: with SMTP id j33-v6mr26324383pld.260.1522163612576; Tue, 27 Mar 2018 08:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522163612; cv=none; d=google.com; s=arc-20160816; b=XK7bRTgAGwpN1oCz8ENP93FW88LHJLRyT1SCIytzuBfXZnlACnUN7q/1lCKYe5LsT+ QlMB2whOHsHfh6k4nZUcfpzylRQ70lX1RymfVXxnrCozqq73IxlwJ9CA9cSK4tdkCa/f xDGW1FvpHXyhmsOdht4SKGEgy8DdjT5K6tHwULTmsBZ/0qzCZcjLeadoE9W/1uBQBzHn eu/Jj3okwWWpW+a9jF4YPGW3lvHKy675Blu6N5pfarJ6oj38e339h+jFjcot8INTwnzu Rh+ppC0UPG+i0KqCti81l+GPEgDxDnb2jE9Tvc2emMJC5Ntzd3XzgON5rvE0FFrp1qef KQFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=IXwb2jPWIjbqzWxoNS1o4Ygr8u2Ek8jyVJs9QIhowHs=; b=vlndpiLZHXAWGW4wKhAi9c7qx5Bp0Wrr2adqXAyCAb1SZ9JOQsuVDMlGXBEpAO5ZkM iriIAat5lKoYbFjybk5yD+eweO5YyJfuwS335iPFXWu15bCFrT5pqiHSpyoFeD/HPm7L qIa2SD1bzxzLHCiUbFHjK1q5krRZk/nI2zAenXcInM2wNyooZ6hrC1/P5jSdmmDZONIF trCiZMX73Kpb7355jMgMQRXHjcnesEVF1ePK9VJUW37HUQx7yE3ZnM+/vdNPbF7jJGIo OLBUA3X2KT4c4UrzEUzQvrR28VZqSI27IZXCMo9oNVgx0B8LHOnXvkTpi5v++sMRkYKg qB8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=CX5sq+G8; 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 32-v6si1496400ple.282.2018.03.27.08.13.18; Tue, 27 Mar 2018 08:13:32 -0700 (PDT) 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; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=CX5sq+G8; 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 S1752839AbeC0PLS (ORCPT + 99 others); Tue, 27 Mar 2018 11:11:18 -0400 Received: from mail-dm3nam03on0055.outbound.protection.outlook.com ([104.47.41.55]:5369 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752507AbeC0PHw (ORCPT ); Tue, 27 Mar 2018 11:07:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=IXwb2jPWIjbqzWxoNS1o4Ygr8u2Ek8jyVJs9QIhowHs=; b=CX5sq+G8rumobtobZ0OPshMmwELV1OyLjeCxOlsgGpokAJNSUSJ3zMcTYYnKo/MKmpo6Yj9syoS00wjku3N0gNYf0ArMWNmd3K/GqaARHigNzApEYe+BiHDAj4xl7PC9zs74DMVjcSbMvhYJp4W7sw/gsWWXwpwkC7tjF+MTMmw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Vadim.Lomovtsev@cavium.com; Received: from localhost.localdomain.com (50.233.148.156) by CY4PR07MB2998.namprd07.prod.outlook.com (2603:10b6:903:d0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Tue, 27 Mar 2018 15:07:48 +0000 From: Vadim Lomovtsev To: sgoutham@cavium.com, sunil.kovvuri@gmail.com, robert.richter@kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: dnelson@redhat.com, Vadim Lomovtsev Subject: [PATCH 2/7] net: thunderx: add MAC address filter tracking for LMAC Date: Tue, 27 Mar 2018 08:07:31 -0700 Message-Id: <20180327150736.10718-3-Vadim.Lomovtsev@caviumnetworks.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180327150736.10718-1-Vadim.Lomovtsev@caviumnetworks.com> References: <20180327150736.10718-1-Vadim.Lomovtsev@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: DM5PR20CA0003.namprd20.prod.outlook.com (2603:10b6:3:93::13) To CY4PR07MB2998.namprd07.prod.outlook.com (2603:10b6:903:d0::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8a155892-517c-413b-f91e-08d593f48100 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603328)(7153060)(7193020);SRVR:CY4PR07MB2998; X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2998;3:U01LDnJrRZkX+rAYZvGwsfltbGDda93NCaeGaNnVVCdfQXoWh/BO5lg1B3v7YhU7X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I9gDk9qF2Jeot6av+uM3wldjG3uI3boJecOu296yHSH9rCSGDMKCpe4mRqDQc2LmtdSaVtaZ/e7ivZxIftHhW6ERaWUdKx6zqn3uwH0AfBMs1MafFcX2N8AeG4BdgEBz8f788SfuPYyUcgO7QSmFyH/pC3mX0NqBAmENqWvy+uH7BLE8ahwGSEVpE3BwWw3xm29+vvM70DEF3nTOP2IvCB70Mr43uEuPmmpl6g3igTIHgsNrwhk0MoMSbI7xxYMXKNSa2gcTFohKDF1XEmuTuojMu2hQc0WWxtpRhAcTzBxzSETPY3MxWzeW+ZvWGbFPM0KzUdPmX4T5ORJ4l3/Ylisx+3Z8gLx9aY4SX13hIAqsI8A6KXF742iMe/NYpzKAmgE=;4:H3JMaalVbNXgVbVOur2vcvYWLk0AIwG3yO3n7BR8jGpT9GFPudv8Zcyn5ngeUmcyLDi/URl9DZGsiGwFSMr7NjZh+UsIosge5gGCWDGuoHdJeXWdp9/Lv/hITQCn4okeVpOLlChUDYU/h5OZB357ZcYRPO1TCnzLfJhxgKpKgrlbKd65BDRjV8cxSYyThlgBaGdVqH38IuO9pjhWi31IvZEBer8FNZvKLSV+w8oyJZ/B0e35KoGxtq8xbm6fpaRKXGz7P9O2zhalYa+of/ZppQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(3002001)(10201501046)(3231221)(944501327)(52105095)(6041310)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011);SRVR:CY4PR07MB2998;BCL:0;PCL:0;RULEID:;SRVR:CY4PR07MB2998; X-Forefront-PRVS: 0624A2429E X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(979002)(6069001)(346002)(366004)(39860400002)(396003)(39380400002)(376002)(189003)(199004)(446003)(2616005)(6116002)(478600001)(1076002)(107886003)(3846002)(6666003)(956004)(97736004)(39060400002)(50466002)(7736002)(53936002)(16526019)(66066001)(47776003)(26005)(48376002)(486005)(486005)(6486002)(6512007)(316002)(305945005)(11346002)(16586007)(105586002)(42882007)(6506007)(575784001)(386003)(68736007)(59450400001)(69596002)(106356001)(72206003)(25786009)(2906002)(52116002)(53416004)(76176011)(81166006)(51416003)(8676002)(36756003)(476003)(50226002)(4326008)(5660300001)(81156014)(8936002)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR07MB2998;H:localhost.localdomain.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR07MB2998;23:BtCXLYpanPrBYoLpWdF1fAB7byFlJLwv3HzTqyGbk?= =?us-ascii?Q?0AdhBLS/4Fu/5lB8JKrSSP8Kh0IrkVqyNW3fepzG13WP0itSE19pMNcTGZ+b?= =?us-ascii?Q?InvGM26l3JOvDIYI9p87V7bRrwrdarWmoqmNxcZdzh7iBRPC2Arj5iXX528X?= =?us-ascii?Q?0bqQq/0HcfQMmAC+pW0f0Ui69mokENHurtz0Ba0VJHSFRhuH+YTwAld5kcU+?= =?us-ascii?Q?qBQmdksmH/As1NA6JmNcgkl7m8YsSle25WHnGngdwwavXveG583pCpmM19kt?= =?us-ascii?Q?Mid1d5ypoY9gTRPZMBLrqTCJ5EM0W/l08QuwCopx9YgAHSRMHFFhugzH7eeD?= =?us-ascii?Q?4k0neE83g4u6onlxjVLyt0vIS//EMPNyW6uF1GLqjbAfDt+UjR9xEaKbTP9Y?= =?us-ascii?Q?GEDzMIX9HVbN1drhNsNUuxNJbIWP04r76Ju3YvYw45Mc1RUR6FJFzWELDmp/?= =?us-ascii?Q?GjkfIeuwnRHVZUEOkWBwnfC23ibbiEGMj16P2DWpJ5ellLCQmgidcgSWexFJ?= =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pistNR50+BLDAQ54hfTNuhTEFpiKdfY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2998;7:A9en3QJumOVEPz/CD9RHKmMOGkC+KksTiJT14khPnFl2XhetdIOR45Qe7c8ssZN+FHKfsPOqcs1R9JbeSfPrEHQyUOzGvGUanKEZtAxXmf3ahi15SLsjnJDtVZz16luLW4STP0fcdJb1EB0BOhj2lRcyj68mDvGArUYCLaB5VM2/W21G9+wsbaYWGmheeiunYgvCi3/kqnrVXZty2TwPitKNYoggaPSvjipuKof1m6TA7cDAGwtopsCKJnm9eoCH X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2018 15:07:48.2171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a155892-517c-413b-f91e-08d593f48100 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB2998 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vadim Lomovtsev The ThunderX NIC has two Ethernet Interfaces (BGX) each of them could has up to four Logical MACs configured. Each of BGX has 32 filters to be configured for filtering ingress packets. The number of filters available to particular LMAC is from 8 (if we have four LMACs configured per BGX) up to 32 (in case of only one LMAC is configured per BGX). At the same time the NIC could present up to 128 VFs to OS as network interfaces, each of them kernel will configure with set of MAC addresses for filtering. So to prevent dupes in BGX filter registers from different network interfaces it is required to cache and track all filter configuration requests prior to applying them onto BGX filter registers. This commit is to update LMAC structures with control fields to allocate/releasing filters tracking list along with implementing dmac array allocate/release per LMAC. Signed-off-by: Vadim Lomovtsev --- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 42 +++++++++++++++-------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index 0dd211605eb1..cf0cc19c03c5 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c @@ -37,9 +37,18 @@ enum MCAST_MODE { #define MCAST_MODE_MASK 0x3 #define BGX_MCAST_MODE(x) (x << 1) +struct dmac_map { + u64 vf_map; + u64 dmac; +}; + struct lmac { struct bgx *bgx; - int dmac; + /* actual number of DMACs configured */ + u8 dmacs_cfg; + /* overal number of possible DMACs could be configured per LMAC */ + u8 dmacs_count; + struct dmac_map *dmacs; /* DMAC:VFs tracking filter array */ u8 mac[ETH_ALEN]; u8 lmac_type; u8 lane_to_sds; @@ -236,6 +245,17 @@ void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const u8 *mac) } EXPORT_SYMBOL(bgx_set_lmac_mac); +static void bgx_flush_dmac_cam_filter(struct bgx *bgx, int lmacid) +{ + struct lmac *lmac = NULL; + u8 idx = 0; + + lmac = &bgx->lmac[lmacid]; + /* reset CAM filters */ + for (idx = 0; idx < lmac->dmacs_count; idx++) + bgx_reg_write(bgx, 0, BGX_CMR_RX_DMACX_CAM + ((lmacid * lmac->dmacs_count) + idx) * sizeof(u64), 0); +} + void bgx_lmac_rx_tx_enable(int node, int bgx_idx, int lmacid, bool enable) { struct bgx *bgx = get_bgx(node, bgx_idx); @@ -481,18 +501,6 @@ u64 bgx_get_tx_stats(int node, int bgx_idx, int lmac, int idx) } EXPORT_SYMBOL(bgx_get_tx_stats); -static void bgx_flush_dmac_addrs(struct bgx *bgx, int lmac) -{ - u64 offset; - - while (bgx->lmac[lmac].dmac > 0) { - offset = ((bgx->lmac[lmac].dmac - 1) * sizeof(u64)) + - (lmac * MAX_DMAC_PER_LMAC * sizeof(u64)); - bgx_reg_write(bgx, 0, BGX_CMR_RX_DMACX_CAM + offset, 0); - bgx->lmac[lmac].dmac--; - } -} - /* Configure BGX LMAC in internal loopback mode */ void bgx_lmac_internal_loopback(int node, int bgx_idx, int lmac_idx, bool enable) @@ -925,6 +933,11 @@ static int bgx_lmac_enable(struct bgx *bgx, u8 lmacid) bgx_reg_write(bgx, lmacid, BGX_SMUX_TX_MIN_PKT, 60 + 4); } + /* actual number of filters available to exact LMAC */ + lmac->dmacs_count = (RX_DMAC_COUNT / bgx->lmac_count); + lmac->dmacs = kcalloc(lmac->dmacs_count, sizeof(*lmac->dmacs), + GFP_KERNEL); + /* Enable lmac */ bgx_reg_modify(bgx, lmacid, BGX_CMRX_CFG, CMR_EN); @@ -1011,7 +1024,8 @@ static void bgx_lmac_disable(struct bgx *bgx, u8 lmacid) cfg &= ~CMR_EN; bgx_reg_write(bgx, lmacid, BGX_CMRX_CFG, cfg); - bgx_flush_dmac_addrs(bgx, lmacid); + bgx_flush_dmac_cam_filter(bgx, lmacid); + kfree(lmac->dmacs); if ((lmac->lmac_type != BGX_MODE_XFI) && (lmac->lmac_type != BGX_MODE_XLAUI) && -- 2.14.3