From patchwork Thu Jun 14 08:52:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 10463677 X-Patchwork-Delegate: idosch@idosch.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2C4F1601F9 for ; Thu, 14 Jun 2018 08:53:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D849289B7 for ; Thu, 14 Jun 2018 08:53:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1240E289CF; Thu, 14 Jun 2018 08:53:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 36180289B7 for ; Thu, 14 Jun 2018 08:53:33 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 415y8C3mVszF0jD for ; Thu, 14 Jun 2018 18:53:31 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="exntkNgB"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=resnulli.us (client-ip=2a00:1450:400c:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=jiri@resnulli.us; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="exntkNgB"; dkim-atps=neutral Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 415y7l2GkNzF0jD for ; Thu, 14 Jun 2018 18:53:07 +1000 (AEST) Received: by mail-wr0-x244.google.com with SMTP id a12-v6so5524533wro.1 for ; Thu, 14 Jun 2018 01:53:07 -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=rVzh27qXBiQdnGVp24wOgNlhgj+OCw0JlSXBBCPombc=; b=exntkNgBgNj+kimwFK4gp00oARlum6N3XoGvgW4o/hj74C2rOsHEi0cIHExc8bOOH4 FlUwvxVXnonuz+joTDT8MG4+FUa67mPNt8RySeKe/KYJXptJwjgesnUf/5Lp8yS+so8Y cxC5R4uPa76ZKUwB6YHkNJH1zBYhSVPm3V8B44vP2tGTn8lEck2zwwnzUwUYrYkRJ0HV ApYvhAyercr72CDCmnv6EP8yDiY05HPdFlcUDxfuhyrgbyTP6UiLk3Pxin1qRwq7ZLwT kjmZp0ZjbJZexbGs4JgaHEZgTs5MHA5/GaxuaGANQhCpnjNEWB6DvR3W8PD5McM5sodY hCxA== 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=rVzh27qXBiQdnGVp24wOgNlhgj+OCw0JlSXBBCPombc=; b=X2BNrcVovGdd7cJoT9FdJrQ6Gz9Z1beI7gXcX5aXDP3PNK38YnLf8bb0qqC3lTpu1A 6F8U7neaQcYIfOcEZLYaqiZytT7NCU/25xG47Ncr0FWbbu9yo3zlcI7HuswLQnDLE/se psm4BWOpoULeHvOC/DvtQWuIOxKIS2ndVzlKhDP7yqFO+ZA+dJGCbUjGaja4c5xX1XnP WQBgPK0sedskiwyhtT4MzHyOqYMJMtTxtZwHV0Yc575W0xo2Wt8trpOrDEyHvU87Y6yL v3LUlTUkgRFAC9+8+mEWpXtxkQyf8pA7WvfFqRJM2ojLO5zYxOSe50BgymmdTV9FXnei Rbgg== X-Gm-Message-State: APt69E0Z/fNA/WY6t1U0fs6kurftHw1gXGkqJkbHassiEuStU7YIzEN5 3SDeh/p+SUewtzKNb+3Et+oXu1or X-Google-Smtp-Source: ADUXVKIpSLyZexz6TqeJs05dQF4tyTfawsHH/AaW6tgUAA+J3G95w4ntT+pxpeM5wmnVdyAJwwUTxw== X-Received: by 2002:adf:9a4c:: with SMTP id z70-v6mr1432553wrb.118.1528966384358; Thu, 14 Jun 2018 01:53:04 -0700 (PDT) Received: from localhost ([83.167.225.161]) by smtp.gmail.com with ESMTPSA id l7-v6sm888826wmh.1.2018.06.14.01.53.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Jun 2018 01:53:03 -0700 (PDT) From: Jiri Pirko To: linux-internal@mellanox.com Subject: [patch net-next/mlxsw internal 10/15] mlxsw: reg: Add Policy-Engine Region eRP Register Date: Thu, 14 Jun 2018 10:52:36 +0200 Message-Id: <20180614085241.1873-11-jiri@resnulli.us> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180614085241.1873-1-jiri@resnulli.us> References: <20180614085241.1873-1-jiri@resnulli.us> X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ido Schimmel The PERERP register configures the region eRPs. It can be used, for example, to enable lookup in the C-TCAM in addition to the A-TCAM. To be able to perform a lookup in the C-TCAM we need to "use" the eRP table. This is done by marking the pointer as valid, but zeroing the eRP table vector. Signed-off-by: Ido Schimmel Signed-off-by: Jiri Pirko --- drivers/net/ethernet/mellanox/mlxsw/reg.h | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index d6ac24367a60..2da8a79bf4d6 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -2592,6 +2592,76 @@ static inline void mlxsw_reg_percr_pack(char *payload, u16 region_id) memset(payload + 0x20, 0xff, 96); } +/* PERERP - Policy-Engine Region eRP Register + * ------------------------------------------ + * This register configures the region eRP. The region_id must be + * allocated. + */ +#define MLXSW_REG_PERERP_ID 0x302B +#define MLXSW_REG_PERERP_LEN 0x1C + +MLXSW_REG_DEFINE(pererp, MLXSW_REG_PERERP_ID, MLXSW_REG_PERERP_LEN); + +/* reg_pererp_region_id + * Region identifier. + * Range 0..cap_max_regions-1 + * Access: Index + */ +MLXSW_ITEM32(reg, pererp, region_id, 0x00, 0, 16); + +/* reg_pererp_ctcam_le + * C-TCAM lookup enable. Reserved when erpt_pointer_valid = 0. + * Access: RW + */ +MLXSW_ITEM32(reg, pererp, ctcam_le, 0x04, 28, 1); + +/* reg_pererp_erpt_pointer_valid + * erpt_pointer is valid. + * Access: RW + */ +MLXSW_ITEM32(reg, pererp, erpt_pointer_valid, 0x10, 31, 1); + +/* reg_pererp_erpt_bank_pointer + * Pointer to eRP table bank. May be modified at any time. + * Range 0..cap_max_erp_table_banks-1 + * Reserved when erpt_pointer_valid = 0 + */ +MLXSW_ITEM32(reg, pererp, erpt_bank_pointer, 0x10, 16, 4); + +/* reg_pererp_erpt_pointer + * Pointer to eRP table within the eRP bank. Can be changed for an + * existing region. + * Range 0..cap_max_erp_table_size-1 + * Reserved when erpt_pointer_valid = 0 + * Access: RW + */ +MLXSW_ITEM32(reg, pererp, erpt_pointer, 0x10, 0, 8); + +/* reg_pererp_erpt_vector + * Vector of allowed eRP indexes starting from erpt_pointer within the + * erpt_bank_pointer. Next entries will be in next bank. + * Note that eRP index is used and not eRP ID. + * Reserved when erpt_pointer_valid = 0 + * Access: RW + */ +MLXSW_ITEM32(reg, pererp, erpt_vector, 0x14, 0, 16); + +/* reg_pererp_master_rp_id + * Master RP ID. When there are no eRPs, then this provides the eRP ID + * for the lookup. Can be changed for an existing region. + * Reserved when erpt_pointer_valid = 1 + * Access: RW + */ +MLXSW_ITEM32(reg, pererp, master_rp_id, 0x18, 0, 4); + +static inline void mlxsw_reg_pererp_pack(char *payload, u16 region_id) +{ + MLXSW_REG_ZERO(pererp, payload); + mlxsw_reg_pererp_region_id_set(payload, region_id); + mlxsw_reg_pererp_ctcam_le_set(payload, true); + mlxsw_reg_pererp_erpt_pointer_valid_set(payload, true); +} + /* IEDR - Infrastructure Entry Delete Register * ---------------------------------------------------- * This register is used for deleting entries from the entry tables. @@ -8093,6 +8163,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = { MLXSW_REG(ptce2), MLXSW_REG(perar), MLXSW_REG(percr), + MLXSW_REG(pererp), MLXSW_REG(iedr), MLXSW_REG(qpcr), MLXSW_REG(qtct),