-/*-
- * BSD LICENSE
+/* SPDX-License-Identifier: BSD-3-Clause
*
- * Copyright (c) 2017 Solarflare Communications Inc.
- * All rights reserved.
+ * Copyright(c) 2019-2021 Xilinx, Inc.
+ * Copyright(c) 2017-2019 Solarflare Communications Inc.
*
* This software was jointly developed between OKTET Labs (under contract
* for Solarflare) and Solarflare Communications, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SFC_DP_H
#include <rte_pci.h>
+#include "sfc_log.h"
+#include "sfc_stats.h"
+
#ifdef __cplusplus
extern "C" {
#endif
/** Datapath queue run-time information */
struct sfc_dp_queue {
+ /*
+ * Typically the structure is located at the end of Rx/Tx queue
+ * data structure and not used on datapath. So, it is not a
+ * problem to have extra fields even if not used. However,
+ * put stats at top of the structure to be closer to fields
+ * used on datapath or reap to have more chances to be cache-hot.
+ */
+ union sfc_pkts_bytes stats;
+ uint32_t dbells;
+
uint16_t port_id;
uint16_t queue_id;
struct rte_pci_addr pci_addr;
uint16_t port_id, uint16_t queue_id,
const struct rte_pci_addr *pci_addr);
+/* Maximum datapath log level to be included in build. */
+#ifndef SFC_DP_LOG_LEVEL
+#define SFC_DP_LOG_LEVEL RTE_LOG_NOTICE
+#endif
+
/*
* Helper macro to define datapath logging macros and have uniform
* logging.
const struct sfc_dp_queue *_dpq = (dpq); \
const struct rte_pci_addr *_addr = &(_dpq)->pci_addr; \
\
- RTE_LOG(level, PMD, \
+ if (RTE_LOG_ ## level > SFC_DP_LOG_LEVEL) \
+ break; \
+ SFC_GENERIC_LOG(level, \
RTE_FMT("%s " PCI_PRI_FMT \
" #%" PRIu16 ".%" PRIu16 ": " \
- RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+ RTE_FMT_HEAD(__VA_ARGS__ ,), \
dp_name, \
_addr->domain, _addr->bus, \
_addr->devid, _addr->function, \
enum sfc_dp_type type;
/* Mask of required hardware/firmware capabilities */
unsigned int hw_fw_caps;
-#define SFC_DP_HW_FW_CAP_EF10 0x1
+#define SFC_DP_HW_FW_CAP_EF10 0x1
+#define SFC_DP_HW_FW_CAP_RX_ES_SUPER_BUFFER 0x2
+#define SFC_DP_HW_FW_CAP_RX_EFX 0x4
+#define SFC_DP_HW_FW_CAP_TX_EFX 0x8
+#define SFC_DP_HW_FW_CAP_EF100 0x10
};
/** List of datapath variants */
TAILQ_HEAD(sfc_dp_list, sfc_dp);
+typedef unsigned int sfc_sw_index_t;
+#define SFC_SW_INDEX_INVALID ((sfc_sw_index_t)(UINT_MAX))
+
+typedef int32_t sfc_ethdev_qid_t;
+#define SFC_ETHDEV_QID_INVALID ((sfc_ethdev_qid_t)(-1))
+
/* Check if available HW/FW capabilities are sufficient for the datapath */
static inline bool
sfc_dp_match_hw_fw_caps(const struct sfc_dp *dp, unsigned int avail_caps)
unsigned int avail_caps);
int sfc_dp_register(struct sfc_dp_list *head, struct sfc_dp *entry);
+/**
+ * Dynamically registered mbuf flag "mport_override" (as a bitmask).
+ *
+ * If this flag is set in an mbuf then the dynamically registered
+ * mbuf field "mport" holds a valid value. This is used to direct
+ * port representor transmit traffic to the correct target port.
+ */
+extern uint64_t sfc_dp_mport_override;
+
+/**
+ * Dynamically registered mbuf field "mport" (mbuf byte offset).
+ *
+ * If the dynamically registered "mport_override" flag is set in
+ * an mbuf then the mbuf "mport" field holds a valid value. This
+ * is used to direct port representor transmit traffic to the
+ * correct target port.
+ */
+extern int sfc_dp_mport_offset;
+
+/**
+ * Register dynamic mbuf flag and field which can be used to require Tx override
+ * prefix descriptor with egress mport set.
+ */
+int sfc_dp_mport_register(void);
+
+/** Dynamically registered mbuf "ft_ctx_id" validity flag (as a bitmask). */
+extern uint64_t sfc_dp_ft_ctx_id_valid;
+
+/** Dynamically registered mbuf field "ft_ctx_id" (mbuf byte offset). */
+extern int sfc_dp_ft_ctx_id_offset;
+
+/** Register dynamic mbuf field "ft_ctx_id" and its validity flag. */
+int sfc_dp_ft_ctx_id_register(void);
+
#ifdef __cplusplus
}
#endif