From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 439C742C07; Thu, 1 Jun 2023 21:56:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A69742D56; Thu, 1 Jun 2023 21:55:51 +0200 (CEST) Received: from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80]) by mails.dpdk.org (Postfix) with ESMTP id 6862442D33 for ; Thu, 1 Jun 2023 21:55:45 +0200 (CEST) Received: from localhost.localdomain (unknown [78.109.69.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by agw.arknetworks.am (Postfix) with ESMTPSA id DA820E11EC; Thu, 1 Jun 2023 23:55:44 +0400 (+04) From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko , Ferruh Yigit , Denis Pryazhennikov , Andy Moreton Subject: [PATCH 08/34] net/sfc: add MCDI wrappers for BCAM tables Date: Thu, 1 Jun 2023 23:55:12 +0400 Message-Id: <20230601195538.8265-9-ivan.malov@arknetworks.am> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230601195538.8265-1-ivan.malov@arknetworks.am> References: <20230601195538.8265-1-ivan.malov@arknetworks.am> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Denis Pryazhennikov A "table" is structure used for lookups, consisting of a set of entries which can be matched against an N-bit "request", to return either a "hit" with an M-bit "response", or a "miss" if there is no match. There are a number of HW tables of various types that could be used in MAE. In some types of table the entry may also be associated with an N-bit "mask", allowing some bits of the request to be treated as don't-care, and an integer "priority" to determine which entry is used if more than one matches. BCAM tables don't support "mask" and "priority", so the corresponding fields must be zeroed. Signed-off-by: Denis Pryazhennikov Reviewed-by: Ivan Malov Reviewed-by: Andy Moreton --- drivers/net/sfc/sfc_tbls.h | 69 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 drivers/net/sfc/sfc_tbls.h diff --git a/drivers/net/sfc/sfc_tbls.h b/drivers/net/sfc/sfc_tbls.h new file mode 100644 index 0000000000..2a5c87b82c --- /dev/null +++ b/drivers/net/sfc/sfc_tbls.h @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2023 Advanced Micro Devices, Inc. + */ + +#ifndef _SFC_TBLS_H +#define _SFC_TBLS_H + +#include "efx.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Table types: + * CAM - Content addressable memory + * BCAM - Binary CAM + * TCAM - Ternary CAM + * STCAM - Semi-ternary CAM + * + * Short description: + * TCAM: Each entry has a key, mask, response and priority. An entry matches + * when (key & mask) == (request & mask). In the case of multiple + * matches, the entry with the highest priority wins; Each entry may + * have its own mask, but TCAM table definitions may place constraints + * on the possible masks allowed for each of the individual fields. + * STCAM: A limited form of TCAM in which only a limited number of masks and + * associated priorities), up to some maximum fixed by the definition + * of the table, may be in use at any one time. + * BCAM: Each entry has only a key and response, with the whole request + * matched against the key (like a typical hash table or "map"). + * Direct (sometimes "DCAM", although it's not really content-addressable): + * Essentially just an array, where the key bits are used simply as an + * index. + */ + +/* Priority is used only for TCAM or STCAM, use 0 in case of BCAM */ +#define SFC_TBLS_BCAM_PRIORITY 0 + +/* Mask ID is used only for STCAM with ALLOC_MASKS flag, use 0 for BCAM */ +#define SFC_TBLS_BCAM_MASK_ID 0 + +/* Mask is used only for STCAM */ +#define SFC_TBLS_BCAM_MASK_WIDTH 0 + +static inline int +sfc_tbls_bcam_entry_insert(efx_nic_t *enp, efx_table_id_t table_id, uint16_t key_width, + uint16_t resp_width, uint8_t *data, unsigned int data_size) +{ + return efx_table_entry_insert(enp, table_id, SFC_TBLS_BCAM_PRIORITY, + SFC_TBLS_BCAM_MASK_ID, key_width, + SFC_TBLS_BCAM_MASK_WIDTH, resp_width, + data, data_size); +} + +static inline int +sfc_tbls_bcam_entry_delete(efx_nic_t *enp, efx_table_id_t table_id, uint16_t key_width, + uint8_t *data, unsigned int data_size) +{ + return efx_table_entry_delete(enp, table_id, SFC_TBLS_BCAM_MASK_ID, + key_width, SFC_TBLS_BCAM_MASK_WIDTH, + data, data_size); +} + +#ifdef __cplusplus +} +#endif +#endif /* _SFC_TBLS_H */ -- 2.17.1